From cea9419fb67ff6b40f013323ed833ce8f3f37f30 Mon Sep 17 00:00:00 2001 From: Sollace Date: Fri, 17 Aug 2018 22:46:28 +0200 Subject: [PATCH] Some spring cleaning --- .../model/AbstractPonyModel.java | 22 +++++++++---------- .../minelittlepony/model/ModelWrapper.java | 3 +-- .../model/components/PonyTail.java | 2 +- .../minelittlepony/posture/package-info.java | 7 ------ .../minelittlepony/render/RenderPonyMob.java | 2 -- .../util/coordinates/Color.java | 8 +++---- .../minelittlepony/util/coordinates/Quad.java | 2 +- .../util/coordinates/Vertex.java | 11 ++-------- 8 files changed, 20 insertions(+), 37 deletions(-) delete mode 100644 src/main/java/com/minelittlepony/posture/package-info.java diff --git a/src/main/java/com/minelittlepony/model/AbstractPonyModel.java b/src/main/java/com/minelittlepony/model/AbstractPonyModel.java index cb643a86..fdba4bff 100644 --- a/src/main/java/com/minelittlepony/model/AbstractPonyModel.java +++ b/src/main/java/com/minelittlepony/model/AbstractPonyModel.java @@ -104,8 +104,8 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel { super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity); - float headRotateAngleY = isSleeping ? 1.4f : headYaw / 57.29578F; - float headRotateAngleX = isSleeping ? 0.1f : headPitch / 57.29578F; + float headRotateAngleY = isSleeping() ? 1.4f : headYaw / 57.29578F; + float headRotateAngleX = isSleeping() ? 0.1f : headPitch / 57.29578F; headRotateAngleX = Math.min(headRotateAngleX, (float) (0.5f - Math.toRadians(motionPitch))); headRotateAngleX = Math.max(headRotateAngleX, (float) (-1.25f - Math.toRadians(motionPitch))); @@ -115,7 +115,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel { shakeBody(move, swing, getWobbleAmount(), ticks); rotateLegs(move, swing, ticks, entity); - if (!isSwimming && !rainboom) { + if (!isSwimming() && !rainboom) { holdItem(swing); } swingItem(entity); @@ -178,7 +178,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel { * @param ticks Total whole and partial ticks since the entity's existance. Used in animations together with {@code swing} and {@code move}. */ protected void shakeBody(float move, float swing, float bodySwing, float ticks) { - tail.setRotationAndAngles(isSwimming || rainboom, move, swing, bodySwing * 5, ticks); + tail.setRotationAndAngles(isSwimming() || rainboom, move, swing, bodySwing * 5, ticks); upperTorso.rotateAngleY = bodySwing; bipedBody.rotateAngleY = bodySwing; @@ -349,7 +349,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel { } protected float getLegOutset() { - if (isSleeping) return 3.6f; + if (isSleeping()) return 3.6f; if (isCrouching()) return 1; return 5; } @@ -382,13 +382,13 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel { switch (pose) { case ITEM: float swag = 1; - if (!isFlying && both) { + if (!isFlying() && both) { swag -= (float)Math.pow(swing, 2); } float mult = 1 - swag/2; arm.rotateAngleX = arm.rotateAngleX * mult - (PI / 10) * swag; arm.rotateAngleZ = -reflect * (PI / 15); - if (isSneak) { + if (isCrouching()) { arm.rotationPointX -= reflect * 2; } case EMPTY: @@ -399,7 +399,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel { arm.rotateAngleY = reflect * PI / 9; arm.rotationPointX += reflect; arm.rotationPointZ += 3; - if (isSneak) { + if (isCrouching()) { arm.rotationPointY += 4; } break; @@ -426,7 +426,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel { * @param entity The entity we are being called for. */ protected void swingItem(Entity entity) { - if (swingProgress > 0 && !isSleeping) { + if (swingProgress > 0 && !isSleeping()) { EnumHandSide mainSide = getMainHand(entity); swingArm(getArmForSide(mainSide)); @@ -457,7 +457,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel { * @param ticks Total whole and partial ticks since the entity's existance. Used in animations together with {@code swing} and {@code move}. */ protected void swingArms(float ticks) { - if (isSleeping) return; + if (isSleeping()) return; float cos = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F; float sin = MathHelper.sin(ticks * 0.067F) * 0.05F; @@ -841,7 +841,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel { public void transform(BodyPart part) { if (isRiding()) translate(0, -0.4F, -0.2F); - if (isSleeping) { + if (isSleeping()) { rotate(90, 1, 0, 0); rotate(180, 0, 1, 0); } diff --git a/src/main/java/com/minelittlepony/model/ModelWrapper.java b/src/main/java/com/minelittlepony/model/ModelWrapper.java index 28a887dc..993a41f1 100644 --- a/src/main/java/com/minelittlepony/model/ModelWrapper.java +++ b/src/main/java/com/minelittlepony/model/ModelWrapper.java @@ -19,7 +19,7 @@ public class ModelWrapper implements IModelWrapper { public ModelWrapper(AbstractPonyModel model) { body = model; armor = model.createArmour(); - armor.apply(model.metadata); + armor.apply(model.getMetadata()); } public AbstractPonyModel getBody() { @@ -28,7 +28,6 @@ public class ModelWrapper implements IModelWrapper { /** * Returns the contained armour model. - * @return */ public IEquestrianArmor getArmor() { return armor; diff --git a/src/main/java/com/minelittlepony/model/components/PonyTail.java b/src/main/java/com/minelittlepony/model/components/PonyTail.java index 8eee9088..09f0cf92 100644 --- a/src/main/java/com/minelittlepony/model/components/PonyTail.java +++ b/src/main/java/com/minelittlepony/model/components/PonyTail.java @@ -58,7 +58,7 @@ public class PonyTail extends PlaneRenderer implements IModelPart { rotationPointZ++; } - tailStop = theModel.metadata.getTail().ordinal(); + tailStop = theModel.getMetadata().getTail().ordinal(); } private void swingX(float ticks) { diff --git a/src/main/java/com/minelittlepony/posture/package-info.java b/src/main/java/com/minelittlepony/posture/package-info.java deleted file mode 100644 index 5a8d20a1..00000000 --- a/src/main/java/com/minelittlepony/posture/package-info.java +++ /dev/null @@ -1,7 +0,0 @@ -@MethodsReturnNonnullByDefault -@ParametersAreNonnullByDefault -package com.minelittlepony.posture; - -import mcp.MethodsReturnNonnullByDefault; - -import javax.annotation.ParametersAreNonnullByDefault; diff --git a/src/main/java/com/minelittlepony/render/RenderPonyMob.java b/src/main/java/com/minelittlepony/render/RenderPonyMob.java index b98374ee..2b4fe37f 100644 --- a/src/main/java/com/minelittlepony/render/RenderPonyMob.java +++ b/src/main/java/com/minelittlepony/render/RenderPonyMob.java @@ -23,8 +23,6 @@ import javax.annotation.Nonnull; import java.util.List; -// TODO: A lot of this duplicates RenderPonyPlayer -// and is the whole reason we had this scaling bug in the first place. public abstract class RenderPonyMob extends RenderLiving implements IRenderPony { protected RenderPony renderPony = new RenderPony(this); diff --git a/src/main/java/com/minelittlepony/util/coordinates/Color.java b/src/main/java/com/minelittlepony/util/coordinates/Color.java index 915b910b..a5fcc211 100644 --- a/src/main/java/com/minelittlepony/util/coordinates/Color.java +++ b/src/main/java/com/minelittlepony/util/coordinates/Color.java @@ -3,19 +3,19 @@ package com.minelittlepony.util.coordinates; import net.minecraft.client.renderer.GlStateManager; public interface Color { - public static float r(int color) { + static float r(int color) { return (color >> 16 & 255) / 255F; } - public static float g(int color) { + static float g(int color) { return (color >> 8 & 255) / 255F; } - public static float b(int color) { + static float b(int color) { return (color & 255) / 255F; } - public static void glColor(int color, float alpha) { + static void glColor(int color, float alpha) { GlStateManager.color(Color.r(color), Color.g(color), Color.b(color), alpha); } } diff --git a/src/main/java/com/minelittlepony/util/coordinates/Quad.java b/src/main/java/com/minelittlepony/util/coordinates/Quad.java index ea43f510..02cdfb21 100644 --- a/src/main/java/com/minelittlepony/util/coordinates/Quad.java +++ b/src/main/java/com/minelittlepony/util/coordinates/Quad.java @@ -4,7 +4,7 @@ import net.minecraft.client.model.TexturedQuad; public class Quad extends TexturedQuad { - public Quad(Vertex[] vertices, int texcoordU1, int texcoordV1, int texcoordU2, int texcoordV2, float textureWidth, float textureHeight) { + Quad(Vertex[] vertices, int texcoordU1, int texcoordV1, int texcoordU2, int texcoordV2, float textureWidth, float textureHeight) { super(vertices, texcoordU1, texcoordV1, texcoordU2, texcoordV2, textureWidth, textureHeight); } } \ No newline at end of file diff --git a/src/main/java/com/minelittlepony/util/coordinates/Vertex.java b/src/main/java/com/minelittlepony/util/coordinates/Vertex.java index c2a30a44..114f8992 100644 --- a/src/main/java/com/minelittlepony/util/coordinates/Vertex.java +++ b/src/main/java/com/minelittlepony/util/coordinates/Vertex.java @@ -4,11 +4,11 @@ import net.minecraft.client.model.PositionTextureVertex; public class Vertex extends PositionTextureVertex { - public Vertex(float x, float y, float z, int texX, int texY) { + Vertex(float x, float y, float z, int texX, int texY) { super(x, y, z, texX, texY); } - public Vertex(Vertex old, float texX, float texY) { + private Vertex(Vertex old, float texX, float texY) { super(old, texX, texY); } @@ -17,11 +17,4 @@ public class Vertex extends PositionTextureVertex { public Vertex setTexturePosition(float texX, float texY) { return new Vertex(this, texX, texY); } - - /** - * Creates a new vertex mapping the given (x, y, z) coordinates to a texture offset. - */ - public static Vertex vert(float x, float y, float z, int texX, int texY) { - return new Vertex(x, y, z, texX, texY); - } }