Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-211235

Sculk sensors are not activated upon snow being formed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 20w51a, 21w03a, 21w05a, 21w05b, 21w06a, 21w07a, 21w14a, 21w17a, 21w19a, 21w20a, 1.17 Release Candidate 1, 1.17, 1.17.1 Pre-release 1, 1.17.1 Release Candidate 1, 1.17.1, 1.18.1, 1.18.2, 22w14a, 1.19, 1.19.3, 23w03a, 1.19.4, 1.20.1, 1.21
    • Confirmed
    • Game Events
    • Low
    • Gameplay

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

            Unassigned Unassigned
            Avoma [Mod] Avoma
            Votes:
            6 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              CHK: