Update to forge 40.2.10
This commit is contained in:
parent
473aa47edb
commit
c743dbdb58
@ -1207,7 +1207,7 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
|
||||
// CraftBukkit end
|
||||
|
||||
InteractionResult enuminteractionresult = interaction.run(player, entity, hand);
|
||||
if (ForgeHooks.onInteractEntityAt(player, entity, entity.position(), hand) != null) return;
|
||||
// if (ForgeHooks.onInteractEntityAt(player, entity, entity.position(), hand) != null) return;
|
||||
|
||||
// CraftBukkit start
|
||||
if (!itemInHand.isEmpty() && itemInHand.getCount() <= -1) {
|
||||
@ -1233,7 +1233,11 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB
|
||||
|
||||
@Override
|
||||
public void onInteraction(InteractionHand hand, Vec3 vec) {
|
||||
this.performInteraction(hand, (player, e, h) -> e.interactAt(player, vec, h),
|
||||
this.performInteraction(hand, (player, e, h) -> {
|
||||
var interactionResult = ForgeHooks.onInteractEntityAt(player, entity, vec, hand);
|
||||
if (interactionResult != null) return interactionResult;
|
||||
return e.interactAt(player, vec, h);
|
||||
},
|
||||
new PlayerInteractAtEntityEvent(getCraftPlayer(), ((EntityBridge) entity).bridge$getBukkitEntity(),
|
||||
new org.bukkit.util.Vector(vec.x, vec.y, vec.z), (hand == InteractionHand.OFF_HAND) ? EquipmentSlot.OFF_HAND : EquipmentSlot.HAND));
|
||||
}
|
||||
|
||||
@ -49,8 +49,6 @@ public abstract class EntityTypeMixin<T extends Entity> implements EntityTypeBri
|
||||
public T spawn(ServerLevel worldIn, @Nullable CompoundTag compound, @Nullable Component customName, @Nullable Player playerIn, BlockPos pos, MobSpawnType reason, boolean p_220342_7_, boolean p_220342_8_, CreatureSpawnEvent.SpawnReason spawnReason) {
|
||||
T t = this.create(worldIn, compound, customName, playerIn, pos, reason, p_220342_7_, p_220342_8_);
|
||||
if (t != null) {
|
||||
if (t instanceof net.minecraft.world.entity.Mob && net.minecraftforge.event.ForgeEventFactory.doSpecialSpawn((net.minecraft.world.entity.Mob) t, worldIn, pos.getX(), pos.getY(), pos.getZ(), null, reason))
|
||||
return null;
|
||||
((IWorldWriterBridge) worldIn).bridge$pushAddEntityReason(spawnReason);
|
||||
worldIn.addFreshEntityWithPassengers(t);
|
||||
return t.isRemoved() ? null : t;
|
||||
|
||||
@ -35,7 +35,7 @@ import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
public abstract class BucketItemMixin {
|
||||
|
||||
// @formatter:off
|
||||
@Shadow public abstract boolean emptyContents(@javax.annotation.Nullable Player player, Level worldIn, BlockPos posIn, @javax.annotation.Nullable BlockHitResult rayTrace);
|
||||
@Shadow(remap = false) public abstract boolean emptyContents(@javax.annotation.Nullable Player player, Level worldIn, BlockPos posIn, @javax.annotation.Nullable BlockHitResult rayTrace, ItemStack stack);
|
||||
// @formatter:on
|
||||
|
||||
@Inject(method = "use", cancellable = true, locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/block/BucketPickup;pickupBlock(Lnet/minecraft/world/level/LevelAccessor;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/level/block/state/BlockState;)Lnet/minecraft/world/item/ItemStack;"))
|
||||
@ -54,11 +54,10 @@ public abstract class BucketItemMixin {
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "use", locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/BucketItem;emptyContents(Lnet/minecraft/world/entity/player/Player;Lnet/minecraft/world/level/Level;Lnet/minecraft/core/BlockPos;Lnet/minecraft/world/phys/BlockHitResult;)Z"))
|
||||
@Inject(method = "use", locals = LocalCapture.CAPTURE_FAILHARD, at = @At(value = "INVOKE", remap = false, target = "Lnet/minecraft/world/item/BucketItem;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"))
|
||||
private void arclight$capture(Level worldIn, Player playerIn, InteractionHand handIn, CallbackInfoReturnable<InteractionResultHolder<ItemStack>> cir, ItemStack stack, BlockHitResult result) {
|
||||
arclight$direction = result.getDirection();
|
||||
arclight$click = result.getBlockPos();
|
||||
arclight$stack = stack;
|
||||
}
|
||||
|
||||
@Inject(method = "use", at = @At("RETURN"))
|
||||
@ -66,7 +65,6 @@ public abstract class BucketItemMixin {
|
||||
arclight$captureItem = null;
|
||||
arclight$direction = null;
|
||||
arclight$click = null;
|
||||
arclight$stack = null;
|
||||
}
|
||||
|
||||
private transient org.bukkit.inventory.@Nullable ItemStack arclight$captureItem;
|
||||
@ -79,25 +77,22 @@ public abstract class BucketItemMixin {
|
||||
public boolean emptyContents(Player entity, Level world, BlockPos pos, @Nullable BlockHitResult result, Direction direction, BlockPos clicked, ItemStack itemstack) {
|
||||
arclight$direction = direction;
|
||||
arclight$click = clicked;
|
||||
arclight$stack = itemstack;
|
||||
try {
|
||||
return this.emptyContents(entity, world, pos, result);
|
||||
return this.emptyContents(entity, world, pos, result, itemstack);
|
||||
} finally {
|
||||
arclight$direction = null;
|
||||
arclight$click = null;
|
||||
arclight$stack = null;
|
||||
}
|
||||
}
|
||||
|
||||
private transient Direction arclight$direction;
|
||||
private transient BlockPos arclight$click;
|
||||
private transient ItemStack arclight$stack;
|
||||
|
||||
@Inject(method = "emptyContents", 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, CallbackInfoReturnable<Boolean> cir) {
|
||||
@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", remap = false, cancellable = true, at = @At(value = "INVOKE", remap = true, target = "Lnet/minecraft/world/level/dimension/DimensionType;ultraWarm()Z"))
|
||||
private void arclight$bucketEmpty(Player player, Level worldIn, BlockPos posIn, BlockHitResult rayTrace, ItemStack itemStack, CallbackInfoReturnable<Boolean> cir) {
|
||||
if (!DistValidate.isValid(worldIn)) return;
|
||||
if (player != null) {
|
||||
PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent((ServerLevel) worldIn, player, posIn, arclight$click, arclight$direction, arclight$stack);
|
||||
PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent((ServerLevel) worldIn, player, posIn, arclight$click, arclight$direction, itemStack);
|
||||
if (event.isCancelled()) {
|
||||
((ServerPlayer) player).connection.send(new ClientboundBlockUpdatePacket(worldIn, posIn));
|
||||
((ServerPlayerEntityBridge) player).bridge$getBukkitEntity().updateInventory();
|
||||
|
||||
@ -14,7 +14,7 @@ allprojects {
|
||||
ext {
|
||||
agpVersion = '1.23'
|
||||
minecraftVersion = '1.18.2'
|
||||
forgeVersion = '40.2.1'
|
||||
forgeVersion = '40.2.10'
|
||||
apiVersion = '1.4.0'
|
||||
toolsVersion = '1.3.+'
|
||||
mixinVersion = '0.8.5'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user