mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-26 06:18:00 +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!
|
#Build Number for ANT. Do not edit!
|
||||||
#Sat Jun 02 16:08:02 MSK 2018
|
#Tue Apr 10 14:03:42 CAT 2018
|
||||||
build.number=498
|
build.number=497
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package com.minelittlepony.model.components;
|
package com.minelittlepony.model.components;
|
||||||
|
|
||||||
import com.minelittlepony.model.AbstractPonyModel;
|
import com.minelittlepony.model.AbstractPonyModel;
|
||||||
|
import com.minelittlepony.model.capabilities.IModelPart;
|
||||||
import com.minelittlepony.render.plane.PlaneRenderer;
|
import com.minelittlepony.render.plane.PlaneRenderer;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
import static com.minelittlepony.model.PonyModelConstants.*;
|
import static com.minelittlepony.model.PonyModelConstants.*;
|
||||||
|
|
||||||
public class PonyAccessory {
|
public class PonyAccessory implements IModelPart {
|
||||||
|
|
||||||
private final AbstractPonyModel theModel;
|
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) {
|
@Override
|
||||||
float angleY = 0;
|
public void init(float yOffset, float stretch) {
|
||||||
if (theModel.swingProgress > -9990.0F && !theModel.metadata.hasMagic()) {
|
if (bag != null && theModel.metadata.hasBags()) {
|
||||||
angleY = MathHelper.sin(MathHelper.sqrt(theModel.swingProgress) * PI * 2) * 0.02F;
|
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) {
|
public void render(float scale) {
|
||||||
|
@ -35,28 +62,4 @@ public class PonyAccessory {
|
||||||
bag.render(scale);
|
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,22 +19,25 @@ public class ModelEarthPony extends AbstractPonyModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
public void init(float yOffset, float stretch) {
|
||||||
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
super.init(yOffset, stretch);
|
||||||
|
|
||||||
if (bipedCape != null) {
|
|
||||||
bipedCape.rotationPointY = isSneak ? 2 : isRiding ? -4 : 0;
|
|
||||||
}
|
|
||||||
if (accessory != null && metadata.hasAccessory()) {
|
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
|
@Override
|
||||||
protected void renderBody(Entity entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) {
|
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);
|
super.renderBody(entity, move, swing, ticks, headYaw, headPitch, scale);
|
||||||
|
|
||||||
bipedBody.postRender(this.scale);
|
|
||||||
if (accessory != null && metadata.hasAccessory()) {
|
if (accessory != null && metadata.hasAccessory()) {
|
||||||
accessory.render(scale);
|
accessory.render(scale);
|
||||||
}
|
}
|
||||||
|
@ -49,11 +52,11 @@ public class ModelEarthPony extends AbstractPonyModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initPositions(float yOffset, float stretch) {
|
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
|
||||||
super.initPositions(yOffset, stretch);
|
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
|
||||||
|
|
||||||
if (accessory != null && metadata.hasAccessory()) {
|
if (bipedCape != null) {
|
||||||
accessory.initPositions(yOffset, stretch);
|
bipedCape.rotationPointY = isSneak ? 2 : isRiding ? -4 : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue