mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-22 12:37:59 +01:00
Remove redundant magic rendering code
This commit is contained in:
parent
437d361170
commit
cb232cc145
5 changed files with 0 additions and 59 deletions
|
@ -1,12 +1,8 @@
|
||||||
package com.minelittlepony.client.model;
|
package com.minelittlepony.client.model;
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelPart;
|
import net.minecraft.client.model.ModelPart;
|
||||||
import net.minecraft.client.render.VertexConsumerProvider;
|
|
||||||
import net.minecraft.client.render.entity.model.*;
|
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.entity.LivingEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.Arm;
|
import net.minecraft.util.Arm;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
|
|
||||||
|
@ -110,10 +106,6 @@ public abstract class ClientPonyModel<T extends LivingEntity> 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) {
|
static void resetPivot(ModelPart part) {
|
||||||
part.setPivot(part.getDefaultTransform().pivotX, part.getDefaultTransform().pivotY, part.getDefaultTransform().pivotZ);
|
part.setPivot(part.getDefaultTransform().pivotX, part.getDefaultTransform().pivotY, part.getDefaultTransform().pivotZ);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,10 @@
|
||||||
package com.minelittlepony.client.model;
|
package com.minelittlepony.client.model;
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelPart;
|
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.BipedEntityModel;
|
||||||
import net.minecraft.client.render.entity.model.ModelWithArms;
|
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.client.util.math.MatrixStack;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.Arm;
|
import net.minecraft.util.Arm;
|
||||||
|
|
||||||
import com.minelittlepony.api.model.BodyPart;
|
import com.minelittlepony.api.model.BodyPart;
|
||||||
|
@ -93,11 +90,6 @@ public interface IPonyMixinModel<T extends LivingEntity, M extends IPonyModel<T>
|
||||||
return mixin().getBodyPart(part);
|
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<T extends LivingEntity, M extends IPonyModel<T> & IUnicorn, ArmModel> extends IPonyMixinModel<T, M>, IUnicorn {
|
interface Caster<T extends LivingEntity, M extends IPonyModel<T> & IUnicorn, ArmModel> extends IPonyMixinModel<T, M>, IUnicorn {
|
||||||
@Override
|
@Override
|
||||||
default boolean isCasting() {
|
default boolean isCasting() {
|
||||||
|
|
|
@ -1,14 +1,9 @@
|
||||||
package com.minelittlepony.client.model;
|
package com.minelittlepony.client.model;
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelPart;
|
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.BipedEntityModel;
|
||||||
import net.minecraft.client.render.entity.model.ModelWithArms;
|
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.entity.LivingEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.Arm;
|
|
||||||
|
|
||||||
import com.minelittlepony.api.model.BodyPart;
|
import com.minelittlepony.api.model.BodyPart;
|
||||||
import com.minelittlepony.api.model.ICapitated;
|
import com.minelittlepony.api.model.ICapitated;
|
||||||
|
@ -24,6 +19,4 @@ public interface IPonyModel<T extends LivingEntity> extends IModel, ICapitated<M
|
||||||
void updateLivingState(T entity, IPony pony, ModelAttributes.Mode mode);
|
void updateLivingState(T entity, IPony pony, ModelAttributes.Mode mode);
|
||||||
|
|
||||||
ModelPart getBodyPart(BodyPart part);
|
ModelPart getBodyPart(BodyPart part);
|
||||||
|
|
||||||
void postItemRender(IPony pony, T entity, ItemStack drop, ModelTransformationMode transform, Arm hand, MatrixStack stack, VertexConsumerProvider renderContext);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,21 +1,16 @@
|
||||||
package com.minelittlepony.client.model.entity.race;
|
package com.minelittlepony.client.model.entity.race;
|
||||||
|
|
||||||
import com.minelittlepony.api.model.*;
|
import com.minelittlepony.api.model.*;
|
||||||
import com.minelittlepony.api.pony.IPony;
|
|
||||||
import com.minelittlepony.api.pony.meta.Size;
|
import com.minelittlepony.api.pony.meta.Size;
|
||||||
import com.minelittlepony.api.pony.meta.Sizes;
|
import com.minelittlepony.api.pony.meta.Sizes;
|
||||||
import com.minelittlepony.client.MineLittlePony;
|
import com.minelittlepony.client.MineLittlePony;
|
||||||
import com.minelittlepony.client.model.part.UnicornHorn;
|
import com.minelittlepony.client.model.part.UnicornHorn;
|
||||||
import com.minelittlepony.client.render.PonyRenderDispatcher;
|
|
||||||
import com.minelittlepony.client.util.render.RenderList;
|
import com.minelittlepony.client.util.render.RenderList;
|
||||||
import com.minelittlepony.mson.api.ModelView;
|
import com.minelittlepony.mson.api.ModelView;
|
||||||
|
|
||||||
import net.minecraft.client.model.ModelPart;
|
import net.minecraft.client.model.ModelPart;
|
||||||
import net.minecraft.client.render.VertexConsumerProvider;
|
|
||||||
import net.minecraft.client.render.model.json.ModelTransformationMode;
|
|
||||||
import net.minecraft.client.util.math.MatrixStack;
|
import net.minecraft.client.util.math.MatrixStack;
|
||||||
import net.minecraft.entity.LivingEntity;
|
import net.minecraft.entity.LivingEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.*;
|
import net.minecraft.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -120,13 +115,4 @@ public class UnicornModel<T extends LivingEntity> extends EarthPonyModel<T> 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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,6 @@ import com.minelittlepony.client.util.render.RenderLayerUtil;
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import net.minecraft.client.MinecraftClient;
|
|
||||||
import net.minecraft.client.render.OverlayTexture;
|
import net.minecraft.client.render.OverlayTexture;
|
||||||
import net.minecraft.client.render.VertexConsumerProvider;
|
import net.minecraft.client.render.VertexConsumerProvider;
|
||||||
import net.minecraft.client.render.item.ItemRenderer;
|
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.CrossbowItem;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.screen.PlayerScreenHandler;
|
import net.minecraft.screen.PlayerScreenHandler;
|
||||||
import net.minecraft.util.Arm;
|
|
||||||
import net.minecraft.util.UseAction;
|
import net.minecraft.util.UseAction;
|
||||||
import net.minecraft.util.math.RotationAxis;
|
import net.minecraft.util.math.RotationAxis;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class LevitatingItemRenderer {
|
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) {
|
private VertexConsumerProvider getProvider(IPony pony, VertexConsumerProvider renderContext) {
|
||||||
final int color = pony.metadata().getGlowColor();
|
final int color = pony.metadata().getGlowColor();
|
||||||
return layer -> {
|
return layer -> {
|
||||||
|
|
Loading…
Reference in a new issue