mojira.dev
MC-211235

Sculk sensors are not activated upon snow being formed

The Bug:

Sculk sensors are not activated upon snow being formed.

Steps to Reproduce:

  1. Enter a cold biome and place down a sculk sensor nearby.

  2. Set to weather to "rain" to make it snow and wait for some snow to form.

  3. Take note as to whether or not sculk sensors are activated upon snow being formed.

Observed Behavior:

Sculk sensors aren't activated.

Expected Behavior:

Sculk sensors would be activated.

Code Analysis:

Code analysis by @unknown can be found below.

The following is based on a decompiled version of Minecraft 1.18.2 using MCP-Reborn.

net.minecraft.server.level.ServerLevel.java

public class ServerLevel extends Level implements WorldGenLevel {
   ...
   public void tickChunk(LevelChunk p_8715_, int p_8716_) {
      ChunkPos chunkpos = p_8715_.getPos();
      boolean flag = this.isRaining();
      int i = chunkpos.getMinBlockX();
      int j = chunkpos.getMinBlockZ();
      ...
      if (this.random.nextInt(16) == 0) {
         BlockPos blockpos2 = this.getHeightmapPos(Heightmap.Types.MOTION_BLOCKING, this.getBlockRandomPos(i, 0, j, 15));
         ...
         Biome biome = this.getBiome(blockpos2).value();
         ...
         if (flag) {
            if (biome.shouldSnow(this, blockpos2)) {
               this.setBlockAndUpdate(blockpos2, Blocks.SNOW.defaultBlockState());
            }
            ...

If we look at the above class, we can see that snow forming as a result of precipitation simply isn't registered as a game event as the gameEvent() method is never called, thus not detecting this action as a vibration.

Potential Fix:

Simply calling the gameEvent() method where appropriate within this piece of code should resolve this problem. The "BLOCK_PLACE" game event tag would be expected to be used here as snow is being placed into the world.

Linked issues

Attachments

Comments 6

Is this still an issue in snapshot 21w05a or later?

This is still an issue in 21w05a. I've updated this ticket accordingly.

Can confirm in 23w03a

Avoma

(Unassigned)

Confirmed

Gameplay

Low

Game Events

sculk_sensor, snow

20w51a, 21w03a, 21w05a, 21w05b, 21w06a, ..., 1.20.1, 1.21, 1.21.4, 1.21.5, 1.21.7

Retrieved