From b6242902f6a06bf33711764266dadbca25191816 Mon Sep 17 00:00:00 2001 From: PolyacovYury Date: Mon, 4 Jun 2018 03:11:14 +0300 Subject: [PATCH] So THAT's how it works... --- .../model/components/ModelWing.java | 8 ++-- .../model/components/PegasusWings.java | 13 +++--- .../model/components/PonyAccessory.java | 42 +++++++++---------- .../model/player/ModelEarthPony.java | 4 +- .../minelittlepony/pony/data/PonyData.java | 1 + 5 files changed, 33 insertions(+), 35 deletions(-) diff --git a/src/main/java/com/minelittlepony/model/components/ModelWing.java b/src/main/java/com/minelittlepony/model/components/ModelWing.java index 2145f564..b4026b7d 100644 --- a/src/main/java/com/minelittlepony/model/components/ModelWing.java +++ b/src/main/java/com/minelittlepony/model/components/ModelWing.java @@ -51,11 +51,13 @@ public class ModelWing { } - public void render(boolean extend, float scale) { + public void render(boolean hasBags, boolean extend, float scale) { extended.rotationPointX = (mirror ? -1 : 1) * LEFT_WING_EXT_RP_X; - extended.rotationPointY = LEFT_WING_EXT_RP_Y; - + extended.rotationPointY = LEFT_WING_EXT_RP_Y + (hasBags ? -1f : 0f); + extended.rotationPointZ = LEFT_WING_EXT_RP_Z + (hasBags ? 1f : 0f); extended.rotateAngleY = 3; + + folded.offset((hasBags ? (mirror ? -0.5f : 0.5f) : 0f), (hasBags ? -0.5f : 0f), (hasBags ? -1.5f : 0f)); if (extend) { extended.render(scale); } else { diff --git a/src/main/java/com/minelittlepony/model/components/PegasusWings.java b/src/main/java/com/minelittlepony/model/components/PegasusWings.java index 249ef669..4a4e69c7 100644 --- a/src/main/java/com/minelittlepony/model/components/PegasusWings.java +++ b/src/main/java/com/minelittlepony/model/components/PegasusWings.java @@ -18,10 +18,8 @@ public class PegasusWings implements IModelPart { public PegasusWings(T model, float yOffset, float stretch) { pegasus = model; - boolean hasBags = ((AbstractPonyModel) pegasus).metadata.hasBags(); - if (hasBags) yOffset -= 12f; - leftWing = new ModelWing(model, false, 4f - (hasBags ? -0.5f : 0f), yOffset, stretch, 32); - rightWing = new ModelWing(model, true, (hasBags ? -0.5f : 0f) - 6f, yOffset, stretch, hasBags ? 32 : 16); + leftWing = new ModelWing(model, false, 4f, yOffset, stretch, 32); + rightWing = new ModelWing(model, true, -6f, yOffset, stretch, 16); } @@ -70,10 +68,11 @@ public class PegasusWings implements IModelPart { @Override public void render(float scale) { AbstractPonyModel model = ((AbstractPonyModel) pegasus); - if (!model.metadata.hasBags() || model.textureHeight == 64) { + boolean hasBags = model.metadata.hasBags(); + if (!hasBags || model.textureHeight == 64) { boolean standing = pegasus.wingsAreOpen(); - leftWing.render(standing, scale); - rightWing.render(standing, scale); + leftWing.render(hasBags, standing, scale); + rightWing.render(hasBags, standing, scale); } } } diff --git a/src/main/java/com/minelittlepony/model/components/PonyAccessory.java b/src/main/java/com/minelittlepony/model/components/PonyAccessory.java index 75e61774..40e9e2cd 100644 --- a/src/main/java/com/minelittlepony/model/components/PonyAccessory.java +++ b/src/main/java/com/minelittlepony/model/components/PonyAccessory.java @@ -17,28 +17,26 @@ public class PonyAccessory implements IModelPart { public PonyAccessory(T model, float yOffset, float stretch) { theModel = model; - if (theModel.metadata.hasBags()) { - bag = new PlaneRenderer(theModel, 56, 19); - bag.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z) - .around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z) - .tex(56, 25).addBackPlane(-7, -5, -4, 3, 6, stretch) //right bag front - .addBackPlane( 4, -5, -4, 3, 6, stretch) //left bag front - .tex(59, 25).addBackPlane(-7, -5, 4, 3, 6, stretch) //right bag back - .addBackPlane( 4, -5, 4, 3, 6, stretch) //left bag back - .tex(56, 19).addWestPlane(-7, -5, -4, 6, 8, stretch) //right bag outside - .addWestPlane( 7, -5, -4, 6, 8, stretch) //left bag outside - .addWestPlane(-4.01f, -5, -4, 6, 8, stretch) //right bag inside - .addWestPlane( 4.01f, -5, -4, 6, 8, stretch) //left bag inside - .tex(56, 31) .addTopPlane(-4, -4.5F, -1, 8, 1, stretch) //strap front - .addTopPlane(-4, -4.5F, 0, 8, 1, stretch) //strap back - .addBackPlane(-4, -4.5F, 0, 8, 1, stretch) - .addFrontPlane(-4, -4.5F, 0, 8, 1, stretch) - .child(0).tex(56, 16).addTopPlane(2, -5, -13, 8, 3, stretch) //left bag top - .flipZ().addTopPlane(2, -5, -2, 8, 3, stretch) //right bag top - .tex(56, 22).addBottomPlane(2, 1, -13, 8, 3, stretch) //left bag bottom - .flipZ().addBottomPlane(2, 1, -2, 8, 3, stretch) //right bag bottom - .rotateAngleY = 4.712389F; - } + bag = new PlaneRenderer(theModel, 56, 19); + bag.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z) + .around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z) + .tex(56, 25).addBackPlane(-7, -5, -4, 3, 6, stretch) //right bag front + .addBackPlane( 4, -5, -4, 3, 6, stretch) //left bag front + .tex(59, 25).addBackPlane(-7, -5, 4, 3, 6, stretch) //right bag back + .addBackPlane( 4, -5, 4, 3, 6, stretch) //left bag back + .tex(56, 19).addWestPlane(-7, -5, -4, 6, 8, stretch) //right bag outside + .addWestPlane( 7, -5, -4, 6, 8, stretch) //left bag outside + .addWestPlane(-4.01f, -5, -4, 6, 8, stretch) //right bag inside + .addWestPlane( 4.01f, -5, -4, 6, 8, stretch) //left bag inside + .tex(56, 31) .addTopPlane(-4, -4.5F, -1, 8, 1, stretch) //strap front + .addTopPlane(-4, -4.5F, 0, 8, 1, stretch) //strap back + .addBackPlane(-4, -4.5F, 0, 8, 1, stretch) + .addFrontPlane(-4, -4.5F, 0, 8, 1, stretch) + .child(0).tex(56, 16).addTopPlane(2, -5, -13, 8, 3, stretch) //left bag top + .flipZ().addTopPlane(2, -5, -2, 8, 3, stretch) //right bag top + .tex(56, 22).addBottomPlane(2, 1, -13, 8, 3, stretch) //left bag bottom + .flipZ().addBottomPlane(2, 1, -2, 8, 3, stretch) //right bag bottom + .rotateAngleY = 4.712389F; } @Override diff --git a/src/main/java/com/minelittlepony/model/player/ModelEarthPony.java b/src/main/java/com/minelittlepony/model/player/ModelEarthPony.java index 1081a4fd..5a189ee5 100644 --- a/src/main/java/com/minelittlepony/model/player/ModelEarthPony.java +++ b/src/main/java/com/minelittlepony/model/player/ModelEarthPony.java @@ -21,9 +21,7 @@ public class ModelEarthPony extends AbstractPonyModel { @Override public void init(float yOffset, float stretch) { super.init(yOffset, stretch); - if (metadata.hasAccessory()) { - accessory = new PonyAccessory(this, yOffset, stretch); - } + accessory = new PonyAccessory(this, yOffset, stretch); } @Override diff --git a/src/main/java/com/minelittlepony/pony/data/PonyData.java b/src/main/java/com/minelittlepony/pony/data/PonyData.java index 9d9530d8..69145193 100644 --- a/src/main/java/com/minelittlepony/pony/data/PonyData.java +++ b/src/main/java/com/minelittlepony/pony/data/PonyData.java @@ -84,6 +84,7 @@ public class PonyData implements IPonyData { .add("gender", gender) .add("size", size) .add("glowColor", "#" + Integer.toHexString(glowColor)) + .add("accessory", accessory) .toString(); }