From f347f8598623649ddb963ecc0d9c2c1aec2d3d93 Mon Sep 17 00:00:00 2001 From: IzzelAliz Date: Fri, 22 Sep 2023 21:44:18 +0800 Subject: [PATCH] Update to forge 47.2.0 --- README.md | 2 +- .../mixin/core/network/ServerPlayNetHandlerMixin.java | 10 +++++++--- .../server/management/ServerPlayerGameModeMixin.java | 2 +- .../common/mixin/core/world/entity/EntityMixin.java | 2 +- build.gradle | 2 +- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index aae1d215..f43ab629 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ A Bukkit server implementation utilizing Mixin. | Release | Forge | Status | Build | |:--------------------:|:-------:|:------:|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:| -| Trials (1.20-1.20.1) | 47.1.0 | ACTIVE | [![1.19.4 Status](https://img.shields.io/github/actions/workflow/status/IzzelAliz/Arclight/gradle.yml?branch=Trials&style=flat-square)](https://github.com/IzzelAliz/Arclight/actions?query=branch%3ATrials) | +| Trials (1.20-1.20.1) | 47.2.0 | ACTIVE | [![1.19.4 Status](https://img.shields.io/github/actions/workflow/status/IzzelAliz/Arclight/gradle.yml?branch=Trials&style=flat-square)](https://github.com/IzzelAliz/Arclight/actions?query=branch%3ATrials) | | Executions (1.19.4) | 45.1.0 | LTS | [![1.19.4 Status](https://img.shields.io/github/actions/workflow/status/IzzelAliz/Arclight/gradle.yml?branch=Executions&style=flat-square)](https://github.com/IzzelAliz/Arclight/actions?query=branch%3AExecutions) | | 1.18.x | 40.1.80 | LTS | [![1.18 Status](https://img.shields.io/github/actions/workflow/status/IzzelAliz/Arclight/gradle.yml?branch=1.18&style=flat-square)](https://ci.appveyor.com/project/IzzelAliz/arclight-18) | | 1.16.x | 36.2.39 | LTS | [![1.16 Status](https://img.shields.io/github/actions/workflow/status/IzzelAliz/Arclight/gradle.yml?branch=1.16&style=flat-square)](https://ci.appveyor.com/project/IzzelAliz/arclight-16) | 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 5b211685..8a4cf885 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 @@ -759,16 +759,20 @@ public abstract class ServerPlayNetHandlerMixin implements ServerPlayNetHandlerB switch (packetplayinblockdig_enumplayerdigtype) { case SWAP_ITEM_WITH_OFFHAND: { if (!this.player.isSpectator()) { - ItemStack itemstack = this.player.getItemInHand(InteractionHand.OFF_HAND); + // ItemStack itemstack = this.player.getItemInHand(InteractionHand.OFF_HAND); + var event = net.minecraftforge.common.ForgeHooks.onLivingSwapHandItems(this.player); + if (event.isCanceled()) return; + ItemStack itemstack = event.getItemSwappedToMainHand(); + ItemStack originMainHand = event.getItemSwappedToOffHand(); CraftItemStack mainHand = CraftItemStack.asCraftMirror(itemstack); - CraftItemStack offHand = CraftItemStack.asCraftMirror(this.player.getItemInHand(InteractionHand.MAIN_HAND)); + CraftItemStack offHand = CraftItemStack.asCraftMirror(originMainHand); PlayerSwapHandItemsEvent swapItemsEvent = new PlayerSwapHandItemsEvent(this.getCraftPlayer(), mainHand.clone(), offHand.clone()); this.cserver.getPluginManager().callEvent(swapItemsEvent); if (swapItemsEvent.isCancelled()) { return; } if (swapItemsEvent.getOffHandItem().equals(offHand)) { - this.player.setItemInHand(InteractionHand.OFF_HAND, this.player.getItemInHand(InteractionHand.MAIN_HAND)); + this.player.setItemInHand(InteractionHand.OFF_HAND, originMainHand); } else { this.player.setItemInHand(InteractionHand.OFF_HAND, CraftItemStack.asNMSCopy(swapItemsEvent.getOffHandItem())); } 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 e0cad3fb..a03fb7c9 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 @@ -93,7 +93,7 @@ public abstract class ServerPlayerGameModeMixin implements PlayerInteractionMana if (!this.level.hasChunkAt(blockPos)) { return; } - net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickBlock forgeEvent = net.minecraftforge.common.ForgeHooks.onLeftClickBlock(player, blockPos, direction); + net.minecraftforge.event.entity.player.PlayerInteractEvent.LeftClickBlock forgeEvent = net.minecraftforge.common.ForgeHooks.onLeftClickBlock(player, blockPos, direction, action); if (forgeEvent.isCanceled() || (!this.isCreative() && forgeEvent.getUseItem() == net.minecraftforge.eventbus.api.Event.Result.DENY)) { // Restore block and te data level.sendBlockUpdated(blockPos, level.getBlockState(blockPos), level.getBlockState(blockPos), 3); return; diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/EntityMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/EntityMixin.java index f17313b6..e8fd5d29 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/EntityMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/world/entity/EntityMixin.java @@ -414,7 +414,7 @@ public abstract class EntityMixin implements InternalEntityBridge, EntityBridge, if ((Object) this instanceof ServerPlayer) this.handleNetherPortal();// CraftBukkit - // Moved up to postTick } - @Redirect(method = "updateFluidHeightAndDoFluidPushing()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/level/material/FluidState;getFlow(Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/phys/Vec3;")) + @Redirect(method = "updateFluidHeightAndDoFluidPushing(Ljava/util/function/Predicate;)V", remap = false, at = @At(value = "INVOKE", remap = true, target = "Lnet/minecraft/world/level/material/FluidState;getFlow(Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/core/BlockPos;)Lnet/minecraft/world/phys/Vec3;")) private Vec3 arclight$setLava(FluidState instance, BlockGetter level, BlockPos pos) { if (instance.getType().is(FluidTags.LAVA)) { lastLavaContact = pos.immutable(); diff --git a/build.gradle b/build.gradle index 1d87ec21..3b7537b1 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ allprojects { ext { agpVersion = '1.23' minecraftVersion = '1.20.1' - forgeVersion = '47.1.1' + forgeVersion = '47.2.0' apiVersion = '1.5.4' toolsVersion = '1.3.0' mixinVersion = '0.8.5'