mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-30 07:57:59 +01:00
Merging together @PolyacovYury and @Sollace's visions on saddlebags. (#69)
This commit is contained in:
parent
8be2f2fa39
commit
845f3536ad
4 changed files with 38 additions and 27 deletions
|
@ -47,7 +47,7 @@ public final class PonyModelConstants {
|
||||||
HORN_Z = HEAD_CENTRE_Z - 1.5F,
|
HORN_Z = HEAD_CENTRE_Z - 1.5F,
|
||||||
|
|
||||||
LEFT_WING_EXT_RP_X = 4.5F,
|
LEFT_WING_EXT_RP_X = 4.5F,
|
||||||
LEFT_WING_EXT_RP_Y = 6,
|
LEFT_WING_EXT_RP_Y = 5.3F,
|
||||||
LEFT_WING_EXT_RP_Z = 6,
|
LEFT_WING_EXT_RP_Z = 6,
|
||||||
|
|
||||||
LEFT_WING_ROTATE_ANGLE_Z_SNEAK = 4,
|
LEFT_WING_ROTATE_ANGLE_Z_SNEAK = 4,
|
||||||
|
|
|
@ -4,7 +4,9 @@ import static com.minelittlepony.model.PonyModelConstants.*;
|
||||||
|
|
||||||
import com.minelittlepony.model.AbstractPonyModel;
|
import com.minelittlepony.model.AbstractPonyModel;
|
||||||
import com.minelittlepony.model.capabilities.IModelPegasus;
|
import com.minelittlepony.model.capabilities.IModelPegasus;
|
||||||
|
import com.minelittlepony.pony.data.PonyWearable;
|
||||||
import com.minelittlepony.render.PonyRenderer;
|
import com.minelittlepony.render.PonyRenderer;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
|
||||||
public class ModelWing {
|
public class ModelWing {
|
||||||
|
|
||||||
|
@ -13,18 +15,14 @@ public class ModelWing {
|
||||||
private final PonyRenderer extended;
|
private final PonyRenderer extended;
|
||||||
private final PonyRenderer folded;
|
private final PonyRenderer folded;
|
||||||
|
|
||||||
public <T extends AbstractPonyModel & IModelPegasus> ModelWing(T pegasus, boolean right, float y, float scale, int texX, int texY) {
|
public <T extends AbstractPonyModel & IModelPegasus> ModelWing(T pegasus, boolean right, boolean legacy, float y, float scale, int texX, int texY) {
|
||||||
this.pegasus = pegasus;
|
this.pegasus = pegasus;
|
||||||
|
|
||||||
if (right) {
|
folded = new PonyRenderer(pegasus, 56, texY).mirror(legacy);
|
||||||
texX ++;
|
|
||||||
}
|
|
||||||
|
|
||||||
folded = new PonyRenderer(pegasus, 56, texY);
|
|
||||||
extended = new PonyRenderer(pegasus, texX, texY + 3);
|
extended = new PonyRenderer(pegasus, texX, texY + 3);
|
||||||
|
|
||||||
addClosedWing(right, y, scale);
|
addClosedWing(right, y, scale);
|
||||||
addFeathers(right, y, scale);
|
addFeathers(right, legacy, y, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addClosedWing(boolean right, float y, float scale) {
|
private void addClosedWing(boolean right, float y, float scale) {
|
||||||
|
@ -37,20 +35,21 @@ public class ModelWing {
|
||||||
.rotateAngleX = ROTATE_90;
|
.rotateAngleX = ROTATE_90;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addFeathers(boolean right, float rotationPointY, float scale) {
|
private void addFeathers(boolean right, boolean l, float rotationPointY, float scale) {
|
||||||
float r = right ? -1 : 1;
|
float r = right ? -1 : 1;
|
||||||
|
|
||||||
extended.around(r * LEFT_WING_EXT_RP_X, LEFT_WING_EXT_RP_Y + rotationPointY, LEFT_WING_EXT_RP_Z);
|
extended.around(r * LEFT_WING_EXT_RP_X, LEFT_WING_EXT_RP_Y + rotationPointY, LEFT_WING_EXT_RP_Z)
|
||||||
addFeather(0, 6, 0, 8, scale + 0.1F);
|
.rotateAngleY = r * 3;
|
||||||
addFeather(1, -1.2F, -0.2F, 8, scale + 0.2F) .rotateAngleX = -0.85F;
|
addFeather(0, l, 6, 0, 8, scale + 0.1F);
|
||||||
addFeather(2, 1.8F, 1.3F, 8, scale + 0.1F) .rotateAngleX = -0.75F;
|
addFeather(1, l, -1, -0.3F, 8, scale + 0.1F) .rotateAngleX = -0.85F;
|
||||||
addFeather(3, 5, 2, 8, scale) .rotateAngleX = -0.5F;
|
addFeather(2, l, 1.8F, 1.3F, 8, scale - 0.1F) .rotateAngleX = -0.75F;
|
||||||
addFeather(4, 0, -0.2F, 6, scale + 0.3F);
|
addFeather(3, l, 5, 2, 8, scale) .rotateAngleX = -0.5F;
|
||||||
addFeather(5, 0, 0.2F, 3, scale + 0.19F).rotateAngleX = -0.85F;
|
addFeather(4, l, 0, -0.2F, 6, scale + 0.3F);
|
||||||
|
addFeather(5, l, 0, 0, 3, scale + 0.19F).rotateAngleX = -0.85F;
|
||||||
}
|
}
|
||||||
|
|
||||||
private PonyRenderer addFeather(int i, float y, float z, int h, float scale) {
|
private PonyRenderer addFeather(int i, boolean l, float y, float z, int h, float scale) {
|
||||||
return extended.child(i).around(0, 0, 0).box(0, y, z, 1, h, 2, scale);
|
return extended.child(i).around(0, 0, 0).mirror(l).box(-0.5F, y, z, 1, h, 2, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rotateWalking(float swing) {
|
public void rotateWalking(float swing) {
|
||||||
|
@ -62,11 +61,18 @@ public class ModelWing {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(float scale) {
|
public void render(float scale) {
|
||||||
extended.rotateAngleY = 3;
|
|
||||||
if (pegasus.wingsAreOpen()) {
|
if (pegasus.wingsAreOpen()) {
|
||||||
extended.render(scale);
|
extended.render(scale);
|
||||||
} else {
|
} else {
|
||||||
|
boolean bags = pegasus.isWearing(PonyWearable.SADDLE_BAGS);
|
||||||
|
if (bags) {
|
||||||
|
GlStateManager.pushMatrix();
|
||||||
|
GlStateManager.translate(0, 0, 0.198F);
|
||||||
|
}
|
||||||
folded.render(scale);
|
folded.render(scale);
|
||||||
|
if (bags) {
|
||||||
|
GlStateManager.popMatrix();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,10 +28,10 @@ public class PegasusWings<T extends AbstractPonyModel & IModelPegasus> implement
|
||||||
public void init(float yOffset, float stretch) {
|
public void init(float yOffset, float stretch) {
|
||||||
int x = 57;
|
int x = 57;
|
||||||
|
|
||||||
leftWing = new ModelWing(pegasus, false, yOffset, stretch, x, 32);
|
leftWing = new ModelWing(pegasus, false, false, yOffset, stretch, x, 32);
|
||||||
rightWing = new ModelWing(pegasus, true, yOffset, stretch, x, 16);
|
rightWing = new ModelWing(pegasus, true, false, yOffset, stretch, x - 1, 16);
|
||||||
|
|
||||||
legacyWing = new ModelWing(pegasus, true, yOffset, stretch, x - 1, 32);
|
legacyWing = new ModelWing(pegasus, true, true, yOffset, stretch, x, 32);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModelWing getLeft() {
|
public ModelWing getLeft() {
|
||||||
|
@ -63,8 +63,8 @@ public class PegasusWings<T extends AbstractPonyModel & IModelPegasus> implement
|
||||||
|
|
||||||
if (pegasus.wingsAreOpen()) {
|
if (pegasus.wingsAreOpen()) {
|
||||||
float flapAngle = pegasus.getWingRotationFactor(ticks);
|
float flapAngle = pegasus.getWingRotationFactor(ticks);
|
||||||
if (pegasus.isWearing(PonyWearable.SADDLE_BAGS)) {
|
if (!pegasus.isCrouching() && pegasus.isWearing(PonyWearable.SADDLE_BAGS)) {
|
||||||
flapAngle -= 0.6F;
|
flapAngle -= 1F;
|
||||||
}
|
}
|
||||||
getLeft().rotateFlying(flapAngle);
|
getLeft().rotateFlying(flapAngle);
|
||||||
getRight().rotateFlying(-flapAngle);
|
getRight().rotateFlying(-flapAngle);
|
||||||
|
|
|
@ -40,7 +40,13 @@ public class SaddleBags implements IModelPart {
|
||||||
.tex(56, 31).addTopPlane(0, 0, 0, 8, 1, stretch)
|
.tex(56, 31).addTopPlane(0, 0, 0, 8, 1, stretch)
|
||||||
.addTopPlane(0, 0, 1, 8, 1, stretch)
|
.addTopPlane(0, 0, 1, 8, 1, stretch)
|
||||||
.addBackPlane(0, 0, 2, 8, 1, stretch)
|
.addBackPlane(0, 0, 2, 8, 1, stretch)
|
||||||
.addFrontPlane(0, 0, 0, 8, 1, stretch);
|
.addFrontPlane(0, 0, 0, 8, 1, stretch)
|
||||||
|
.child(0).offset(0, -3, -0.305F).tex(56, 31)
|
||||||
|
.addWestPlane(4.0002F, 0, 0, 1, 3, stretch) // 0.0001 is there
|
||||||
|
.addWestPlane(4.0002F, -1, 0, 1, 3, stretch) // otherwise straps
|
||||||
|
.addWestPlane(-4.0002F, 0, 0, 1, 3, stretch) // clip into the body
|
||||||
|
.addWestPlane(-4.0002F, -1, 0, 1, 3, stretch)
|
||||||
|
.rotateAngleX = ROTATE_270;
|
||||||
|
|
||||||
leftBag.offset(x, y, z).around(0, 4, 4)
|
leftBag.offset(x, y, z).around(0, 4, 4)
|
||||||
.tex(56, 25).addBackPlane(0, 0, 0, 3, 6, stretch)
|
.tex(56, 25).addBackPlane(0, 0, 0, 3, 6, stretch)
|
||||||
|
@ -104,11 +110,10 @@ public class SaddleBags implements IModelPart {
|
||||||
|
|
||||||
leftBag.render(scale);
|
leftBag.render(scale);
|
||||||
rightBag.render(scale);
|
rightBag.render(scale);
|
||||||
strap.render(scale);
|
|
||||||
|
|
||||||
if (hangLow) {
|
if (hangLow) {
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
}
|
}
|
||||||
|
strap.render(scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue