The bug
Sculk sensors do not detect using an axe to clear the wax/weathering of a copper block.
How to reproduce
Place any type of waxed or weathered copper block
Place a sculk sensor:
/setblock ~ ~ ~ sculk_sensor
Use an axe to scrape the wax/oxidation off of the copper
❌ The sculk sensor does not detect this
Expected results
The sculk sensor would detect scraping the wax or oxidation off of the copper block.
Code analysis
Code analysis by @unknown can be found in this comment.
Attachments
Comments 12
I am able to confirm this behavior in 21w43a. Here are some extra details regarding this problem.
The Bug:
Sculk sensors are not activated upon scraping the wax or weathering off copper blocks.
Steps to Reproduce:
Place down an oxidized block of copper and a waxed block of copper.
Place down a sculk sensor nearby.
Obtain an axe and scrap the wax/weathering off both of these blocks.
Take note as to whether or not sculk sensors are activated upon scraping the wax or weathering off copper blocks.
Observed Behavior:
Sculk sensors are not activated upon scraping the wax or weathering off copper blocks.
Expected Behavior:
Sculk sensors would be activated upon scraping the wax or weathering off copper blocks.
Can confirm in 1.18.2 and 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.item.AxeItem.java
public class AxeItem extends DiggerItem {
...
public InteractionResult useOn(UseOnContext $uoc) {
Level level = $uoc.getLevel();
BlockPos blockpos = $uoc.getClickedPos();
Player player = $uoc.getPlayer();
BlockState blockstate = level.getBlockState(blockpos);
Optional<BlockState> optional = this.getStripped(blockstate);
Optional<BlockState> optional1 = WeatheringCopper.getPrevious(blockstate);
Optional<BlockState> optional2 = Optional.ofNullable(HoneycombItem.WAX_OFF_BY_BLOCK.get().get(blockstate.getBlock())).map((p_150694_) -> {
return p_150694_.withPropertiesOf(blockstate);
});
ItemStack itemstack = $uoc.getItemInHand();
Optional<BlockState> optional3 = Optional.empty();
if (optional.isPresent()) {
level.playSound(player, blockpos, SoundEvents.AXE_STRIP, SoundSource.BLOCKS, 1.0F, 1.0F);
optional3 = optional;
} else if (optional1.isPresent()) {
level.playSound(player, blockpos, SoundEvents.AXE_SCRAPE, SoundSource.BLOCKS, 1.0F, 1.0F);
level.levelEvent(player, 3005, blockpos, 0);
optional3 = optional1;
} else if (optional2.isPresent()) {
level.playSound(player, blockpos, SoundEvents.AXE_WAX_OFF, SoundSource.BLOCKS, 1.0F, 1.0F);
level.levelEvent(player, 3004, blockpos, 0);
optional3 = optional2;
}
...
If we look at the above class, we can see that the actions of scraping wax and weathering off copper blocks simply aren't registered as game events as the gameEvent()
method is never called, thus not detecting these actions as vibrations.
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 for both of these actions as the block states of copper blocks are changed when wax or weathering is scarped off them. The following line of code could be used in order to fix this:
$LEVEL.gameEvent($PLAYER, GameEvent.BLOCK_CHANGE, $BLOCKPOS);
Relates to MC-220087