From 9bae88c8c714e9739bc68a1ba3bd5e0eb27d3470 Mon Sep 17 00:00:00 2001 From: LudoCrypt <60561627+LudoCrypt@users.noreply.github.com> Date: Mon, 6 Jun 2022 14:11:49 -0500 Subject: [PATCH] fix #18 --- .../java/net/ludocrypt/corners/mixin/SnowBlockMixin.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/ludocrypt/corners/mixin/SnowBlockMixin.java b/src/main/java/net/ludocrypt/corners/mixin/SnowBlockMixin.java index ef8afba..824e7f1 100644 --- a/src/main/java/net/ludocrypt/corners/mixin/SnowBlockMixin.java +++ b/src/main/java/net/ludocrypt/corners/mixin/SnowBlockMixin.java @@ -9,16 +9,16 @@ import net.minecraft.block.BlockState; import net.minecraft.block.SnowBlock; import net.minecraft.item.ItemPlacementContext; -import net.minecraft.item.ItemStack; @Mixin(SnowBlock.class) public class SnowBlockMixin { @Inject(method = "Lnet/minecraft/block/SnowBlock;canReplace(Lnet/minecraft/block/BlockState;Lnet/minecraft/item/ItemPlacementContext;)Z", at = @At("RETURN"), cancellable = true) private void corners$canReplace(BlockState state, ItemPlacementContext ctx, CallbackInfoReturnable ci) { - ItemStack stack = ctx.getPlayer().getStackInHand(ctx.getHand()); - if (stack.getItem().equals(CornerBlocks.DARK_RAILING.asItem())) { - ci.setReturnValue(true); + if (ctx.getStack() != null) { + if (ctx.getStack().getItem().equals(CornerBlocks.DARK_RAILING.asItem())) { + ci.setReturnValue(true); + } } } }