Update mson

This commit is contained in:
Sollace 2024-02-09 17:40:15 +00:00
parent 9d65185fcd
commit 475e96726e
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB
6 changed files with 14 additions and 36 deletions

View file

@ -21,6 +21,6 @@ org.gradle.daemon=false
# Dependencies # Dependencies
modmenu_version=7.1.0 modmenu_version=7.1.0
kirin_version=1.15.2 kirin_version=1.15.4+1.20
hd_skins_version=6.10.0+1.20 hd_skins_version=6.10.3+1.20
mson_version=1.8.1 mson_version=1.9.2+1.20.1

View file

@ -1,7 +1,6 @@
package com.minelittlepony.client.mixin; package com.minelittlepony.client.mixin;
import com.minelittlepony.api.pony.IPony; import com.minelittlepony.api.pony.IPony;
import com.minelittlepony.client.pony.Pony;
import com.minelittlepony.client.render.EquineRenderManager; import com.minelittlepony.client.render.EquineRenderManager;
import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.network.AbstractClientPlayerEntity;

View file

@ -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"));
}
}

View file

@ -2,6 +2,7 @@ package com.minelittlepony.client.render;
import java.util.function.Function; import java.util.function.Function;
import com.minelittlepony.api.pony.IPony;
import com.minelittlepony.api.pony.meta.Race; import com.minelittlepony.api.pony.meta.Race;
import com.minelittlepony.client.mixin.MixinEntityRenderers; import com.minelittlepony.client.mixin.MixinEntityRenderers;
import com.minelittlepony.client.model.IPonyModel; 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.Entity;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.util.Identifier;
/** /**
* Render manager responsible for replacing and restoring entity renderers when the client settings change. * 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) { private void addPlayerSkin(EntityRenderDispatcher manager, boolean slimArms, Race race) {
String modelId = race.getModelId(slimArms);
Mson.getInstance().getEntityRendererRegistry().registerPlayerRenderer( 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) ModelType.getPlayerModel(race).getFactory(slimArms)
); );
} }

View file

@ -36,7 +36,8 @@
"fabric-api-base": ">=0.1.0", "fabric-api-base": ">=0.1.0",
"fabric-lifecycle-events-v1": ">=0.1.0", "fabric-lifecycle-events-v1": ">=0.1.0",
"fabric-resource-loader-v0": ">=0.1.0", "fabric-resource-loader-v0": ">=0.1.0",
"kirin": "*" "kirin": "*",
"mson": "*"
}, },
"suggests": { "suggests": {
"hdskins": "*", "hdskins": "*",

View file

@ -8,7 +8,6 @@
"IResizeable", "IResizeable",
"MixinCamera", "MixinCamera",
"MixinDefaultSkinHelper", "MixinDefaultSkinHelper",
"MixinEntityRenderDispatcher",
"MixinEntityRenderers", "MixinEntityRenderers",
"MixinSkullBlockEntityRenderer", "MixinSkullBlockEntityRenderer",
"MixinHeldItemRenderer", "MixinHeldItemRenderer",