Skip to content

Commit

Permalink
Fix block breaker crash - #205
Browse files Browse the repository at this point in the history
  • Loading branch information
Direwolf20-MC committed Oct 8, 2024
1 parent e5a0f42 commit 5b2c8a8
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,10 @@ public boolean tryBreakBlock(ItemStack tool, FakePlayer fakePlayer, BlockPos bre

public void breakBlock(FakePlayer player, BlockPos breakPos, ItemStack itemStack, BlockState state) {
//itemStack.onBlockStartBreak(breakPos, player);
BlockEntity blockEntity = level.getBlockEntity(breakPos);
boolean success = level.destroyBlock(breakPos, false, player);
if (success) {
Block.dropResources(state, level, breakPos, level.getBlockEntity(breakPos), player, itemStack);
Block.dropResources(state, level, breakPos, blockEntity, player, itemStack);
if (state.getDestroySpeed(level, breakPos) != 0.0F)
itemStack.hurtAndBreak(1, player, LivingEntity.getSlotForHand(InteractionHand.MAIN_HAND));
}
Expand Down

0 comments on commit 5b2c8a8

Please sign in to comment.