mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-25 22:07:59 +01:00
Accessory now implements IModelPart. Also that build.number managed to sheak in
This commit is contained in:
parent
c556922286
commit
d09a27553e
3 changed files with 50 additions and 44 deletions
|
@ -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
|
||||
|
|
|
@ -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,22 +22,8 @@ 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;
|
||||
}
|
||||
bag.rotateAngleY = angleY;
|
||||
|
||||
}
|
||||
|
||||
public void render(float scale) {
|
||||
if (bag != null && theModel.metadata.hasBags()) {
|
||||
bag.render(scale);
|
||||
}
|
||||
}
|
||||
|
||||
public void initPositions(float yOffset, float stretch) {
|
||||
@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)
|
||||
|
@ -53,10 +40,26 @@ public class PonyAccessory {
|
|||
.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().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 // 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) {
|
||||
if (bag != null && theModel.metadata.hasBags()) {
|
||||
bag.render(scale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue