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

Sculk sensors are not activated upon leaves decaying

XMLWordPrintable

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

      The Bug:

      Sculk sensors are not activated upon leaves decaying.

      Be careful when reproducing this because items such as azaleas, apples, and sticks will fall from leaves and this may activate the sculk sensors. To avoid this, you can set the "doTileDrops" gamerule to false if you wish.

      Steps to Reproduce:

      1. Place down a sculk sensor.
      2. Summon some leaves above your head by using the command provided below.
        /fill ~-3 ~3 ~-3 ~3 ~5 ~3 minecraft:oak_leaves
      3. Wait for some of the leaves to decay, and watch the sculk sensor closely as this happens.
      4. Take note as to whether or not sculk sensors are activated upon leaves decaying.

      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.world.level.block.LeavesBlock.java
      public class LeavesBlock extends Block {
         ...
         public void randomTick(BlockState $bs, ServerLevel $sl, BlockPos $bp, Random $r) {
            if (!$bs.getValue(PERSISTENT) && $bs.getValue(DISTANCE) == 7) {
               dropResources($bs, $sl, $bp);
               $sl.removeBlock($bp, false);
            }
      
         }
         ...

      If we look at the above class, we can see that leaves decaying 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_DESTROY" game event tag would be expected to be used here as leaves are removed from the world in this instance.

        1. MC-210333.mp4
          5.28 MB
        2. MC-210333.png
          MC-210333.png
          708 kB

            Unassigned Unassigned
            Avoma [Mod] Avoma
            Votes:
            7 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              CHK: