Accessory now implements IModelPart. Also that build.number managed to sheak in

This commit is contained in:
PolyacovYury 2018-06-04 01:50:46 +03:00
parent c556922286
commit d09a27553e
3 changed files with 50 additions and 44 deletions

View file

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Sat Jun 02 16:08:02 MSK 2018
build.number=498
#Tue Apr 10 14:03:42 CAT 2018
build.number=497

View file

@ -1,13 +1,14 @@
package com.minelittlepony.model.components;
import com.minelittlepony.model.AbstractPonyModel;
import com.minelittlepony.model.capabilities.IModelPart;
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 PonyAccessory {
public class PonyAccessory implements IModelPart {
private final AbstractPonyModel theModel;
@ -21,13 +22,39 @@ public class PonyAccessory {
}
}
public void setRotationAndAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
float angleY = 0;
if (theModel.swingProgress > -9990.0F && !theModel.metadata.hasMagic()) {
angleY = MathHelper.sin(MathHelper.sqrt(theModel.swingProgress) * PI * 2) * 0.02F;
@Override
public void init(float yOffset, float stretch) {
if (bag != null && theModel.metadata.hasBags()) {
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.rotateAngleY = angleY;
}
@Override // I really didn't know, what to do here, but since this has to be overridden...
public void setRotationAndAngles(boolean rainboom, float move, float swing, float bodySwing, float ticks) {
}
public void shakeBody(float bodySwing) {
if (bag != null && theModel.metadata.hasBags()) {
bag.rotateAngleY = bodySwing;
}
}
public void render(float scale) {
@ -35,28 +62,4 @@ public class PonyAccessory {
bag.render(scale);
}
}
public void initPositions(float yOffset, float stretch) {
if (bag != null && theModel.metadata.hasBags()) {
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;
}
}
}

View file

@ -19,22 +19,25 @@ public class ModelEarthPony extends AbstractPonyModel {
}
@Override
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
public void init(float yOffset, float stretch) {
super.init(yOffset, stretch);
if (bipedCape != null) {
bipedCape.rotationPointY = isSneak ? 2 : isRiding ? -4 : 0;
}
if (accessory != null && metadata.hasAccessory()) {
accessory.setRotationAndAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
accessory.init(yOffset, stretch);
}
}
@Override
protected void shakeBody(float move, float swing, float bodySwing, float ticks) {
super.shakeBody(move, swing, bodySwing, ticks);
if (accessory != null && metadata.hasAccessory()) {
accessory.shakeBody(bodySwing);
}
}
@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 (accessory != null && metadata.hasAccessory()) {
accessory.render(scale);
}
@ -49,11 +52,11 @@ public class ModelEarthPony extends AbstractPonyModel {
}
@Override
protected void initPositions(float yOffset, float stretch) {
super.initPositions(yOffset, stretch);
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
if (accessory != null && metadata.hasAccessory()) {
accessory.initPositions(yOffset, stretch);
if (bipedCape != null) {
bipedCape.rotationPointY = isSneak ? 2 : isRiding ? -4 : 0;
}
}