From 57404a01cf1bfb112abfec729f1c5b6217d6f484 Mon Sep 17 00:00:00 2001 From: Matthew Messinger Date: Tue, 8 Mar 2016 22:00:28 -0500 Subject: [PATCH] Add some model children. May be buggy --- .../model/part/AbstractHeadPart.java | 6 +++++ .../model/part/PegasusWings.java | 11 +++++++++ .../minelittlepony/model/part/PonyEars.java | 4 ++++ .../minelittlepony/model/part/PonySnout.java | 10 ++++++++ .../model/part/UnicornHorn.java | 20 ++++++++++------ .../model/pony/ModelVillagerPony.java | 24 +++++-------------- .../renderer/RenderPonySkeleton.java | 4 ++-- 7 files changed, 52 insertions(+), 27 deletions(-) diff --git a/src/main/java/com/brohoof/minelittlepony/model/part/AbstractHeadPart.java b/src/main/java/com/brohoof/minelittlepony/model/part/AbstractHeadPart.java index 916db634..55b5e6df 100644 --- a/src/main/java/com/brohoof/minelittlepony/model/part/AbstractHeadPart.java +++ b/src/main/java/com/brohoof/minelittlepony/model/part/AbstractHeadPart.java @@ -4,6 +4,7 @@ import com.brohoof.minelittlepony.PonyData; import com.brohoof.minelittlepony.model.BodyPart; import com.brohoof.minelittlepony.model.AbstractPonyModel; +import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.renderer.GlStateManager; public abstract class AbstractHeadPart implements IPonyPart { @@ -13,6 +14,9 @@ public abstract class AbstractHeadPart implements IPonyPart { @Override public void init(AbstractPonyModel pony, float yOffset, float stretch) { this.pony = pony; + for (ModelRenderer m : getModels()) { + this.pony.bipedHead.addChild(m); + } } @Override @@ -51,6 +55,8 @@ public abstract class AbstractHeadPart implements IPonyPart { return pony; } + protected abstract ModelRenderer[] getModels(); + protected abstract void position(float posX, float posY, float posZ); protected abstract void rotate(float rotX, float rotY); diff --git a/src/main/java/com/brohoof/minelittlepony/model/part/PegasusWings.java b/src/main/java/com/brohoof/minelittlepony/model/part/PegasusWings.java index ca59fb67..b48c4d34 100644 --- a/src/main/java/com/brohoof/minelittlepony/model/part/PegasusWings.java +++ b/src/main/java/com/brohoof/minelittlepony/model/part/PegasusWings.java @@ -41,6 +41,17 @@ public class PegasusWings implements IPonyPart, PonyModelConstants { } 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) { diff --git a/src/main/java/com/brohoof/minelittlepony/model/part/PonyEars.java b/src/main/java/com/brohoof/minelittlepony/model/part/PonyEars.java index b4a3ff3a..8c947beb 100644 --- a/src/main/java/com/brohoof/minelittlepony/model/part/PonyEars.java +++ b/src/main/java/com/brohoof/minelittlepony/model/part/PonyEars.java @@ -45,4 +45,8 @@ public class PonyEars extends AbstractHeadPart implements PonyModelConstants { right.render(scale); } + @Override + protected ModelRenderer[] getModels() { + return new ModelRenderer[] { left, right }; + } } diff --git a/src/main/java/com/brohoof/minelittlepony/model/part/PonySnout.java b/src/main/java/com/brohoof/minelittlepony/model/part/PonySnout.java index 72922a1c..f672306e 100644 --- a/src/main/java/com/brohoof/minelittlepony/model/part/PonySnout.java +++ b/src/main/java/com/brohoof/minelittlepony/model/part/PonySnout.java @@ -9,6 +9,9 @@ import com.brohoof.minelittlepony.model.AbstractPonyModel; import com.brohoof.minelittlepony.model.PonyModelConstants; import com.brohoof.minelittlepony.renderer.PlaneRenderer; 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 { @@ -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); + } + } diff --git a/src/main/java/com/brohoof/minelittlepony/model/part/UnicornHorn.java b/src/main/java/com/brohoof/minelittlepony/model/part/UnicornHorn.java index 199a47b9..9c8d9cb7 100644 --- a/src/main/java/com/brohoof/minelittlepony/model/part/UnicornHorn.java +++ b/src/main/java/com/brohoof/minelittlepony/model/part/UnicornHorn.java @@ -24,6 +24,7 @@ public class UnicornHorn extends AbstractHeadPart implements PonyModelConstants this.hornglow = new HornGlowRenderer[2]; for (int i = 0; i < hornglow.length; i++) { 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); @@ -66,9 +67,9 @@ public class UnicornHorn extends AbstractHeadPart implements PonyModelConstants protected void position(float posX, float posY, float posZ) { AbstractPonyModel.setRotationPoint(this.horn, posX, posY, posZ); - for (int i = 0; i < this.hornglow.length; i++) { - AbstractPonyModel.setRotationPoint(this.hornglow[i], posX, posY, posZ); - } +// for (int i = 0; i < this.hornglow.length; i++) { +// AbstractPonyModel.setRotationPoint(this.hornglow[i], posX, posY, posZ); +// } } 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.rotateAngleY = rotY; - for (int i = 0; i < this.hornglow.length; i++) { - this.hornglow[i].rotateAngleX = rotX + 0.5F; - this.hornglow[i].rotateAngleY = rotY; - } +// for (int i = 0; i < this.hornglow.length; i++) { +// this.hornglow[i].rotateAngleX = rotX + 0.5F; +// this.hornglow[i].rotateAngleY = rotY; +// } } + @Override + protected ModelRenderer[] getModels() { + // TODO Auto-generated method stub + return new ModelRenderer[] { horn }; + } } diff --git a/src/main/java/com/brohoof/minelittlepony/model/pony/ModelVillagerPony.java b/src/main/java/com/brohoof/minelittlepony/model/pony/ModelVillagerPony.java index c96793dc..1abb1613 100644 --- a/src/main/java/com/brohoof/minelittlepony/model/pony/ModelVillagerPony.java +++ b/src/main/java/com/brohoof/minelittlepony/model/pony/ModelVillagerPony.java @@ -35,24 +35,6 @@ public class ModelVillagerPony extends ModelPlayerPony { 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 protected void renderBody() { super.renderBody(); @@ -88,6 +70,12 @@ public class ModelVillagerPony extends ModelPlayerPony { this.VillagerBagPiece[13] = new PlaneRenderer(this, 56, 31); this.VillagerApron = new PlaneRenderer(this, 56, 16); 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 diff --git a/src/main/java/com/brohoof/minelittlepony/renderer/RenderPonySkeleton.java b/src/main/java/com/brohoof/minelittlepony/renderer/RenderPonySkeleton.java index 7df286bf..5362d463 100644 --- a/src/main/java/com/brohoof/minelittlepony/renderer/RenderPonySkeleton.java +++ b/src/main/java/com/brohoof/minelittlepony/renderer/RenderPonySkeleton.java @@ -21,8 +21,8 @@ public class RenderPonySkeleton extends RenderPonyMob { addLayer(new LayerBipedArmor(this) { @Override protected void initArmor() { - this.field_177189_c = PMAPI.skeleton.getArmor().modelArmor; - this.field_177186_d = PMAPI.skeleton.getArmor().modelArmorChestplate; + this.modelLeggings = PMAPI.skeleton.getArmor().modelArmor; + this.modelArmor = PMAPI.skeleton.getArmor().modelArmorChestplate; } }); }