Added a model for witches (current texture is a placeholder until we can get Zebras)

This commit is contained in:
Sollace 2018-04-28 23:00:01 +02:00
parent 3f32e2b19a
commit 7fbc14ca01
6 changed files with 132 additions and 2 deletions

View file

@ -12,6 +12,7 @@ import com.minelittlepony.render.ponies.RenderPonyPigman;
import com.minelittlepony.render.ponies.RenderPonySkeleton;
import com.minelittlepony.render.ponies.RenderPonyVex;
import com.minelittlepony.render.ponies.RenderPonyVillager;
import com.minelittlepony.render.ponies.RenderPonyWitch;
import com.minelittlepony.render.ponies.RenderPonyZombie;
import com.minelittlepony.render.ponies.RenderPonyZombieVillager;
import com.mumfrey.liteloader.util.ModUtilities;
@ -28,6 +29,7 @@ import net.minecraft.entity.monster.EntitySkeleton;
import net.minecraft.entity.monster.EntityStray;
import net.minecraft.entity.monster.EntityVex;
import net.minecraft.entity.monster.EntityVindicator;
import net.minecraft.entity.monster.EntityWitch;
import net.minecraft.entity.monster.EntityWitherSkeleton;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraft.entity.monster.EntityZombieVillager;
@ -69,10 +71,12 @@ public class PonyRenderManager {
if (config.villagers) {
pushNewRenderer(rm, EntityVillager.class, new RenderPonyVillager(rm));
pushNewRenderer(rm, EntityWitch.class, new RenderPonyWitch(rm));
pushNewRenderer(rm, EntityZombieVillager.class, new RenderPonyZombieVillager(rm));
MineLittlePony.logger.info("Villagers are now ponies.");
} else {
restoreRenderer(EntityVillager.class);
restoreRenderer(EntityWitch.class);
restoreRenderer(EntityZombieVillager.class);
}

View file

@ -0,0 +1,72 @@
package com.minelittlepony.model.ponies;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.entity.Entity;
import net.minecraft.entity.monster.EntityWitch;
import net.minecraft.util.ResourceLocation;
import static com.minelittlepony.model.PonyModelConstants.HEAD_RP_X;
import static com.minelittlepony.model.PonyModelConstants.HEAD_RP_Y;
import static com.minelittlepony.model.PonyModelConstants.HEAD_RP_Z;
import com.minelittlepony.render.PonyRenderer;
public class ModelWitchPony extends ModelVillagerPony {
private static final ResourceLocation WITCH_TEXTURES = new ResourceLocation("textures/entity/witch.png");
private PonyRenderer witchHat;
public ModelWitchPony() {
super();
}
public void setRotationAngles(float move, float swing, float age, float headYaw, float headPitch, float scale, Entity entity) {
rightArmPose = ArmPose.EMPTY;
leftArmPose = ((EntityWitch) entity).getHeldItemMainhand().isEmpty() ? ArmPose.EMPTY : ArmPose.ITEM;
super.setRotationAngles(move, swing, age, headYaw, headPitch, scale, entity);
if (leftArmPose != ArmPose.EMPTY) {
if (!canCast()) {
bipedRightArm.rotateAngleX = -2 * (float)Math.PI/3;
bipedRightArm.offsetZ = 0.1f;
}
unicornArmRight.offsetZ = -0.1f;
}
}
@Override
public void render(Entity entityIn, float move, float swing, float age, float headYaw, float headPitch, float scale) {
super.render(entityIn, move, swing, age, headYaw, headPitch, scale);
copyModelAngles(bipedHead, witchHat);
TextureManager tex = Minecraft.getMinecraft().getRenderManager().renderEngine;
tex.bindTexture(WITCH_TEXTURES);
witchHat.render(scale * 1.3f);
}
@Override
protected void initTextures() {
super.initTextures();
witchHat = new PonyRenderer(this).size(64, 128);
}
@Override
protected void initPositions(float yOffset, float stretch) {
super.initPositions(yOffset, stretch);
witchHat.offset(-5, -6, -7)
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2)
.tex(0, 64).box(0, 0, 0, 10, 2, 10, stretch)
.child(0).offset(-5, -5, -7).around(1.75F, -4, 2)
.tex(0, 76).box(0, 0, 0, 7, 4, 7, stretch)
.rotate(-0.05235988F, 0, 0.02617994F)
.child(0).offset(-5, -4, -7).around(1.75F, -4, 2)
.tex(0, 87).box(0, 0, 0, 4, 4, 4, stretch)
.rotate(-0.10471976F, 0, 0.05235988F)
.child(0).offset(-5, -2, -7).around(1.75F, -2, 2)
.tex(0, 95).box(0, 0, 0, 1, 2, 1, stretch)
.rotate(-0.20943952F, 0, 0.10471976F);
}
}

View file

@ -3,6 +3,7 @@ package com.minelittlepony.render;
import com.minelittlepony.MineLittlePony;
import com.minelittlepony.ducks.IRenderPony;
import com.minelittlepony.model.ModelWrapper;
import com.minelittlepony.render.layer.LayerHeldPonyItem;
import com.minelittlepony.render.layer.LayerHeldPonyItemMagical;
import com.minelittlepony.render.layer.LayerPonyArmor;
import com.minelittlepony.render.layer.LayerPonyCustomHead;
@ -29,10 +30,14 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
protected void addLayers() {
addLayer(new LayerPonyArmor<>(this));
addLayer(new LayerHeldPonyItemMagical<>(this));
// addLayer(new LayerArrow(this));
addLayer(new LayerPonyCustomHead<>(this));
addLayer(new LayerPonyElytra<>(this));
addLayer(createItemHoldingLayer());
}
protected LayerHeldPonyItem<T> createItemHoldingLayer() {
return new LayerHeldPonyItemMagical<>(this);
}
@Override

View file

@ -28,7 +28,7 @@ public class LayerHeldPonyItemMagical<T extends EntityLivingBase> extends LayerH
super(livingPony);
}
private boolean isUnicorn() {
protected boolean isUnicorn() {
ModelBase model = getMainModel();
return model instanceof IModelUnicorn && ((IModelUnicorn) model).canCast();
}

View file

@ -0,0 +1,49 @@
package com.minelittlepony.render.ponies;
import com.minelittlepony.model.PMAPI;
import com.minelittlepony.render.RenderPonyMob;
import com.minelittlepony.render.layer.LayerHeldPonyItem;
import com.minelittlepony.render.layer.LayerHeldPonyItemMagical;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.entity.monster.EntityWitch;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHandSide;
import net.minecraft.util.ResourceLocation;
public class RenderPonyWitch extends RenderPonyMob<EntityWitch> {
private static final ResourceLocation WITCH_TEXTURES = new ResourceLocation("minelittlepony", "textures/entity/witch_pony.png");
public RenderPonyWitch(RenderManager manager) {
super(manager, PMAPI.witch);
}
@Override
protected LayerHeldPonyItem<EntityWitch> createItemHoldingLayer() {
return new LayerHeldPonyItemMagical<EntityWitch>(this) {
@Override
protected void preItemRender(EntityWitch entity, ItemStack drop, TransformType transform, EnumHandSide hand) {
if (isUnicorn()) {
GlStateManager.translate(-0.1F, 0.7F, 0);
GlStateManager.rotate(110, 1, 0, 0);
} else {
GlStateManager.translate(-0.2F, -0.3F, -0.7F);
}
}
};
}
@Override
protected void preRenderCallback(EntityWitch entity, float ticks) {
super.preRenderCallback(entity, ticks);
GlStateManager.scale(0.9375F, 0.9375F, 0.9375F);
}
@Override
protected ResourceLocation getTexture(EntityWitch entity) {
return WITCH_TEXTURES;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 620 B