From b8edc534735762e21f96d1c88b593be9bb6313cd Mon Sep 17 00:00:00 2001 From: IzzelAliz Date: Mon, 19 Jun 2023 11:18:14 +0800 Subject: [PATCH] Update upstream --- .../mixin/core/network/ServerPlayNetHandlerMixin.java | 2 +- .../server/management/ServerPlayerGameModeMixin.java | 2 +- .../common/mixin/core/world/item/BoatItemMixin.java | 2 +- .../world/level/block/entity/BlockEntityMixin.java | 1 + .../level/block/entity/BrushableBlockEntityMixin.java | 8 ++++++++ .../entity/ChiseledBookShelfBlockEntityMixin.java | 10 ++++++++-- .../block/entity/SculkCatalystBlockEntityMixin.java | 8 +++++++- .../src/main/resources/META-INF/accesstransformer.cfg | 1 + 8 files changed, 28 insertions(+), 6 deletions(-) diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/network/ServerPlayNetHandlerMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/network/ServerPlayNetHandlerMixin.java index 894f6e89..ad951b66 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/network/ServerPlayNetHandlerMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/network/ServerPlayNetHandlerMixin.java @@ -820,7 +820,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB } else { // TODO 1.20 update this BlockHitResult movingobjectpositionblock = movingobjectposition; - PlayerInteractEvent event2 = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_BLOCK, movingobjectpositionblock.getBlockPos(), movingobjectpositionblock.getDirection(), itemstack, true, enumhand); + PlayerInteractEvent event2 = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_BLOCK, movingobjectpositionblock.getBlockPos(), movingobjectpositionblock.getDirection(), itemstack, true, enumhand, movingobjectpositionblock.getLocation()); cancelled = (event2.useItemInHand() == Event.Result.DENY); } if (cancelled) { diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/server/management/ServerPlayerGameModeMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/server/management/ServerPlayerGameModeMixin.java index 9cdb82b9..e0cad3fb 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/server/management/ServerPlayerGameModeMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/server/management/ServerPlayerGameModeMixin.java @@ -303,7 +303,7 @@ public abstract class ServerPlayerGameModeMixin implements PlayerInteractionMana cancelledBlock = true; } - PlayerInteractEvent bukkitEvent = CraftEventFactory.callPlayerInteractEvent(playerIn, Action.RIGHT_CLICK_BLOCK, blockpos, blockRaytraceResultIn.getDirection(), stackIn, cancelledBlock, handIn); + PlayerInteractEvent bukkitEvent = CraftEventFactory.callPlayerInteractEvent(playerIn, Action.RIGHT_CLICK_BLOCK, blockpos, blockRaytraceResultIn.getDirection(), stackIn, cancelledBlock, handIn, blockRaytraceResultIn.getLocation()); bridge$setFiredInteract(true); bridge$setInteractResult(bukkitEvent.useItemInHand() == Event.Result.DENY); if (bukkitEvent.useInteractedBlock() == Event.Result.DENY) { diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/item/BoatItemMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/item/BoatItemMixin.java index 135b1144..afe952aa 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/item/BoatItemMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/item/BoatItemMixin.java @@ -69,7 +69,7 @@ public abstract class BoatItemMixin extends Item { if (result.getType() == HitResult.Type.BLOCK) { if (DistValidate.isValid(worldIn)) { - PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(playerIn, Action.RIGHT_CLICK_BLOCK, result.getBlockPos(), result.getDirection(), itemstack, handIn); + PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(playerIn, Action.RIGHT_CLICK_BLOCK, result.getBlockPos(), result.getDirection(), itemstack, false, handIn, result.getLocation()); if (event.isCancelled()) { return new InteractionResultHolder<>(InteractionResult.PASS, itemstack); diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/level/block/entity/BlockEntityMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/level/block/entity/BlockEntityMixin.java index f0aad641..f2b5be3d 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/level/block/entity/BlockEntityMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/level/block/entity/BlockEntityMixin.java @@ -36,6 +36,7 @@ public abstract class BlockEntityMixin implements TileEntityBridge { @Shadow public abstract boolean onlyOpCanSetNbt(); @Shadow protected static void setChanged(Level p_155233_, BlockPos p_155234_, BlockState p_155235_) { } @Shadow public abstract BlockEntityType getType(); + @Shadow public void load(CompoundTag p_155245_) {} // @formatter:on @Inject(method = "load", at = @At("RETURN")) diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/level/block/entity/BrushableBlockEntityMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/level/block/entity/BrushableBlockEntityMixin.java index d084db69..1d730885 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/level/block/entity/BrushableBlockEntityMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/level/block/entity/BrushableBlockEntityMixin.java @@ -1,5 +1,6 @@ package io.izzel.arclight.common.mixin.core.world.level.block.entity; +import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.item.ItemEntity; @@ -10,7 +11,9 @@ import org.bukkit.craftbukkit.v.block.CraftBlock; import org.bukkit.craftbukkit.v.event.CraftEventFactory; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import java.util.Collections; @@ -23,4 +26,9 @@ public abstract class BrushableBlockEntityMixin extends BlockEntityMixin { CraftEventFactory.handleBlockDropItemEvent(block, block.getState(), (ServerPlayer) player, Collections.singletonList((ItemEntity) entity)); return true; } + + @Inject(method = "load", at = @At("HEAD")) + private void arclight$load(CompoundTag p_277597_, CallbackInfo ci) { + super.load(p_277597_); + } } diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/level/block/entity/ChiseledBookShelfBlockEntityMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/level/block/entity/ChiseledBookShelfBlockEntityMixin.java index 3386202d..1be1a560 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/level/block/entity/ChiseledBookShelfBlockEntityMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/level/block/entity/ChiseledBookShelfBlockEntityMixin.java @@ -4,6 +4,7 @@ import io.izzel.arclight.common.bridge.core.inventory.IInventoryBridge; import io.izzel.arclight.common.bridge.core.world.WorldBridge; import io.izzel.arclight.common.mod.util.DistValidate; import net.minecraft.core.NonNullList; +import net.minecraft.nbt.CompoundTag; import net.minecraft.world.Container; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.entity.ChiseledBookShelfBlockEntity; @@ -69,10 +70,15 @@ public abstract class ChiseledBookShelfBlockEntityMixin extends BlockEntityMixin return new org.bukkit.Location(((WorldBridge) level).bridge$getWorld(), worldPosition.getX(), worldPosition.getY(), worldPosition.getZ()); } - @Inject(method = "setItem", cancellable = true, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/entity/ChiseledBookShelfBlockEntity;updateState(I)V")) - private void arclight$skipIfNull(int p_256610_, ItemStack p_255789_, CallbackInfo ci) { + @Inject(method = "updateState", cancellable = true, at = @At("HEAD")) + private void arclight$skipIfNull(int p_261806_, CallbackInfo ci) { if (level == null) { ci.cancel(); } } + + @Inject(method = "load", at = @At("HEAD")) + private void arclight$load(CompoundTag p_277597_, CallbackInfo ci) { + super.load(p_277597_); + } } diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/level/block/entity/SculkCatalystBlockEntityMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/level/block/entity/SculkCatalystBlockEntityMixin.java index 71048f02..3a6e049f 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/level/block/entity/SculkCatalystBlockEntityMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/level/block/entity/SculkCatalystBlockEntityMixin.java @@ -1,6 +1,7 @@ package io.izzel.arclight.common.mixin.core.world.level.block.entity; import net.minecraft.core.BlockPos; +import net.minecraft.nbt.CompoundTag; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.SculkCatalystBlockEntity; import net.minecraft.world.level.block.state.BlockState; @@ -11,7 +12,7 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(SculkCatalystBlockEntity.class) -public class SculkCatalystBlockEntityMixin { +public abstract class SculkCatalystBlockEntityMixin extends BlockEntityMixin { @Inject(method = "serverTick", at = @At("HEAD")) private static void arclight$overrideSource(Level p_222780_, BlockPos p_222781_, BlockState p_222782_, SculkCatalystBlockEntity blockEntity, CallbackInfo ci) { @@ -22,4 +23,9 @@ public class SculkCatalystBlockEntityMixin { private static void arclight$resetSource(Level p_222780_, BlockPos p_222781_, BlockState p_222782_, SculkCatalystBlockEntity blockEntity, CallbackInfo ci) { CraftEventFactory.sourceBlockOverride = null; } + + @Inject(method = "load", at = @At("HEAD")) + private void arclight$load(CompoundTag p_277597_, CallbackInfo ci) { + super.load(p_277597_); + } } diff --git a/arclight-common/src/main/resources/META-INF/accesstransformer.cfg b/arclight-common/src/main/resources/META-INF/accesstransformer.cfg index 4b63439c..e4854898 100644 --- a/arclight-common/src/main/resources/META-INF/accesstransformer.cfg +++ b/arclight-common/src/main/resources/META-INF/accesstransformer.cfg @@ -6,6 +6,7 @@ public net.minecraft.server.packs.repository.Pack f_244124_ # resources public net.minecraft.world.flag.FeatureFlag f_243952_ # universe public net.minecraft.world.flag.FeatureFlagRegistry f_244560_ # names public-f net.minecraft.server.players.PlayerList f_11193_ # maxPlayers +public net.minecraft.world.level.block.ChiseledBookShelfBlock m_261279_(Lnet/minecraft/world/phys/Vec2;)I # getHitSlot # Arclight 1.19.3 public net.minecraft.server.MinecraftServer$TimeProfiler (JI)V # TimeProfiler public net.minecraft.world.level.block.entity.SkullBlockEntity f_262250_ # noteBlockSound