From ebceedbe51aa5f6aa0b9ddad8ab6cd189dc75ee3 Mon Sep 17 00:00:00 2001 From: Ruben Taelman Date: Mon, 29 Jul 2024 17:48:24 +0200 Subject: [PATCH] Fix server crash when igniting lightning bomb, Closes #1040 --- .../java/org/cyclops/evilcraft/block/BlockLightningBomb.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/cyclops/evilcraft/block/BlockLightningBomb.java b/src/main/java/org/cyclops/evilcraft/block/BlockLightningBomb.java index 9457be47b2..adb8aa288e 100644 --- a/src/main/java/org/cyclops/evilcraft/block/BlockLightningBomb.java +++ b/src/main/java/org/cyclops/evilcraft/block/BlockLightningBomb.java @@ -115,7 +115,9 @@ public InteractionResult useWithoutItem(BlockState state, Level world, BlockPos (player.getItemInHand(hand).getItem() == Items.FLINT_AND_STEEL || player.getItemInHand(hand).getItem() == Items.FIRE_CHARGE)) { this.primeBomb(world, blockPos, defaultBlockState().setValue(PRIMED, true), player); world.removeBlock(blockPos, false); - player.getItemInHand(hand).hurtAndBreak(1, (ServerLevel) world, player, (e) -> {}); + if (world instanceof ServerLevel serverLevel) { + player.getItemInHand(hand).hurtAndBreak(1, serverLevel, player, (e) -> {}); + } return InteractionResult.SUCCESS; } else { return super.useWithoutItem(state, world, blockPos, player, p_225533_6_);