mojira.dev
MC-241636

Snow golems don't take damage in hot biomes when a cave biome is underneath

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 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

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.

Can confirm in 1.18 Pre-release 2.

@@unknown, how do you get that source code? And yes l'm voting for this bug.

This appears to be fixed in 1.18 pre-release 6

This still was the case in 1.18 Pre-release 5, but was fixed in Pre-release 6.

Oops meant pre 6 must have still been thinking of pre 5 😛

I can also confirm that this seems to be fixed in pre6.

Justin Barker

(Unassigned)

Confirmed

Low

Mob behaviour

1.18 Pre-release 1, 1.18 Pre-release 2, 1.18 Pre-release 4, 1.18 Pre-release 5

1.18 Pre-release 6

Retrieved