From ea78257ffde49d203540a7da5d3b43721f7d29f5 Mon Sep 17 00:00:00 2001 From: Sollace Date: Sat, 25 Nov 2023 21:27:29 +0000 Subject: [PATCH] Force ponies to use the seapony model (if they have one) when they are a seapony in unicopia --- .../unicopia/UnicopiaMixinPlugin.java | 3 +++ .../mixin/client/minelp/MixinPonyPosture.java | 22 +++++++++++++++++++ src/main/resources/unicopia.mixin.json | 1 + 3 files changed, 26 insertions(+) create mode 100644 src/main/java/com/minelittlepony/unicopia/mixin/client/minelp/MixinPonyPosture.java diff --git a/src/main/java/com/minelittlepony/unicopia/UnicopiaMixinPlugin.java b/src/main/java/com/minelittlepony/unicopia/UnicopiaMixinPlugin.java index 48dcf6b7..df5394d9 100644 --- a/src/main/java/com/minelittlepony/unicopia/UnicopiaMixinPlugin.java +++ b/src/main/java/com/minelittlepony/unicopia/UnicopiaMixinPlugin.java @@ -35,6 +35,9 @@ public class UnicopiaMixinPlugin implements IMixinConfigPlugin { if (mixinClassName.indexOf("ad_astra") != -1) { return FabricLoader.getInstance().isModLoaded("ad_astra"); } + if (mixinClassName.indexOf("minelp") != -1) { + return FabricLoader.getInstance().isModLoaded("minelp"); + } } return true; } diff --git a/src/main/java/com/minelittlepony/unicopia/mixin/client/minelp/MixinPonyPosture.java b/src/main/java/com/minelittlepony/unicopia/mixin/client/minelp/MixinPonyPosture.java new file mode 100644 index 00000000..618907d7 --- /dev/null +++ b/src/main/java/com/minelittlepony/unicopia/mixin/client/minelp/MixinPonyPosture.java @@ -0,0 +1,22 @@ +package com.minelittlepony.unicopia.mixin.client.minelp; + +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.callback.CallbackInfoReturnable; + +import com.minelittlepony.api.pony.PonyPosture; +import com.minelittlepony.unicopia.Race; +import com.minelittlepony.unicopia.entity.player.Pony; + +import net.minecraft.entity.LivingEntity; + +@Mixin(PonyPosture.class) +abstract class MixinPonyPosture { + @Inject(method = "isPartiallySubmerged", at = @At("HEAD"), cancellable = true) + private static void isPartiallySubmerged(LivingEntity entity, CallbackInfoReturnable info) { + if (Pony.of(entity).filter(pony -> pony.getCompositeRace().includes(Race.SEAPONY)).isPresent()) { + info.setReturnValue(true); + } + } +} diff --git a/src/main/resources/unicopia.mixin.json b/src/main/resources/unicopia.mixin.json index b85f5823..0c6d99ef 100644 --- a/src/main/resources/unicopia.mixin.json +++ b/src/main/resources/unicopia.mixin.json @@ -78,6 +78,7 @@ "client.MixinTranslationStorage", "client.MixinWorldRenderer", "client.sodium.MixinSodiumWorldRenderer", + "client.minelp.MixinPonyPosture", "trinkets.MixinTrinketCreativeSlot" ], "injectors": {