mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 16:24:23 +01:00
Separate wearables from their parent models
This commit is contained in:
parent
810fc938a4
commit
a919c76638
18 changed files with 315 additions and 118 deletions
|
@ -153,7 +153,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel, P
|
|||
snout.setGender(metadata.getGender());
|
||||
}
|
||||
|
||||
protected float getWobbleAmount() {
|
||||
public float getWobbleAmount() {
|
||||
|
||||
if (swingProgress <= 0) {
|
||||
return 0;
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
package com.minelittlepony.model.gear;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.minelittlepony.model.AbstractPonyModel;
|
||||
import com.minelittlepony.model.PonyModelConstants;
|
||||
|
||||
public abstract class AbstractGear extends ModelBase implements IGear, PonyModelConstants {
|
||||
|
||||
public AbstractGear() {
|
||||
textureWidth = 64;
|
||||
textureHeight = 64;
|
||||
|
||||
init(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelRenderer getOriginBodyPart(AbstractPonyModel model) {
|
||||
switch (getGearLocation()) {
|
||||
default:
|
||||
case HEAD: return model.bipedHead;
|
||||
case TAIL:
|
||||
case NECK:
|
||||
case LEGS:
|
||||
case BODY: return model.bipedBody;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderSeparately(Entity entity, float scale) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
|
||||
TextureManager tex = Minecraft.getMinecraft().getRenderManager().renderEngine;
|
||||
tex.bindTexture(getTexture(entity));
|
||||
|
||||
renderPart(scale);
|
||||
|
||||
GlStateManager.popAttrib();
|
||||
}
|
||||
}
|
54
src/main/java/com/minelittlepony/model/gear/IGear.java
Normal file
54
src/main/java/com/minelittlepony/model/gear/IGear.java
Normal file
|
@ -0,0 +1,54 @@
|
|||
package com.minelittlepony.model.gear;
|
||||
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import com.minelittlepony.model.AbstractPonyModel;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.capabilities.IModel;
|
||||
import com.minelittlepony.model.capabilities.IModelPart;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public interface IGear extends IModelPart {
|
||||
|
||||
/**
|
||||
* Determines if this wearable can and is worn by the selected entity.
|
||||
*
|
||||
* @param model The primary model
|
||||
* @param entity The entity being rendered
|
||||
*
|
||||
* @return True to render this wearable
|
||||
*/
|
||||
boolean canRender(IModel model, Entity entity);
|
||||
|
||||
/**
|
||||
* Gets the body location that this wearable appears on.
|
||||
*/
|
||||
BodyPart getGearLocation();
|
||||
|
||||
/**
|
||||
* Gets the texture to use for this wearable.
|
||||
* Return null to use the same as the primary model.
|
||||
*/
|
||||
@Nullable
|
||||
ResourceLocation getTexture(Entity entity);
|
||||
|
||||
/**
|
||||
* Gets the actual body part this wearable will latch onto.
|
||||
*/
|
||||
@Nonnull
|
||||
ModelRenderer getOriginBodyPart(AbstractPonyModel model);
|
||||
|
||||
/**
|
||||
* Orients this wearable.
|
||||
*/
|
||||
void setLivingAnimations(IModel model, Entity entity);
|
||||
|
||||
/**
|
||||
* Renders this wearable separately. (used outside of the gear render layer)
|
||||
*/
|
||||
void renderSeparately(Entity entity, float scale);
|
||||
}
|
|
@ -1,31 +1,22 @@
|
|||
package com.minelittlepony.model.components;
|
||||
package com.minelittlepony.model.gear;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.minelittlepony.model.AbstractPonyModel;
|
||||
import com.minelittlepony.model.capabilities.IModelPart;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.capabilities.IModel;
|
||||
import com.minelittlepony.pony.data.PonyWearable;
|
||||
import com.minelittlepony.render.model.PonyRenderer;
|
||||
|
||||
public class Muffin implements IModelPart {
|
||||
public class Muffin extends AbstractGear {
|
||||
|
||||
private static final ResourceLocation TEXTURE = new ResourceLocation("minelittlepony", "textures/models/muffin.png");
|
||||
|
||||
private PonyRenderer crown;
|
||||
|
||||
AbstractPonyModel model;
|
||||
|
||||
public Muffin(AbstractPonyModel model) {
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(float yOffset, float stretch) {
|
||||
crown = new PonyRenderer(model, 0, 0).size(64, 44)
|
||||
crown = new PonyRenderer(this, 0, 0).size(64, 44)
|
||||
.around(-4, -12, -6)
|
||||
.box(0, 0, 0, 8, 4, 8, stretch)
|
||||
.box(3, -1.5F, 3, 2, 2, 2, stretch)
|
||||
|
@ -36,14 +27,25 @@ public class Muffin implements IModelPart {
|
|||
|
||||
@Override
|
||||
public void renderPart(float scale) {
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
|
||||
TextureManager tex = Minecraft.getMinecraft().getRenderManager().renderEngine;
|
||||
tex.bindTexture(TEXTURE);
|
||||
|
||||
crown.render(scale);
|
||||
|
||||
GlStateManager.popAttrib();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLivingAnimations(IModel model, Entity entity) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRender(IModel model, Entity entity) {
|
||||
return model.isWearing(PonyWearable.MUFFIN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BodyPart getGearLocation() {
|
||||
return BodyPart.HEAD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTexture(Entity entity) {
|
||||
return TEXTURE;
|
||||
}
|
||||
}
|
|
@ -1,16 +1,17 @@
|
|||
package com.minelittlepony.model.components;
|
||||
package com.minelittlepony.model.gear;
|
||||
|
||||
import static com.minelittlepony.model.PonyModelConstants.*;
|
||||
|
||||
import com.minelittlepony.model.AbstractPonyModel;
|
||||
import com.minelittlepony.model.capabilities.IModelPart;
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.capabilities.IModel;
|
||||
import com.minelittlepony.model.capabilities.IModelPegasus;
|
||||
import com.minelittlepony.pony.data.PonyWearable;
|
||||
import com.minelittlepony.render.model.PlaneRenderer;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
public class SaddleBags implements IModelPart {
|
||||
public class SaddleBags extends AbstractGear {
|
||||
|
||||
private PlaneRenderer leftBag;
|
||||
private PlaneRenderer rightBag;
|
||||
|
@ -21,18 +22,15 @@ public class SaddleBags implements IModelPart {
|
|||
|
||||
float dropAmount = 0;
|
||||
|
||||
AbstractPonyModel model;
|
||||
|
||||
public SaddleBags(AbstractPonyModel model) {
|
||||
this.model = model;
|
||||
|
||||
leftBag = new PlaneRenderer(model, 56, 19);
|
||||
rightBag = new PlaneRenderer(model, 56, 19);
|
||||
strap = new PlaneRenderer(model, 56, 19);
|
||||
}
|
||||
private IModel model;
|
||||
|
||||
@Override
|
||||
public void init(float yOffset, float stretch) {
|
||||
leftBag = new PlaneRenderer(this, 56, 19);
|
||||
rightBag = new PlaneRenderer(this, 56, 19);
|
||||
strap = new PlaneRenderer(this, 56, 19);
|
||||
|
||||
float y = -0.5F;
|
||||
int x = 4;
|
||||
int z = -1;
|
||||
|
@ -70,8 +68,17 @@ public class SaddleBags implements IModelPart {
|
|||
.flipZ().top(0, 0, -3, 8, 3, stretch)
|
||||
.tex(56, 22).flipZ().bottom(0, 6, -3, 8, 3, stretch)
|
||||
.rotateAngleY = ROTATE_270;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLivingAnimations(IModel model, Entity entity) {
|
||||
this.model = model;
|
||||
|
||||
hangLow = false;
|
||||
|
||||
if (model instanceof IModelPegasus) {
|
||||
hangLow = model.canFly() && ((IModelPegasus)model).wingsAreOpen();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -97,6 +104,7 @@ public class SaddleBags implements IModelPart {
|
|||
dropAmount = hangLow ? 0.15F : 0;
|
||||
}
|
||||
|
||||
|
||||
public void sethangingLow(boolean veryLow) {
|
||||
hangLow = veryLow;
|
||||
}
|
||||
|
@ -116,4 +124,20 @@ public class SaddleBags implements IModelPart {
|
|||
strap.render(scale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canRender(IModel model, Entity entity) {
|
||||
return model.isWearing(PonyWearable.SADDLE_BAGS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BodyPart getGearLocation() {
|
||||
return BodyPart.BODY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTexture(Entity entity) {
|
||||
// use the default
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
58
src/main/java/com/minelittlepony/model/gear/WitchHat.java
Normal file
58
src/main/java/com/minelittlepony/model/gear/WitchHat.java
Normal file
|
@ -0,0 +1,58 @@
|
|||
package com.minelittlepony.model.gear;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.capabilities.IModel;
|
||||
import com.minelittlepony.pony.data.PonyWearable;
|
||||
import com.minelittlepony.render.model.PonyRenderer;
|
||||
|
||||
public class WitchHat extends AbstractGear {
|
||||
|
||||
private static final ResourceLocation WITCH_TEXTURES = new ResourceLocation("textures/entity/witch.png");
|
||||
|
||||
private PonyRenderer witchHat;
|
||||
|
||||
@Override
|
||||
public void renderPart(float scale) {
|
||||
witchHat.render(scale * 1.3F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLivingAnimations(IModel model, Entity entity) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(float yOffset, float stretch) {
|
||||
witchHat = new PonyRenderer(this).size(64, 128);
|
||||
witchHat.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
|
||||
.tex(0, 64).box(-5, -6, -7, 10, 2, 10, stretch)
|
||||
.child(0).around(1.75F, -4, 2)
|
||||
.tex(0, 76).box(-5, -5, -7, 7, 4, 7, stretch)
|
||||
.rotate(-0.05235988F, 0, 0.02617994F)
|
||||
.child(0).around(1.75F, -4, 2)
|
||||
.tex(0, 87).box(-5, -4, -7, 4, 4, 4, stretch)
|
||||
.rotate(-0.10471976F, 0, 0.05235988F)
|
||||
.child(0).around(1.75F, -2, 2)
|
||||
.tex(0, 95).box(-5, -2, -7, 1, 2, 1, stretch)
|
||||
.rotate(-0.20943952F, 0, 0.10471976F);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean canRender(IModel model, Entity entity) {
|
||||
return model.isWearing(PonyWearable.HAT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public BodyPart getGearLocation() {
|
||||
return BodyPart.HEAD;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResourceLocation getTexture(Entity entity) {
|
||||
return WITCH_TEXTURES;
|
||||
}
|
||||
}
|
|
@ -25,7 +25,6 @@ public class ModelAlicorn extends ModelUnicorn implements IModelPegasus {
|
|||
|
||||
if (canFly()) {
|
||||
wings.setRotationAndAngles(rainboom, move, swing, 0, ticks);
|
||||
saddlebags.sethangingLow(wingsAreOpen());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ public class ModelBatpony extends ModelEarthPony implements IModelPegasus {
|
|||
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
||||
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
||||
wings.setRotationAndAngles(rainboom, move, swing, 0, ticks);
|
||||
saddlebags.sethangingLow(wingsAreOpen());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.minelittlepony.model.player;
|
||||
|
||||
import com.minelittlepony.model.AbstractPonyModel;
|
||||
import com.minelittlepony.model.components.SaddleBags;
|
||||
import com.minelittlepony.pony.data.PonyWearable;
|
||||
import com.minelittlepony.render.model.PonyRenderer;
|
||||
|
||||
|
@ -11,8 +10,6 @@ public class ModelEarthPony extends AbstractPonyModel {
|
|||
|
||||
private final boolean smallArms;
|
||||
|
||||
public SaddleBags saddlebags;
|
||||
|
||||
public PonyRenderer bipedCape;
|
||||
|
||||
public ModelEarthPony(boolean smallArms) {
|
||||
|
@ -29,18 +26,12 @@ public class ModelEarthPony extends AbstractPonyModel {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shakeBody(float move, float swing, float bodySwing, float ticks) {
|
||||
super.shakeBody(move, swing, bodySwing, ticks);
|
||||
saddlebags.setRotationAndAngles(rainboom, move, swing, bodySwing, ticks);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderBody(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
super.renderBody(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
|
||||
if (isWearing(PonyWearable.SADDLE_BAGS)) {
|
||||
saddlebags.renderPart(scale);
|
||||
// saddlebags.renderPart(scale);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,13 +67,6 @@ public class ModelEarthPony extends AbstractPonyModel {
|
|||
.size(64, 32).box(-5, 0, -1, 10, 16, 1, stretch);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initBody(float yOffset, float stretch) {
|
||||
super.initBody(yOffset, stretch);
|
||||
saddlebags = new SaddleBags(this);
|
||||
saddlebags.init(yOffset, stretch);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderCape(float scale) {
|
||||
bipedCape.render(scale);
|
||||
|
|
|
@ -23,7 +23,6 @@ public class ModelPegasus extends ModelEarthPony implements IModelPegasus {
|
|||
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
||||
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
||||
wings.setRotationAndAngles(rainboom, move, swing, 0, ticks);
|
||||
saddlebags.sethangingLow(wingsAreOpen());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -38,7 +38,7 @@ public class ModelUnicorn extends ModelEarthPony implements IModelUnicorn {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected float getWobbleAmount() {
|
||||
public float getWobbleAmount() {
|
||||
if (isCasting()) {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package com.minelittlepony.model.player;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.render.model.PonyRenderer;
|
||||
|
||||
public class ModelZebra extends ModelEarthPony {
|
||||
|
@ -14,15 +14,14 @@ public class ModelZebra extends ModelEarthPony {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void renderHead(Entity entity, float move, float swing, float age, float headYaw, float headPitch, float scale) {
|
||||
GlStateManager.translate(0, -0.1F, 0);
|
||||
super.renderHead(entity, move, swing, age, headYaw, headPitch, scale);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderNeck(float scale) {
|
||||
GlStateManager.scale(1, 1.1F, 1);
|
||||
super.renderNeck(scale);
|
||||
public void transform(BodyPart part) {
|
||||
if (part == BodyPart.HEAD) {
|
||||
GlStateManager.translate(0, -0.1F, 0);
|
||||
}
|
||||
if (part == BodyPart.NECK) {
|
||||
GlStateManager.scale(1, 1.1F, 1);
|
||||
}
|
||||
super.transform(part);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.minelittlepony.model.ponies;
|
||||
|
||||
import com.minelittlepony.model.BodyPart;
|
||||
import com.minelittlepony.model.components.SeaponyTail;
|
||||
import com.minelittlepony.model.player.ModelUnicorn;
|
||||
import com.minelittlepony.pony.data.IPony;
|
||||
|
@ -108,10 +109,12 @@ public class ModelSeapony extends ModelUnicorn {
|
|||
public void render(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
setVisible(bipedLeftArmwear.showModel);
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
GlStateManager.translate(0, 0.6F, 0);
|
||||
super.render(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transform(BodyPart part) {
|
||||
GlStateManager.translate(0, 0.6F, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,8 +5,6 @@ import net.minecraft.entity.EntityLivingBase;
|
|||
import net.minecraft.entity.monster.EntityZombieVillager;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
|
||||
import com.minelittlepony.model.capabilities.IModelPart;
|
||||
import com.minelittlepony.model.components.Muffin;
|
||||
import com.minelittlepony.model.player.ModelAlicorn;
|
||||
import com.minelittlepony.pony.data.PonyWearable;
|
||||
import com.minelittlepony.render.model.PlaneRenderer;
|
||||
|
@ -15,8 +13,6 @@ public class ModelVillagerPony extends ModelAlicorn {
|
|||
|
||||
public PlaneRenderer apron, trinket;
|
||||
|
||||
public IModelPart muffin;
|
||||
|
||||
private int profession;
|
||||
|
||||
public boolean special;
|
||||
|
@ -53,15 +49,6 @@ public class ModelVillagerPony extends ModelAlicorn {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderHead(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
super.renderHead(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
|
||||
if (special2) {
|
||||
muffin.renderPart(scale);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getModelHeight() {
|
||||
return special2 ? 2.3F : 2;
|
||||
|
@ -73,6 +60,10 @@ public class ModelVillagerPony extends ModelAlicorn {
|
|||
return !special && profession > -1 && profession < 2;
|
||||
}
|
||||
|
||||
if (wearable == PonyWearable.MUFFIN) {
|
||||
return special2;
|
||||
}
|
||||
|
||||
return super.isWearing(wearable);
|
||||
}
|
||||
|
||||
|
@ -90,9 +81,6 @@ public class ModelVillagerPony extends ModelAlicorn {
|
|||
public void init(float yOffset, float stretch) {
|
||||
super.init(yOffset, stretch);
|
||||
|
||||
muffin = new Muffin(this);
|
||||
muffin.init(yOffset, stretch);
|
||||
|
||||
apron = new PlaneRenderer(this, 56, 16)
|
||||
.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z)
|
||||
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
|
||||
|
|
|
@ -1,25 +1,18 @@
|
|||
package com.minelittlepony.model.ponies;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.monster.EntityWitch;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.minelittlepony.model.gear.IGear;
|
||||
import com.minelittlepony.model.gear.WitchHat;
|
||||
import com.minelittlepony.model.player.ModelZebra;
|
||||
import com.minelittlepony.pony.data.IPony;
|
||||
import com.minelittlepony.render.model.PonyRenderer;
|
||||
|
||||
public class ModelWitchPony extends ModelZebra {
|
||||
|
||||
private static final ResourceLocation WITCH_TEXTURES = new ResourceLocation("textures/entity/witch.png");
|
||||
|
||||
private PonyRenderer witchHat;
|
||||
private IGear witchHat;
|
||||
|
||||
public ModelWitchPony() {
|
||||
super(false);
|
||||
|
@ -89,30 +82,13 @@ public class ModelWitchPony extends ModelZebra {
|
|||
@Override
|
||||
protected void renderHead(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
super.renderHead(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
|
||||
TextureManager tex = Minecraft.getMinecraft().getRenderManager().renderEngine;
|
||||
tex.bindTexture(WITCH_TEXTURES);
|
||||
witchHat.render(scale * 1.3F);
|
||||
|
||||
GlStateManager.popAttrib();
|
||||
// FIXME: Wearables don't show on witches unless it's holding an item/drinking something
|
||||
witchHat.renderSeparately(entity, scale);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(float yOffset, float stretch) {
|
||||
super.init(yOffset, stretch);
|
||||
witchHat = new PonyRenderer(this).size(64, 128);
|
||||
witchHat.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
|
||||
.tex(0, 64).box(-5, -6, -7, 10, 2, 10, stretch)
|
||||
.child(0).around(1.75F, -4, 2)
|
||||
.tex(0, 76).box(-5, -5, -7, 7, 4, 7, stretch)
|
||||
.rotate(-0.05235988F, 0, 0.02617994F)
|
||||
.child(0).around(1.75F, -4, 2)
|
||||
.tex(0, 87).box(-5, -4, -7, 4, 4, 4, stretch)
|
||||
.rotate(-0.10471976F, 0, 0.05235988F)
|
||||
.child(0).around(1.75F, -2, 2)
|
||||
.tex(0, 95).box(-5, -2, -7, 1, 2, 1, stretch)
|
||||
.rotate(-0.20943952F, 0, 0.10471976F);
|
||||
witchHat = new WitchHat();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.minelittlepony.MineLittlePony;
|
|||
import com.minelittlepony.ducks.IRenderPony;
|
||||
import com.minelittlepony.model.ModelWrapper;
|
||||
import com.minelittlepony.pony.data.IPony;
|
||||
import com.minelittlepony.render.layer.LayerGear;
|
||||
import com.minelittlepony.render.layer.LayerHeldPonyItem;
|
||||
import com.minelittlepony.render.layer.LayerHeldPonyItemMagical;
|
||||
import com.minelittlepony.render.layer.LayerPonyArmor;
|
||||
|
@ -39,6 +40,7 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
|
|||
addLayer(new LayerArrow(this));
|
||||
addLayer(new LayerPonyCustomHead<>(this));
|
||||
addLayer(new LayerPonyElytra<>(this));
|
||||
addLayer(new LayerGear<>(this));
|
||||
}
|
||||
|
||||
protected LayerHeldPonyItem<T> createItemHoldingLayer() {
|
||||
|
|
61
src/main/java/com/minelittlepony/render/layer/LayerGear.java
Normal file
61
src/main/java/com/minelittlepony/render/layer/LayerGear.java
Normal file
|
@ -0,0 +1,61 @@
|
|||
package com.minelittlepony.render.layer;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.RenderLivingBase;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.minelittlepony.model.AbstractPonyModel;
|
||||
import com.minelittlepony.model.gear.IGear;
|
||||
import com.minelittlepony.model.gear.Muffin;
|
||||
import com.minelittlepony.model.gear.SaddleBags;
|
||||
import com.minelittlepony.model.gear.WitchHat;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class LayerGear<T extends EntityLivingBase> extends AbstractPonyLayer<T> {
|
||||
|
||||
private static List<IGear> gears = Lists.newArrayList(
|
||||
new SaddleBags(),
|
||||
new WitchHat(),
|
||||
new Muffin()
|
||||
);
|
||||
|
||||
public LayerGear(RenderLivingBase<T> renderer) {
|
||||
super(renderer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void doPonyRender(T entity, float move, float swing, float partialTicks, float ticks, float headYaw, float headPitch, float scale) {
|
||||
AbstractPonyModel model = getPlayerModel();
|
||||
|
||||
for (IGear gear : gears) {
|
||||
if (gear.canRender(model, entity)) {
|
||||
renderGear(model, entity, gear, move, swing, scale, ticks);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void renderGear(AbstractPonyModel model, T entity, IGear gear, float move, float swing, float scale, float ticks) {
|
||||
GlStateManager.pushMatrix();
|
||||
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
|
||||
|
||||
model.transform(gear.getGearLocation());
|
||||
gear.getOriginBodyPart(model).postRender(scale);
|
||||
|
||||
ResourceLocation texture = gear.getTexture(entity);
|
||||
if (texture != null) {
|
||||
getRenderer().bindTexture(texture);
|
||||
}
|
||||
|
||||
gear.setLivingAnimations(model, entity);
|
||||
gear.setRotationAndAngles(model.isGoingFast(), move, swing, model.getWobbleAmount(), ticks);
|
||||
gear.renderPart(scale);
|
||||
|
||||
GlStateManager.popAttrib();
|
||||
GlStateManager.popMatrix();
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@ import com.minelittlepony.pony.data.IPony;
|
|||
import com.minelittlepony.render.RenderPony;
|
||||
import com.minelittlepony.render.layer.LayerDJPon3Head;
|
||||
import com.minelittlepony.render.layer.LayerEntityOnPonyShoulder;
|
||||
import com.minelittlepony.render.layer.LayerGear;
|
||||
import com.minelittlepony.render.layer.LayerHeldPonyItemMagical;
|
||||
import com.minelittlepony.render.layer.LayerPonyArmor;
|
||||
import com.minelittlepony.render.layer.LayerPonyCape;
|
||||
|
@ -44,6 +45,7 @@ public class RenderPonyPlayer extends RenderPlayer implements IRenderPony<Abstra
|
|||
addLayer(new LayerHeldPonyItemMagical<>(this));
|
||||
addLayer(new LayerPonyCape(this));
|
||||
addLayer(new LayerEntityOnPonyShoulder(renderManager, this));
|
||||
addLayer(new LayerGear<>(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue