Killing mobs with a quantum sword sometimes makes them immortal
Kevin-Marsh opened this issue · 6 comments
It appears that killing mobs with the Quantum sword occasionally sets their hp to 0 and makes them unkillable.
Neoforge: 21.0.98
Version: 2.2.9-beta
Skeleton has the following entity data: {Brain: {memories: {}}, "neoforge:attachments": {"blueflame:blue_flame_handler": {isOnFire: 0b}}, HurtByTimestamp: 323, Invulnerable: 0b, FallFlying: 0b, PortalCooldown: 0, AbsorptionAmount: NaNf, FallDistance: 0.0f, DeathTime: 0s, StrayConversionTime: -1, HandDropChances: [0.085f, 0.085f], PersistenceRequired: 0b, UUID: [I; 1958129293, 1920943232, -1498188703, 2021155203], Tags: ["disenchanting_table.checked"], Motion: [0.0d, -0.0784000015258789d, 0.0d], Health: NaNf, LeftHanded: 0b, Air: 300s, OnGround: 1b, Rotation: [127.30957f, 0.0f], HandItems: [{count: 1, id: "minecraft:bow"}, {}], ArmorDropChances: [0.085f, 0.085f, 0.085f, 0.085f], "neoforge:spawn_type": "NATURAL", Pos: [69.10433949892881d, 56.0d, 218.96149435061707d], Fire: -1s, ArmorItems: [{}, {}, {}, {}], CanPickUpLoot: 0b, attributes: [{id: "minecraft:generic.follow_range", modifiers: [{amount: 0.01592083941241385d, id: "minecraft:random_spawn_bonus", operation: "add_multiplied_base"}], base: 16.0d}, {id: "minecraft:generic.movement_speed", base: 0.25d}, {id: "minecraft:generic.oxygen_bonus", base: 0.0d}], HurtTime: 0s}
this is what i got
From the entity data you posted, the AbsorptionAmount
and Health
fields are both set to NaN.
This may be caused by difficulty scaling and other calculations causing the incoming damage amount, Float.MAX_VALUE
≈ 3.4 × 1038, to become Infinity
and later NaN
, which then propagates into the absorption and health fields.
This is a vanilla bug, see MC-273311.
A workaround is to change out Float.MAX_VALUE
for Float.MAX_VALUE / 5f
here:
I actually saw this happen with a player, they were wearing the Quantum Helmet and were "killed', they got stuck in the same thing that I think you're talking about.
Yes, I got the bug on me as a player, I am now stuck on 0 hp and twitching like I am taking damage constantly. Any solution to this purgatory? I am playing on a server.
Thanks to @Minecrafter8001 for sending a PR. To fix existing mobs/players, you might have to edit their NBT data.