From 475e96726e78758001e506833bc3865053fd0f13 Mon Sep 17 00:00:00 2001 From: Sollace Date: Fri, 9 Feb 2024 17:40:15 +0000 Subject: [PATCH] Update mson --- gradle.properties | 6 ++-- .../client/mixin/MixinClientPlayerEntity.java | 1 - .../mixin/MixinEntityRenderDispatcher.java | 29 ------------------- .../client/render/PonyRenderDispatcher.java | 10 ++++++- src/main/resources/fabric.mod.json | 3 +- src/main/resources/minelp.mixin.json | 1 - 6 files changed, 14 insertions(+), 36 deletions(-) delete mode 100644 src/main/java/com/minelittlepony/client/mixin/MixinEntityRenderDispatcher.java diff --git a/gradle.properties b/gradle.properties index 999cda73..84885946 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,6 +21,6 @@ org.gradle.daemon=false # Dependencies modmenu_version=7.1.0 - kirin_version=1.15.2 - hd_skins_version=6.10.0+1.20 - mson_version=1.8.1 + kirin_version=1.15.4+1.20 + hd_skins_version=6.10.3+1.20 + mson_version=1.9.2+1.20.1 diff --git a/src/main/java/com/minelittlepony/client/mixin/MixinClientPlayerEntity.java b/src/main/java/com/minelittlepony/client/mixin/MixinClientPlayerEntity.java index 81c1f4fd..3649e6d0 100644 --- a/src/main/java/com/minelittlepony/client/mixin/MixinClientPlayerEntity.java +++ b/src/main/java/com/minelittlepony/client/mixin/MixinClientPlayerEntity.java @@ -1,7 +1,6 @@ package com.minelittlepony.client.mixin; import com.minelittlepony.api.pony.IPony; -import com.minelittlepony.client.pony.Pony; import com.minelittlepony.client.render.EquineRenderManager; import net.minecraft.client.network.AbstractClientPlayerEntity; diff --git a/src/main/java/com/minelittlepony/client/mixin/MixinEntityRenderDispatcher.java b/src/main/java/com/minelittlepony/client/mixin/MixinEntityRenderDispatcher.java deleted file mode 100644 index 5cf71455..00000000 --- a/src/main/java/com/minelittlepony/client/mixin/MixinEntityRenderDispatcher.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.minelittlepony.client.mixin; - -import com.minelittlepony.api.model.PreviewModel; -import com.minelittlepony.api.pony.IPony; - -import net.minecraft.client.network.AbstractClientPlayerEntity; -import net.minecraft.client.render.entity.EntityRenderDispatcher; -import net.minecraft.entity.Entity; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; - -@Mixin(EntityRenderDispatcher.class) -abstract class MixinEntityRenderDispatcher { - @Redirect( - method = "getRenderer(Lnet/minecraft/entity/Entity;)Lnet/minecraft/client/render/entity/EntityRenderer;", - at = @At( - value = "INVOKE", - target = "Lnet/minecraft/client/network/AbstractClientPlayerEntity;getModel()Ljava/lang/String;")) - private String getPlayerModel(AbstractClientPlayerEntity player, Entity entity) { - if (player instanceof PreviewModel) { - return player.getModel(); - } - return IPony.getManager() - .getPony(player) - .race() - .getModelId(player.getModel().contains("slim")); - } -} diff --git a/src/main/java/com/minelittlepony/client/render/PonyRenderDispatcher.java b/src/main/java/com/minelittlepony/client/render/PonyRenderDispatcher.java index 547a3a28..669c84ef 100644 --- a/src/main/java/com/minelittlepony/client/render/PonyRenderDispatcher.java +++ b/src/main/java/com/minelittlepony/client/render/PonyRenderDispatcher.java @@ -2,6 +2,7 @@ package com.minelittlepony.client.render; import java.util.function.Function; +import com.minelittlepony.api.pony.IPony; import com.minelittlepony.api.pony.meta.Race; import com.minelittlepony.client.mixin.MixinEntityRenderers; import com.minelittlepony.client.model.IPonyModel; @@ -19,6 +20,7 @@ import net.minecraft.client.render.entity.model.EntityModel; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; +import net.minecraft.util.Identifier; /** * Render manager responsible for replacing and restoring entity renderers when the client settings change. @@ -55,8 +57,14 @@ public class PonyRenderDispatcher { } private void addPlayerSkin(EntityRenderDispatcher manager, boolean slimArms, Race race) { + String modelId = race.getModelId(slimArms); Mson.getInstance().getEntityRendererRegistry().registerPlayerRenderer( - race.getModelId(slimArms), + new Identifier("minelittlepony", race.getModelId(slimArms)), + player -> { + return IPony.getManager() + .getPony(player) + .race().getModelId(slimArms).equalsIgnoreCase(modelId); + }, ModelType.getPlayerModel(race).getFactory(slimArms) ); } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index ae4e1f24..4ce46e03 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -36,7 +36,8 @@ "fabric-api-base": ">=0.1.0", "fabric-lifecycle-events-v1": ">=0.1.0", "fabric-resource-loader-v0": ">=0.1.0", - "kirin": "*" + "kirin": "*", + "mson": "*" }, "suggests": { "hdskins": "*", diff --git a/src/main/resources/minelp.mixin.json b/src/main/resources/minelp.mixin.json index edb508ea..ac4aa1d6 100644 --- a/src/main/resources/minelp.mixin.json +++ b/src/main/resources/minelp.mixin.json @@ -8,7 +8,6 @@ "IResizeable", "MixinCamera", "MixinDefaultSkinHelper", - "MixinEntityRenderDispatcher", "MixinEntityRenderers", "MixinSkullBlockEntityRenderer", "MixinHeldItemRenderer",