Add some model children. May be buggy

This commit is contained in:
Matthew Messinger 2016-03-08 22:00:28 -05:00
parent c8aa2176a2
commit 57404a01cf
7 changed files with 52 additions and 27 deletions

View file

@ -4,6 +4,7 @@ import com.brohoof.minelittlepony.PonyData;
import com.brohoof.minelittlepony.model.BodyPart; import com.brohoof.minelittlepony.model.BodyPart;
import com.brohoof.minelittlepony.model.AbstractPonyModel; import com.brohoof.minelittlepony.model.AbstractPonyModel;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
public abstract class AbstractHeadPart implements IPonyPart { public abstract class AbstractHeadPart implements IPonyPart {
@ -13,6 +14,9 @@ public abstract class AbstractHeadPart implements IPonyPart {
@Override @Override
public void init(AbstractPonyModel pony, float yOffset, float stretch) { public void init(AbstractPonyModel pony, float yOffset, float stretch) {
this.pony = pony; this.pony = pony;
for (ModelRenderer m : getModels()) {
this.pony.bipedHead.addChild(m);
}
} }
@Override @Override
@ -51,6 +55,8 @@ public abstract class AbstractHeadPart implements IPonyPart {
return pony; return pony;
} }
protected abstract ModelRenderer[] getModels();
protected abstract void position(float posX, float posY, float posZ); protected abstract void position(float posX, float posY, float posZ);
protected abstract void rotate(float rotX, float rotY); protected abstract void rotate(float rotX, float rotY);

View file

@ -41,6 +41,17 @@ public class PegasusWings implements IPonyPart, PonyModelConstants {
} }
initPositions(yOffset, stretch); initPositions(yOffset, stretch);
addChildren(this.leftWing);
addChildren(this.rightWing);
addChildren(this.leftWingExt);
addChildren(this.rightWingExt);
}
private void addChildren(ModelRenderer... models) {
for (ModelRenderer m : models) {
this.pony.bipedBody.addChild(m);
}
} }
private void initPositions(float yOffset, float stretch) { private void initPositions(float yOffset, float stretch) {

View file

@ -45,4 +45,8 @@ public class PonyEars extends AbstractHeadPart implements PonyModelConstants {
right.render(scale); right.render(scale);
} }
@Override
protected ModelRenderer[] getModels() {
return new ModelRenderer[] { left, right };
}
} }

View file

@ -9,6 +9,9 @@ import com.brohoof.minelittlepony.model.AbstractPonyModel;
import com.brohoof.minelittlepony.model.PonyModelConstants; import com.brohoof.minelittlepony.model.PonyModelConstants;
import com.brohoof.minelittlepony.renderer.PlaneRenderer; import com.brohoof.minelittlepony.renderer.PlaneRenderer;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ObjectArrays;
import net.minecraft.client.model.ModelRenderer;
public class PonySnout extends AbstractHeadPart implements PonyModelConstants { public class PonySnout extends AbstractHeadPart implements PonyModelConstants {
@ -103,4 +106,11 @@ public class PonySnout extends AbstractHeadPart implements PonyModelConstants {
} }
} }
@Override
protected ModelRenderer[] getModels() {
ModelRenderer[] male = MUZZLES.get(PonyGender.STALLION);
ModelRenderer[] female = MUZZLES.get(PonyGender.MARE);
return ObjectArrays.concat(male, female, ModelRenderer.class);
}
} }

View file

@ -24,6 +24,7 @@ public class UnicornHorn extends AbstractHeadPart implements PonyModelConstants
this.hornglow = new HornGlowRenderer[2]; this.hornglow = new HornGlowRenderer[2];
for (int i = 0; i < hornglow.length; i++) { for (int i = 0; i < hornglow.length; i++) {
this.hornglow[i] = new HornGlowRenderer(pony, 0, 3); this.hornglow[i] = new HornGlowRenderer(pony, 0, 3);
this.horn.addChild(this.hornglow[i]);
} }
this.horn.addBox(-0.5F + HEAD_CENTRE_X, -10.0F + HEAD_CENTRE_Y, -1.5F + HEAD_CENTRE_Z, 1, 4, 1, stretch); this.horn.addBox(-0.5F + HEAD_CENTRE_X, -10.0F + HEAD_CENTRE_Y, -1.5F + HEAD_CENTRE_Z, 1, 4, 1, stretch);
@ -66,9 +67,9 @@ public class UnicornHorn extends AbstractHeadPart implements PonyModelConstants
protected void position(float posX, float posY, float posZ) { protected void position(float posX, float posY, float posZ) {
AbstractPonyModel.setRotationPoint(this.horn, posX, posY, posZ); AbstractPonyModel.setRotationPoint(this.horn, posX, posY, posZ);
for (int i = 0; i < this.hornglow.length; i++) { // for (int i = 0; i < this.hornglow.length; i++) {
AbstractPonyModel.setRotationPoint(this.hornglow[i], posX, posY, posZ); // AbstractPonyModel.setRotationPoint(this.hornglow[i], posX, posY, posZ);
} // }
} }
protected void rotate(float rotX, float rotY) { protected void rotate(float rotX, float rotY) {
@ -76,10 +77,15 @@ public class UnicornHorn extends AbstractHeadPart implements PonyModelConstants
this.horn.rotateAngleX = rotX + 0.5F; this.horn.rotateAngleX = rotX + 0.5F;
this.horn.rotateAngleY = rotY; this.horn.rotateAngleY = rotY;
for (int i = 0; i < this.hornglow.length; i++) { // for (int i = 0; i < this.hornglow.length; i++) {
this.hornglow[i].rotateAngleX = rotX + 0.5F; // this.hornglow[i].rotateAngleX = rotX + 0.5F;
this.hornglow[i].rotateAngleY = rotY; // this.hornglow[i].rotateAngleY = rotY;
} // }
} }
@Override
protected ModelRenderer[] getModels() {
// TODO Auto-generated method stub
return new ModelRenderer[] { horn };
}
} }

View file

@ -35,24 +35,6 @@ public class ModelVillagerPony extends ModelPlayerPony {
this.VillagerTrinket.rotateAngleY = bodySwingRotation * 0.2F; this.VillagerTrinket.rotateAngleY = bodySwingRotation * 0.2F;
} }
@Override
protected void adjustBodyComponents(float rotateAngleX, float rotationPointY, float rotationPointZ) {
super.adjustBodyComponents(rotateAngleX, rotationPointY, rotationPointZ);
for (int i = 0; i < this.VillagerBagPiece.length; ++i) {
this.VillagerBagPiece[i].rotateAngleX = rotateAngleX;
this.VillagerBagPiece[i].rotationPointY = rotationPointY;
this.VillagerBagPiece[i].rotationPointZ = rotationPointZ;
}
this.VillagerApron.rotateAngleX = rotateAngleX;
this.VillagerApron.rotationPointY = rotationPointY;
this.VillagerApron.rotationPointZ = rotationPointZ;
this.VillagerTrinket.rotateAngleX = rotateAngleX;
this.VillagerTrinket.rotationPointY = rotationPointY;
this.VillagerTrinket.rotationPointZ = rotationPointZ;
}
@Override @Override
protected void renderBody() { protected void renderBody() {
super.renderBody(); super.renderBody();
@ -88,6 +70,12 @@ public class ModelVillagerPony extends ModelPlayerPony {
this.VillagerBagPiece[13] = new PlaneRenderer(this, 56, 31); this.VillagerBagPiece[13] = new PlaneRenderer(this, 56, 31);
this.VillagerApron = new PlaneRenderer(this, 56, 16); this.VillagerApron = new PlaneRenderer(this, 56, 16);
this.VillagerTrinket = new PlaneRenderer(this, 0, 3); this.VillagerTrinket = new PlaneRenderer(this, 0, 3);
for (PlaneRenderer p : this.VillagerBagPiece) {
this.bipedBody.addChild(p);
}
this.bipedBody.addChild(this.VillagerApron);
this.bipedBody.addChild(this.VillagerTrinket);
} }
@Override @Override

View file

@ -21,8 +21,8 @@ public class RenderPonySkeleton extends RenderPonyMob<EntitySkeleton> {
addLayer(new LayerBipedArmor(this) { addLayer(new LayerBipedArmor(this) {
@Override @Override
protected void initArmor() { protected void initArmor() {
this.field_177189_c = PMAPI.skeleton.getArmor().modelArmor; this.modelLeggings = PMAPI.skeleton.getArmor().modelArmor;
this.field_177186_d = PMAPI.skeleton.getArmor().modelArmorChestplate; this.modelArmor = PMAPI.skeleton.getArmor().modelArmorChestplate;
} }
}); });
} }