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

Sculk sensors are not activated upon filling composters

    XMLWordPrintable

Details

    • 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 Release Candidate 2, 1.17, 1.17.1 Pre-release 1, 1.17.1, 21w38a, 21w40a, 1.18, 1.18.1, 1.18.2, 22w14a, 22w17a, 22w18a, 1.19 Pre-release 1, 1.19 Pre-release 3, 1.19 Pre-release 5, 1.19 Release Candidate 2, 1.19, 1.19.2, 22w45a, 1.19.3
    • Confirmed
    • Game Events
    • Normal

    Description

      The Bug:

      Sculk sensors are not activated upon filling composters.

      Steps to Reproduce:

      1. Place down a composter along with a sculk sensor nearby.
      2. Fill the composter with a cake and watch the sculk sensor closely as you do this.
      3. Take note as to whether or not sculk sensors are activated upon filling composters.

      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.ComposterBlock.java
      public class ComposterBlock extends Block implements WorldlyContainerHolder {
         ...
         public InteractionResult use(BlockState $bs, Level $l, BlockPos $bp, Player $p, InteractionHand $ih, BlockHitResult $bhr) {
            int i = $bs.getValue(LEVEL);
            ItemStack itemstack = $p.getItemInHand($ih);
            if (i < 8 && COMPOSTABLES.containsKey(itemstack.getItem())) {
               if (i < 7 && !$l.isClientSide) {
                  BlockState blockstate = addItem($bs, $l, $bp, itemstack);
                  $l.levelEvent(1500, $bp, $bs != blockstate ? 1 : 0);
                  $p.awardStat(Stats.ITEM_USED.get(itemstack.getItem()));
                  ...

      If we look at the above class, we can see that filling composters 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_CHANGE" game event tag would be expected to be used here as the block states of composters are changed when they're filled. The following line of code could be used in order to fix this:

      $LEVEL.gameEvent($PLAYER, GameEvent.BLOCK_CHANGE, $BLOCKPOS);

      Attachments

        1. MC-209929.mp4
          6.88 MB
        2. MC-209929.png
          MC-209929.png
          445 kB

        Issue Links

          Activity

            People

              kingbdogz [Mojang] Brandon Pearce
              Avoma [Helper] Avoma
              Votes:
              10 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                CHK: