Fix modded bucket NPE (#1088)

This commit is contained in:
IzzelAliz 2023-09-17 10:35:19 +08:00
parent 7b06a3b156
commit f2a1e87edd

View File

@ -95,7 +95,7 @@ public abstract class BucketItemMixin {
@Inject(method = "emptyContents(Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/phys/BlockHitResult;Lnet/minecraft/world/item/ItemStack;)Z", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/dimension/DimensionType;ultraWarm()Z"))
private void arclight$bucketEmpty(Player player, Level worldIn, BlockPos posIn, BlockHitResult rayTrace, ItemStack stack, CallbackInfoReturnable<Boolean> cir) {
if (!DistValidate.isValid(worldIn)) return;
if (player != null) {
if (player != null && stack != null) {
PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent((ServerLevel) worldIn, player, posIn, arclight$click, arclight$direction, stack, arclight$hand == null ? InteractionHand.MAIN_HAND : arclight$hand);
if (event.isCancelled()) {
((ServerPlayer) player).connection.send(new ClientboundBlockUpdatePacket(worldIn, posIn));