Skip to content

Commit

Permalink
Fix InventoryMoveItemEvent npe
Browse files Browse the repository at this point in the history
  • Loading branch information
Mgazul committed Aug 12, 2023
1 parent 90827e3 commit c5d92ab
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,9 @@ private static boolean ejectItems(Level world, BlockPos blockposition, BlockStat
target = "Lnet/minecraft/world/item/ItemStack;isEmpty()Z"),
cancellable = true)
private static void banner$cancelIfNotEject(Level level, BlockPos pos, BlockState state, Container sourceContainer, CallbackInfoReturnable<Boolean> cir) {
if (banner$moveEvent.get().isCancelled()) {
if (banner$moveEvent.get() != null && banner$moveEvent.getAndSet(null).isCancelled()) {
cir.setReturnValue(false);
}
banner$moveEvent.set(null);
}

@Redirect(method = "tryTakeInItemFromSlot", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/entity/HopperBlockEntity;addItem(Lnet/minecraft/world/Container;Lnet/minecraft/world/Container;Lnet/minecraft/world/item/ItemStack;Lnet/minecraft/core/Direction;)Lnet/minecraft/world/item/ItemStack;"))
Expand Down

0 comments on commit c5d92ab

Please sign in to comment.