[dep] patch for denpendences
This commit is contained in:
parent
6df6dbcaf6
commit
592d993c4e
@ -9,15 +9,18 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.6.0",
|
"axios": "^1.6.0",
|
||||||
|
"compass-utils": "file:utils",
|
||||||
"debug": "^4.3.4",
|
"debug": "^4.3.4",
|
||||||
"mineflayer": "^4.14.0",
|
"mineflayer": "^4.14.0",
|
||||||
"mineflayer-event-promise": "file:plugin/event-promise",
|
|
||||||
"compass-utils": "file:utils",
|
|
||||||
"mineflayer-control": "file:plugin/control",
|
"mineflayer-control": "file:plugin/control",
|
||||||
|
"mineflayer-event-promise": "file:plugin/event-promise",
|
||||||
"mineflayer-fly-control": "file:plugin/fly-control",
|
"mineflayer-fly-control": "file:plugin/fly-control",
|
||||||
"yargs": "^17.7.2"
|
"yargs": "^17.7.2"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=20"
|
"node": ">=20"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"patch-package": "^8.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
99
patches/mineflayer+4.14.0.patch
Normal file
99
patches/mineflayer+4.14.0.patch
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
diff --git a/node_modules/mineflayer/lib/plugins/entities.js b/node_modules/mineflayer/lib/plugins/entities.js
|
||||||
|
index 85cbf2e..df73887 100644
|
||||||
|
--- a/node_modules/mineflayer/lib/plugins/entities.js
|
||||||
|
+++ b/node_modules/mineflayer/lib/plugins/entities.js
|
||||||
|
@@ -369,7 +369,7 @@ function inject (bot) {
|
||||||
|
}
|
||||||
|
if (bot.fireworkRocketDuration !== 0 && entity.id === bot.entity?.id && !elytraFlying) {
|
||||||
|
bot.fireworkRocketDuration = 0
|
||||||
|
- knownFireworks.splice(0, knownFireworks.length)
|
||||||
|
+ knownFireworks.clear()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (startedFlying) {
|
||||||
|
@@ -377,28 +377,17 @@ function inject (bot) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- const knownFireworks = []
|
||||||
|
+ const knownFireworks = new Set();
|
||||||
|
function handleBotUsedFireworkRocket (fireworkEntityId, fireworkInfo) {
|
||||||
|
- if (knownFireworks.includes(fireworkEntityId)) return
|
||||||
|
- knownFireworks.push(fireworkEntityId)
|
||||||
|
- let flightDur = 1
|
||||||
|
- if (fireworkInfo?.nbtData != null) {
|
||||||
|
- let nbt = fireworkInfo.nbtData
|
||||||
|
- if (nbt.type === 'compound' && nbt.value.Fireworks != null) {
|
||||||
|
- nbt = nbt.value.Fireworks
|
||||||
|
- if (nbt.type === 'compound' && nbt.value.Flight != null) {
|
||||||
|
- nbt = nbt.value.Flight
|
||||||
|
- if (nbt.type === 'int') {
|
||||||
|
- flightDur += nbt.value
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
- const baseDuration = 10 * flightDur
|
||||||
|
+ if (knownFireworks.has(fireworkEntityId)) return
|
||||||
|
+ knownFireworks.add(fireworkEntityId)
|
||||||
|
+ let flightDur = fireworkInfo?.nbtData?.value?.Fireworks?.value?.Flight.value ?? 1
|
||||||
|
+ if (typeof flightDur !== 'number') { flightDur = 1 }
|
||||||
|
+ const baseDuration = 10 * (flightDur + 1)
|
||||||
|
const randomDuration = Math.floor(Math.random() * 6) + Math.floor(Math.random() * 7)
|
||||||
|
bot.fireworkRocketDuration = baseDuration + randomDuration
|
||||||
|
|
||||||
|
- bot.emit('usedFirework')
|
||||||
|
+ bot.emit('usedFirework', fireworkEntityId)
|
||||||
|
}
|
||||||
|
|
||||||
|
let fireworkEntityName
|
||||||
|
diff --git a/node_modules/mineflayer/lib/plugins/inventory.js b/node_modules/mineflayer/lib/plugins/inventory.js
|
||||||
|
index 1314205..7f28008 100644
|
||||||
|
--- a/node_modules/mineflayer/lib/plugins/inventory.js
|
||||||
|
+++ b/node_modules/mineflayer/lib/plugins/inventory.js
|
||||||
|
@@ -10,7 +10,7 @@ module.exports = inject
|
||||||
|
const DIG_CLICK_TIMEOUT = 500
|
||||||
|
// The number of milliseconds to wait for the server to respond with consume completion.
|
||||||
|
// This number is larger than the eat time of 1.61 seconds to account for latency and low tps.
|
||||||
|
-// The eat time comes from https://minecraft.fandom.com/wiki/Food#Usage
|
||||||
|
+// The eat time comes from https://minecraft.wiki/w/Food#Usage
|
||||||
|
const CONSUME_TIMEOUT = 2500
|
||||||
|
// milliseconds to wait for the server to respond to a window click transaction
|
||||||
|
const WINDOW_TIMEOUT = 5000
|
||||||
|
@@ -43,8 +43,24 @@ function inject (bot, { hideErrors }) {
|
||||||
|
bot.quickBarSlot = null
|
||||||
|
bot.inventory = windows.createWindow(0, 'minecraft:inventory', 'Inventory')
|
||||||
|
bot.currentWindow = null
|
||||||
|
- bot.heldItem = null
|
||||||
|
bot.usingHeldItem = false
|
||||||
|
+ Object.defineProperty(bot, 'heldItem', {
|
||||||
|
+ get: function () {
|
||||||
|
+ return bot.inventory.slots[bot.QUICK_BAR_START + bot.quickBarSlot]
|
||||||
|
+ },
|
||||||
|
+ })
|
||||||
|
+
|
||||||
|
+ bot.on('spawn', () => {
|
||||||
|
+ Object.defineProperty(bot.entity, 'equipment', {
|
||||||
|
+ get: bot.supportFeature('doesntHaveOffHandSlot') ? function() {
|
||||||
|
+ return [bot.heldItem, bot.inventory.slots[8], bot.inventory.slots[7],
|
||||||
|
+ bot.inventory.slots[6], bot.inventory.slots[5]]
|
||||||
|
+ } : function() {
|
||||||
|
+ return [bot.heldItem, bot.inventory.slots[45], bot.inventory.slots[8],
|
||||||
|
+ bot.inventory.slots[7], bot.inventory.slots[6], bot.inventory.slots[5]]
|
||||||
|
+ },
|
||||||
|
+ });
|
||||||
|
+ });
|
||||||
|
|
||||||
|
bot._client.on('entity_status', (packet) => {
|
||||||
|
if (packet.entityId === bot.entity.id && packet.entityStatus === 9 && !eatingTask.done) {
|
||||||
|
@@ -364,9 +380,7 @@ function inject (bot, { hideErrors }) {
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateHeldItem () {
|
||||||
|
- bot.heldItem = bot.inventory.slots[bot.QUICK_BAR_START + bot.quickBarSlot]
|
||||||
|
- bot.entity.heldItem = bot.heldItem
|
||||||
|
- bot.emit('heldItemChanged', bot.entity.heldItem)
|
||||||
|
+ bot.emit('heldItemChanged', bot.heldItem)
|
||||||
|
}
|
||||||
|
|
||||||
|
function closeWindow (window) {
|
39
patches/prismarine-entity+2.3.1.patch
Normal file
39
patches/prismarine-entity+2.3.1.patch
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
diff --git a/node_modules/prismarine-entity/index.d.ts b/node_modules/prismarine-entity/index.d.ts
|
||||||
|
index b5ca0ad..1ee66c4 100644
|
||||||
|
--- a/node_modules/prismarine-entity/index.d.ts
|
||||||
|
+++ b/node_modules/prismarine-entity/index.d.ts
|
||||||
|
@@ -35,7 +35,7 @@ declare module 'prismarine-entity' {
|
||||||
|
width: number;
|
||||||
|
onGround: boolean;
|
||||||
|
equipment: Array<Item>;
|
||||||
|
- heldItem: Item;
|
||||||
|
+ get heldItem(): Item;
|
||||||
|
metadata: Array<object>;
|
||||||
|
isValid: boolean;
|
||||||
|
health?: number;
|
||||||
|
diff --git a/node_modules/prismarine-entity/index.js b/node_modules/prismarine-entity/index.js
|
||||||
|
index bbbbbd4..bc36b6b 100644
|
||||||
|
--- a/node_modules/prismarine-entity/index.js
|
||||||
|
+++ b/node_modules/prismarine-entity/index.js
|
||||||
|
@@ -19,7 +19,6 @@ module.exports = (registryOrVersion) => {
|
||||||
|
this.effects = {}
|
||||||
|
// 0 = held item, 1-4 = armor slot
|
||||||
|
this.equipment = new Array(5)
|
||||||
|
- this.heldItem = this.equipment[0] // shortcut to equipment[0]
|
||||||
|
this.isValid = true
|
||||||
|
this.metadata = []
|
||||||
|
}
|
||||||
|
@@ -44,9 +43,12 @@ module.exports = (registryOrVersion) => {
|
||||||
|
this.displayName = name
|
||||||
|
}
|
||||||
|
|
||||||
|
+ get heldItem() {
|
||||||
|
+ return this.equipment[0]
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
setEquipment (index, item) {
|
||||||
|
this.equipment[index] = item
|
||||||
|
- this.heldItem = this.equipment[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
getCustomName () {
|
139
patches/prismarine-physics+1.8.0.patch
Normal file
139
patches/prismarine-physics+1.8.0.patch
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
diff --git a/node_modules/prismarine-physics/index.js b/node_modules/prismarine-physics/index.js
|
||||||
|
index 2ef4ca1..85f7ea8 100644
|
||||||
|
--- a/node_modules/prismarine-physics/index.js
|
||||||
|
+++ b/node_modules/prismarine-physics/index.js
|
||||||
|
@@ -4,12 +4,43 @@ const math = require('./lib/math')
|
||||||
|
const features = require('./lib/features')
|
||||||
|
const attribute = require('./lib/attribute')
|
||||||
|
|
||||||
|
-function makeSupportFeature (mcData) {
|
||||||
|
- return feature => features.some(({ name, versions }) => name === feature && versions.includes(mcData.version.majorVersion))
|
||||||
|
-}
|
||||||
|
+class FeatureList {
|
||||||
|
+ static checkVersion(version, condition) {
|
||||||
|
+ const [predicateName, parameter] = condition.split(' ')
|
||||||
|
+ if (parameter == null) { return predicateName === version.majorVersion }
|
||||||
|
+ return version[predicateName](parameter)
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ constructor(version) {
|
||||||
|
+ this.version = version;
|
||||||
|
+ this.features = new Set();
|
||||||
|
+ for (const { name, versions } of features) {
|
||||||
|
+ for (const versionConditions of versions) {
|
||||||
|
+ let flag = true
|
||||||
|
+ if (versionConditions instanceof Array) {
|
||||||
|
+ for (const condition of versionConditions) {
|
||||||
|
+ flag &= FeatureList.checkVersion(version, condition)
|
||||||
|
+ }
|
||||||
|
+ } else {
|
||||||
|
+ flag = FeatureList.checkVersion(version, versionConditions)
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (flag) {
|
||||||
|
+ this.features.add(name)
|
||||||
|
+ break
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ supportFeature(featureName) {
|
||||||
|
+ return this.features.has(featureName);
|
||||||
|
+ }
|
||||||
|
+};
|
||||||
|
|
||||||
|
function Physics (mcData, world) {
|
||||||
|
- const supportFeature = makeSupportFeature(mcData)
|
||||||
|
+ const supportedFeatureList = new FeatureList(mcData.version)
|
||||||
|
+ const supportFeature = (name) => supportedFeatureList.supportFeature(name)
|
||||||
|
const blocksByName = mcData.blocksByName
|
||||||
|
|
||||||
|
// Block Slipperiness
|
||||||
|
@@ -33,6 +64,21 @@ function Physics (mcData, world) {
|
||||||
|
const waterIds = [blocksByName.water.id, blocksByName.flowing_water ? blocksByName.flowing_water.id : -1]
|
||||||
|
const lavaIds = [blocksByName.lava.id, blocksByName.flowing_lava ? blocksByName.flowing_lava.id : -1]
|
||||||
|
const ladderId = blocksByName.ladder.id
|
||||||
|
+
|
||||||
|
+ // NOTE: Copper trapdoors is coming in 1.21.
|
||||||
|
+ const trapdoorIds = new Set();
|
||||||
|
+ if (blocksByName.iron_trapdoor != null) { trapdoorIds.add(blocksByName.iron_trapdoor.id) } // 1.8+
|
||||||
|
+ if (blocksByName.acacia_trapdoor != null) { trapdoorIds.add(blocksByName.acacia_trapdoor.id) } // 1.13+
|
||||||
|
+ if (blocksByName.birch_trapdoor != null) { trapdoorIds.add(blocksByName.birch_trapdoor.id) } // 1.13+
|
||||||
|
+ if (blocksByName.jungle_trapdoor != null) { trapdoorIds.add(blocksByName.jungle_trapdoor.id) } // 1.13+
|
||||||
|
+ if (blocksByName.oak_trapdoor != null) { trapdoorIds.add(blocksByName.oak_trapdoor.id) } // 1.13+
|
||||||
|
+ if (blocksByName.dark_oak_trapdoor != null) { trapdoorIds.add(blocksByName.dark_oak_trapdoor.id) } // 1.13+
|
||||||
|
+ if (blocksByName.spruce_trapdoor != null) { trapdoorIds.add(blocksByName.spruce_trapdoor.id) } // 1.13+
|
||||||
|
+ if (blocksByName.crimson_trapdoor != null) { trapdoorIds.add(blocksByName.crimson_trapdoor.id) } // 1.16+
|
||||||
|
+ if (blocksByName.warped_trapdoor != null) { trapdoorIds.add(blocksByName.warped_trapdoor.id) } // 1.16+
|
||||||
|
+ if (blocksByName.mangrove_trapdoor != null) { trapdoorIds.add(blocksByName.mangrove_trapdoor.id) } // 1.19+
|
||||||
|
+ if (blocksByName.cherry_trapdoor != null) { trapdoorIds.add(blocksByName.cherry_trapdoor.id) } // 1.20+
|
||||||
|
+
|
||||||
|
const vineId = blocksByName.vine.id
|
||||||
|
const waterLike = new Set()
|
||||||
|
if (blocksByName.seagrass) waterLike.add(blocksByName.seagrass.id) // 1.13+
|
||||||
|
@@ -421,7 +467,22 @@ function Physics (mcData, world) {
|
||||||
|
|
||||||
|
function isOnLadder (world, pos) {
|
||||||
|
const block = world.getBlock(pos)
|
||||||
|
- return (block && (block.type === ladderId || block.type === vineId))
|
||||||
|
+ if (!block) { return false }
|
||||||
|
+ if (block.type === ladderId || block.type === vineId) { return true }
|
||||||
|
+
|
||||||
|
+ // Since 1.9, when a trapdoor satisfies the following conditions, it also becomes climbable:
|
||||||
|
+ // 1. The trapdoor is placed directly above a ladder.
|
||||||
|
+ // 2. The trapdoor is opened.
|
||||||
|
+ // 3. The trapdoor and the ladder directly below it face the same direction.
|
||||||
|
+ if (supportFeature('climableTrapdoor') && trapdoorIds.has(block.type)) {
|
||||||
|
+ const block_below = world.getBlock(pos.offset(0, -1, 0))
|
||||||
|
+ if (block_below.type != ladderId) { return false } // condition 1.
|
||||||
|
+ if (!block.getProperties().open) { return false } // condition 2.
|
||||||
|
+ if (block.getProperties().facing != block_below.getProperties().facing) { return false } // condition 3
|
||||||
|
+ return true
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return false
|
||||||
|
}
|
||||||
|
|
||||||
|
function doesNotCollide (world, pos) {
|
||||||
|
diff --git a/node_modules/prismarine-physics/lib/features.json b/node_modules/prismarine-physics/lib/features.json
|
||||||
|
index 411cff3..aa0378e 100644
|
||||||
|
--- a/node_modules/prismarine-physics/lib/features.json
|
||||||
|
+++ b/node_modules/prismarine-physics/lib/features.json
|
||||||
|
@@ -2,26 +2,31 @@
|
||||||
|
{
|
||||||
|
"name": "independentLiquidGravity",
|
||||||
|
"description": "Liquid gravity is a constant",
|
||||||
|
- "versions": ["1.8", "1.9", "1.10", "1.11", "1.12"]
|
||||||
|
+ "versions": [[">= 1.8", "<= 1.12"]]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "proportionalLiquidGravity",
|
||||||
|
"description": "Liquid gravity is a proportion of normal gravity",
|
||||||
|
- "versions": ["1.13", "1.14", "1.15", "1.16", "1.17", "1.18", "1.19", "1.20"]
|
||||||
|
+ "versions": [">= 1.13"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "velocityBlocksOnCollision",
|
||||||
|
"description": "Velocity changes are caused by blocks are triggered by collision with the block",
|
||||||
|
- "versions": ["1.8", "1.9", "1.10", "1.11", "1.12", "1.13", "1.14"]
|
||||||
|
+ "versions": [[">= 1.8", "<= 1.14"]]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "velocityBlocksOnTop",
|
||||||
|
"description": "Velocity changes are caused by the block the player is standing on",
|
||||||
|
- "versions": ["1.15", "1.17", "1.18"]
|
||||||
|
+ "versions": [">= 1.15"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "climbUsingJump",
|
||||||
|
"description": "Entity can climb ladders and vines by pressing jump",
|
||||||
|
- "versions": ["1.14", "1.15", "1.17", "1.18"]
|
||||||
|
+ "versions": [">= 1.14"]
|
||||||
|
+ },
|
||||||
|
+ {
|
||||||
|
+ "name": "climableTrapdoor",
|
||||||
|
+ "description": "Trapdoors placed directly above ladders become climable.",
|
||||||
|
+ "versions": [">= 1.9"]
|
||||||
|
}
|
||||||
|
]
|
Loading…
x
Reference in New Issue
Block a user