diff --git a/src/main/java/com/wenxin2/marioverse/client/renderers/ArmorRenderingExtension.java b/src/main/java/com/wenxin2/marioverse/client/renderers/ArmorRenderingExtension.java deleted file mode 100644 index ffda6395..00000000 --- a/src/main/java/com/wenxin2/marioverse/client/renderers/ArmorRenderingExtension.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.wenxin2.marioverse.client.renderers; - -import com.mojang.blaze3d.vertex.PoseStack; -import com.wenxin2.marioverse.client.models.entities.GoombaModel; -import com.wenxin2.marioverse.mixin.LivingEntityRendererMixinAccessor; -import io.wispforest.accessories.api.client.AccessoryRenderer; -import io.wispforest.accessories.api.slot.SlotReference; -import net.minecraft.client.Minecraft; -import net.minecraft.client.model.EntityModel; -import net.minecraft.client.model.HumanoidModel; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.item.Equipable; -import net.minecraft.world.item.ItemStack; - -public interface ArmorRenderingExtension> { - - AccessoryRenderer RENDERER = new AccessoryRenderer() { - @Override - public void render(ItemStack stack, SlotReference reference, PoseStack matrices, - EntityModel model, MultiBufferSource multiBufferSource, - int light, float limbSwing, float limbSwingAmount, float partialTicks, - float ageInTicks, float netHeadYaw, float headPitch) { - var entityRender = Minecraft.getInstance().getEntityRenderDispatcher().getRenderer(reference.entity()); - - if (!(entityRender instanceof LivingEntityRendererMixinAccessor accessor)) return; - if (!(stack.getItem() instanceof Equipable equipable)) return; - var equipmentSlot = equipable.getEquipmentSlot(); - var possibleLayer = accessor.getLayers().stream() - .filter(renderLayer -> renderLayer instanceof ArmorRenderingExtension) - .findFirst(); - - if (model instanceof HumanoidModel humanoidModel) - possibleLayer.ifPresent(layer -> - ((ArmorRenderingExtension) layer).renderArmorPiece(stack, matrices, multiBufferSource, - reference.entity(), equipmentSlot, light, humanoidModel)); - } - }; - - default void renderArmorPiece(ItemStack stack, PoseStack poseStack, MultiBufferSource multiBufferSource, - T livingEntity, EquipmentSlot equipmentSlot, int light, A baseModel) { - throw new IllegalStateException("Injected interface method is unimplemented!"); - } -} \ No newline at end of file diff --git a/src/main/java/com/wenxin2/marioverse/mixin/HumanoidArmorLayerMixin.java b/src/main/java/com/wenxin2/marioverse/mixin/HumanoidArmorLayerMixin.java deleted file mode 100644 index 140602f0..00000000 --- a/src/main/java/com/wenxin2/marioverse/mixin/HumanoidArmorLayerMixin.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.wenxin2.marioverse.mixin; - -import com.llamalad7.mixinextras.injector.wrapoperation.Operation; -import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; -import com.mojang.blaze3d.vertex.PoseStack; -import com.wenxin2.marioverse.client.renderers.ArmorRenderingExtension; -import net.minecraft.client.model.HumanoidModel; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.entity.layers.HumanoidArmorLayer; -import net.minecraft.client.renderer.texture.OverlayTexture; -import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.entity.LivingEntity; -import net.minecraft.world.item.ItemStack; -import org.jetbrains.annotations.Nullable; -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.Unique; -import org.spongepowered.asm.mixin.injection.At; -import software.bernie.geckolib.animatable.client.GeoRenderProvider; -import software.bernie.geckolib.renderer.GeoArmorRenderer; -import software.bernie.geckolib.util.Color; - -@Mixin(HumanoidArmorLayer.class) -public abstract class HumanoidArmorLayerMixin> implements ArmorRenderingExtension { - - @Shadow - protected abstract void renderArmorPiece(PoseStack poseStack, MultiBufferSource multiBufferSource, T livingEntity, EquipmentSlot equipmentSlot, int i, A humanoidModel); - - @Shadow - private A getArmorModel(EquipmentSlot slot) { return null; } - - @Shadow @Final private A innerModel; - @Unique - @Nullable - private ItemStack tempStack = null; - - @Override - public void renderArmorPiece(ItemStack stack, PoseStack poseStack, MultiBufferSource multiBufferSource, T livingEntity, - EquipmentSlot equipmentSlot, int light, A baseModel) { - this.tempStack = stack; - - HumanoidModel geckolibModel = GeoRenderProvider.of(stack).getGeoArmorRenderer(livingEntity, stack, equipmentSlot, baseModel); - - if (geckolibModel instanceof GeoArmorRenderer geoArmorRenderer) { - geoArmorRenderer.prepForRender(livingEntity, stack, equipmentSlot, baseModel); - geoArmorRenderer.renderToBuffer(poseStack, null, - light, OverlayTexture.NO_OVERLAY, Color.WHITE.argbInt()); - baseModel.copyPropertiesTo((A)geckolibModel); - } else { - this.renderArmorPiece(poseStack, multiBufferSource, livingEntity, equipmentSlot, light, this.getArmorModel(equipmentSlot)); - } - - this.tempStack = null; - } - - @WrapOperation(method = "renderArmorPiece", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;getItemBySlot(Lnet/minecraft/world/entity/EquipmentSlot;)Lnet/minecraft/world/item/ItemStack;")) - private ItemStack getAlternativeStack(LivingEntity instance, EquipmentSlot equipmentSlot, Operation original) { - if (tempStack != null) return tempStack; - - return original.call(instance, equipmentSlot); - } -} \ No newline at end of file diff --git a/src/main/java/com/wenxin2/marioverse/mixin/LivingEntityRendererMixinAccessor.java b/src/main/java/com/wenxin2/marioverse/mixin/LivingEntityRendererMixinAccessor.java deleted file mode 100644 index 3117aca1..00000000 --- a/src/main/java/com/wenxin2/marioverse/mixin/LivingEntityRendererMixinAccessor.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.wenxin2.marioverse.mixin; - -import java.util.List; -import net.minecraft.client.model.EntityModel; -import net.minecraft.client.renderer.entity.LivingEntityRenderer; -import net.minecraft.client.renderer.entity.layers.RenderLayer; -import net.minecraft.world.entity.LivingEntity; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - -@Mixin(LivingEntityRenderer.class) -public interface LivingEntityRendererMixinAccessor> { - @Accessor("layers") - List> getLayers(); -} \ No newline at end of file diff --git a/src/main/resources/marioverse.mixins.json b/src/main/resources/marioverse.mixins.json index 9d6ea602..03ec3a9f 100644 --- a/src/main/resources/marioverse.mixins.json +++ b/src/main/resources/marioverse.mixins.json @@ -15,7 +15,6 @@ "TrapDoorBlockMixin" ], "client": [ - "HumanoidArmorLayerMixin", "LivingEntityClientMixin", "LivingEntityRendererMixinAccessor" ],