From cb232cc145566a867680acbbc54da793841de8d3 Mon Sep 17 00:00:00 2001 From: Sollace Date: Mon, 10 Apr 2023 22:46:18 +0200 Subject: [PATCH] Remove redundant magic rendering code --- .../client/model/ClientPonyModel.java | 8 ------- .../client/model/IPonyMixinModel.java | 8 ------- .../client/model/IPonyModel.java | 7 ------ .../model/entity/race/UnicornModel.java | 14 ------------ .../client/render/LevitatingItemRenderer.java | 22 ------------------- 5 files changed, 59 deletions(-) diff --git a/src/main/java/com/minelittlepony/client/model/ClientPonyModel.java b/src/main/java/com/minelittlepony/client/model/ClientPonyModel.java index 504d257a..6b040c65 100644 --- a/src/main/java/com/minelittlepony/client/model/ClientPonyModel.java +++ b/src/main/java/com/minelittlepony/client/model/ClientPonyModel.java @@ -1,12 +1,8 @@ package com.minelittlepony.client.model; import net.minecraft.client.model.ModelPart; -import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.entity.model.*; -import net.minecraft.client.render.model.json.ModelTransformationMode; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.LivingEntity; -import net.minecraft.item.ItemStack; import net.minecraft.util.Arm; import net.minecraft.util.Hand; @@ -110,10 +106,6 @@ public abstract class ClientPonyModel extends MsonPlayer } - @Override - public void postItemRender(IPony pony, T entity, ItemStack drop, ModelTransformationMode transform, Arm hand, MatrixStack stack, VertexConsumerProvider renderContext) { - } - static void resetPivot(ModelPart part) { part.setPivot(part.getDefaultTransform().pivotX, part.getDefaultTransform().pivotY, part.getDefaultTransform().pivotZ); } diff --git a/src/main/java/com/minelittlepony/client/model/IPonyMixinModel.java b/src/main/java/com/minelittlepony/client/model/IPonyMixinModel.java index e3a2e64b..38dadaf8 100644 --- a/src/main/java/com/minelittlepony/client/model/IPonyMixinModel.java +++ b/src/main/java/com/minelittlepony/client/model/IPonyMixinModel.java @@ -1,13 +1,10 @@ package com.minelittlepony.client.model; import net.minecraft.client.model.ModelPart; -import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.entity.model.BipedEntityModel; import net.minecraft.client.render.entity.model.ModelWithArms; -import net.minecraft.client.render.model.json.ModelTransformationMode; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.LivingEntity; -import net.minecraft.item.ItemStack; import net.minecraft.util.Arm; import com.minelittlepony.api.model.BodyPart; @@ -93,11 +90,6 @@ public interface IPonyMixinModel return mixin().getBodyPart(part); } - @Override - default void postItemRender(IPony pony, T entity, ItemStack drop, ModelTransformationMode transform, Arm hand, MatrixStack stack, VertexConsumerProvider renderContext) { - mixin().postItemRender(pony, entity, drop, transform, hand, stack, renderContext); - } - interface Caster & IUnicorn, ArmModel> extends IPonyMixinModel, IUnicorn { @Override default boolean isCasting() { diff --git a/src/main/java/com/minelittlepony/client/model/IPonyModel.java b/src/main/java/com/minelittlepony/client/model/IPonyModel.java index 93a91915..56d4140c 100644 --- a/src/main/java/com/minelittlepony/client/model/IPonyModel.java +++ b/src/main/java/com/minelittlepony/client/model/IPonyModel.java @@ -1,14 +1,9 @@ package com.minelittlepony.client.model; import net.minecraft.client.model.ModelPart; -import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.entity.model.BipedEntityModel; import net.minecraft.client.render.entity.model.ModelWithArms; -import net.minecraft.client.render.model.json.ModelTransformationMode; -import net.minecraft.client.util.math.MatrixStack; import net.minecraft.entity.LivingEntity; -import net.minecraft.item.ItemStack; -import net.minecraft.util.Arm; import com.minelittlepony.api.model.BodyPart; import com.minelittlepony.api.model.ICapitated; @@ -24,6 +19,4 @@ public interface IPonyModel extends IModel, ICapitated extends EarthPonyModel impl } } } - - @Override - public void postItemRender(IPony pony, T entity, ItemStack drop, ModelTransformationMode transform, Arm hand, MatrixStack stack, VertexConsumerProvider renderContext) { - if (!MineLittlePony.getInstance().getConfig().tpsmagic.get() || !hasMagic()) { - return; - } - - PonyRenderDispatcher.getInstance().getMagicRenderer().renderItemGlow(pony, entity, drop, transform, hand, getMagicColor(), stack, renderContext); - } } diff --git a/src/main/java/com/minelittlepony/client/render/LevitatingItemRenderer.java b/src/main/java/com/minelittlepony/client/render/LevitatingItemRenderer.java index 7a7a4969..4459f36d 100644 --- a/src/main/java/com/minelittlepony/client/render/LevitatingItemRenderer.java +++ b/src/main/java/com/minelittlepony/client/render/LevitatingItemRenderer.java @@ -6,7 +6,6 @@ import com.minelittlepony.client.util.render.RenderLayerUtil; import org.jetbrains.annotations.Nullable; -import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.OverlayTexture; import net.minecraft.client.render.VertexConsumerProvider; import net.minecraft.client.render.item.ItemRenderer; @@ -17,32 +16,11 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.CrossbowItem; import net.minecraft.item.ItemStack; import net.minecraft.screen.PlayerScreenHandler; -import net.minecraft.util.Arm; import net.minecraft.util.UseAction; import net.minecraft.util.math.RotationAxis; import net.minecraft.world.World; public class LevitatingItemRenderer { - /** - * Renders a magical overlay over an item in third person. - */ - public void renderItemGlow(IPony pony, LivingEntity entity, ItemStack drop, ModelTransformationMode transform, Arm hand, int glowColor, MatrixStack stack, VertexConsumerProvider renderContext) { - stack.push(); - - ItemRenderer renderer = MinecraftClient.getInstance().getItemRenderer(); - - stack.scale(1.1F, 1.1F, 1.1F); - stack.translate(0.01F, 0.01F, 0.01F); - - VertexConsumerProvider interceptedContext = getProvider(pony, renderContext); - - renderer.renderItem(entity, drop, transform, hand == Arm.LEFT, stack, interceptedContext, entity.world, 0x0F00F0, OverlayTexture.DEFAULT_UV, 0); - stack.translate(-0.02F, -0.02F, -0.02F); - renderer.renderItem(entity, drop, transform, hand == Arm.LEFT, stack, interceptedContext, entity.world, 0x0F00F0, OverlayTexture.DEFAULT_UV, 0); - - stack.pop(); - } - private VertexConsumerProvider getProvider(IPony pony, VertexConsumerProvider renderContext) { final int color = pony.metadata().getGlowColor(); return layer -> {