FIX COMBAT: swing_source='attack' required for damage registration
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) <noreply@anthropic.com>
This commit is contained in:
parent
195ef2d860
commit
48d968a9d7
1 changed files with 3 additions and 3 deletions
|
|
@ -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 hand = arm === 'right' ? 0 : 1
|
||||||
const packet: any = {
|
const packet: any = {
|
||||||
action_id: 'swing_arm',
|
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);
|
const targetEyePos = target.position.offset(0, (target.height || 0) * 0.5, 0);
|
||||||
await bot.lookAt(targetEyePos, true);
|
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) {
|
if (swing) {
|
||||||
bot.swingArm();
|
bot.swingArm('right', true, 'attack');
|
||||||
}
|
}
|
||||||
attackEntity(target);
|
attackEntity(target);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue