mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 08:14:23 +01:00
Slight refactor
This commit is contained in:
parent
facb3e6ab0
commit
d4fa867884
25 changed files with 106 additions and 115 deletions
|
@ -8,7 +8,7 @@ import com.minelittlepony.client.model.IPonyModel;
|
|||
import com.minelittlepony.client.model.entity.race.PlayerModels;
|
||||
import com.minelittlepony.client.render.LevitatingItemRenderer;
|
||||
import com.minelittlepony.client.render.entity.MobRenderers;
|
||||
import com.minelittlepony.client.render.IPonyRender;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
@ -94,15 +94,15 @@ public class PonyRenderManager {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Nullable
|
||||
public <T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> IPonyRender<T, M> getPonyRenderer(@Nullable T entity) {
|
||||
public <T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> IPonyRenderContext<T, M> getPonyRenderer(@Nullable T entity) {
|
||||
if (entity == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
EntityRenderer<T> renderer = (EntityRenderer<T>)MinecraftClient.getInstance().getEntityRenderManager().getRenderer(entity);
|
||||
|
||||
if (renderer instanceof IPonyRender) {
|
||||
return (IPonyRender<T, M>) renderer;
|
||||
if (renderer instanceof IPonyRenderContext) {
|
||||
return (IPonyRenderContext<T, M>) renderer;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -4,8 +4,8 @@ import com.minelittlepony.client.MineLittlePony;
|
|||
import com.minelittlepony.client.model.ClientPonyModel;
|
||||
import com.minelittlepony.client.model.ModelType;
|
||||
import com.minelittlepony.client.model.ModelWrapper;
|
||||
import com.minelittlepony.client.render.IPonyRender;
|
||||
import com.minelittlepony.client.render.RenderPony;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
import com.minelittlepony.client.render.EquineRenderManager;
|
||||
import com.minelittlepony.client.render.entity.feature.LayerGear;
|
||||
import com.minelittlepony.client.render.entity.feature.LayerHeldPonyItemMagical;
|
||||
import com.minelittlepony.client.render.entity.feature.LayerPonyArmor;
|
||||
|
@ -24,22 +24,21 @@ import net.minecraft.util.Identifier;
|
|||
/**
|
||||
* Renderer used for the dummy pony model when selecting a skin.
|
||||
*/
|
||||
class DummyPonyRenderer extends DummyPlayerRenderer<DummyPony, ClientPonyModel<DummyPony>> implements IPonyRender<DummyPony, ClientPonyModel<DummyPony>> {
|
||||
class DummyPonyRenderer extends DummyPlayerRenderer<DummyPony, ClientPonyModel<DummyPony>> implements IPonyRenderContext<DummyPony, ClientPonyModel<DummyPony>> {
|
||||
|
||||
protected final RenderPony<DummyPony, ClientPonyModel<DummyPony>> renderPony = new RenderPony<>(this);
|
||||
protected final EquineRenderManager<DummyPony, ClientPonyModel<DummyPony>> manager = new EquineRenderManager<>(this);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public DummyPonyRenderer(EntityRenderDispatcher manager) {
|
||||
super(manager, null);
|
||||
public DummyPonyRenderer(EntityRenderDispatcher dispatcher) {
|
||||
super(dispatcher, null);
|
||||
addFeature(new LayerGear<>(this));
|
||||
|
||||
renderPony.setPonyModel((ModelKey<ClientPonyModel<DummyPony>>)(Object)ModelType.EARTH_PONY.getKey(false));
|
||||
renderPony.setSkipBlend();
|
||||
manager.setModel(ModelType.EARTH_PONY.getKey(false));
|
||||
manager.setSkipBlend();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelWrapper<DummyPony, ClientPonyModel<DummyPony>> getModelWrapper() {
|
||||
return renderPony.playerModel;
|
||||
return manager.playerModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -49,7 +48,7 @@ class DummyPonyRenderer extends DummyPlayerRenderer<DummyPony, ClientPonyModel<D
|
|||
|
||||
@Override
|
||||
protected void scale(DummyPony entity, MatrixStack stack, float ticks) {
|
||||
renderPony.preRenderCallback(entity, stack, ticks);
|
||||
manager.preRenderCallback(entity, stack, ticks);
|
||||
|
||||
if (entity.isSwimming()) {
|
||||
if (entity.getVelocity().x < 100) {
|
||||
|
@ -82,7 +81,7 @@ class DummyPonyRenderer extends DummyPlayerRenderer<DummyPony, ClientPonyModel<D
|
|||
@SuppressWarnings("unchecked")
|
||||
ModelKey<? extends ClientPonyModel<DummyPony>> key = (ModelKey<? extends ClientPonyModel<DummyPony>>)(canWet ? ModelType.SEA_PONY.getKey(slim) : ModelType.getPlayerModel(thePony.getRace(true)).getKey(slim));
|
||||
|
||||
return renderPony.setPonyModel(key).apply(thePony.getMetadata()).getBody();
|
||||
return manager.setModel(key).apply(thePony.getMetadata()).getBody();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -106,8 +105,8 @@ class DummyPonyRenderer extends DummyPlayerRenderer<DummyPony, ClientPonyModel<D
|
|||
}
|
||||
|
||||
@Override
|
||||
public RenderPony<DummyPony, ClientPonyModel<DummyPony>> getInternalRenderer() {
|
||||
return renderPony;
|
||||
public EquineRenderManager<DummyPony, ClientPonyModel<DummyPony>> getInternalRenderer() {
|
||||
return manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.minelittlepony.model.IModel;
|
|||
import com.minelittlepony.model.armour.IArmour;
|
||||
import com.minelittlepony.model.armour.IEquestrianArmour;
|
||||
import com.minelittlepony.model.capabilities.IModelWrapper;
|
||||
import com.minelittlepony.mson.api.ModelKey;
|
||||
import com.minelittlepony.pony.IPonyData;
|
||||
|
||||
/**
|
||||
|
@ -20,10 +21,11 @@ public class ModelWrapper<T extends LivingEntity, M extends IModel> implements I
|
|||
/**
|
||||
* Creates a new model wrapper to contain the given pony.
|
||||
*/
|
||||
public ModelWrapper(M model) {
|
||||
body = model;
|
||||
armor = model.createArmour();
|
||||
armor.apply(model.getMetadata());
|
||||
@SuppressWarnings("unchecked")
|
||||
public ModelWrapper(ModelKey<?> key) {
|
||||
body = (M)key.createModel();
|
||||
armor = body.createArmour();
|
||||
armor.apply(body.getMetadata());
|
||||
}
|
||||
|
||||
public M getBody() {
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.minelittlepony.client.pony;
|
|||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.minelittlepony.client.PonyRenderManager;
|
||||
import com.minelittlepony.client.render.IPonyRender;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
import com.minelittlepony.client.transform.PonyTransformation;
|
||||
import com.minelittlepony.pony.IPony;
|
||||
import com.minelittlepony.pony.IPonyData;
|
||||
|
@ -168,7 +168,7 @@ public class Pony implements IPony {
|
|||
if (entity.hasVehicle() && entity.getVehicle() instanceof LivingEntity) {
|
||||
LivingEntity mount = (LivingEntity) entity.getVehicle();
|
||||
|
||||
IPonyRender<LivingEntity, ?> render = PonyRenderManager.getInstance().getPonyRenderer(mount);
|
||||
IPonyRenderContext<LivingEntity, ?> render = PonyRenderManager.getInstance().getPonyRenderer(mount);
|
||||
|
||||
return render == null ? null : render.getEntityPony(mount);
|
||||
}
|
||||
|
|
|
@ -13,14 +13,9 @@ import net.minecraft.util.shape.VoxelShapes;
|
|||
|
||||
import com.minelittlepony.pony.IPony;
|
||||
|
||||
public class DebugBoundingBoxRenderer {
|
||||
public final class DebugBoundingBoxRenderer {
|
||||
|
||||
public static final DebugBoundingBoxRenderer instance = new DebugBoundingBoxRenderer();
|
||||
|
||||
private DebugBoundingBoxRenderer() {
|
||||
}
|
||||
|
||||
public void render(IPony pony, LivingEntity entity, MatrixStack stack, VertexConsumerProvider renderContext) {
|
||||
public static void render(IPony pony, LivingEntity entity, MatrixStack stack, VertexConsumerProvider renderContext) {
|
||||
MinecraftClient mc = MinecraftClient.getInstance();
|
||||
|
||||
if (!mc.getEntityRenderManager().shouldRenderHitboxes() || entity.squaredDistanceTo(mc.player) > 70) {
|
||||
|
|
|
@ -21,13 +21,13 @@ import net.minecraft.entity.Entity;
|
|||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public class RenderPony<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> {
|
||||
public class EquineRenderManager<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> {
|
||||
|
||||
public ModelWrapper<T, M> playerModel;
|
||||
|
||||
private IPony pony;
|
||||
|
||||
private final IPonyRender<T, M> renderer;
|
||||
private final IPonyRenderContext<T, M> renderer;
|
||||
|
||||
private boolean skipBlend;
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class RenderPony<T extends LivingEntity, M extends EntityModel<T> & IPony
|
|||
RenderSystem.disableBlend();
|
||||
}
|
||||
|
||||
public RenderPony(IPonyRender<T, M> renderer) {
|
||||
public EquineRenderManager(IPonyRenderContext<T, M> renderer) {
|
||||
this.renderer = renderer;
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ public class RenderPony<T extends LivingEntity, M extends EntityModel<T> & IPony
|
|||
if (entity.hasVehicle() && entity.getVehicle() instanceof LivingEntity) {
|
||||
|
||||
LivingEntity ridingEntity = (LivingEntity) entity.getVehicle();
|
||||
IPonyRender<LivingEntity, ?> renderer = PonyRenderManager.getInstance().getPonyRenderer(ridingEntity);
|
||||
IPonyRenderContext<LivingEntity, ?> renderer = PonyRenderManager.getInstance().getPonyRenderer(ridingEntity);
|
||||
|
||||
if (renderer != null) {
|
||||
// negate vanilla translations so the rider begins at the ridees feet.
|
||||
|
@ -133,8 +133,8 @@ public class RenderPony<T extends LivingEntity, M extends EntityModel<T> & IPony
|
|||
return playerModel.getBody();
|
||||
}
|
||||
|
||||
public ModelWrapper<T, M> setPonyModel(ModelKey<? extends M> model) {
|
||||
playerModel = new ModelWrapper<>(model.createModel());
|
||||
public ModelWrapper<T, M> setModel(ModelKey<?> key) {
|
||||
playerModel = new ModelWrapper<>(key);
|
||||
|
||||
return playerModel;
|
||||
}
|
|
@ -13,9 +13,9 @@ public class FrustrumCheck<T extends LivingEntity> extends Frustum {
|
|||
|
||||
private Frustum vanilla;
|
||||
|
||||
private final RenderPony<T, ?> renderer;
|
||||
private final EquineRenderManager<T, ?> renderer;
|
||||
|
||||
public FrustrumCheck(RenderPony<T, ?> render) {
|
||||
public FrustrumCheck(EquineRenderManager<T, ?> render) {
|
||||
super(new Matrix4f(), new Matrix4f());
|
||||
renderer = render;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.util.Identifier;
|
||||
|
||||
public interface IPonyRender<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> extends PonyModelConstants, IRenderContext<T, M> {
|
||||
public interface IPonyRenderContext<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> extends PonyModelConstants, IRenderContext<T, M> {
|
||||
|
||||
/**
|
||||
* Gets the wrapped pony model for this renderer.
|
||||
|
@ -23,7 +23,7 @@ public interface IPonyRender<T extends LivingEntity, M extends EntityModel<T> &
|
|||
|
||||
IPony getEntityPony(T entity);
|
||||
|
||||
RenderPony<T, M> getInternalRenderer();
|
||||
EquineRenderManager<T, M> getInternalRenderer();
|
||||
|
||||
Identifier findTexture(T entity);
|
||||
|
||||
|
@ -37,7 +37,6 @@ public interface IPonyRender<T extends LivingEntity, M extends EntityModel<T> &
|
|||
*/
|
||||
default void translateRider(T entity, IPony entityPony, LivingEntity passenger, IPony passengerPony, MatrixStack stack, float ticks) {
|
||||
if (!passengerPony.getRace(false).isHuman()) {
|
||||
//float yaw = MathUtil.interpolateDegress(entity.prevRenderYawOffset, entity.renderYawOffset, ticks);
|
||||
float yaw = MathUtil.interpolateDegress((float)entity.prevRenderY, (float)entity.getY(), ticks);
|
||||
|
||||
getModelWrapper().apply(entityPony.getMetadata());
|
|
@ -1,10 +1,7 @@
|
|||
package com.minelittlepony.client.render;
|
||||
|
||||
import org.lwjgl.opengl.GL14;
|
||||
|
||||
import com.minelittlepony.client.MineLittlePony;
|
||||
import com.minelittlepony.pony.IPony;
|
||||
import com.minelittlepony.util.math.Color;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ import com.minelittlepony.client.model.ClientPonyModel;
|
|||
import com.minelittlepony.client.model.IPonyModel;
|
||||
import com.minelittlepony.client.model.ModelWrapper;
|
||||
import com.minelittlepony.client.render.DebugBoundingBoxRenderer;
|
||||
import com.minelittlepony.client.render.IPonyRender;
|
||||
import com.minelittlepony.client.render.RenderPony;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
import com.minelittlepony.client.render.EquineRenderManager;
|
||||
import com.minelittlepony.client.render.entity.feature.LayerGear;
|
||||
import com.minelittlepony.client.render.entity.feature.LayerHeldPonyItem;
|
||||
import com.minelittlepony.client.render.entity.feature.LayerHeldPonyItemMagical;
|
||||
|
@ -31,15 +31,14 @@ import net.minecraft.util.Identifier;
|
|||
import java.util.List;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public abstract class RenderPonyMob<T extends MobEntity, M extends EntityModel<T> & IPonyModel<T>> extends MobEntityRenderer<T, M> implements IPonyRender<T, M> {
|
||||
public abstract class RenderPonyMob<T extends MobEntity, M extends EntityModel<T> & IPonyModel<T>> extends MobEntityRenderer<T, M> implements IPonyRenderContext<T, M> {
|
||||
|
||||
protected RenderPony<T, M> renderPony = new RenderPony<>(this);
|
||||
protected EquineRenderManager<T, M> manager = new EquineRenderManager<>(this);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public RenderPonyMob(EntityRenderDispatcher manager, ModelKey<? super M> key) {
|
||||
super(manager, (M)key.createModel(), 0.5F);
|
||||
public RenderPonyMob(EntityRenderDispatcher dispatcher, ModelKey<? super M> key) {
|
||||
super(dispatcher, null, 0.5F);
|
||||
|
||||
this.model = renderPony.setPonyModel((ModelKey<M>)key).getBody();
|
||||
this.model = manager.setModel(key).getBody();
|
||||
|
||||
addLayers();
|
||||
}
|
||||
|
@ -63,31 +62,31 @@ public abstract class RenderPonyMob<T extends MobEntity, M extends EntityModel<T
|
|||
|
||||
super.render(entity, entityYaw, tickDelta, stack, renderContext, lightUv);
|
||||
|
||||
DebugBoundingBoxRenderer.instance.render(renderPony.getPony(entity), entity, stack, renderContext);
|
||||
DebugBoundingBoxRenderer.render(manager.getPony(entity), entity, stack, renderContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupTransforms(T entity, MatrixStack stack, float ageInTicks, float rotationYaw, float partialTicks) {
|
||||
rotationYaw = renderPony.getRenderYaw(entity, rotationYaw, partialTicks);
|
||||
rotationYaw = manager.getRenderYaw(entity, rotationYaw, partialTicks);
|
||||
super.setupTransforms(entity, stack, ageInTicks, rotationYaw, partialTicks);
|
||||
|
||||
renderPony.applyPostureTransform(entity, stack, rotationYaw, partialTicks);
|
||||
manager.applyPostureTransform(entity, stack, rotationYaw, partialTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible(T entity, Frustum visibleRegion, double camX, double camY, double camZ) {
|
||||
return super.isVisible(entity, renderPony.getFrustrum(entity, visibleRegion), camX, camY, camZ);
|
||||
return super.isVisible(entity, manager.getFrustrum(entity, visibleRegion), camX, camY, camZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void scale(T entity, MatrixStack stack, float ticks) {
|
||||
renderPony.preRenderCallback(entity, stack, ticks);
|
||||
manager.preRenderCallback(entity, stack, ticks);
|
||||
if (this.getModel() instanceof PlayerEntityModel) {
|
||||
((PlayerEntityModel<?>)getModel()).setVisible(true);
|
||||
}
|
||||
|
||||
// shadowRadius
|
||||
field_4673 = renderPony.getShadowScale();
|
||||
field_4673 = manager.getShadowScale();
|
||||
|
||||
if (entity.isBaby()) {
|
||||
field_4673 *= 3; // undo vanilla shadow scaling
|
||||
|
@ -102,12 +101,12 @@ public abstract class RenderPonyMob<T extends MobEntity, M extends EntityModel<T
|
|||
|
||||
@Override
|
||||
public ModelWrapper<T, M> getModelWrapper() {
|
||||
return renderPony.playerModel;
|
||||
return manager.playerModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderLabelIfPresent(T entity, String name, MatrixStack stack, VertexConsumerProvider renderContext, int maxDistance) {
|
||||
stack.translate(0, renderPony.getNamePlateYOffset(entity), 0);
|
||||
stack.translate(0, manager.getNamePlateYOffset(entity), 0);
|
||||
super.renderLabelIfPresent(entity, name, stack, renderContext, maxDistance);
|
||||
}
|
||||
|
||||
|
@ -119,8 +118,8 @@ public abstract class RenderPonyMob<T extends MobEntity, M extends EntityModel<T
|
|||
}
|
||||
|
||||
@Override
|
||||
public RenderPony<T, M> getInternalRenderer() {
|
||||
return renderPony;
|
||||
public EquineRenderManager<T, M> getInternalRenderer() {
|
||||
return manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,8 +5,8 @@ import com.minelittlepony.client.model.ClientPonyModel;
|
|||
import com.minelittlepony.client.model.ModelWrapper;
|
||||
import com.minelittlepony.client.model.gear.SaddleBags;
|
||||
import com.minelittlepony.client.render.DebugBoundingBoxRenderer;
|
||||
import com.minelittlepony.client.render.IPonyRender;
|
||||
import com.minelittlepony.client.render.RenderPony;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
import com.minelittlepony.client.render.EquineRenderManager;
|
||||
import com.minelittlepony.client.render.entity.feature.LayerDJPon3Head;
|
||||
import com.minelittlepony.client.render.entity.feature.LayerEntityOnPonyShoulder;
|
||||
import com.minelittlepony.client.render.entity.feature.LayerGear;
|
||||
|
@ -37,14 +37,14 @@ import net.minecraft.util.Arm;
|
|||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
public class RenderPonyPlayer extends PlayerEntityRenderer implements IPonyRender<AbstractClientPlayerEntity, ClientPonyModel<AbstractClientPlayerEntity>> {
|
||||
public class RenderPonyPlayer extends PlayerEntityRenderer implements IPonyRenderContext<AbstractClientPlayerEntity, ClientPonyModel<AbstractClientPlayerEntity>> {
|
||||
|
||||
protected final RenderPony<AbstractClientPlayerEntity, ClientPonyModel<AbstractClientPlayerEntity>> renderPony = new RenderPony<>(this);
|
||||
protected final EquineRenderManager<AbstractClientPlayerEntity, ClientPonyModel<AbstractClientPlayerEntity>> manager = new EquineRenderManager<>(this);
|
||||
|
||||
public RenderPonyPlayer(EntityRenderDispatcher manager, boolean slim, ModelKey<? extends ClientPonyModel<AbstractClientPlayerEntity>> key) {
|
||||
super(manager, slim);
|
||||
public RenderPonyPlayer(EntityRenderDispatcher dispatcher, boolean slim, ModelKey<? extends ClientPonyModel<AbstractClientPlayerEntity>> key) {
|
||||
super(dispatcher, slim);
|
||||
|
||||
this.model = renderPony.setPonyModel(key).getBody();
|
||||
this.model = manager.setModel(key).getBody();
|
||||
|
||||
addLayers();
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ public class RenderPonyPlayer extends PlayerEntityRenderer implements IPonyRende
|
|||
|
||||
@Override
|
||||
protected void scale(AbstractClientPlayerEntity player, MatrixStack stack, float ticks) {
|
||||
renderPony.preRenderCallback(player, stack, ticks);
|
||||
manager.preRenderCallback(player, stack, ticks);
|
||||
|
||||
if (player.hasVehicle()) {
|
||||
stack.translate(0, player.getHeightOffset(), 0);
|
||||
|
@ -79,17 +79,17 @@ public class RenderPonyPlayer extends PlayerEntityRenderer implements IPonyRende
|
|||
|
||||
@Override
|
||||
public void render(AbstractClientPlayerEntity entity, float entityYaw, float tickDelta, MatrixStack stack, VertexConsumerProvider renderContext, int lightUv) {
|
||||
field_4673 = renderPony.getShadowScale();
|
||||
field_4673 = manager.getShadowScale();
|
||||
super.render(entity, entityYaw, tickDelta, stack, renderContext, lightUv);
|
||||
|
||||
DebugBoundingBoxRenderer.instance.render(renderPony.getPony(entity), entity, stack, renderContext);
|
||||
DebugBoundingBoxRenderer.render(manager.getPony(entity), entity, stack, renderContext);
|
||||
|
||||
// Translate the shadow position after everything is done
|
||||
// (shadows are drawn after us)
|
||||
// TODO: Get a proper shadow renderer going
|
||||
if (!entity.hasVehicle() && !entity.isSleeping()) {
|
||||
float yaw = MathHelper.lerpAngleDegrees(tickDelta, entity.prevBodyYaw, entity.bodyYaw);
|
||||
float l = entity.getWidth() / 2 * renderPony.getPony(entity).getMetadata().getSize().getScaleFactor();
|
||||
float l = entity.getWidth() / 2 * manager.getPony(entity).getMetadata().getSize().getScaleFactor();
|
||||
|
||||
stack.multiply(Vector3f.NEGATIVE_Y.getDegreesQuaternion(yaw));
|
||||
stack.translate(0, 0, -l);
|
||||
|
@ -102,7 +102,7 @@ public class RenderPonyPlayer extends PlayerEntityRenderer implements IPonyRende
|
|||
if (entity.isSleeping() && entity == MinecraftClient.getInstance().player) {
|
||||
return true;
|
||||
}
|
||||
return super.isVisible(entity, renderPony.getFrustrum(entity, camera), camX, camY, camZ);
|
||||
return super.isVisible(entity, manager.getFrustrum(entity, camera), camX, camY, camZ);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -114,7 +114,7 @@ public class RenderPonyPlayer extends PlayerEntityRenderer implements IPonyRende
|
|||
stack.translate(Math.cos(bedRad), 0, -Math.sin(bedRad));
|
||||
}
|
||||
}
|
||||
stack.translate(0, renderPony.getNamePlateYOffset(entity), 0);
|
||||
stack.translate(0, manager.getNamePlateYOffset(entity), 0);
|
||||
super.renderLabelIfPresent(entity, name, stack, renderContext, maxDistance);
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ public class RenderPonyPlayer extends PlayerEntityRenderer implements IPonyRende
|
|||
}
|
||||
|
||||
protected void renderArm(MatrixStack stack, VertexConsumerProvider renderContext, int lightUv, AbstractClientPlayerEntity player, Arm side) {
|
||||
renderPony.updateModel(player);
|
||||
manager.updateModel(player);
|
||||
|
||||
stack.push();
|
||||
float reflect = side == Arm.LEFT ? 1 : -1;
|
||||
|
@ -147,25 +147,25 @@ public class RenderPonyPlayer extends PlayerEntityRenderer implements IPonyRende
|
|||
|
||||
@Override
|
||||
protected void setupTransforms(AbstractClientPlayerEntity entity, MatrixStack stack, float ageInTicks, float rotationYaw, float partialTicks) {
|
||||
rotationYaw = renderPony.getRenderYaw(entity, rotationYaw, partialTicks);
|
||||
rotationYaw = manager.getRenderYaw(entity, rotationYaw, partialTicks);
|
||||
super.setupTransforms(entity, stack, ageInTicks, rotationYaw, partialTicks);
|
||||
|
||||
renderPony.applyPostureTransform(entity, stack, rotationYaw, partialTicks);
|
||||
manager.applyPostureTransform(entity, stack, rotationYaw, partialTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Identifier getTexture(AbstractClientPlayerEntity player) {
|
||||
return renderPony.getPony(player).getTexture();
|
||||
return manager.getPony(player).getTexture();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelWrapper<AbstractClientPlayerEntity, ClientPonyModel<AbstractClientPlayerEntity>> getModelWrapper() {
|
||||
return renderPony.playerModel;
|
||||
return manager.playerModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RenderPony<AbstractClientPlayerEntity, ClientPonyModel<AbstractClientPlayerEntity>> getInternalRenderer() {
|
||||
return renderPony;
|
||||
public EquineRenderManager<AbstractClientPlayerEntity, ClientPonyModel<AbstractClientPlayerEntity>> getInternalRenderer() {
|
||||
return manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -186,6 +186,6 @@ public class RenderPonyPlayer extends PlayerEntityRenderer implements IPonyRende
|
|||
}
|
||||
}
|
||||
|
||||
return IPonyRender.super.getDefaultTexture(entity, wearable);
|
||||
return IPonyRenderContext.super.getDefaultTexture(entity, wearable);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ public class RenderSeaponyPlayer extends RenderPonyPlayer {
|
|||
|
||||
boolean wet = pony.isPartiallySubmerged(player);
|
||||
|
||||
model = renderPony.setPonyModel(wet ? seapony : normalPony).getBody();
|
||||
model = manager.setModel(wet ? seapony : normalPony).getBody();
|
||||
|
||||
float state = wet ? 100 : 0;
|
||||
float interpolated = pony.getMetadata().getInterpolator(player.getUuid()).interpolate("seapony_state", state, 5);
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.minelittlepony.client.render.entity.feature;
|
|||
|
||||
import com.minelittlepony.client.model.IPonyModel;
|
||||
import com.minelittlepony.client.model.ModelWrapper;
|
||||
import com.minelittlepony.client.render.IPonyRender;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
|
||||
import net.minecraft.client.render.VertexConsumerProvider;
|
||||
import net.minecraft.client.render.entity.feature.FeatureRenderer;
|
||||
|
@ -13,10 +13,10 @@ import net.minecraft.entity.LivingEntity;
|
|||
|
||||
public abstract class AbstractPonyLayer<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> extends FeatureRenderer<T, M> {
|
||||
|
||||
private final IPonyRender<T, M> context;
|
||||
private final IPonyRenderContext<T, M> context;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public AbstractPonyLayer(IPonyRender<T, M> context) {
|
||||
public AbstractPonyLayer(IPonyRenderContext<T, M> context) {
|
||||
super((FeatureRendererContext<T, M>)context);
|
||||
this.context = context;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public abstract class AbstractPonyLayer<T extends LivingEntity, M extends Entity
|
|||
public abstract void render(MatrixStack stack, VertexConsumerProvider renderContext, int lightUv, T entity, float limbDistance, float limbAngle, float tickDelta, float age, float headYaw, float headPitch);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
protected <C extends IPonyRender<T, M> & FeatureRendererContext<T, M>> C getContext() {
|
||||
protected <C extends IPonyRenderContext<T, M> & FeatureRendererContext<T, M>> C getContext() {
|
||||
return (C)context;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,14 +9,14 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
|
||||
import com.minelittlepony.client.model.IPonyModel;
|
||||
import com.minelittlepony.client.model.ModelDeadMau5Ears;
|
||||
import com.minelittlepony.client.render.IPonyRender;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
|
||||
public class LayerDJPon3Head<T extends AbstractClientPlayerEntity, M extends EntityModel<T> & IPonyModel<T>> extends AbstractPonyLayer<T, M> {
|
||||
|
||||
private final ModelDeadMau5Ears deadMau5 = new ModelDeadMau5Ears();
|
||||
|
||||
public LayerDJPon3Head(IPonyRender<T, M> context) {
|
||||
public LayerDJPon3Head(IPonyRenderContext<T, M> context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
|
|
|
@ -12,14 +12,14 @@ import net.minecraft.entity.player.PlayerEntity;
|
|||
import net.minecraft.nbt.CompoundTag;
|
||||
|
||||
import com.minelittlepony.client.model.ClientPonyModel;
|
||||
import com.minelittlepony.client.render.IPonyRender;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
|
||||
public class LayerEntityOnPonyShoulder<T extends PlayerEntity, M extends ClientPonyModel<T>> extends AbstractPonyLayer<T, M> {
|
||||
|
||||
private final ParrotEntityModel model = new ParrotEntityModel();
|
||||
|
||||
public LayerEntityOnPonyShoulder(IPonyRender<T, M> context) {
|
||||
public LayerEntityOnPonyShoulder(IPonyRenderContext<T, M> context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,13 +8,13 @@ import net.minecraft.entity.LivingEntity;
|
|||
import net.minecraft.util.Identifier;
|
||||
|
||||
import com.minelittlepony.client.model.IPonyModel;
|
||||
import com.minelittlepony.client.render.IPonyRender;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
|
||||
public class LayerEyeGlow<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> extends EyesFeatureRenderer<T, M> {
|
||||
|
||||
private final RenderLayer layer;
|
||||
|
||||
public <V extends FeatureRendererContext<T, M> & IPonyRender<T, M> & IGlowingRenderer> LayerEyeGlow(V renderer) {
|
||||
public <V extends FeatureRendererContext<T, M> & IPonyRenderContext<T, M> & IGlowingRenderer> LayerEyeGlow(V renderer) {
|
||||
super(renderer);
|
||||
layer = RenderLayer.getEyes(renderer.getEyeTexture());
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import net.minecraft.entity.LivingEntity;
|
|||
|
||||
import com.minelittlepony.client.model.IPonyModel;
|
||||
import com.minelittlepony.client.model.ModelType;
|
||||
import com.minelittlepony.client.render.IPonyRender;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.gear.IGear;
|
||||
import com.minelittlepony.model.gear.IStackable;
|
||||
|
@ -24,7 +24,7 @@ public class LayerGear<T extends LivingEntity, M extends EntityModel<T> & IPonyM
|
|||
|
||||
private final Map<Wearable, IGear> gears;
|
||||
|
||||
public LayerGear(IPonyRender<T, M> renderer) {
|
||||
public LayerGear(IPonyRenderContext<T, M> renderer) {
|
||||
super(renderer);
|
||||
|
||||
gears = ModelType.getWearables().collect(Collectors.toMap(
|
||||
|
|
|
@ -6,11 +6,11 @@ import net.minecraft.entity.mob.IllagerEntity;
|
|||
import net.minecraft.util.Arm;
|
||||
|
||||
import com.minelittlepony.client.model.entity.race.ModelAlicorn;
|
||||
import com.minelittlepony.client.render.IPonyRender;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
|
||||
public class LayerHeldItemIllager<T extends IllagerEntity, M extends ModelAlicorn<T>> extends LayerHeldPonyItem<T, M> {
|
||||
|
||||
public LayerHeldItemIllager(IPonyRender<T,M> livingPony) {
|
||||
public LayerHeldItemIllager(IPonyRenderContext<T,M> livingPony) {
|
||||
super(livingPony);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.minelittlepony.client.render.entity.feature;
|
||||
|
||||
import com.minelittlepony.client.model.IPonyModel;
|
||||
import com.minelittlepony.client.render.IPonyRender;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
|
@ -16,7 +16,7 @@ import net.minecraft.util.Arm;
|
|||
|
||||
public class LayerHeldPonyItem<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> extends AbstractPonyLayer<T, M> {
|
||||
|
||||
public LayerHeldPonyItem(IPonyRender<T, M> livingPony) {
|
||||
public LayerHeldPonyItem(IPonyRenderContext<T, M> livingPony) {
|
||||
super(livingPony);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.minelittlepony.client.render.entity.feature;
|
|||
|
||||
import com.minelittlepony.client.PonyRenderManager;
|
||||
import com.minelittlepony.client.model.IPonyModel;
|
||||
import com.minelittlepony.client.render.IPonyRender;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
import com.minelittlepony.model.IUnicorn;
|
||||
|
||||
import net.minecraft.client.model.ModelPart;
|
||||
|
@ -16,7 +16,7 @@ import net.minecraft.util.Arm;
|
|||
|
||||
public class LayerHeldPonyItemMagical<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> extends LayerHeldPonyItem<T, M> {
|
||||
|
||||
public LayerHeldPonyItemMagical(IPonyRender<T, M> context) {
|
||||
public LayerHeldPonyItemMagical(IPonyRenderContext<T, M> context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import com.minelittlepony.client.ForgeProxy;
|
|||
import com.minelittlepony.client.model.IPonyModel;
|
||||
import com.minelittlepony.client.model.ModelWrapper;
|
||||
import com.minelittlepony.client.model.armour.DefaultArmourTextureResolver;
|
||||
import com.minelittlepony.client.render.IPonyRender;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
import com.minelittlepony.model.armour.ArmourLayer;
|
||||
import com.minelittlepony.model.armour.IArmour;
|
||||
import com.minelittlepony.model.armour.IArmourTextureResolver;
|
||||
|
@ -33,7 +33,7 @@ public class LayerPonyArmor<T extends LivingEntity, M extends EntityModel<T> & I
|
|||
|
||||
private ModelWrapper<T, M> pony;
|
||||
|
||||
public LayerPonyArmor(IPonyRender<T, M> renderer) {
|
||||
public LayerPonyArmor(IPonyRenderContext<T, M> renderer) {
|
||||
super(renderer);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.minelittlepony.client.render.entity.feature;
|
||||
|
||||
import com.minelittlepony.client.model.ClientPonyModel;
|
||||
import com.minelittlepony.client.render.IPonyRender;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
|
||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||
|
@ -20,7 +20,7 @@ import static com.minelittlepony.model.PonyModelConstants.PI;
|
|||
|
||||
public class LayerPonyCape<M extends ClientPonyModel<AbstractClientPlayerEntity>> extends AbstractPonyLayer<AbstractClientPlayerEntity, M> {
|
||||
|
||||
public LayerPonyCape(IPonyRender<AbstractClientPlayerEntity, M> context) {
|
||||
public LayerPonyCape(IPonyRenderContext<AbstractClientPlayerEntity, M> context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.minelittlepony.client.render.entity.feature;
|
|||
|
||||
import com.minelittlepony.client.model.AbstractPonyModel;
|
||||
import com.minelittlepony.client.model.IPonyModel;
|
||||
import com.minelittlepony.client.render.IPonyRender;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
|
@ -30,7 +30,7 @@ import static com.mojang.blaze3d.platform.GlStateManager.*;
|
|||
|
||||
public class LayerPonyCustomHead<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> extends AbstractPonyLayer<T, M> {
|
||||
|
||||
public LayerPonyCustomHead(IPonyRender<T, M> renderPony) {
|
||||
public LayerPonyCustomHead(IPonyRenderContext<T, M> renderPony) {
|
||||
super(renderPony);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.minelittlepony.client.render.entity.feature;
|
|||
import com.minelittlepony.client.model.IPonyModel;
|
||||
import com.minelittlepony.client.model.ModelType;
|
||||
import com.minelittlepony.client.model.PonyElytra;
|
||||
import com.minelittlepony.client.render.IPonyRender;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
|
||||
import net.minecraft.client.network.AbstractClientPlayerEntity;
|
||||
|
@ -27,7 +27,7 @@ public class LayerPonyElytra<T extends LivingEntity, M extends EntityModel<T> &
|
|||
@SuppressWarnings("unchecked")
|
||||
private final PonyElytra<T> modelElytra = (PonyElytra<T>)ModelType.ELYTRA.createModel();
|
||||
|
||||
public LayerPonyElytra(IPonyRender<T, M> rp) {
|
||||
public LayerPonyElytra(IPonyRenderContext<T, M> rp) {
|
||||
super(rp);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,15 +15,15 @@ import net.minecraft.village.VillagerProfession;
|
|||
import net.minecraft.village.VillagerType;
|
||||
|
||||
import com.minelittlepony.client.model.IPonyModel;
|
||||
import com.minelittlepony.client.render.IPonyRender;
|
||||
import com.minelittlepony.client.render.RenderPony;
|
||||
import com.minelittlepony.client.render.IPonyRenderContext;
|
||||
import com.minelittlepony.client.render.EquineRenderManager;
|
||||
|
||||
class ClothingLayer<
|
||||
T extends LivingEntity & VillagerDataContainer,
|
||||
M extends EntityModel<T> & IPonyModel<T> & ModelWithHat,
|
||||
C extends FeatureRendererContext<T, M> & IPonyRender<T, M>> extends VillagerClothingFeatureRenderer<T, M> {
|
||||
C extends FeatureRendererContext<T, M> & IPonyRenderContext<T, M>> extends VillagerClothingFeatureRenderer<T, M> {
|
||||
|
||||
private final RenderPony<T, M> renderer;
|
||||
private final EquineRenderManager<T, M> renderer;
|
||||
|
||||
public ClothingLayer(C context, String type) {
|
||||
super(context, (ReloadableResourceManager)MinecraftClient.getInstance().getResourceManager(), type);
|
||||
|
|
Loading…
Reference in a new issue