Bug Open

Knockback enchant compounds Ender Dragon velocity while perched, dragon gets flung thousands of blocks and despawns

#10108 opened by daniel3032 1 day ago

daniel3032reported this bug

Hitting a perched Ender Dragon with a Knockback-enchanted weapon roughly doubles the dragon's stored velocity on every hit. While perched the dragon doesn't move, so the velocity keeps building up. When it switches to takeoff, it moves with that velocity in a single tick and gets flung thousands of blocks into unloaded chunks. For players, the dragon and boss bar vanish and the dragon reappears flying a few seconds later. It only happens with the Knockback enchant. Unenchanted weapons (normal base knockback) don't cause it. **Steps to reproduce** 1. Start an Ender Dragon fight with MythicEnchants installed. 2. Wait for the dragon to perch on the exit portal. 3. Hit it several times in melee with a Knockback II sword. 4. When it takes off, it vanishes (`/execute if entity @e[type=minecraft:ender_dragon]` fails), then comes back a few seconds later.

Expected: Same as vanilla: Knockback has no effect on the perched dragon's velocity.

Actual: Dragon velocity (logged each hit; position stays at 1,68,0 while perched): | Hit | Velocity (x, y, z) | |---|---| | before | -9.68, 0.89, -22.81 | | 1 | -19.29, 1.04, -46.52 | | 2 | -38.53, 1.19, -93.94 | | 3 | -77.00, 1.34, -188.78 | | 4 | -153.93, 1.49, -378.46 | | 5 | -307.81, 1.64, -757.81 | | 6 | -615.56, 1.79, -1516.53 | | 7 | -1231.05, 1.94, -3033.95 | | 8 | -2462.05, 2.09, -6068.80 | | 9 | -4924.04, 2.24, -12138.50 | On takeoff the dragon moved from `1,68,0` to `-3939,70,-9711` in one tick, then was unloaded.

Control test without MythicEnchants: Same server software, fresh world, MythicEnchants removed, vanilla `knockback:2` sword. Five hits on the perched dragon left its velocity unchanged (`-0.07, -0.05, 0.56`), and it took off normally at under 1 block per tick.

Likely cause: The Knockback re-implementation seems to build on the target's current velocity (or apply knockback twice), instead of matching vanilla. On a perched dragon the velocity is never used up, so it compounds exponentially.

Sign in to join the discussion.