mojira.dev
MC-78684

Spawning a mob with a spawn egg in a block on fire doesn't light that mob on fire

If you light a block on fire using flint and steel, and then click with a spawn egg on the block, it will spawn that animal, and it will take damage, but it won't light on fire. If you do this with pigs, it will drop uncooked flesh instead of the cooked flesh it should drop.



Code analysis by @unknown can be found in this comment.

Linked issues

Attachments

Comments 5

Confirmed in 1.8.3. This seems to be a combination of two bugs. One, if a mob starts existing in fire (either from a spawn egg or /summon (I haven't been able to test with breeding because of MC-78688)), it will have its Fire tag set to 1s, instead of the correct value. Two, the fire tag is shifted up by 1, meaning that a mob with Fire:1s won't be on fire at all, a mob with Fire:2s will only be on fire for one tick, etc.

Still in 1.10.2, also can confirm with the /summon command.

Please link to this comment in the description

The following is based on a decompiled version of Minecraft 1.10 using MCP 9.30.

The reason for this is that the method net.minecraft.entity.Entity.moveEntity(double, double, double) always increases the Fire value by 1 if the entity is standing in fire. However it only sets it to 8 ticks of fire if the Fire value was -1 before. The problem is that after this if the entity is not standing in fire and the Fire value is 0 or lower it is set to the negative amount of net.minecraft.entity.Entity.fireResistance. This acts kind of like a cooldown which is for players 20 and for all other entities 1. This means a player can stand 19 ticks in fire before actually catching fire and all other entities catch instantly fire. As this value is set after setting the Fire value if the entity is in fire however, the Fire value is at that point still 0 which means the 8 ticks of fire won't be applied.

This is a general problem because methods like net.minecraft.entity.Entity.onEntityUpdate() (also by reducing the Fire value by 1 only if it is higher than 0), net.minecraft.entity.Entity.extinguish() and net.minecraft.entity.Entity.handleWaterMovement() use 0 as default value instead of the value of net.minecraft.entity.Entity.fireResistance.

Looks like this is fixed in 1.11.2 as the constructor now sets the cooldown correctly. My previous comment might be partwise incorrect, but the last paragraph seems to be still true. I might investigate it a little bit.

Anonymous

(Unassigned)

Confirmed

Minecraft 1.8.3, Minecraft 1.8.8, Minecraft 15w49b, Minecraft 1.9, Minecraft 1.10.2, Minecraft 16w32a, Minecraft 16w32b, Minecraft 16w33a

Minecraft 1.11.2

Retrieved