remove if rune block is broken
This commit is contained in:
parent
85db38a9a8
commit
1bd736dca8
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue