From 8bda98f594060c8f2ab9eb2790c173a884785c8f Mon Sep 17 00:00:00 2001 From: FlorianMichael Date: Sun, 4 Aug 2024 20:40:36 +0200 Subject: [PATCH] Fix boat interactions in <= 1.20.6 --- .../florianmichael/viafabricplus/ViaFabricPlus.java | 3 --- .../fixes/minecraft/entity/MixinBoatEntity.java | 12 ++++++++++++ src/main/resources/viafabricplus.mixins.json | 6 +++--- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java b/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java index cb8e2e46..c7676f91 100644 --- a/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java +++ b/src/main/java/de/florianmichael/viafabricplus/ViaFabricPlus.java @@ -40,9 +40,6 @@ import java.util.concurrent.CompletableFuture; * - Entity attachment calculation got changed completely * - Particle handling has slightly changed * - * TODO | Port 1.21 - * - HangingEntity/ItemFrame/Painting bounding box calculation changed - * * TODO | General * - Make recipe fixes dynamic instead of a data dump in java classes * - Window interactions in <= 1.16.5 has changed and can be detected by the server diff --git a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinBoatEntity.java b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinBoatEntity.java index 47b4b6e6..65675424 100644 --- a/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinBoatEntity.java +++ b/src/main/java/de/florianmichael/viafabricplus/injection/mixin/fixes/minecraft/entity/MixinBoatEntity.java @@ -29,10 +29,13 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.MovementType; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.vehicle.BoatEntity; import net.minecraft.entity.vehicle.VehicleEntity; import net.minecraft.particle.ParticleTypes; import net.minecraft.registry.tag.FluidTags; +import net.minecraft.util.ActionResult; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; import net.minecraft.util.math.MathHelper; @@ -85,6 +88,15 @@ public abstract class MixinBoatEntity extends VehicleEntity { super(type, world); } + @Redirect(method = "interact", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/vehicle/VehicleEntity;interact(Lnet/minecraft/entity/player/PlayerEntity;Lnet/minecraft/util/Hand;)Lnet/minecraft/util/ActionResult;")) + private ActionResult makeNotLeashable(VehicleEntity instance, PlayerEntity player, Hand hand) { + if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_5)) { + return ActionResult.PASS; + } else { + return instance.interact(player, hand); + } + } + @Redirect(method = "updateVelocity", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;isSpaceEmpty(Lnet/minecraft/entity/Entity;Lnet/minecraft/util/math/Box;)Z")) private boolean alwaysUpdatePosition(World instance, Entity entity, Box box) { if (ProtocolTranslator.getTargetVersion().olderThanOrEqualTo(ProtocolVersion.v1_20_5)) { diff --git a/src/main/resources/viafabricplus.mixins.json b/src/main/resources/viafabricplus.mixins.json index 191f8ee4..e80d0db1 100644 --- a/src/main/resources/viafabricplus.mixins.json +++ b/src/main/resources/viafabricplus.mixins.json @@ -112,6 +112,7 @@ "fixes.minecraft.entity.MixinEntityRenderDispatcher", "fixes.minecraft.entity.MixinItemEntity", "fixes.minecraft.entity.MixinLivingEntity", + "fixes.minecraft.entity.MixinMobEntity", "fixes.minecraft.entity.MixinOtherClientPlayerEntity", "fixes.minecraft.entity.MixinPlayerEntity", "fixes.minecraft.entity.MixinPlayerEntityRenderer", @@ -135,6 +136,7 @@ "fixes.minecraft.item.MixinItemPlacementContext", "fixes.minecraft.item.MixinItemRenderer", "fixes.minecraft.item.MixinItemStack", + "fixes.minecraft.item.MixinKnowledgeBookItem", "fixes.minecraft.item.MixinShovelItem", "fixes.minecraft.item.MixinSwordItem", "fixes.minecraft.network.MixinChatMessageC2SPacket", @@ -205,9 +207,7 @@ "fixes.viaversion.MixinWorldPacketRewriter1_19", "viabedrock.MixinJoinPackets", "vialegacy.MixinExtensionProtocolMetadataStorage", - "vialegacy.MixinViaLegacyConfig", - "fixes.minecraft.item.MixinKnowledgeBookItem", - "fixes.minecraft.entity.MixinMobEntity" + "vialegacy.MixinViaLegacyConfig" ], "injectors": { "defaultRequire": 1