So THAT's how it works...

This commit is contained in:
PolyacovYury 2018-06-04 03:11:14 +03:00
parent 646e26985a
commit b6242902f6
5 changed files with 33 additions and 35 deletions

View file

@ -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.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; extended.rotateAngleY = 3;
folded.offset((hasBags ? (mirror ? -0.5f : 0.5f) : 0f), (hasBags ? -0.5f : 0f), (hasBags ? -1.5f : 0f));
if (extend) { if (extend) {
extended.render(scale); extended.render(scale);
} else { } else {

View file

@ -18,10 +18,8 @@ public class PegasusWings implements IModelPart {
public <T extends AbstractPonyModel & IModelPegasus> PegasusWings(T model, float yOffset, float stretch) { public <T extends AbstractPonyModel & IModelPegasus> PegasusWings(T model, float yOffset, float stretch) {
pegasus = model; pegasus = model;
boolean hasBags = ((AbstractPonyModel) pegasus).metadata.hasBags(); leftWing = new ModelWing(model, false, 4f, yOffset, stretch, 32);
if (hasBags) yOffset -= 12f; rightWing = new ModelWing(model, true, -6f, yOffset, stretch, 16);
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);
} }
@ -70,10 +68,11 @@ public class PegasusWings implements IModelPart {
@Override @Override
public void render(float scale) { public void render(float scale) {
AbstractPonyModel model = ((AbstractPonyModel) pegasus); 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(); boolean standing = pegasus.wingsAreOpen();
leftWing.render(standing, scale); leftWing.render(hasBags, standing, scale);
rightWing.render(standing, scale); rightWing.render(hasBags, standing, scale);
} }
} }
} }

View file

@ -17,28 +17,26 @@ public class PonyAccessory implements IModelPart {
public <T extends AbstractPonyModel> PonyAccessory(T model, float yOffset, float stretch) { public <T extends AbstractPonyModel> PonyAccessory(T model, float yOffset, float stretch) {
theModel = model; theModel = model;
if (theModel.metadata.hasBags()) { bag = new PlaneRenderer(theModel, 56, 19);
bag = new PlaneRenderer(theModel, 56, 19); bag.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z)
bag.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z) .around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_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
.tex(56, 25).addBackPlane(-7, -5, -4, 3, 6, stretch) //right bag front .addBackPlane( 4, -5, -4, 3, 6, stretch) //left 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
.tex(59, 25).addBackPlane(-7, -5, 4, 3, 6, stretch) //right bag back .addBackPlane( 4, -5, 4, 3, 6, stretch) //left 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
.tex(56, 19).addWestPlane(-7, -5, -4, 6, 8, stretch) //right bag outside .addWestPlane( 7, -5, -4, 6, 8, stretch) //left 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) //right bag inside .addWestPlane( 4.01f, -5, -4, 6, 8, stretch) //left 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
.tex(56, 31) .addTopPlane(-4, -4.5F, -1, 8, 1, stretch) //strap front .addTopPlane(-4, -4.5F, 0, 8, 1, stretch) //strap back
.addTopPlane(-4, -4.5F, 0, 8, 1, stretch) //strap back .addBackPlane(-4, -4.5F, 0, 8, 1, stretch)
.addBackPlane(-4, -4.5F, 0, 8, 1, stretch) .addFrontPlane(-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
.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
.flipZ().addTopPlane(2, -5, -2, 8, 3, stretch) //right bag top .tex(56, 22).addBottomPlane(2, 1, -13, 8, 3, stretch) //left bag bottom
.tex(56, 22).addBottomPlane(2, 1, -13, 8, 3, stretch) //left bag bottom .flipZ().addBottomPlane(2, 1, -2, 8, 3, stretch) //right bag bottom
.flipZ().addBottomPlane(2, 1, -2, 8, 3, stretch) //right bag bottom .rotateAngleY = 4.712389F;
.rotateAngleY = 4.712389F;
}
} }
@Override @Override

View file

@ -21,9 +21,7 @@ public class ModelEarthPony extends AbstractPonyModel {
@Override @Override
public void init(float yOffset, float stretch) { public void init(float yOffset, float stretch) {
super.init(yOffset, stretch); super.init(yOffset, stretch);
if (metadata.hasAccessory()) { accessory = new PonyAccessory(this, yOffset, stretch);
accessory = new PonyAccessory(this, yOffset, stretch);
}
} }
@Override @Override

View file

@ -84,6 +84,7 @@ public class PonyData implements IPonyData {
.add("gender", gender) .add("gender", gender)
.add("size", size) .add("size", size)
.add("glowColor", "#" + Integer.toHexString(glowColor)) .add("glowColor", "#" + Integer.toHexString(glowColor))
.add("accessory", accessory)
.toString(); .toString();
} }