diff --git a/gradle.properties b/gradle.properties index b8cb5a5..d904ddd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,11 +1,11 @@ org.gradle.jvmargs=-Xmx1G -minecraft_version=1.19.2 -yarn_mappings=1.19.2+build.1 -loader_version=0.14.9 +minecraft_version=1.19 +yarn_mappings=1.19+build.1 +loader_version=0.14.6 -mod_version = 0.2.2 +mod_version = 0.2.3 maven_group = com.github.clevernucleus archives_base_name = armorrenderlib -fabric_api_version=0.59.0+1.19.2 +fabric_api_version=0.58.0+1.19 diff --git a/src/main/java/com/github/clevernucleus/armorrenderlib/impl/ArmorRenderLibImpl.java b/src/main/java/com/github/clevernucleus/armorrenderlib/impl/ArmorRenderLibImpl.java index 6b5d860..3517fc8 100644 --- a/src/main/java/com/github/clevernucleus/armorrenderlib/impl/ArmorRenderLibImpl.java +++ b/src/main/java/com/github/clevernucleus/armorrenderlib/impl/ArmorRenderLibImpl.java @@ -33,7 +33,7 @@ private static , A extends if(item.getSlotType() != slot) return; var entityRenderer = MinecraftClient.getInstance().getEntityRenderDispatcher().getRenderer(entity); - ArmorFeatureRenderer armorFeatureRenderer = (ArmorFeatureRenderer)((FeatureRendererAccessor)entityRenderer).getFeatureRenderer(ArmorFeatureRenderer.class); + ArmorFeatureRenderer armorFeatureRenderer = (ArmorFeatureRenderer)((FeatureRendererAccessor)entityRenderer).getFeatureRenderer(); A model = ((ArmorFeatureRendererInvoker)armorFeatureRenderer).invokeGetArmor(slot); contextModel.setAttributes((BipedEntityModel)model); ((ArmorFeatureRendererInvoker)armorFeatureRenderer).invokeSetVisible(model, slot); diff --git a/src/main/java/com/github/clevernucleus/armorrenderlib/impl/FeatureRendererAccessor.java b/src/main/java/com/github/clevernucleus/armorrenderlib/impl/FeatureRendererAccessor.java index a6330f7..4a836d3 100644 --- a/src/main/java/com/github/clevernucleus/armorrenderlib/impl/FeatureRendererAccessor.java +++ b/src/main/java/com/github/clevernucleus/armorrenderlib/impl/FeatureRendererAccessor.java @@ -5,5 +5,5 @@ import net.minecraft.entity.LivingEntity; public interface FeatureRendererAccessor> { - ArmorFeatureRenderer getFeatureRenderer(Object key); + ArmorFeatureRenderer getFeatureRenderer(); } diff --git a/src/main/java/com/github/clevernucleus/armorrenderlib/mixin/LivingEntityRendererMixin.java b/src/main/java/com/github/clevernucleus/armorrenderlib/mixin/LivingEntityRendererMixin.java index 4ebb4d8..4a2a1bc 100644 --- a/src/main/java/com/github/clevernucleus/armorrenderlib/mixin/LivingEntityRendererMixin.java +++ b/src/main/java/com/github/clevernucleus/armorrenderlib/mixin/LivingEntityRendererMixin.java @@ -1,19 +1,13 @@ package com.github.clevernucleus.armorrenderlib.mixin; -import java.util.List; -import java.util.Map; - -import org.objectweb.asm.Opcodes; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import com.github.clevernucleus.armorrenderlib.impl.FeatureRendererAccessor; -import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap; import net.minecraft.client.render.entity.LivingEntityRenderer; import net.minecraft.client.render.entity.feature.ArmorFeatureRenderer; import net.minecraft.client.render.entity.feature.FeatureRenderer; @@ -24,22 +18,17 @@ abstract class LivingEntityRendererMixin> implements FeatureRendererAccessor { @Unique - private final Map>, FeatureRenderer> arl_features = new Object2ObjectArrayMap<>(); + private FeatureRenderer arl_armorFeature; - @SuppressWarnings("unchecked") @Inject(method = "addFeature", at = @At("HEAD"), cancellable = true) private void arl_addFeature(FeatureRenderer feature, CallbackInfoReturnable info) { - this.arl_features.put((Class>)feature.getClass(), feature); - info.setReturnValue(true); - } - - @Redirect(method = "render", at = @At(value = "FIELD", target = "Lnet/minecraft/client/render/entity/LivingEntityRenderer;features:Ljava/util/List;", opcode = Opcodes.GETFIELD)) - private List> arl_get(LivingEntityRenderer renderer) { - return this.arl_features.values().stream().toList(); + if(feature instanceof ArmorFeatureRenderer) { + this.arl_armorFeature = feature; + } } @Override - public ArmorFeatureRenderer getFeatureRenderer(Object key) { - return (ArmorFeatureRenderer)this.arl_features.get(key); + public ArmorFeatureRenderer getFeatureRenderer() { + return (ArmorFeatureRenderer)this.arl_armorFeature; } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index cf6fa77..6fb72a6 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -25,9 +25,9 @@ "armorrenderlib.mixins.json" ], "depends": { - "fabricloader": ">=0.14.9", - "fabric-api": ">=0.59.0", - "minecraft": "1.19.2", + "fabricloader": ">=0.14.6", + "fabric": ">=0.58.0", + "minecraft": "1.19", "java": ">=17" } } \ No newline at end of file