mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-12-01 16:27:59 +01:00
First (tecnically - third) iteration on saddlebags. Waiting for resolution on right wing issue
This commit is contained in:
parent
d3efbc5c05
commit
5cb230aea8
6 changed files with 92 additions and 3 deletions
|
@ -1,3 +1,3 @@
|
|||
#Build Number for ANT. Do not edit!
|
||||
#Tue Apr 10 14:03:42 CAT 2018
|
||||
build.number=497
|
||||
#Sat Jun 02 16:08:02 MSK 2018
|
||||
build.number=498
|
||||
|
|
|
@ -3,13 +3,18 @@ package com.minelittlepony.model.player;
|
|||
import com.minelittlepony.model.AbstractPonyModel;
|
||||
import com.minelittlepony.render.PonyRenderer;
|
||||
|
||||
import com.minelittlepony.render.plane.PlaneRenderer;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
||||
import static com.minelittlepony.model.PonyModelConstants.*;
|
||||
|
||||
public class ModelEarthPony extends AbstractPonyModel {
|
||||
|
||||
private final boolean smallArms;
|
||||
|
||||
public PonyRenderer bipedCape;
|
||||
public PlaneRenderer bag;
|
||||
|
||||
public ModelEarthPony(boolean smallArms) {
|
||||
super(smallArms);
|
||||
|
@ -23,6 +28,59 @@ public class ModelEarthPony extends AbstractPonyModel {
|
|||
if (bipedCape != null) {
|
||||
bipedCape.rotationPointY = isSneak ? 2 : isRiding ? -4 : 0;
|
||||
}
|
||||
if (bag != null && metadata.hasBags()) {
|
||||
float angleY = 0;
|
||||
if (swingProgress > -9990.0F && !metadata.hasMagic()) {
|
||||
angleY = MathHelper.sin(MathHelper.sqrt(swingProgress) * PI * 2) * 0.02F;
|
||||
}
|
||||
bag.rotateAngleY = angleY;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void renderBody(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
||||
super.renderBody(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||
|
||||
bipedBody.postRender(this.scale);
|
||||
if (bag != null && metadata.hasBags()) {
|
||||
bag.render(scale);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initTextures() {
|
||||
super.initTextures();
|
||||
if (metadata.hasBags()) {
|
||||
bag = new PlaneRenderer(this, 56, 19);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initPositions(float yOffset, float stretch) {
|
||||
super.initPositions(yOffset, stretch);
|
||||
|
||||
if (bag == null || !metadata.hasBags()) {
|
||||
return;
|
||||
}
|
||||
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
|
||||
.addTopPlane(2, -5, -2, 8, 3, stretch) //right bag top
|
||||
.tex(56, 22).flipZ().addBottomPlane(2, 1, -13, 8, 3, stretch) //left bag bottom
|
||||
.flipZ().addBottomPlane(2, 1, -2, 8, 3, stretch) //right bag bottom
|
||||
.rotateAngleY = 4.712389F;
|
||||
}
|
||||
|
||||
protected float getLegOutset() {
|
||||
|
|
|
@ -35,4 +35,9 @@ public interface IPonyData extends IMetadataSection {
|
|||
* Returns true if and only if this metadata represents a pony that can cast magic.
|
||||
*/
|
||||
boolean hasMagic();
|
||||
|
||||
/**
|
||||
* Returns true if and only if this metadata represents a pony that has bags.
|
||||
*/
|
||||
boolean hasBags();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package com.minelittlepony.pony.data;
|
||||
|
||||
public enum PonyAccessory implements ITriggerPixelMapped<PonyAccessory> {
|
||||
|
||||
SADDLEBAGS(0x442300),
|
||||
NONE(0);
|
||||
|
||||
private int triggerValue;
|
||||
|
||||
PonyAccessory(int pixel) {
|
||||
triggerValue = pixel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTriggerPixel() {
|
||||
return triggerValue;
|
||||
}
|
||||
}
|
|
@ -18,6 +18,7 @@ public class PonyData implements IPonyData {
|
|||
private final PonyGender gender;
|
||||
private final PonySize size;
|
||||
private final int glowColor;
|
||||
private final PonyAccessory accessory;
|
||||
|
||||
public PonyData() {
|
||||
race = PonyRace.HUMAN;
|
||||
|
@ -25,6 +26,7 @@ public class PonyData implements IPonyData {
|
|||
gender = PonyGender.MARE;
|
||||
size = PonySize.NORMAL;
|
||||
glowColor = 0x4444aa;
|
||||
accessory = PonyAccessory.NONE;
|
||||
}
|
||||
|
||||
private PonyData(BufferedImage image) {
|
||||
|
@ -33,6 +35,7 @@ public class PonyData implements IPonyData {
|
|||
size = TriggerPixels.SIZE.readValue(image);
|
||||
gender = TriggerPixels.GENDER.readValue(image);
|
||||
glowColor = TriggerPixels.GLOW.readColor(image, -1);
|
||||
accessory = TriggerPixels.ACCESSORY.readValue(image);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -60,6 +63,10 @@ public class PonyData implements IPonyData {
|
|||
return glowColor;
|
||||
}
|
||||
|
||||
public boolean hasBags() {
|
||||
return accessory == PonyAccessory.SADDLEBAGS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasMagic() {
|
||||
return race != null && race.hasHorn() && glowColor != 0;
|
||||
|
|
|
@ -12,7 +12,8 @@ public enum TriggerPixels {
|
|||
TAIL(TailLengths.FULL, 1, 0),
|
||||
GENDER(PonyGender.MARE, 2, 0),
|
||||
SIZE(PonySize.LARGE, 3, 0),
|
||||
GLOW(null, 0, 1);
|
||||
GLOW(null, 0, 1),
|
||||
ACCESSORY(PonyAccessory.NONE, 0, 2);
|
||||
|
||||
private int x;
|
||||
private int y;
|
||||
|
|
Loading…
Reference in a new issue