airi/patches/mineflayer@4.33.0.patch

75 lines
3.1 KiB
Diff

# MIT License
# Copyright (c) 2024 Kolby Nottingham
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
diff --git a/lib/plugins/digging.js b/lib/plugins/digging.js
index 496cf63..813a667 100644
--- a/lib/plugins/digging.js
+++ b/lib/plugins/digging.js
@@ -242,11 +242,14 @@ function inject (bot) {
enchantments = enchantments.concat(helmetEnchantments)
}
+ if (block.material === 'incorrect_for_wooden_tool')
+ block.material = 'mineable/pickaxe'
+
const creative = bot.game.gameMode === 'creative'
return block.digTime(
type,
creative,
- bot.entity.isInWater,
+ false, // isInWater, water calc is bugged, so always false
!bot.entity.onGround,
enchantments,
bot.entity.effects
diff --git a/lib/plugins/inventory.js b/lib/plugins/inventory.js
index 70db312..93d2054 100644
--- a/lib/plugins/inventory.js
+++ b/lib/plugins/inventory.js
@@ -125,10 +125,15 @@ function inject (bot, { hideErrors }) {
cursorZ: -1
})
} else if (bot.supportFeature('useItemWithOwnPacket')) {
+ const yawDeg = -bot.entity.yaw * 180 / Math.PI + 180 // invert + shift
+ const pitchDeg = -bot.entity.pitch * 180 / Math.PI // invert
bot._client.write('use_item', {
hand: offHand ? 1 : 0,
sequence,
- rotation: { x: 0, y: 0 }
+ rotation: {
+ x: yawDeg,
+ y: pitchDeg
+ }
})
}
}
diff --git a/lib/plugins/place_block.js b/lib/plugins/place_block.js
index fdaec6b..08983b6 100644
--- a/lib/plugins/place_block.js
+++ b/lib/plugins/place_block.js
@@ -11,7 +11,7 @@ function inject (bot) {
let newBlock = bot.blockAt(dest)
if (oldBlock.type === newBlock.type) {
[oldBlock, newBlock] = await onceWithCleanup(bot, `blockUpdate:${dest}`, {
- timeout: 5000,
+ timeout: 500,
// Condition to wait to receive block update actually changing the block type, in case the bot receives block updates with no changes
// oldBlock and newBlock will both be null when the world unloads
checkCondition: (oldBlock, newBlock) => !oldBlock || !newBlock || oldBlock.type !== newBlock.type