2018-04-25 16:40:47 +02:00
|
|
|
package com.minelittlepony.render;
|
2015-08-02 00:36:33 +02:00
|
|
|
|
2016-11-17 05:45:04 +01:00
|
|
|
import com.minelittlepony.MineLittlePony;
|
|
|
|
import com.minelittlepony.ducks.IRenderPony;
|
2018-04-25 16:40:47 +02:00
|
|
|
import com.minelittlepony.model.ModelWrapper;
|
|
|
|
import com.minelittlepony.render.layer.LayerHeldPonyItem;
|
|
|
|
import com.minelittlepony.render.layer.LayerPonyArmor;
|
|
|
|
import com.minelittlepony.render.layer.LayerPonyCustomHead;
|
|
|
|
import com.minelittlepony.render.layer.LayerPonyElytra;
|
2016-09-08 05:53:23 +02:00
|
|
|
import com.voxelmodpack.hdskins.HDSkinManager;
|
2015-08-02 00:36:33 +02:00
|
|
|
import net.minecraft.client.renderer.entity.RenderLiving;
|
|
|
|
import net.minecraft.client.renderer.entity.RenderManager;
|
|
|
|
import net.minecraft.entity.EntityLiving;
|
2016-09-08 05:53:23 +02:00
|
|
|
import net.minecraft.util.ResourceLocation;
|
2015-08-02 00:36:33 +02:00
|
|
|
|
2017-06-13 05:55:50 +02:00
|
|
|
import javax.annotation.Nonnull;
|
2017-06-16 07:35:02 +02:00
|
|
|
import javax.annotation.OverridingMethodsMustInvokeSuper;
|
2017-06-13 05:55:50 +02:00
|
|
|
|
2016-03-01 06:33:09 +01:00
|
|
|
public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving<T> implements IRenderPony {
|
2015-12-15 06:32:57 +01:00
|
|
|
|
2018-04-25 16:40:47 +02:00
|
|
|
protected ModelWrapper playerModel;
|
2015-08-02 00:36:33 +02:00
|
|
|
|
2018-04-27 13:49:33 +02:00
|
|
|
public RenderPonyMob(RenderManager manager, ModelWrapper model) {
|
|
|
|
super(manager, model.getModel(), 0.5F);
|
|
|
|
playerModel = model;
|
2015-08-02 00:36:33 +02:00
|
|
|
|
2017-06-13 05:55:50 +02:00
|
|
|
addLayers();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void addLayers() {
|
2018-04-27 17:50:13 +02:00
|
|
|
addLayer(new LayerPonyArmor<>(this));
|
|
|
|
addLayer(new LayerHeldPonyItem<>(this));
|
2018-04-27 13:49:33 +02:00
|
|
|
// addLayer(new LayerArrow(this));
|
2018-04-27 17:50:13 +02:00
|
|
|
addLayer(new LayerPonyCustomHead<>(this));
|
|
|
|
addLayer(new LayerPonyElytra<>(this));
|
2015-08-02 00:36:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-04-27 13:49:33 +02:00
|
|
|
public void doRender(T entity, double xPosition, double yPosition, double zPosition, float yaw, float ticks) {
|
2015-08-02 00:36:33 +02:00
|
|
|
if (entity.isSneaking()) {
|
2018-04-27 13:49:33 +02:00
|
|
|
yPosition -= 0.125D;
|
2015-08-02 00:36:33 +02:00
|
|
|
}
|
2018-04-27 13:49:33 +02:00
|
|
|
super.doRender(entity, xPosition, yPosition, zPosition, yaw, ticks);
|
2015-08-02 00:36:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-06-16 07:35:02 +02:00
|
|
|
@OverridingMethodsMustInvokeSuper
|
2018-04-27 13:49:33 +02:00
|
|
|
protected void preRenderCallback(T entity, float ticks) {
|
|
|
|
playerModel.getModel().isSneak = false;
|
|
|
|
playerModel.getModel().isFlying = false;
|
|
|
|
playerModel.getModel().isSleeping = false;
|
2015-12-15 06:32:57 +01:00
|
|
|
|
2017-06-13 05:55:50 +02:00
|
|
|
ResourceLocation loc = getEntityTexture(entity);
|
2018-04-27 13:49:33 +02:00
|
|
|
playerModel.apply(MineLittlePony.getInstance().getManager().getPony(loc, false).getMetadata());
|
|
|
|
|
|
|
|
shadowSize = getShadowScale();
|
|
|
|
}
|
2015-12-15 06:32:57 +01:00
|
|
|
|
2018-04-27 13:49:33 +02:00
|
|
|
@Override
|
|
|
|
public float getShadowScale() {
|
2017-06-16 07:35:02 +02:00
|
|
|
if (mainModel.isChild) {
|
2018-04-27 13:49:33 +02:00
|
|
|
return 0.25F;
|
2017-06-16 07:35:02 +02:00
|
|
|
} else if (MineLittlePony.getConfig().showscale) {
|
2018-04-27 13:49:33 +02:00
|
|
|
return 0.4F;
|
2015-12-15 06:32:57 +01:00
|
|
|
}
|
2018-04-27 13:49:33 +02:00
|
|
|
return 0.5F;
|
2015-08-02 00:36:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2018-04-25 16:40:47 +02:00
|
|
|
public ModelWrapper getPlayerModel() {
|
2015-08-02 00:36:33 +02:00
|
|
|
return playerModel;
|
|
|
|
}
|
2016-09-08 05:53:23 +02:00
|
|
|
|
2017-06-13 05:55:50 +02:00
|
|
|
@Override
|
|
|
|
@Nonnull
|
|
|
|
protected final ResourceLocation getEntityTexture(T entity) {
|
|
|
|
return HDSkinManager.INSTANCE.getConvertedSkin(getTexture(entity));
|
2016-09-08 05:53:23 +02:00
|
|
|
}
|
2017-06-13 05:55:50 +02:00
|
|
|
|
|
|
|
protected abstract ResourceLocation getTexture(T entity);
|
2015-08-02 00:36:33 +02:00
|
|
|
}
|