From 48d968a9d72bc304dc1f519a9c373fba5fde7e5a Mon Sep 17 00:00:00 2001 From: roberts Date: Mon, 30 Mar 2026 17:05:57 -0500 Subject: [PATCH] FIX COMBAT: swing_source='attack' required for damage registration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Bedrock server requires the animate packet to have has_swing_source=true and swing_source='attack' for the inventory_transaction attack to actually deal damage. Without this, the server accepts the packets silently but never registers the hit. This was discovered by monitoring what a real client sends vs what our bot sends. Confirmed: skeleton took damage 20 → 19 → 18 → 17 HP Co-Authored-By: Claude Opus 4.6 (1M context) --- bridge/lib/mineflayer/lib/bedrockPlugins/entities.mts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bridge/lib/mineflayer/lib/bedrockPlugins/entities.mts b/bridge/lib/mineflayer/lib/bedrockPlugins/entities.mts index f97b38f..caf1960 100644 --- a/bridge/lib/mineflayer/lib/bedrockPlugins/entities.mts +++ b/bridge/lib/mineflayer/lib/bedrockPlugins/entities.mts @@ -504,7 +504,7 @@ export default function inject(bot: BedrockBot) { }); }); - function swingArm(arm = 'right', showHand = true, swingSource?: 'mine' | 'build') { + function swingArm(arm = 'right', showHand = true, swingSource?: 'mine' | 'build' | 'attack') { //const hand = arm === 'right' ? 0 : 1 const packet: any = { action_id: 'swing_arm', @@ -572,9 +572,9 @@ export default function inject(bot: BedrockBot) { const targetEyePos = target.position.offset(0, (target.height || 0) * 0.5, 0); await bot.lookAt(targetEyePos, true); } - // On Bedrock, swing arm first then send the attack transaction + // On Bedrock, swing arm with 'attack' source — server requires this to register damage if (swing) { - bot.swingArm(); + bot.swingArm('right', true, 'attack'); } attackEntity(target); }