diff --git a/src/main/java/com/minelittlepony/client/HorseCam.java b/src/main/java/com/minelittlepony/client/HorseCam.java index 9ebafbd4..24b8987e 100644 --- a/src/main/java/com/minelittlepony/client/HorseCam.java +++ b/src/main/java/com/minelittlepony/client/HorseCam.java @@ -77,7 +77,7 @@ public class HorseCam { MinecraftClient client = MinecraftClient.getInstance(); PlayerEntity player = client.player; client.gameRenderer.updateTargetedEntity(1); - HitResult hit = client.hitResult; + HitResult hit = client.crosshairTarget; // noop // Ignore misses, helps with bows, arrows, and projectiles diff --git a/src/main/java/com/minelittlepony/client/MineLittlePony.java b/src/main/java/com/minelittlepony/client/MineLittlePony.java index c8f46980..5cb6fd65 100644 --- a/src/main/java/com/minelittlepony/client/MineLittlePony.java +++ b/src/main/java/com/minelittlepony/client/MineLittlePony.java @@ -32,8 +32,7 @@ import net.minecraft.text.Style; import net.minecraft.text.TranslatableText; import net.minecraft.util.Formatting; import net.minecraft.util.Identifier; -import net.minecraft.util.SystemUtil; - +import net.minecraft.util.Util; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.lwjgl.glfw.GLFW; @@ -119,7 +118,7 @@ public class MineLittlePony implements ClientModInitializer { } else if (inGame) { long handle = client.window.getHandle(); - if ((SystemUtil.getMeasuringTimeMs() % 10) == 0) { + if ((Util.getMeasuringTimeMs() % 10) == 0) { if (InputUtil.isKeyPressed(handle, GLFW.GLFW_KEY_F3) && InputUtil.isKeyPressed(handle, GLFW.GLFW_KEY_M)) { if (!reloadingModels) { client.inGameHud.getChatHud().addMessage( diff --git a/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java b/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java index 877ee345..1acb4e39 100644 --- a/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java +++ b/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java @@ -10,7 +10,7 @@ import com.minelittlepony.client.util.render.Part; import com.minelittlepony.model.BodyPart; import com.minelittlepony.model.IPart; import com.minelittlepony.model.armour.IEquestrianArmour; -import net.minecraft.client.model.Cuboid; +import net.minecraft.client.model.ModelPart; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.util.Arm; @@ -80,17 +80,17 @@ public abstract class AbstractPonyModel extends ClientPo } else { adjustBody(BODY_ROT_X_NOTSNEAK, BODY_RP_Y_NOTSNEAK, BODY_RP_Z_NOTSNEAK); - rightLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK; - leftLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK; + rightLeg.pivotY = FRONT_LEG_RP_Y_NOTSNEAK; + leftLeg.pivotY = FRONT_LEG_RP_Y_NOTSNEAK; if (!attributes.isSleeping) { animateBreathing(ticks); } if (attributes.isSwimmingRotated) { - head.setRotationPoint(0, -2, -2); + head.setPivot(0, -2, -2); } else { - head.setRotationPoint(0, 0, 0); + head.setPivot(0, 0, 0); } } @@ -108,13 +108,13 @@ public abstract class AbstractPonyModel extends ClientPo */ protected void ponyCrouch() { adjustBody(BODY_ROT_X_SNEAK, BODY_RP_Y_SNEAK, BODY_RP_Z_SNEAK); - head.setRotationPoint(0, 6, -2); + head.setPivot(0, 6, -2); rightArm.pitch -= LEG_ROT_X_SNEAK_ADJ; leftArm.pitch -= LEG_ROT_X_SNEAK_ADJ; - leftLeg.rotationPointY = FRONT_LEG_RP_Y_SNEAK; - rightLeg.rotationPointY = FRONT_LEG_RP_Y_SNEAK; + leftLeg.pivotY = FRONT_LEG_RP_Y_SNEAK; + rightLeg.pivotY = FRONT_LEG_RP_Y_SNEAK; } protected void ponySleep() { @@ -124,7 +124,7 @@ public abstract class AbstractPonyModel extends ClientPo rightLeg.pitch = ROTATE_90; leftLeg.pitch = ROTATE_90; - head.setRotationPoint(1, 2, isSneaking ? -1 : 1); + head.setPivot(1, 2, isSneaking ? -1 : 1); Part.shiftRotationPoint(rightArm, 0, 2, 6); Part.shiftRotationPoint(leftArm, 0, 2, 6); @@ -136,20 +136,20 @@ public abstract class AbstractPonyModel extends ClientPo if (attributes.isSitting) { adjustBodyComponents(BODY_ROT_X_RIDING * 2, BODY_RP_Y_RIDING, BODY_RP_Z_RIDING); adjustNeck(BODY_ROT_X_NOTSNEAK * 2, BODY_RP_Y_NOTSNEAK, BODY_RP_Z_NOTSNEAK - 4); - head.setRotationPoint(0, -2, -5); + head.setPivot(0, -2, -5); } else { adjustBodyComponents(BODY_ROT_X_RIDING, BODY_RP_Y_RIDING, BODY_RP_Z_RIDING); adjustNeck(BODY_ROT_X_NOTSNEAK, BODY_RP_Y_NOTSNEAK, BODY_RP_Z_NOTSNEAK); - head.setRotationPoint(0, 0, 0); + head.setPivot(0, 0, 0); } - leftLeg.rotationPointZ = 15; - leftLeg.rotationPointY = 9; + leftLeg.pivotZ = 15; + leftLeg.pivotY = 9; leftLeg.pitch = -PI / 4; leftLeg.yaw = -PI / 5; - rightLeg.rotationPointZ = 15; - rightLeg.rotationPointY = 9; + rightLeg.pivotZ = 15; + rightLeg.pivotY = 9; rightLeg.pitch = -PI / 4; rightLeg.yaw = PI / 5; @@ -160,14 +160,14 @@ public abstract class AbstractPonyModel extends ClientPo leftLeg.yaw = PI / 15; leftLeg.pitch = PI / 9; - leftLeg.rotationPointZ = 10; - leftLeg.rotationPointY = 7; + leftLeg.pivotZ = 10; + leftLeg.pivotY = 7; rightLeg.yaw = -PI / 15; rightLeg.pitch = PI / 9; - rightLeg.rotationPointZ = 10; - rightLeg.rotationPointY = 7; + rightLeg.pivotZ = 10; + rightLeg.pivotY = 7; leftArm.pitch = PI / 6; rightArm.pitch = PI / 6; @@ -189,18 +189,18 @@ public abstract class AbstractPonyModel extends ClientPo tail.setRotationAndAngles(attributes.isSwimming || attributes.isGoingFast, attributes.interpolatorId, move, swing, bodySwing * 5, ticks); upperTorso.yaw = bodySwing; - body.yaw = bodySwing; + torso.yaw = bodySwing; neck.yaw = bodySwing; } private void animateWears() { - leftArmOverlay.copyRotation(leftArm); - rightArmOverlay.copyRotation(rightArm); - leftLegOverlay.copyRotation(leftLeg); - rightLegOverlay.copyRotation(rightLeg); - bodyOverlay.copyRotation(body); - headwear.copyRotation(head); - upperTorsoOverlay.copyRotation(upperTorso); + leftSleeve.copyPositionAndRotation(leftArm); + rightSleeve.copyPositionAndRotation(rightArm); + leftPantLeg.copyPositionAndRotation(leftLeg); + rightPantLeg.copyPositionAndRotation(rightLeg); + jacket.copyPositionAndRotation(torso); + helmet.copyPositionAndRotation(head); + upperTorsoOverlay.copyPositionAndRotation(upperTorso); } /** @@ -247,29 +247,29 @@ public abstract class AbstractPonyModel extends ClientPo rotateLegsOnGround(move, swing, ticks, entity); } - float sin = MathHelper.sin(body.yaw) * 5; - float cos = MathHelper.cos(body.yaw) * 5; + float sin = MathHelper.sin(torso.yaw) * 5; + float cos = MathHelper.cos(torso.yaw) * 5; float spread = attributes.isGoingFast ? 2 : 1; - rightArm.rotationPointZ = spread + sin; - leftArm.rotationPointZ = spread - sin; + rightArm.pivotZ = spread + sin; + leftArm.pivotZ = spread - sin; float legRPX = cos - getLegOutset() - 0.001F; legRPX = getMetadata().getInterpolator(attributes.interpolatorId).interpolate("legOffset", legRPX, 3); - rightArm.rotationPointX = -legRPX; - rightLeg.rotationPointX = -legRPX; + rightArm.pivotX = -legRPX; + rightLeg.pivotX = -legRPX; - leftArm.rotationPointX = legRPX; - leftLeg.rotationPointX = legRPX; + leftArm.pivotX = legRPX; + leftLeg.pivotX = legRPX; - rightArm.yaw += body.yaw; - leftArm.yaw += body.yaw; + rightArm.yaw += torso.yaw; + leftArm.yaw += torso.yaw; - rightArm.rotationPointY = leftArm.rotationPointY = 8; - rightLeg.rotationPointZ = leftLeg.rotationPointZ = 10; + rightArm.pivotY = leftArm.pivotY = 8; + rightLeg.pivotZ = leftLeg.pivotZ = 10; } /** @@ -378,14 +378,14 @@ public abstract class AbstractPonyModel extends ClientPo } @Override - public Cuboid getBodyPart(BodyPart part) { + public ModelPart getBodyPart(BodyPart part) { switch (part) { default: case HEAD: return head; case NECK: return neck; case TAIL: case LEGS: - case BODY: return body; + case BODY: return torso; } } @@ -397,7 +397,7 @@ public abstract class AbstractPonyModel extends ClientPo * @param both True if we have something in both hands * @param swing Degree to which each 'limb' swings. */ - protected void alignArmForAction(Cuboid arm, ArmPose pose, ArmPose complement, boolean both, float swing, float reflect) { + protected void alignArmForAction(ModelPart arm, ArmPose pose, ArmPose complement, boolean both, float swing, float reflect) { switch (pose) { case ITEM: arm.yaw = 0; @@ -413,7 +413,7 @@ public abstract class AbstractPonyModel extends ClientPo arm.roll = -reflect * (PI / 15); if (attributes.isCrouching) { - arm.rotationPointX -= reflect * 2; + arm.pivotX -= reflect * 2; } } @@ -427,10 +427,10 @@ public abstract class AbstractPonyModel extends ClientPo if (complement == pose) { arm.yaw -= reflect * PI / 18; } - arm.rotationPointX += reflect; - arm.rotationPointZ += 3; + arm.pivotX += reflect; + arm.pivotZ += 3; if (attributes.isCrouching) { - arm.rotationPointY += 4; + arm.pivotY += 4; } break; case BOW_AND_ARROW: @@ -454,13 +454,13 @@ public abstract class AbstractPonyModel extends ClientPo } } - protected void aimBow(Cuboid arm, float ticks) { + protected void aimBow(ModelPart arm, float ticks) { arm.pitch = ROTATE_270 + head.pitch + (MathHelper.sin(ticks * 0.067F) * 0.05F); arm.yaw = head.yaw - 0.06F; arm.roll = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F; if (isSneaking) { - arm.rotationPointY += 4; + arm.pivotY += 4; } } @@ -482,7 +482,7 @@ public abstract class AbstractPonyModel extends ClientPo * * @param arm The arm to swing */ - protected void swingArm(Cuboid arm) { + protected void swingArm(ModelPart arm) { float swing = 1 - (float)Math.pow(1 - getSwingAmount(), 3); float deltaX = MathHelper.sin(swing * PI); @@ -491,7 +491,7 @@ public abstract class AbstractPonyModel extends ClientPo float deltaAim = deltaZ * (0.7F - head.pitch) * 0.75F; arm.pitch -= deltaAim + deltaX * 1.2F; - arm.yaw += body.yaw * 2; + arm.yaw += torso.yaw * 2; arm.roll = -deltaZ * 0.4F; } @@ -529,17 +529,17 @@ public abstract class AbstractPonyModel extends ClientPo } protected void adjustBodyComponents(float rotateAngleX, float rotationPointY, float rotationPointZ) { - body.pitch = rotateAngleX; - body.rotationPointY = rotationPointY; - body.rotationPointZ = rotationPointZ; + torso.pitch = rotateAngleX; + torso.pivotY = rotationPointY; + torso.pivotZ = rotationPointZ; upperTorso.pitch = rotateAngleX; - upperTorso.rotationPointY = rotationPointY; - upperTorso.rotationPointZ = rotationPointZ; + upperTorso.pivotY = rotationPointY; + upperTorso.pivotZ = rotationPointZ; } private void adjustNeck(float rotateAngleX, float rotationPointY, float rotationPointZ) { - neck.setRotationPoint(NECK_ROT_X + rotateAngleX, rotationPointY, rotationPointZ); + neck.setPivot(NECK_ROT_X + rotateAngleX, rotationPointY, rotationPointZ); } @Override @@ -559,7 +559,7 @@ public abstract class AbstractPonyModel extends ClientPo .box(-4, -4, -4, 8, 8, 8, stretch); initEars(((Part)head), yOffset, stretch); - headwear = new Part(this, 32, 0) + helmet = new Part(this, 32, 0) .offset(HEAD_CENTRE_X, HEAD_CENTRE_Y, HEAD_CENTRE_Z) .around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2) .box(-4, -4, -4, 8, 8, 8, stretch + 0.5F); @@ -583,11 +583,11 @@ public abstract class AbstractPonyModel extends ClientPo */ protected void initBody(float yOffset, float stretch) { if (textureHeight == 64) { - bodyOverlay.boxes.clear(); - cuboidList.add(bodyOverlay); + jacket.cuboids.clear(); + cuboidList.add(jacket); } - body = new Part(this, 16, 16) + torso = new Part(this, 16, 16) .around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z) .box(-4, 4, -2, 8, 8, 4, stretch); @@ -622,8 +622,8 @@ public abstract class AbstractPonyModel extends ClientPo stretch += 0.25F; - bodyOverlay.addBox(-4, 4, -2, 8, 8, 4, stretch); - bodyOverlay.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); + jacket.addCuboid(-4, 4, -2, 8, 8, 4, stretch); + jacket.setPivot(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); upperTorsoOverlay = new Part(this, 24, 0); upperTorsoOverlay.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z) @@ -645,18 +645,18 @@ public abstract class AbstractPonyModel extends ClientPo } protected void preInitLegs() { - leftArm = new Cuboid(this, 32, 48); - rightArm = new Cuboid(this, 40, 16); + leftArm = new ModelPart(this, 32, 48); + rightArm = new ModelPart(this, 40, 16); - leftLeg = new Cuboid(this, 16, 48); - rightLeg = new Cuboid(this, 0, 16); + leftLeg = new ModelPart(this, 16, 48); + rightLeg = new ModelPart(this, 0, 16); } protected void preInitLegwear() { - leftArmOverlay.boxes.clear(); - rightArmOverlay.boxes.clear(); - leftLegOverlay.boxes.clear(); - rightLegOverlay.boxes.clear(); + leftSleeve.cuboids.clear(); + rightSleeve.cuboids.clear(); + leftPantLeg.cuboids.clear(); + rightPantLeg.cuboids.clear(); } protected void initLegs(float yOffset, float stretch) { @@ -674,25 +674,25 @@ public abstract class AbstractPonyModel extends ClientPo float armY = THIRDP_ARM_CENTRE_Y; float armZ = BODY_CENTRE_Z / 2 - 1 - armDepth; - leftArm .setRotationPoint( rarmX, yOffset + rarmY, 0); - rightArm .setRotationPoint(-rarmX, yOffset + rarmY, 0); - leftArmOverlay .setRotationPoint( rarmX, yOffset + rarmY, 0); - rightArmOverlay.setRotationPoint(-rarmX, yOffset + rarmY, 0); + leftArm .setPivot( rarmX, yOffset + rarmY, 0); + rightArm .setPivot(-rarmX, yOffset + rarmY, 0); + leftSleeve .setPivot( rarmX, yOffset + rarmY, 0); + rightSleeve.setPivot(-rarmX, yOffset + rarmY, 0); - leftLeg .setRotationPoint( rarmX, yOffset, 0); - rightLeg .setRotationPoint(-rarmX, yOffset, 0); - leftLegOverlay .setRotationPoint( rarmX, yOffset, 0); - rightLegOverlay.setRotationPoint(-rarmX, yOffset, 0); + leftLeg .setPivot( rarmX, yOffset, 0); + rightLeg .setPivot(-rarmX, yOffset, 0); + leftPantLeg .setPivot( rarmX, yOffset, 0); + rightPantLeg.setPivot(-rarmX, yOffset, 0); - leftArm .addBox(armX, armY, armZ, armWidth, armLength, armDepth, stretch); - rightArm .addBox(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch); - leftArmOverlay .addBox(armX, armY, armZ, armWidth, armLength, armDepth, stretch + 0.25f); - rightArmOverlay.addBox(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch + 0.25f); + leftArm .addCuboid(armX, armY, armZ, armWidth, armLength, armDepth, stretch); + rightArm .addCuboid(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch); + leftSleeve .addCuboid(armX, armY, armZ, armWidth, armLength, armDepth, stretch + 0.25f); + rightSleeve.addCuboid(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch + 0.25f); - leftLeg .addBox(armX, armY, armZ, armWidth, armLength, armDepth, stretch); - rightLeg .addBox(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch); - leftLegOverlay .addBox(armX, armY, armZ, armWidth, armLength, armDepth, stretch + 0.25f); - rightLegOverlay.addBox(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch + 0.25f); + leftLeg .addCuboid(armX, armY, armZ, armWidth, armLength, armDepth, stretch); + rightLeg .addCuboid(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch); + leftPantLeg .addCuboid(armX, armY, armZ, armWidth, armLength, armDepth, stretch + 0.25f); + rightPantLeg.addCuboid(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch + 0.25f); } @Override @@ -749,7 +749,7 @@ public abstract class AbstractPonyModel extends ClientPo } protected void renderHelmet(float scale) { - headwear.render(scale); + helmet.render(scale); } protected void renderNeck(float scale) { @@ -758,22 +758,22 @@ public abstract class AbstractPonyModel extends ClientPo } protected void renderBody(float scale) { - body.render(scale); + torso.render(scale); upperTorso.render(scale); - body.applyTransform(scale); + torso.applyTransform(scale); tail.renderPart(scale, attributes.interpolatorId); } protected void renderVest(float scale) { - bodyOverlay.render(scale); - if (bodyOverlay.visible) { + jacket.render(scale); + if (jacket.visible) { upperTorsoOverlay.render(scale); } } protected void renderLegs(float scale) { if (!isSneaking) { - body.applyTransform(scale); + torso.applyTransform(scale); } leftArm.render(scale); @@ -783,10 +783,10 @@ public abstract class AbstractPonyModel extends ClientPo } protected void renderSleeves(float scale) { - leftArmOverlay.render(scale); - rightArmOverlay.render(scale); - leftLegOverlay.render(scale); - rightLegOverlay.render(scale); + leftSleeve.render(scale); + rightSleeve.render(scale); + leftPantLeg.render(scale); + rightPantLeg.render(scale); } @Override diff --git a/src/main/java/com/minelittlepony/client/model/ClientPonyModel.java b/src/main/java/com/minelittlepony/client/model/ClientPonyModel.java index 8a6b7b37..d9f055f1 100644 --- a/src/main/java/com/minelittlepony/client/model/ClientPonyModel.java +++ b/src/main/java/com/minelittlepony/client/model/ClientPonyModel.java @@ -1,6 +1,6 @@ package com.minelittlepony.client.model; -import net.minecraft.client.model.Cuboid; +import net.minecraft.client.model.ModelPart; import net.minecraft.client.render.entity.model.BipedEntityModel; import net.minecraft.client.render.entity.model.PlayerEntityModel; import net.minecraft.entity.LivingEntity; @@ -65,7 +65,7 @@ public abstract class ClientPonyModel extends PlayerEnti } @Override - public Cuboid getHead() { + public ModelPart getHead() { return head; } @@ -81,7 +81,7 @@ public abstract class ClientPonyModel extends PlayerEnti @Override - public Cuboid getArm(Arm side) { + public ModelPart getArm(Arm side) { return super.getArm(side); } @@ -103,26 +103,26 @@ public abstract class ClientPonyModel extends PlayerEnti } @Override - public Cuboid getRandomCuboid(Random rand) { + public ModelPart getRandomCuboid(Random rand) { // grab one at random, but cycle through the list until you find one that's filled. // Return if you find one, or if you get back to where you started in which case there isn't any. int randomI = rand.nextInt(cuboidList.size()); int index = randomI; - Cuboid result; + ModelPart result; do { result = cuboidList.get(randomI); - if (!result.boxes.isEmpty()) return result; + if (!result.cuboids.isEmpty()) return result; index = (index + 1) % cuboidList.size(); } while (index != randomI); - if (result.boxes.isEmpty()) { - result.addBox(0, 0, 0, 0, 0, 0); + if (result.cuboids.isEmpty()) { + result.addCuboid(0, 0, 0, 0, 0, 0); } - if (result.boxes.isEmpty()) { + if (result.cuboids.isEmpty()) { throw new IllegalStateException("This model contains absolutely no boxes and a box could not be added!"); } diff --git a/src/main/java/com/minelittlepony/client/model/IMobModel.java b/src/main/java/com/minelittlepony/client/model/IMobModel.java index 101fcea8..9aa6730c 100644 --- a/src/main/java/com/minelittlepony/client/model/IMobModel.java +++ b/src/main/java/com/minelittlepony/client/model/IMobModel.java @@ -1,6 +1,6 @@ package com.minelittlepony.client.model; -import net.minecraft.client.model.Cuboid; +import net.minecraft.client.model.ModelPart; import net.minecraft.util.math.MathHelper; import com.minelittlepony.model.PonyModelConstants; @@ -18,7 +18,7 @@ public interface IMobModel { * @param swingProgress How far we are through the current swing * @param ticks Render partial ticks */ - default void rotateArmHolding(Cuboid arm, float direction, float swingProgress, float ticks) { + default void rotateArmHolding(ModelPart arm, float direction, float swingProgress, float ticks) { float swing = MathHelper.sin(swingProgress * PonyModelConstants.PI); float roll = MathHelper.sin((1 - (1 - swingProgress) * (1 - swingProgress)) * PonyModelConstants.PI); diff --git a/src/main/java/com/minelittlepony/client/model/IPonyMixinModel.java b/src/main/java/com/minelittlepony/client/model/IPonyMixinModel.java index 23f9bf48..2afde4b0 100644 --- a/src/main/java/com/minelittlepony/client/model/IPonyMixinModel.java +++ b/src/main/java/com/minelittlepony/client/model/IPonyMixinModel.java @@ -1,6 +1,6 @@ package com.minelittlepony.client.model; -import net.minecraft.client.model.Cuboid; +import net.minecraft.client.model.ModelPart; import net.minecraft.entity.LivingEntity; import net.minecraft.util.Arm; @@ -82,12 +82,12 @@ public interface IPonyMixinModel } @Override - default Cuboid getHead() { + default ModelPart getHead() { return mixin().getHead(); } @Override - default Cuboid getBodyPart(BodyPart part) { + default ModelPart getBodyPart(BodyPart part) { return mixin().getBodyPart(part); } diff --git a/src/main/java/com/minelittlepony/client/model/IPonyModel.java b/src/main/java/com/minelittlepony/client/model/IPonyModel.java index 977006cf..8e543185 100644 --- a/src/main/java/com/minelittlepony/client/model/IPonyModel.java +++ b/src/main/java/com/minelittlepony/client/model/IPonyModel.java @@ -1,6 +1,6 @@ package com.minelittlepony.client.model; -import net.minecraft.client.model.Cuboid; +import net.minecraft.client.model.ModelPart; import net.minecraft.entity.LivingEntity; import com.minelittlepony.model.ICapitated; @@ -9,7 +9,7 @@ import com.minelittlepony.model.IModel; import com.minelittlepony.model.PonyModelConstants; import com.minelittlepony.pony.IPony; -public interface IPonyModel extends PonyModelConstants, IModel, ICapitated, ICompartmented { +public interface IPonyModel extends PonyModelConstants, IModel, ICapitated, ICompartmented { void updateLivingState(T entity, IPony pony); diff --git a/src/main/java/com/minelittlepony/client/model/armour/ModelPonyArmour.java b/src/main/java/com/minelittlepony/client/model/armour/ModelPonyArmour.java index 5bb331e9..e31592c1 100644 --- a/src/main/java/com/minelittlepony/client/model/armour/ModelPonyArmour.java +++ b/src/main/java/com/minelittlepony/client/model/armour/ModelPonyArmour.java @@ -1,6 +1,6 @@ package com.minelittlepony.client.model.armour; -import net.minecraft.client.model.Cuboid; +import net.minecraft.client.model.ModelPart; import net.minecraft.client.render.entity.model.BipedEntityModel; import net.minecraft.entity.LivingEntity; @@ -14,8 +14,8 @@ public class ModelPonyArmour extends AbstractPonyModel extends AbstractPonyModel extends AbstractPonyModel mainModel = (BipedEntityModel)model; - body.copyRotation(mainModel.body); - rightArm.copyRotation(mainModel.rightArm); - leftArm.copyRotation(mainModel.leftArm); - rightLeg.copyRotation(mainModel.rightLeg); - leftLeg.copyRotation(mainModel.leftLeg); + torso.copyPositionAndRotation(mainModel.torso); + rightArm.copyPositionAndRotation(mainModel.rightArm); + leftArm.copyPositionAndRotation(mainModel.leftArm); + rightLeg.copyPositionAndRotation(mainModel.rightLeg); + leftLeg.copyPositionAndRotation(mainModel.leftLeg); - steveLeftLeg.copyRotation(mainModel.leftLeg); - steveRightLeg.copyRotation(mainModel.rightLeg); + steveLeftLeg.copyPositionAndRotation(mainModel.leftLeg); + steveRightLeg.copyPositionAndRotation(mainModel.rightLeg); } } @@ -124,22 +124,22 @@ public class ModelPonyArmour extends AbstractPonyModel extends AbstractPonyModel { +public class ModelPonyHead extends SkullOverlayEntityModel implements ICapitated { private PonySnout snout; @@ -35,7 +34,7 @@ public class ModelPonyHead extends SkullOverlayEntityModel implements ICapitated } @Override - public Cuboid getHead() { + public ModelPart getHead() { return skull; } diff --git a/src/main/java/com/minelittlepony/client/model/components/PonyEars.java b/src/main/java/com/minelittlepony/client/model/components/PonyEars.java index 08a3268a..32124e9c 100644 --- a/src/main/java/com/minelittlepony/client/model/components/PonyEars.java +++ b/src/main/java/com/minelittlepony/client/model/components/PonyEars.java @@ -1,8 +1,7 @@ package com.minelittlepony.client.model.components; -import net.minecraft.client.model.Cuboid; import net.minecraft.client.model.Model; - +import net.minecraft.client.model.ModelPart; import com.minelittlepony.client.util.render.Part; import com.minelittlepony.model.ICapitated; import com.minelittlepony.model.IPart; @@ -17,7 +16,7 @@ public class PonyEars implements IPart { private Part right; private Part left; - public > PonyEars(Part head, boolean bat) { + public > PonyEars(Part head, boolean bat) { this.head = head; this.bat = bat; } diff --git a/src/main/java/com/minelittlepony/client/model/components/PonyElytra.java b/src/main/java/com/minelittlepony/client/model/components/PonyElytra.java index c36488c4..5b400f7d 100644 --- a/src/main/java/com/minelittlepony/client/model/components/PonyElytra.java +++ b/src/main/java/com/minelittlepony/client/model/components/PonyElytra.java @@ -71,8 +71,8 @@ public class PonyElytra extends EntityModel { rpY = BODY_RP_Y_SNEAK; } - leftWing.rotationPointX = 5; - leftWing.rotationPointY = rpY; + leftWing.pivotX = 5; + leftWing.pivotY = rpY; if (entity instanceof AbstractClientPlayerEntity) { AbstractClientPlayerEntity player = (AbstractClientPlayerEntity) entity; @@ -90,8 +90,8 @@ public class PonyElytra extends EntityModel { leftWing.roll = rotateY; } - rightWing.rotationPointX = -leftWing.rotationPointX; - rightWing.rotationPointY = leftWing.rotationPointY; + rightWing.pivotX = -leftWing.pivotX; + rightWing.pivotY = leftWing.pivotY; rightWing.pitch = leftWing.pitch; rightWing.yaw = -leftWing.yaw; rightWing.roll = -leftWing.roll; diff --git a/src/main/java/com/minelittlepony/client/model/components/PonySnout.java b/src/main/java/com/minelittlepony/client/model/components/PonySnout.java index 8bd5c21f..e4810389 100644 --- a/src/main/java/com/minelittlepony/client/model/components/PonySnout.java +++ b/src/main/java/com/minelittlepony/client/model/components/PonySnout.java @@ -1,8 +1,7 @@ package com.minelittlepony.client.model.components; -import net.minecraft.client.model.Cuboid; import net.minecraft.client.model.Model; - +import net.minecraft.client.model.ModelPart; import com.minelittlepony.client.MineLittlePony; import com.minelittlepony.client.util.render.Part; import com.minelittlepony.model.ICapitated; @@ -18,13 +17,13 @@ public class PonySnout implements IPart { private Part mare; private Part stallion; - private final ICapitated head; + private final ICapitated head; - public > PonySnout(T pony) { + public > PonySnout(T pony) { this(pony, 0, 0, 0); } - public > PonySnout(T pony, int x, int y, int z) { + public > PonySnout(T pony, int x, int y, int z) { head = pony; mare = new Part(pony).offset(HEAD_CENTRE_X + x, HEAD_CENTRE_Y + y, HEAD_CENTRE_Z + z + 0.25F); diff --git a/src/main/java/com/minelittlepony/client/model/components/PonyTail.java b/src/main/java/com/minelittlepony/client/model/components/PonyTail.java index 3faa73b3..53f9eba1 100644 --- a/src/main/java/com/minelittlepony/client/model/components/PonyTail.java +++ b/src/main/java/com/minelittlepony/client/model/components/PonyTail.java @@ -37,11 +37,11 @@ public class PonyTail extends Part implements IPart { if (theModel.getAttributes().isCrouching && !rainboom) { rotateSneak(); } else if (theModel.isRiding()) { - rotationPointZ = TAIL_RP_Z_RIDING; - rotationPointY = TAIL_RP_Y_RIDING; + pivotZ = TAIL_RP_Z_RIDING; + pivotY = TAIL_RP_Y_RIDING; pitch = PI / 5; } else { - setRotationPoint(TAIL_RP_X, TAIL_RP_Y, TAIL_RP_Z_NOTSNEAK); + setPivot(TAIL_RP_X, TAIL_RP_Y, TAIL_RP_Z_NOTSNEAK); if (rainboom) { pitch = ROTATE_90 + MathHelper.sin(move) / 10; } else { @@ -52,8 +52,8 @@ public class PonyTail extends Part implements IPart { } if (rainboom) { - rotationPointY += 6; - rotationPointZ++; + pivotY += 6; + pivotZ++; } tailStop = theModel.getMetadata().getTail().ordinal(); @@ -66,7 +66,7 @@ public class PonyTail extends Part implements IPart { } private void rotateSneak() { - setRotationPoint(TAIL_RP_X, TAIL_RP_Y, TAIL_RP_Z_SNEAK); + setPivot(TAIL_RP_X, TAIL_RP_Y, TAIL_RP_Z_SNEAK); pitch = -BODY_ROT_X_SNEAK + 0.1F; } diff --git a/src/main/java/com/minelittlepony/client/model/components/UnicornHorn.java b/src/main/java/com/minelittlepony/client/model/components/UnicornHorn.java index c7bcac49..fcd7eb51 100644 --- a/src/main/java/com/minelittlepony/client/model/components/UnicornHorn.java +++ b/src/main/java/com/minelittlepony/client/model/components/UnicornHorn.java @@ -1,9 +1,8 @@ package com.minelittlepony.client.model.components; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.model.Cuboid; import net.minecraft.client.model.Model; - +import net.minecraft.client.model.ModelPart; import com.minelittlepony.client.util.render.Color; import com.minelittlepony.client.util.render.Part; import com.minelittlepony.model.ICapitated; @@ -24,11 +23,11 @@ public class UnicornHorn implements IPart { protected boolean isVisible = true; - public > UnicornHorn(T pony, float yOffset, float stretch) { + public > UnicornHorn(T pony, float yOffset, float stretch) { this(pony, yOffset, stretch, 0, 0, 0); } - public > UnicornHorn(T pony, float yOffset, float stretch, int x, int y, int z) { + public > UnicornHorn(T pony, float yOffset, float stretch, int x, int y, int z) { horn = new Part(pony, 0, 3); glow = new Part(pony, 0, 3); diff --git a/src/main/java/com/minelittlepony/client/model/entities/ModelBreezie.java b/src/main/java/com/minelittlepony/client/model/entities/ModelBreezie.java index 6cd8d565..7c9f5e50 100644 --- a/src/main/java/com/minelittlepony/client/model/entities/ModelBreezie.java +++ b/src/main/java/com/minelittlepony/client/model/entities/ModelBreezie.java @@ -1,6 +1,6 @@ package com.minelittlepony.client.model.entities; -import net.minecraft.client.model.Cuboid; +import net.minecraft.client.model.ModelPart; import net.minecraft.client.render.entity.model.BipedEntityModel; import net.minecraft.entity.LivingEntity; import net.minecraft.util.Arm; @@ -23,7 +23,7 @@ public class ModelBreezie extends BipedEntityModel { textureWidth = 64; textureHeight = 64; - headwear.visible = false; + helmet.visible = false; head = new Part(this) .child(new Part(this) .addBox(-3, -6, -3, 6, 6, 6).around(0, 0, -4) @@ -35,7 +35,7 @@ public class ModelBreezie extends BipedEntityModel { .tex(24, 2).addBox(-2, -11, -3, 1, 6, 1) .rotate(-0.2617994F, 0, 0)); - body = new Part(this, 2, 12) + torso = new Part(this, 2, 12) .addBox(0, 0, 0, 6, 7, 14).rotate(-0.5235988F, 0, 0).around(-3, 1, -3); leftArm = new Part(this, 28, 12).addBox(0, 0, 0, 2, 12, 2).around( 1, 8, -5); @@ -67,7 +67,7 @@ public class ModelBreezie extends BipedEntityModel { @Override public void render(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) { - super.render(entity, move, swing, ticks, headYaw, headPitch, scale); + super.setAngles(entity, move, swing, ticks, headYaw, headPitch, scale); neck.render(scale); tailStub.render(scale); tail.render(scale); @@ -124,36 +124,36 @@ public class ModelBreezie extends BipedEntityModel { } protected void swingArms(Arm mainHand) { - body.yaw = MathHelper.sin(MathHelper.sqrt(handSwingProgress) * PI * 2) / 5; + torso.yaw = MathHelper.sin(MathHelper.sqrt(handSwingProgress) * PI * 2) / 5; if (mainHand == Arm.LEFT) { - body.yaw *= -1; + torso.yaw *= -1; } - float sin = MathHelper.sin(body.yaw) * 5; - float cos = MathHelper.cos(body.yaw) * 5; + float sin = MathHelper.sin(torso.yaw) * 5; + float cos = MathHelper.cos(torso.yaw) * 5; - leftArm.pitch += body.yaw; - leftArm.yaw += body.yaw; - leftArm.rotationPointX = cos; - leftArm.rotationPointZ = -sin; + leftArm.pitch += torso.yaw; + leftArm.yaw += torso.yaw; + leftArm.pivotX = cos; + leftArm.pivotZ = -sin; - rightArm.yaw += body.yaw; - rightArm.rotationPointX = -cos; - rightArm.rotationPointZ = sin; + rightArm.yaw += torso.yaw; + rightArm.pivotX = -cos; + rightArm.pivotZ = sin; float swingAmount = 1 - (float)Math.pow(1 - handSwingProgress, 4); float swingFactorX = MathHelper.sin(swingAmount * PI); float swingX = MathHelper.sin(handSwingProgress * PI) * (0.7F - head.pitch) * 0.75F; - Cuboid mainArm = getArm(mainHand); + ModelPart mainArm = getArm(mainHand); mainArm.pitch -= swingFactorX * 1.2F + swingX; - mainArm.yaw += body.yaw * 2; + mainArm.yaw += torso.yaw * 2; mainArm.roll -= MathHelper.sin(handSwingProgress * PI) * 0.4F; } - protected void rotateArm(Cuboid arm, ArmPose pose, float factor) { + protected void rotateArm(ModelPart arm, ArmPose pose, float factor) { switch (pose) { case EMPTY: arm.yaw = 0; @@ -169,7 +169,7 @@ public class ModelBreezie extends BipedEntityModel { } } - protected void raiseArm(Cuboid up, Cuboid down, float factor) { + protected void raiseArm(ModelPart up, ModelPart down, float factor) { up.yaw = head.yaw + (factor / 10); up.pitch = head.pitch - (PI / 2); diff --git a/src/main/java/com/minelittlepony/client/model/entities/ModelEnderStallion.java b/src/main/java/com/minelittlepony/client/model/entities/ModelEnderStallion.java index 98b646bc..2fe66591 100644 --- a/src/main/java/com/minelittlepony/client/model/entities/ModelEnderStallion.java +++ b/src/main/java/com/minelittlepony/client/model/entities/ModelEnderStallion.java @@ -1,6 +1,6 @@ package com.minelittlepony.client.model.entities; -import net.minecraft.client.model.Cuboid; +import net.minecraft.client.model.ModelPart; import net.minecraft.entity.mob.EndermanEntity; import net.minecraft.util.math.MathHelper; @@ -42,11 +42,11 @@ public class ModelEnderStallion extends ModelSkeletonPony { tail.setVisible(false); snout.isHidden = true; - leftArmOverlay.field_3664 = true; - rightArmOverlay.field_3664 = true; + leftSleeve.field_3664 = true; + rightSleeve.field_3664 = true; - leftLegOverlay.field_3664 = true; - rightLegOverlay.field_3664 = true; + leftPantLeg.field_3664 = true; + rightPantLeg.field_3664 = true; leftHorn.pitch = 0.5F; rightHorn.pitch = 0.5F; @@ -57,7 +57,7 @@ public class ModelEnderStallion extends ModelSkeletonPony { super.setAngles(entity, move, swing, ticks, headYaw, headPitch, scale); if (isAttacking) { - head.rotationPointY -= 5; + head.pivotY -= 5; } } @@ -103,7 +103,7 @@ public class ModelEnderStallion extends ModelSkeletonPony { .around(3.9F, -6, 0.001F) .box(0, 0, 0, 2, 6, 2, stretch); - headwear = new Part(this, 32, 0) + helmet = new Part(this, 32, 0) .offset(HEAD_CENTRE_X, HEAD_CENTRE_Y, HEAD_CENTRE_Z) .around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2) .box(-4, -4, -4, 8, 8, 8, stretch - 0.5F); @@ -113,18 +113,18 @@ public class ModelEnderStallion extends ModelSkeletonPony { } @Override - public void rotateArmHolding(Cuboid arm, float direction, float swingProgress, float ticks) { + public void rotateArmHolding(ModelPart arm, float direction, float swingProgress, float ticks) { arm.pitch = -0.3707964F; arm.pitch += 0.4F + MathHelper.sin(ticks * 0.067F) / 10; } @Override protected void preInitLegs() { - leftArm = new Cuboid(this, 0, 20); - rightArm = new Cuboid(this, 0, 20); + leftArm = new ModelPart(this, 0, 20); + rightArm = new ModelPart(this, 0, 20); - leftLeg = new Cuboid(this, 0, 20); - rightLeg = new Cuboid(this, 0, 20); + leftLeg = new ModelPart(this, 0, 20); + rightLeg = new ModelPart(this, 0, 20); } @Override diff --git a/src/main/java/com/minelittlepony/client/model/entities/ModelIllagerPony.java b/src/main/java/com/minelittlepony/client/model/entities/ModelIllagerPony.java index e60b2046..a76fe2af 100644 --- a/src/main/java/com/minelittlepony/client/model/entities/ModelIllagerPony.java +++ b/src/main/java/com/minelittlepony/client/model/entities/ModelIllagerPony.java @@ -1,6 +1,6 @@ package com.minelittlepony.client.model.entities; -import net.minecraft.client.model.Cuboid; +import net.minecraft.client.model.ModelPart; import net.minecraft.entity.mob.IllagerEntity; import net.minecraft.util.Arm; import net.minecraft.util.math.MathHelper; @@ -21,7 +21,7 @@ public class ModelIllagerPony extends ModelAlicorn { boolean rightHanded = illager.getMainArm() == Arm.RIGHT; float mult = rightHanded ? 1 : -1; - Cuboid arm = getArm(illager.getMainArm()); + ModelPart arm = getArm(illager.getMainArm()); if (pose == IllagerEntity.State.ATTACKING) { // vindicator attacking diff --git a/src/main/java/com/minelittlepony/client/model/entities/ModelSeapony.java b/src/main/java/com/minelittlepony/client/model/entities/ModelSeapony.java index 0e6ef7e0..cc13ff00 100644 --- a/src/main/java/com/minelittlepony/client/model/entities/ModelSeapony.java +++ b/src/main/java/com/minelittlepony/client/model/entities/ModelSeapony.java @@ -3,6 +3,7 @@ package com.minelittlepony.client.model.entities; import com.minelittlepony.client.model.armour.ModelPonyArmour; import com.minelittlepony.client.model.armour.ArmourWrapper; import com.minelittlepony.client.model.components.SeaponyTail; +import com.minelittlepony.client.model.entities.ModelSeapony.Armour; import com.minelittlepony.client.model.races.ModelUnicorn; import com.minelittlepony.client.util.render.Part; import com.minelittlepony.model.BodyPart; @@ -62,8 +63,8 @@ public class ModelSeapony extends ModelUnicorn { // hide the back legs leftLeg.visible = false; rightLeg.visible = false; - leftLegOverlay.visible = false; - rightLegOverlay.visible = false; + leftPantLeg.visible = false; + rightPantLeg.visible = false; centerFin = new Part(this, 58, 28) .rotate(PI / 2 - 0.1F, 0, 0).around(0, 6, 9) @@ -138,7 +139,7 @@ public class ModelSeapony extends ModelUnicorn { @Override public void render(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) { - setVisible(leftArmOverlay.visible); + setVisible(leftSleeve.visible); super.render(entity, move, swing, ticks, headYaw, headPitch, scale); } @@ -152,9 +153,9 @@ public class ModelSeapony extends ModelUnicorn { @Override protected void renderBody(float scale) { - body.render(scale); + torso.render(scale); bodyCenter.render(scale); - body.applyTransform(scale); + torso.applyTransform(scale); tail.renderPart(scale, attributes.interpolatorId); @@ -182,8 +183,8 @@ public class ModelSeapony extends ModelUnicorn { // hide the back legs leftLeg.visible = false; rightLeg.visible = false; - leftLegOverlay.visible = false; - rightLegOverlay.visible = false; + leftPantLeg.visible = false; + rightPantLeg.visible = false; bodyCenter.visible = visible; diff --git a/src/main/java/com/minelittlepony/client/model/entities/ModelVillagerPony.java b/src/main/java/com/minelittlepony/client/model/entities/ModelVillagerPony.java index 5c0732ac..8e742856 100644 --- a/src/main/java/com/minelittlepony/client/model/entities/ModelVillagerPony.java +++ b/src/main/java/com/minelittlepony/client/model/entities/ModelVillagerPony.java @@ -100,13 +100,13 @@ public class ModelVillagerPony e float roll = 0.3F * MathHelper.sin(0.45F * ticks); this.head.roll = roll; - this.headwear.roll = roll; + this.helmet.roll = roll; this.head.pitch = 0.4F; - this.headwear.pitch = 0.4F; + this.helmet.pitch = 0.4F; } else { this.head.roll = 0.0F; - this.headwear.roll = 0.0F; + this.helmet.roll = 0.0F; } } } diff --git a/src/main/java/com/minelittlepony/client/model/entities/ModelWitchPony.java b/src/main/java/com/minelittlepony/client/model/entities/ModelWitchPony.java index 547c9b58..2f482f06 100644 --- a/src/main/java/com/minelittlepony/client/model/entities/ModelWitchPony.java +++ b/src/main/java/com/minelittlepony/client/model/entities/ModelWitchPony.java @@ -46,21 +46,21 @@ public class ModelWitchPony extends ModelZebra { float legDrinkingAngle = -1 * PI/3 + rot; rightArm.pitch = legDrinkingAngle; - rightArmOverlay.pitch = legDrinkingAngle; + rightSleeve.pitch = legDrinkingAngle; rightArm.yaw = 0.1F; - rightArmOverlay.yaw = 0.1F; + rightSleeve.yaw = 0.1F; rightArm.z = 0.1F; - rightArmOverlay.z = 0.1F; + rightSleeve.z = 0.1F; if (rot > 0) { rot = 0; } head.pitch = -rot / 2; - headwear.pitch = -rot / 2; + helmet.pitch = -rot / 2; } else { rightArm.z = 0; - rightArmOverlay.z = 0; + rightSleeve.z = 0; } } diff --git a/src/main/java/com/minelittlepony/client/model/races/ModelEarthPony.java b/src/main/java/com/minelittlepony/client/model/races/ModelEarthPony.java index 1dbf5a50..e262af2e 100644 --- a/src/main/java/com/minelittlepony/client/model/races/ModelEarthPony.java +++ b/src/main/java/com/minelittlepony/client/model/races/ModelEarthPony.java @@ -27,7 +27,7 @@ public class ModelEarthPony extends AbstractPonyModel super.setAngles(entity, move, swing, ticks, headYaw, headPitch, scale); if (bipedCape != null) { - bipedCape.rotationPointY = isSneaking ? 2 : isRiding ? -4 : 0; + bipedCape.pivotY = isSneaking ? 2 : isRiding ? -4 : 0; } } diff --git a/src/main/java/com/minelittlepony/client/model/races/ModelUnicorn.java b/src/main/java/com/minelittlepony/client/model/races/ModelUnicorn.java index cde3b02a..5e4e3422 100644 --- a/src/main/java/com/minelittlepony/client/model/races/ModelUnicorn.java +++ b/src/main/java/com/minelittlepony/client/model/races/ModelUnicorn.java @@ -3,8 +3,7 @@ package com.minelittlepony.client.model.races; import com.minelittlepony.client.model.components.UnicornHorn; import com.minelittlepony.client.util.render.Part; import com.minelittlepony.model.IUnicorn; - -import net.minecraft.client.model.Cuboid; +import net.minecraft.client.model.ModelPart; import net.minecraft.entity.LivingEntity; import net.minecraft.util.Arm; import net.minecraft.util.math.MathHelper; @@ -119,7 +118,7 @@ public class ModelUnicorn extends ModelEarthPony impl } @Override - public Cuboid getArm(Arm side) { + public ModelPart getArm(Arm side) { if (canCast() && getArmPoseForSide(side) != ArmPose.EMPTY) { return getUnicornArmForSide(side); } diff --git a/src/main/java/com/minelittlepony/client/render/DebugBoundingBoxRenderer.java b/src/main/java/com/minelittlepony/client/render/DebugBoundingBoxRenderer.java index 6bf9d2e0..82306529 100644 --- a/src/main/java/com/minelittlepony/client/render/DebugBoundingBoxRenderer.java +++ b/src/main/java/com/minelittlepony/client/render/DebugBoundingBoxRenderer.java @@ -6,8 +6,10 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.util.math.Box; import com.minelittlepony.pony.IPony; +import com.mojang.blaze3d.platform.GlStateManager.DestFactor; +import com.mojang.blaze3d.platform.GlStateManager.SourceFactor; -import static com.mojang.blaze3d.platform.GlStateManager.*; +import static com.mojang.blaze3d.systems.RenderSystem.*; public class DebugBoundingBoxRenderer { diff --git a/src/main/java/com/minelittlepony/client/render/LevitatingItemRenderer.java b/src/main/java/com/minelittlepony/client/render/LevitatingItemRenderer.java index 2ee775bc..2797bfac 100644 --- a/src/main/java/com/minelittlepony/client/render/LevitatingItemRenderer.java +++ b/src/main/java/com/minelittlepony/client/render/LevitatingItemRenderer.java @@ -5,7 +5,8 @@ import org.lwjgl.opengl.GL14; import com.minelittlepony.client.MineLittlePony; import com.minelittlepony.client.util.render.Color; import com.minelittlepony.pony.IPony; - +import com.mojang.blaze3d.platform.GlStateManager.DestFactor; +import com.mojang.blaze3d.platform.GlStateManager.SourceFactor; import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.render.FirstPersonRenderer; @@ -16,7 +17,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.Arm; import net.minecraft.util.UseAction; -import static com.mojang.blaze3d.platform.GlStateManager.*; +import static com.mojang.blaze3d.systems.RenderSystem.*; public class LevitatingItemRenderer { diff --git a/src/main/java/com/minelittlepony/client/render/RenderPony.java b/src/main/java/com/minelittlepony/client/render/RenderPony.java index 2d774ed6..15809d05 100644 --- a/src/main/java/com/minelittlepony/client/render/RenderPony.java +++ b/src/main/java/com/minelittlepony/client/render/RenderPony.java @@ -70,7 +70,7 @@ public class RenderPony & IPony if (entity.hasVehicle()) { Entity mount = entity.getVehicle(); if (mount instanceof LivingEntity) { - return MathUtil.interpolateDegress(((LivingEntity) mount).field_6220, ((LivingEntity) mount).field_6283, partialTicks); + return MathUtil.interpolateDegress(((LivingEntity) mount).prevBodyYaw, ((LivingEntity) mount).bodyYaw, partialTicks); } } diff --git a/src/main/java/com/minelittlepony/client/render/layer/LayerEyeGlow.java b/src/main/java/com/minelittlepony/client/render/layer/LayerEyeGlow.java index 6d72d36d..2535f4de 100644 --- a/src/main/java/com/minelittlepony/client/render/layer/LayerEyeGlow.java +++ b/src/main/java/com/minelittlepony/client/render/layer/LayerEyeGlow.java @@ -8,6 +8,8 @@ import net.minecraft.util.Identifier; import com.minelittlepony.client.model.IPonyModel; import com.minelittlepony.client.render.IPonyRender; import com.mojang.blaze3d.platform.GLX; +import com.mojang.blaze3d.platform.GlStateManager.DestFactor; +import com.mojang.blaze3d.platform.GlStateManager.SourceFactor; import static com.mojang.blaze3d.platform.GlStateManager.*; @@ -37,7 +39,7 @@ public class LayerEyeGlow & IPo MinecraftClient.getInstance().gameRenderer.setFogBlack(true); - getModel().render(entity, move, swing, ticks, headYaw, headPitch, scale); + getModel().setAngles(entity, move, swing, ticks, headYaw, headPitch, scale); MinecraftClient.getInstance().gameRenderer.setFogBlack(false); diff --git a/src/main/java/com/minelittlepony/client/render/layer/LayerOverlayBase.java b/src/main/java/com/minelittlepony/client/render/layer/LayerOverlayBase.java index 0770885f..ec36141b 100644 --- a/src/main/java/com/minelittlepony/client/render/layer/LayerOverlayBase.java +++ b/src/main/java/com/minelittlepony/client/render/layer/LayerOverlayBase.java @@ -33,7 +33,7 @@ public abstract class LayerOverlayBase double capeY = MathHelper.lerp(partialTicks, player.field_7502, player.field_7521) - MathHelper.lerp(partialTicks, player.prevY, player.y); double capeZ = MathHelper.lerp(partialTicks, player.field_7522, player.field_7499) - MathHelper.lerp(partialTicks, player.prevZ, player.z); - float motionYaw = player.field_6220 + (player.field_6283 - player.field_6220) * scale; + float motionYaw = player.prevBodyYaw + (player.bodyYaw - player.prevBodyYaw) * scale; //double capeX = player.prevRenderX + (player.x - player.prevRenderX) * scale - (player.prevX + (player.x - player.prevX) * scale); //double capeY = player.prevRenderY + (player.y - player.prevRenderY) * scale - (player.prevY + (player.y - player.prevY) * scale); diff --git a/src/main/java/com/minelittlepony/client/render/layer/LayerPonyCustomHead.java b/src/main/java/com/minelittlepony/client/render/layer/LayerPonyCustomHead.java index a905a34d..95823af9 100644 --- a/src/main/java/com/minelittlepony/client/render/layer/LayerPonyCustomHead.java +++ b/src/main/java/com/minelittlepony/client/render/layer/LayerPonyCustomHead.java @@ -20,7 +20,7 @@ import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundTag; -import net.minecraft.util.TagHelper; +import net.minecraft.nbt.NbtHelper; import net.minecraft.village.VillagerDataContainer; import static com.mojang.blaze3d.platform.GlStateManager.*; @@ -87,11 +87,11 @@ public class LayerPonyCustomHead skullMap = SystemUtil.consume(Maps.newHashMap(), (skullMap) -> { + private static final Map skullMap = Util.create(Maps.newHashMap(), (skullMap) -> { skullMap.put(SkullBlock.Type.SKELETON, new SkeletonSkullRenderer()); skullMap.put(SkullBlock.Type.WITHER_SKELETON, new WitherSkullRenderer()); skullMap.put(SkullBlock.Type.ZOMBIE, new ZombieSkullRenderer()); diff --git a/src/main/java/com/minelittlepony/client/util/render/NativeUtil.java b/src/main/java/com/minelittlepony/client/util/render/NativeUtil.java index 1eff15fe..f7b18eb5 100644 --- a/src/main/java/com/minelittlepony/client/util/render/NativeUtil.java +++ b/src/main/java/com/minelittlepony/client/util/render/NativeUtil.java @@ -12,6 +12,8 @@ import java.util.function.Function; import static com.mojang.blaze3d.platform.GlStateManager.getTexLevelParameter; import static org.lwjgl.opengl.GL11.*; +import com.minelittlepony.client.util.render.NativeUtil.InternalFormat; + public class NativeUtil { enum InternalFormat { RGB(NativeImage.Format.RGB), @@ -98,7 +100,7 @@ public class NativeUtil { } // recreate NativeImage from the GL matrix - textures.bindTexture(resource); + textures.bindTextureInner(resource); // TODO: This returns values that are too specific. // Can we change the level (0) here to something diff --git a/src/main/java/com/minelittlepony/client/util/render/Part.java b/src/main/java/com/minelittlepony/client/util/render/Part.java index 7178b437..651744fa 100644 --- a/src/main/java/com/minelittlepony/client/util/render/Part.java +++ b/src/main/java/com/minelittlepony/client/util/render/Part.java @@ -1,13 +1,13 @@ package com.minelittlepony.client.util.render; import net.minecraft.client.model.Box; -import net.minecraft.client.model.Cuboid; import net.minecraft.client.model.Model; +import net.minecraft.client.model.ModelPart; import net.minecraft.client.model.Quad; import net.minecraft.client.model.Vertex; import net.minecraft.util.math.Direction; -public class Part extends Cuboid { +public class Part extends ModelPart { protected final Model baseModel; @@ -92,10 +92,10 @@ public class Part extends Cuboid { /** * Adjusts the rotation center of the given renderer by the given amounts in each direction. */ - public static void shiftRotationPoint(Cuboid renderer, float x, float y, float z) { - renderer.rotationPointX += x; - renderer.rotationPointY += y; - renderer.rotationPointZ += z; + public static void shiftRotationPoint(ModelPart renderer, float x, float y, float z) { + renderer.pivotX += x; + renderer.pivotY += y; + renderer.pivotZ += z; } /** @@ -112,7 +112,7 @@ public class Part extends Cuboid { * Positions a given model in space by setting its offset values divided * by 16 to account for scaling applied inside the model. */ - public static T at(T renderer, float x, float y, float z) { + public static T at(T renderer, float x, float y, float z) { renderer.x = x / 16; renderer.y = y / 16; renderer.z = z / 16; @@ -122,22 +122,22 @@ public class Part extends Cuboid { /** * Rotates this model to align itself with the angles of another. */ - public void rotateTo(Cuboid other) { + public void rotateTo(ModelPart other) { rotate(other.pitch, other.yaw, other.roll); } /** * Shifts this model to align its center with the center of another. */ - public Part rotateAt(Cuboid other) { - return around(other.rotationPointX, other.rotationPointY, other.rotationPointZ); + public Part rotateAt(ModelPart other) { + return around(other.pivotX, other.pivotY, other.pivotZ); } /** * Sets the rotation point. */ public Part around(float x, float y, float z) { - setRotationPoint(x, y, z); + setPivot(x, y, z); return this; } @@ -166,7 +166,7 @@ public class Part extends Cuboid { /** * Adds a new child renderer and returns itself for chaining. */ - public Part child(K child) { + public Part child(K child) { addChild(child); return this; } @@ -189,7 +189,7 @@ public class Part extends Cuboid { } private Part addPlane(float offX, float offY, float offZ, int width, int height, int depth, float scale, Direction face) { - boxes.add(new Plane(this, textureOffsetX, textureOffsetY, modelOffsetX + offX, modelOffsetY + offY, modelOffsetZ + offZ, width, height, depth, scale, face)); + cuboids.add(new Plane(this, textureOffsetX, textureOffsetY, modelOffsetX + offX, modelOffsetY + offY, modelOffsetZ + offZ, width, height, depth, scale, face)); return this; } @@ -223,30 +223,30 @@ public class Part extends Cuboid { setTextureOffset(texX, texY); addBox(offX, offY, offZ, width, height, depth); - boxes.get(boxes.size() - 1).setName(partName); + cuboids.get(cuboids.size() - 1).setName(partName); return this; } @Override public Part addBox(float offX, float offY, float offZ, int width, int height, int depth) { - addBox(offX, offY, offZ, width, height, depth, 0); + addCuboid(offX, offY, offZ, width, height, depth, 0); return this; } @Override public Part addBox(float offX, float offY, float offZ, int width, int height, int depth, boolean mirrored) { - addBox(offX, offY, offZ, width, height, depth, 0, mirrored); + addCuboid(offX, offY, offZ, width, height, depth, 0, mirrored); return this; } @Override - public void addBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor) { - addBox(offX, offY, offZ, width, height, depth, scaleFactor, mirror); + public void addCuboid(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor) { + addCuboid(offX, offY, offZ, width, height, depth, scaleFactor, mirror); } @Override - public void addBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor, boolean mirrored) { + public void addCuboid(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor, boolean mirrored) { createBox(offX, offY, offZ, width, height, depth, scaleFactor, mirrored); } @@ -254,19 +254,19 @@ public class Part extends Cuboid { * Creates a textured box. */ public Part box(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor) { - addBox(offX, offY, offZ, width, height, depth, scaleFactor, mirror); + addCuboid(offX, offY, offZ, width, height, depth, scaleFactor, mirror); return this; } public Part cone(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor) { - boxes.add(new Cone(this, textureOffsetX, textureOffsetY, modelOffsetX + offX, modelOffsetY + offY, modelOffsetZ + offZ, width, height, depth, scaleFactor)); + cuboids.add(new Cone(this, textureOffsetX, textureOffsetY, modelOffsetX + offX, modelOffsetY + offY, modelOffsetZ + offZ, width, height, depth, scaleFactor)); return this; } protected void createBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor, boolean mirrored) { - boxes.add(new Box(this, textureOffsetX, textureOffsetY, modelOffsetX + offX, modelOffsetY + offY, modelOffsetZ + offZ, width, height, depth, scaleFactor, mirrored)); + cuboids.add(new Box(this, textureOffsetX, textureOffsetY, modelOffsetX + offX, modelOffsetY + offY, modelOffsetZ + offZ, width, height, depth, scaleFactor, mirrored)); } /** diff --git a/src/main/java/com/minelittlepony/pony/meta/TriggerPixels.java b/src/main/java/com/minelittlepony/pony/meta/TriggerPixels.java index b16e71ef..e7855074 100644 --- a/src/main/java/com/minelittlepony/pony/meta/TriggerPixels.java +++ b/src/main/java/com/minelittlepony/pony/meta/TriggerPixels.java @@ -95,7 +95,7 @@ public enum TriggerPixels { public int readValue(int x, int y, NativeImage image) { /*getPixelABGR*/ - return (Color.abgrToArgb(image.getPixelRGBA(x, y)) >> offset) & mask; + return (Color.abgrToArgb(image.getPixelRgba(x, y)) >> offset) & mask; } } } diff --git a/src/main/java/com/minelittlepony/util/transform/MotionCompositor.java b/src/main/java/com/minelittlepony/util/transform/MotionCompositor.java index 3643f332..7bc33948 100644 --- a/src/main/java/com/minelittlepony/util/transform/MotionCompositor.java +++ b/src/main/java/com/minelittlepony/util/transform/MotionCompositor.java @@ -18,9 +18,9 @@ public abstract class MotionCompositor { protected double calculateRoll(PlayerEntity player, double motionX, double motionY, double motionZ) { // since model roll should probably be calculated from model rotation rather than entity rotation... - double roll = MathUtil.sensibleAngle(player.field_6220 - player.field_6283); + double roll = MathUtil.sensibleAngle(player.prevBodyYaw - player.bodyYaw); double horMotion = Math.sqrt(motionX * motionX + motionZ * motionZ); - float modelYaw = MathUtil.sensibleAngle(player.field_6283); + float modelYaw = MathUtil.sensibleAngle(player.bodyYaw); // detecting that we're flying backwards and roll must be inverted if (Math.abs(MathUtil.sensibleAngle((float) Math.toDegrees(Math.atan2(motionX, motionZ)) + modelYaw)) > 90) {