From 1bd736dca86227f13e1c03805d02f99e42f553e2 Mon Sep 17 00:00:00 2001 From: zongor Date: Sun, 17 Nov 2024 00:27:36 -0500 Subject: [PATCH] remove if rune block is broken --- src/main/java/com/futhark/block/RuneBlock.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/futhark/block/RuneBlock.java b/src/main/java/com/futhark/block/RuneBlock.java index 2e7db7a..6c48d35 100644 --- a/src/main/java/com/futhark/block/RuneBlock.java +++ b/src/main/java/com/futhark/block/RuneBlock.java @@ -27,9 +27,20 @@ public class RuneBlock extends Block { if (server != null) { StateSaverAndLoader serverState = StateSaverAndLoader.getServerState(server); player.sendMessage(Text.literal(String.format("Clicked rune %s Total Runes in World: %d", serverState.runes.get(pos), serverState.totalNumberOfRunes))); - world.playSound(player, pos, SoundEvents.BLOCK_AMETHYST_BLOCK_CHIME, SoundCategory.BLOCKS, 1f, 1f); } return ActionResult.SUCCESS; } + + @Override + public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) { + super.onBreak(world, pos, state, player); + + MinecraftServer server = world.getServer(); + if (server != null) { + StateSaverAndLoader serverState = StateSaverAndLoader.getServerState(server); + serverState.runes.remove(pos); + serverState.totalNumberOfRunes -= 1; + } + } }