The Bug
Snow golems still dies in warm biomes while being in powdered snow
Reproduce
Go to a warm biome
Place powdered snow
Summon a snow golem in the powdered snow
❌ Watch it burn
Expected Result
The snow golem wouldn't burn since it is in powdered snow
Code analysis and fix
Code analysis and fix by @unknown can be found in this comment.
Linked issues
is duplicated by 3
Attachments
Comments 11
I can confirm this behavior in 1.19.2. Here's a code analysis of this issue along with a fix.
Code Analysis:
The following is based on a decompiled version of Minecraft 1.19.2 using MCP-Reborn.
net.minecraft.world.entity.animal.SnowGolem.java
public class SnowGolem extends AbstractGolem implements Shearable, RangedAttackMob {
...
public void aiStep() {
super.aiStep();
if (!this.level.isClientSide) {
int i = Mth.floor(this.getX());
int j = Mth.floor(this.getY());
int k = Mth.floor(this.getZ());
BlockPos blockpos = new BlockPos(i, j, k);
Biome biome = this.level.getBiome(blockpos).value();
if (biome.shouldSnowGolemBurn(blockpos)) {
this.hurt(DamageSource.ON_FIRE, 1.0F);
}
...
If we look at the above class, we can see that there are two checks that are carried out before allowing snow golems to burn in warm biomes. One of them is to make sure the action is carried out server-side and not client-side and the other is to check if the snow golem is actually positioned on a block that's inside a warm biome. The game doesn't check if the snow golem is in powder snow before allowing it to burn in warm biomes, therefore resulting in this problem occurring.
Fix:
Simply altering the appropriate existing "if" statement within this piece of code to check if the snow golem is in powder snow before allowing it to burn in warm biomes will resolve this problem.
Current "if" statement:
if (biome.shouldSnowGolemBurn(blockpos))
Fixed "if" statement:
if (biome.shouldSnowGolemBurn(blockpos) && !this.isInPowderSnow)
Following on from my code analysis, I've double-checked my proposed fix and I can confidently confirm that it's fully functioning and works as expected, so I've attached two screenshots to this report, one of which shows the current code and the other that shows the fixed code. I feel this information may be quite insightful hence my reasoning for providing it. 🙂
[media][media]
Probably a feature request MC-205067 or MC-3636
I would question powder snow in warm biomes too. Perhaps if on packed ice?