The Bug
Snow golems seem to take the temperature of the cave biomes instead of the surface biome causing them to not take damage in hot biomes like a desert
Reproduction steps:
Create a world in 1.18 pre-1 with seed 607837285341829140
Create a snow golem at -124 66 -331 --> the golem dies as expected
Create a snow golem at -124 66 -330 --> the golem does not take damage, unless it walks in the -Z direction
Observed Result
The snow golem didn't get damaged at -124, 66, -330
Expected Result
The snow golem would take damage
Linked issues
Attachments
Comments 8
I think that the issue stems from this piece of code, but I'm not sure.
net.minecraft.world.entity.animal.SnowGolem.java (Mojang mappings, 1.18-pre1)
...
public void aiStep() {
...
int $$0 = Mth.floor(this.getX());
int $$1 = Mth.floor(this.getY());
int $$2 = Mth.floor(this.getZ());
BlockPos gh2 = new BlockPos($$0, 0, $$2);
BlockPos gh3 = new BlockPos($$0, $$1, $$2);
if (this.level.getBiome(gh2).getTemperature(gh3) > 1.0f) {
this.hurt(DamageSource.ON_FIRE, 1.0f);
}
...
}
...
As you can see, the snow golem apparently gets the biome located at y = 0
instead of the biome it is standing on.
I figured out the problem. This is because a cave biome exist underneath -124 66 -330 and for some reason the snow golem is taking that temperature instead of the deserts temperature