This was my first suspicion, so I tried testing with a client side event:
@SubscribeEvent
public void onBreak(ClientChatReceivedEvent event) {
Minecraft.getMinecraft().thePlayer.playSound("minecraft:block.anvil.hit", 1.0f, 1.0f);
}
Still, I got nothing. I have no clue what I'm doing wrong.
Additionally, If I refer to that documentation and try and play the sound from the world like this:
@SubscribeEvent
public void onBreak(BreakEvent event) {
if (event.state.getBlock() == Blocks.pumpkin) {
event.world.playSound(event.getPlayer().getPosition().getX(), event.getPlayer().getPosition().getY(), event.getPlayer().getPosition().getZ(), "minecraft:block.anvil.hit", 1.0f, 1.0f, true);
}
}
or like this
@SubscribeEvent
public void onBreak(BreakEvent event) {
if (event.state.getBlock() == Blocks.pumpkin) {
event.world.playSoundEffect(event.getPlayer().getPosition().getX(), event.getPlayer().getPosition().getY(), event.getPlayer().getPosition().getZ(), "minecraft:block.anvil.hit", 1.0f, 1.0f);
}
}
I get nothing