mojira.dev
MC-214621

Sculk sensors do not detect repeater delay switching

The Bug

A sound (or empty sound event) should probably also be implemented for this. Would this not fall under a "block change"?

Steps to Reproduce

  • Place down a redstone repeater and a sculk sensor nearby.

  • Change the delay on the redstone repeater by right-clicking it.

  • As you do this, take note as to whether or not sculk sensors are activated upon using switching the delay on redstone repeaters.

Observed Behavior

Sculk sensors are not activated upon using switching the delay on redstone repeaters.

Expected Behavior

Sculk sensors would be activated upon using switching the delay on redstone repeaters.

Code Analysis

Code analysis by @unknown can be found in this comment.

Linked issues

Attachments

Comments 19

Can confirm in 21w06a.

Can confirm in 21w07a.

Can confirm in 21w08b.

9 more comments

Can confirm in 1.18.1.

Can confirm in 1.18.2.

Can confirm in 22w18a. Here's a code analysis regarding this issue.

Code Analysis:

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

net.minecraft.world.level.block.RepeaterBlock.java

public class RepeaterBlock extends DiodeBlock {
   ...
   public InteractionResult use(BlockState $bs, Level $l, BlockPos $bp, Player $p, InteractionHand $ih, BlockHitResult $bhr) {
      if (!$p.getAbilities().mayBuild) {
         return InteractionResult.PASS;
      } else {
         $l.setBlock($bp, $bs.cycle(DELAY), 3);
         return InteractionResult.sidedSuccess($l.isClientSide);
      }
   }
   ...

If we look at the above class, we can see that switching the delay on repeaters 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 "delay" block states of repeaters are changed. The following line of code could be used in order to fix this:

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

Can confirm in 1.19 and 22w24a.

Can confirm in 1.20 Pre-release 6. And also happens with comparators.

muzikbike

(Unassigned)

Confirmed

Gameplay

Low

Game Events

sculk_sensor

21w05b, 21w06a, 21w07a, 21w08b, 21w11a, ..., 23w33a, 23w43a, 1.20.4, 24w11a, 24w34a

Retrieved