Update mappings

This commit is contained in:
Sollace 2019-11-22 19:24:22 +02:00
parent da2ed444f8
commit a4925cd2c1
35 changed files with 258 additions and 257 deletions

View file

@ -77,7 +77,7 @@ public class HorseCam {
MinecraftClient client = MinecraftClient.getInstance(); MinecraftClient client = MinecraftClient.getInstance();
PlayerEntity player = client.player; PlayerEntity player = client.player;
client.gameRenderer.updateTargetedEntity(1); client.gameRenderer.updateTargetedEntity(1);
HitResult hit = client.hitResult; HitResult hit = client.crosshairTarget;
// noop // noop
// Ignore misses, helps with bows, arrows, and projectiles // Ignore misses, helps with bows, arrows, and projectiles

View file

@ -32,8 +32,7 @@ import net.minecraft.text.Style;
import net.minecraft.text.TranslatableText; import net.minecraft.text.TranslatableText;
import net.minecraft.util.Formatting; import net.minecraft.util.Formatting;
import net.minecraft.util.Identifier; 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.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import org.lwjgl.glfw.GLFW; import org.lwjgl.glfw.GLFW;
@ -119,7 +118,7 @@ public class MineLittlePony implements ClientModInitializer {
} else if (inGame) { } else if (inGame) {
long handle = client.window.getHandle(); 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 (InputUtil.isKeyPressed(handle, GLFW.GLFW_KEY_F3) && InputUtil.isKeyPressed(handle, GLFW.GLFW_KEY_M)) {
if (!reloadingModels) { if (!reloadingModels) {
client.inGameHud.getChatHud().addMessage( client.inGameHud.getChatHud().addMessage(

View file

@ -10,7 +10,7 @@ import com.minelittlepony.client.util.render.Part;
import com.minelittlepony.model.BodyPart; import com.minelittlepony.model.BodyPart;
import com.minelittlepony.model.IPart; import com.minelittlepony.model.IPart;
import com.minelittlepony.model.armour.IEquestrianArmour; 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.Entity;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.util.Arm; import net.minecraft.util.Arm;
@ -80,17 +80,17 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
} else { } else {
adjustBody(BODY_ROT_X_NOTSNEAK, BODY_RP_Y_NOTSNEAK, BODY_RP_Z_NOTSNEAK); adjustBody(BODY_ROT_X_NOTSNEAK, BODY_RP_Y_NOTSNEAK, BODY_RP_Z_NOTSNEAK);
rightLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK; rightLeg.pivotY = FRONT_LEG_RP_Y_NOTSNEAK;
leftLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK; leftLeg.pivotY = FRONT_LEG_RP_Y_NOTSNEAK;
if (!attributes.isSleeping) { if (!attributes.isSleeping) {
animateBreathing(ticks); animateBreathing(ticks);
} }
if (attributes.isSwimmingRotated) { if (attributes.isSwimmingRotated) {
head.setRotationPoint(0, -2, -2); head.setPivot(0, -2, -2);
} else { } else {
head.setRotationPoint(0, 0, 0); head.setPivot(0, 0, 0);
} }
} }
@ -108,13 +108,13 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
*/ */
protected void ponyCrouch() { protected void ponyCrouch() {
adjustBody(BODY_ROT_X_SNEAK, BODY_RP_Y_SNEAK, BODY_RP_Z_SNEAK); 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; rightArm.pitch -= LEG_ROT_X_SNEAK_ADJ;
leftArm.pitch -= LEG_ROT_X_SNEAK_ADJ; leftArm.pitch -= LEG_ROT_X_SNEAK_ADJ;
leftLeg.rotationPointY = FRONT_LEG_RP_Y_SNEAK; leftLeg.pivotY = FRONT_LEG_RP_Y_SNEAK;
rightLeg.rotationPointY = FRONT_LEG_RP_Y_SNEAK; rightLeg.pivotY = FRONT_LEG_RP_Y_SNEAK;
} }
protected void ponySleep() { protected void ponySleep() {
@ -124,7 +124,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
rightLeg.pitch = ROTATE_90; rightLeg.pitch = ROTATE_90;
leftLeg.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(rightArm, 0, 2, 6);
Part.shiftRotationPoint(leftArm, 0, 2, 6); Part.shiftRotationPoint(leftArm, 0, 2, 6);
@ -136,20 +136,20 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
if (attributes.isSitting) { if (attributes.isSitting) {
adjustBodyComponents(BODY_ROT_X_RIDING * 2, BODY_RP_Y_RIDING, BODY_RP_Z_RIDING); 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); 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 { } else {
adjustBodyComponents(BODY_ROT_X_RIDING, BODY_RP_Y_RIDING, BODY_RP_Z_RIDING); 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); 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.pivotZ = 15;
leftLeg.rotationPointY = 9; leftLeg.pivotY = 9;
leftLeg.pitch = -PI / 4; leftLeg.pitch = -PI / 4;
leftLeg.yaw = -PI / 5; leftLeg.yaw = -PI / 5;
rightLeg.rotationPointZ = 15; rightLeg.pivotZ = 15;
rightLeg.rotationPointY = 9; rightLeg.pivotY = 9;
rightLeg.pitch = -PI / 4; rightLeg.pitch = -PI / 4;
rightLeg.yaw = PI / 5; rightLeg.yaw = PI / 5;
@ -160,14 +160,14 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
leftLeg.yaw = PI / 15; leftLeg.yaw = PI / 15;
leftLeg.pitch = PI / 9; leftLeg.pitch = PI / 9;
leftLeg.rotationPointZ = 10; leftLeg.pivotZ = 10;
leftLeg.rotationPointY = 7; leftLeg.pivotY = 7;
rightLeg.yaw = -PI / 15; rightLeg.yaw = -PI / 15;
rightLeg.pitch = PI / 9; rightLeg.pitch = PI / 9;
rightLeg.rotationPointZ = 10; rightLeg.pivotZ = 10;
rightLeg.rotationPointY = 7; rightLeg.pivotY = 7;
leftArm.pitch = PI / 6; leftArm.pitch = PI / 6;
rightArm.pitch = PI / 6; rightArm.pitch = PI / 6;
@ -189,18 +189,18 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
tail.setRotationAndAngles(attributes.isSwimming || attributes.isGoingFast, attributes.interpolatorId, move, swing, bodySwing * 5, ticks); tail.setRotationAndAngles(attributes.isSwimming || attributes.isGoingFast, attributes.interpolatorId, move, swing, bodySwing * 5, ticks);
upperTorso.yaw = bodySwing; upperTorso.yaw = bodySwing;
body.yaw = bodySwing; torso.yaw = bodySwing;
neck.yaw = bodySwing; neck.yaw = bodySwing;
} }
private void animateWears() { private void animateWears() {
leftArmOverlay.copyRotation(leftArm); leftSleeve.copyPositionAndRotation(leftArm);
rightArmOverlay.copyRotation(rightArm); rightSleeve.copyPositionAndRotation(rightArm);
leftLegOverlay.copyRotation(leftLeg); leftPantLeg.copyPositionAndRotation(leftLeg);
rightLegOverlay.copyRotation(rightLeg); rightPantLeg.copyPositionAndRotation(rightLeg);
bodyOverlay.copyRotation(body); jacket.copyPositionAndRotation(torso);
headwear.copyRotation(head); helmet.copyPositionAndRotation(head);
upperTorsoOverlay.copyRotation(upperTorso); upperTorsoOverlay.copyPositionAndRotation(upperTorso);
} }
/** /**
@ -247,29 +247,29 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
rotateLegsOnGround(move, swing, ticks, entity); rotateLegsOnGround(move, swing, ticks, entity);
} }
float sin = MathHelper.sin(body.yaw) * 5; float sin = MathHelper.sin(torso.yaw) * 5;
float cos = MathHelper.cos(body.yaw) * 5; float cos = MathHelper.cos(torso.yaw) * 5;
float spread = attributes.isGoingFast ? 2 : 1; float spread = attributes.isGoingFast ? 2 : 1;
rightArm.rotationPointZ = spread + sin; rightArm.pivotZ = spread + sin;
leftArm.rotationPointZ = spread - sin; leftArm.pivotZ = spread - sin;
float legRPX = cos - getLegOutset() - 0.001F; float legRPX = cos - getLegOutset() - 0.001F;
legRPX = getMetadata().getInterpolator(attributes.interpolatorId).interpolate("legOffset", legRPX, 3); legRPX = getMetadata().getInterpolator(attributes.interpolatorId).interpolate("legOffset", legRPX, 3);
rightArm.rotationPointX = -legRPX; rightArm.pivotX = -legRPX;
rightLeg.rotationPointX = -legRPX; rightLeg.pivotX = -legRPX;
leftArm.rotationPointX = legRPX; leftArm.pivotX = legRPX;
leftLeg.rotationPointX = legRPX; leftLeg.pivotX = legRPX;
rightArm.yaw += body.yaw; rightArm.yaw += torso.yaw;
leftArm.yaw += body.yaw; leftArm.yaw += torso.yaw;
rightArm.rotationPointY = leftArm.rotationPointY = 8; rightArm.pivotY = leftArm.pivotY = 8;
rightLeg.rotationPointZ = leftLeg.rotationPointZ = 10; rightLeg.pivotZ = leftLeg.pivotZ = 10;
} }
/** /**
@ -378,14 +378,14 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
} }
@Override @Override
public Cuboid getBodyPart(BodyPart part) { public ModelPart getBodyPart(BodyPart part) {
switch (part) { switch (part) {
default: default:
case HEAD: return head; case HEAD: return head;
case NECK: return neck; case NECK: return neck;
case TAIL: case TAIL:
case LEGS: case LEGS:
case BODY: return body; case BODY: return torso;
} }
} }
@ -397,7 +397,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
* @param both True if we have something in both hands * @param both True if we have something in both hands
* @param swing Degree to which each 'limb' swings. * @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) { switch (pose) {
case ITEM: case ITEM:
arm.yaw = 0; arm.yaw = 0;
@ -413,7 +413,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
arm.roll = -reflect * (PI / 15); arm.roll = -reflect * (PI / 15);
if (attributes.isCrouching) { if (attributes.isCrouching) {
arm.rotationPointX -= reflect * 2; arm.pivotX -= reflect * 2;
} }
} }
@ -427,10 +427,10 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
if (complement == pose) { if (complement == pose) {
arm.yaw -= reflect * PI / 18; arm.yaw -= reflect * PI / 18;
} }
arm.rotationPointX += reflect; arm.pivotX += reflect;
arm.rotationPointZ += 3; arm.pivotZ += 3;
if (attributes.isCrouching) { if (attributes.isCrouching) {
arm.rotationPointY += 4; arm.pivotY += 4;
} }
break; break;
case BOW_AND_ARROW: case BOW_AND_ARROW:
@ -454,13 +454,13 @@ public abstract class AbstractPonyModel<T extends LivingEntity> 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.pitch = ROTATE_270 + head.pitch + (MathHelper.sin(ticks * 0.067F) * 0.05F);
arm.yaw = head.yaw - 0.06F; arm.yaw = head.yaw - 0.06F;
arm.roll = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F; arm.roll = MathHelper.cos(ticks * 0.09F) * 0.05F + 0.05F;
if (isSneaking) { if (isSneaking) {
arm.rotationPointY += 4; arm.pivotY += 4;
} }
} }
@ -482,7 +482,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
* *
* @param arm The arm to swing * @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 swing = 1 - (float)Math.pow(1 - getSwingAmount(), 3);
float deltaX = MathHelper.sin(swing * PI); float deltaX = MathHelper.sin(swing * PI);
@ -491,7 +491,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
float deltaAim = deltaZ * (0.7F - head.pitch) * 0.75F; float deltaAim = deltaZ * (0.7F - head.pitch) * 0.75F;
arm.pitch -= deltaAim + deltaX * 1.2F; arm.pitch -= deltaAim + deltaX * 1.2F;
arm.yaw += body.yaw * 2; arm.yaw += torso.yaw * 2;
arm.roll = -deltaZ * 0.4F; arm.roll = -deltaZ * 0.4F;
} }
@ -529,17 +529,17 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
} }
protected void adjustBodyComponents(float rotateAngleX, float rotationPointY, float rotationPointZ) { protected void adjustBodyComponents(float rotateAngleX, float rotationPointY, float rotationPointZ) {
body.pitch = rotateAngleX; torso.pitch = rotateAngleX;
body.rotationPointY = rotationPointY; torso.pivotY = rotationPointY;
body.rotationPointZ = rotationPointZ; torso.pivotZ = rotationPointZ;
upperTorso.pitch = rotateAngleX; upperTorso.pitch = rotateAngleX;
upperTorso.rotationPointY = rotationPointY; upperTorso.pivotY = rotationPointY;
upperTorso.rotationPointZ = rotationPointZ; upperTorso.pivotZ = rotationPointZ;
} }
private void adjustNeck(float rotateAngleX, float rotationPointY, float 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 @Override
@ -559,7 +559,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
.box(-4, -4, -4, 8, 8, 8, stretch); .box(-4, -4, -4, 8, 8, 8, stretch);
initEars(((Part)head), yOffset, 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) .offset(HEAD_CENTRE_X, HEAD_CENTRE_Y, HEAD_CENTRE_Z)
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2) .around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2)
.box(-4, -4, -4, 8, 8, 8, stretch + 0.5F); .box(-4, -4, -4, 8, 8, 8, stretch + 0.5F);
@ -583,11 +583,11 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
*/ */
protected void initBody(float yOffset, float stretch) { protected void initBody(float yOffset, float stretch) {
if (textureHeight == 64) { if (textureHeight == 64) {
bodyOverlay.boxes.clear(); jacket.cuboids.clear();
cuboidList.add(bodyOverlay); 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) .around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z)
.box(-4, 4, -2, 8, 8, 4, stretch); .box(-4, 4, -2, 8, 8, 4, stretch);
@ -622,8 +622,8 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
stretch += 0.25F; stretch += 0.25F;
bodyOverlay.addBox(-4, 4, -2, 8, 8, 4, stretch); jacket.addCuboid(-4, 4, -2, 8, 8, 4, stretch);
bodyOverlay.setRotationPoint(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z); jacket.setPivot(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z);
upperTorsoOverlay = new Part(this, 24, 0); upperTorsoOverlay = new Part(this, 24, 0);
upperTorsoOverlay.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z) upperTorsoOverlay.offset(BODY_CENTRE_X, BODY_CENTRE_Y, BODY_CENTRE_Z)
@ -645,18 +645,18 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
} }
protected void preInitLegs() { protected void preInitLegs() {
leftArm = new Cuboid(this, 32, 48); leftArm = new ModelPart(this, 32, 48);
rightArm = new Cuboid(this, 40, 16); rightArm = new ModelPart(this, 40, 16);
leftLeg = new Cuboid(this, 16, 48); leftLeg = new ModelPart(this, 16, 48);
rightLeg = new Cuboid(this, 0, 16); rightLeg = new ModelPart(this, 0, 16);
} }
protected void preInitLegwear() { protected void preInitLegwear() {
leftArmOverlay.boxes.clear(); leftSleeve.cuboids.clear();
rightArmOverlay.boxes.clear(); rightSleeve.cuboids.clear();
leftLegOverlay.boxes.clear(); leftPantLeg.cuboids.clear();
rightLegOverlay.boxes.clear(); rightPantLeg.cuboids.clear();
} }
protected void initLegs(float yOffset, float stretch) { protected void initLegs(float yOffset, float stretch) {
@ -674,25 +674,25 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
float armY = THIRDP_ARM_CENTRE_Y; float armY = THIRDP_ARM_CENTRE_Y;
float armZ = BODY_CENTRE_Z / 2 - 1 - armDepth; float armZ = BODY_CENTRE_Z / 2 - 1 - armDepth;
leftArm .setRotationPoint( rarmX, yOffset + rarmY, 0); leftArm .setPivot( rarmX, yOffset + rarmY, 0);
rightArm .setRotationPoint(-rarmX, yOffset + rarmY, 0); rightArm .setPivot(-rarmX, yOffset + rarmY, 0);
leftArmOverlay .setRotationPoint( rarmX, yOffset + rarmY, 0); leftSleeve .setPivot( rarmX, yOffset + rarmY, 0);
rightArmOverlay.setRotationPoint(-rarmX, yOffset + rarmY, 0); rightSleeve.setPivot(-rarmX, yOffset + rarmY, 0);
leftLeg .setRotationPoint( rarmX, yOffset, 0); leftLeg .setPivot( rarmX, yOffset, 0);
rightLeg .setRotationPoint(-rarmX, yOffset, 0); rightLeg .setPivot(-rarmX, yOffset, 0);
leftLegOverlay .setRotationPoint( rarmX, yOffset, 0); leftPantLeg .setPivot( rarmX, yOffset, 0);
rightLegOverlay.setRotationPoint(-rarmX, yOffset, 0); rightPantLeg.setPivot(-rarmX, yOffset, 0);
leftArm .addBox(armX, armY, armZ, armWidth, armLength, armDepth, stretch); leftArm .addCuboid(armX, armY, armZ, armWidth, armLength, armDepth, stretch);
rightArm .addBox(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch); rightArm .addCuboid(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch);
leftArmOverlay .addBox(armX, armY, armZ, armWidth, armLength, armDepth, stretch + 0.25f); leftSleeve .addCuboid(armX, armY, armZ, armWidth, armLength, armDepth, stretch + 0.25f);
rightArmOverlay.addBox(armX - armWidth, 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); leftLeg .addCuboid(armX, armY, armZ, armWidth, armLength, armDepth, stretch);
rightLeg .addBox(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch); rightLeg .addCuboid(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch);
leftLegOverlay .addBox(armX, armY, armZ, armWidth, armLength, armDepth, stretch + 0.25f); leftPantLeg .addCuboid(armX, armY, armZ, armWidth, armLength, armDepth, stretch + 0.25f);
rightLegOverlay.addBox(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch + 0.25f); rightPantLeg.addCuboid(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch + 0.25f);
} }
@Override @Override
@ -749,7 +749,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
} }
protected void renderHelmet(float scale) { protected void renderHelmet(float scale) {
headwear.render(scale); helmet.render(scale);
} }
protected void renderNeck(float scale) { protected void renderNeck(float scale) {
@ -758,22 +758,22 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
} }
protected void renderBody(float scale) { protected void renderBody(float scale) {
body.render(scale); torso.render(scale);
upperTorso.render(scale); upperTorso.render(scale);
body.applyTransform(scale); torso.applyTransform(scale);
tail.renderPart(scale, attributes.interpolatorId); tail.renderPart(scale, attributes.interpolatorId);
} }
protected void renderVest(float scale) { protected void renderVest(float scale) {
bodyOverlay.render(scale); jacket.render(scale);
if (bodyOverlay.visible) { if (jacket.visible) {
upperTorsoOverlay.render(scale); upperTorsoOverlay.render(scale);
} }
} }
protected void renderLegs(float scale) { protected void renderLegs(float scale) {
if (!isSneaking) { if (!isSneaking) {
body.applyTransform(scale); torso.applyTransform(scale);
} }
leftArm.render(scale); leftArm.render(scale);
@ -783,10 +783,10 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
} }
protected void renderSleeves(float scale) { protected void renderSleeves(float scale) {
leftArmOverlay.render(scale); leftSleeve.render(scale);
rightArmOverlay.render(scale); rightSleeve.render(scale);
leftLegOverlay.render(scale); leftPantLeg.render(scale);
rightLegOverlay.render(scale); rightPantLeg.render(scale);
} }
@Override @Override

View file

@ -1,6 +1,6 @@
package com.minelittlepony.client.model; 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.BipedEntityModel;
import net.minecraft.client.render.entity.model.PlayerEntityModel; import net.minecraft.client.render.entity.model.PlayerEntityModel;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
@ -65,7 +65,7 @@ public abstract class ClientPonyModel<T extends LivingEntity> extends PlayerEnti
} }
@Override @Override
public Cuboid getHead() { public ModelPart getHead() {
return head; return head;
} }
@ -81,7 +81,7 @@ public abstract class ClientPonyModel<T extends LivingEntity> extends PlayerEnti
@Override @Override
public Cuboid getArm(Arm side) { public ModelPart getArm(Arm side) {
return super.getArm(side); return super.getArm(side);
} }
@ -103,26 +103,26 @@ public abstract class ClientPonyModel<T extends LivingEntity> extends PlayerEnti
} }
@Override @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. // 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. // 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 randomI = rand.nextInt(cuboidList.size());
int index = randomI; int index = randomI;
Cuboid result; ModelPart result;
do { do {
result = cuboidList.get(randomI); result = cuboidList.get(randomI);
if (!result.boxes.isEmpty()) return result; if (!result.cuboids.isEmpty()) return result;
index = (index + 1) % cuboidList.size(); index = (index + 1) % cuboidList.size();
} while (index != randomI); } while (index != randomI);
if (result.boxes.isEmpty()) { if (result.cuboids.isEmpty()) {
result.addBox(0, 0, 0, 0, 0, 0); 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!"); throw new IllegalStateException("This model contains absolutely no boxes and a box could not be added!");
} }

View file

@ -1,6 +1,6 @@
package com.minelittlepony.client.model; package com.minelittlepony.client.model;
import net.minecraft.client.model.Cuboid; import net.minecraft.client.model.ModelPart;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import com.minelittlepony.model.PonyModelConstants; import com.minelittlepony.model.PonyModelConstants;
@ -18,7 +18,7 @@ public interface IMobModel {
* @param swingProgress How far we are through the current swing * @param swingProgress How far we are through the current swing
* @param ticks Render partial ticks * @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 swing = MathHelper.sin(swingProgress * PonyModelConstants.PI);
float roll = MathHelper.sin((1 - (1 - swingProgress) * (1 - swingProgress)) * PonyModelConstants.PI); float roll = MathHelper.sin((1 - (1 - swingProgress) * (1 - swingProgress)) * PonyModelConstants.PI);

View file

@ -1,6 +1,6 @@
package com.minelittlepony.client.model; 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.entity.LivingEntity;
import net.minecraft.util.Arm; import net.minecraft.util.Arm;
@ -82,12 +82,12 @@ public interface IPonyMixinModel<T extends LivingEntity, M extends IPonyModel<T>
} }
@Override @Override
default Cuboid getHead() { default ModelPart getHead() {
return mixin().getHead(); return mixin().getHead();
} }
@Override @Override
default Cuboid getBodyPart(BodyPart part) { default ModelPart getBodyPart(BodyPart part) {
return mixin().getBodyPart(part); return mixin().getBodyPart(part);
} }

View file

@ -1,6 +1,6 @@
package com.minelittlepony.client.model; 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.entity.LivingEntity;
import com.minelittlepony.model.ICapitated; import com.minelittlepony.model.ICapitated;
@ -9,7 +9,7 @@ import com.minelittlepony.model.IModel;
import com.minelittlepony.model.PonyModelConstants; import com.minelittlepony.model.PonyModelConstants;
import com.minelittlepony.pony.IPony; import com.minelittlepony.pony.IPony;
public interface IPonyModel<T extends LivingEntity> extends PonyModelConstants, IModel, ICapitated<Cuboid>, ICompartmented<Cuboid> { public interface IPonyModel<T extends LivingEntity> extends PonyModelConstants, IModel, ICapitated<ModelPart>, ICompartmented<ModelPart> {
void updateLivingState(T entity, IPony pony); void updateLivingState(T entity, IPony pony);

View file

@ -1,6 +1,6 @@
package com.minelittlepony.client.model.armour; 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.client.render.entity.model.BipedEntityModel;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
@ -14,8 +14,8 @@ public class ModelPonyArmour<T extends LivingEntity> extends AbstractPonyModel<T
public Part chestPiece; public Part chestPiece;
public Cuboid steveRightLeg; public ModelPart steveRightLeg;
public Cuboid steveLeftLeg; public ModelPart steveLeftLeg;
private ArmourVariant variant = ArmourVariant.NORMAL; private ArmourVariant variant = ArmourVariant.NORMAL;
@ -29,14 +29,14 @@ public class ModelPonyArmour<T extends LivingEntity> extends AbstractPonyModel<T
super.adjustBodyComponents(rotateAngleX, rotationPointY, rotationPointZ); super.adjustBodyComponents(rotateAngleX, rotationPointY, rotationPointZ);
chestPiece.pitch = rotateAngleX; chestPiece.pitch = rotateAngleX;
chestPiece.rotationPointY = rotationPointY; chestPiece.pivotY = rotationPointY;
chestPiece.rotationPointZ = rotationPointZ; chestPiece.pivotZ = rotationPointZ;
} }
@Override @Override
protected void renderBody(float scale) { protected void renderBody(float scale) {
if (variant == ArmourVariant.LEGACY) { if (variant == ArmourVariant.LEGACY) {
body.render(scale); torso.render(scale);
upperTorso.render(scale); upperTorso.render(scale);
} else { } else {
chestPiece.render(scale); chestPiece.render(scale);
@ -61,14 +61,14 @@ public class ModelPonyArmour<T extends LivingEntity> extends AbstractPonyModel<T
if (model instanceof BipedEntityModel) { if (model instanceof BipedEntityModel) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
BipedEntityModel<T> mainModel = (BipedEntityModel<T>)model; BipedEntityModel<T> mainModel = (BipedEntityModel<T>)model;
body.copyRotation(mainModel.body); torso.copyPositionAndRotation(mainModel.torso);
rightArm.copyRotation(mainModel.rightArm); rightArm.copyPositionAndRotation(mainModel.rightArm);
leftArm.copyRotation(mainModel.leftArm); leftArm.copyPositionAndRotation(mainModel.leftArm);
rightLeg.copyRotation(mainModel.rightLeg); rightLeg.copyPositionAndRotation(mainModel.rightLeg);
leftLeg.copyRotation(mainModel.leftLeg); leftLeg.copyPositionAndRotation(mainModel.leftLeg);
steveLeftLeg.copyRotation(mainModel.leftLeg); steveLeftLeg.copyPositionAndRotation(mainModel.leftLeg);
steveRightLeg.copyRotation(mainModel.rightLeg); steveRightLeg.copyPositionAndRotation(mainModel.rightLeg);
} }
} }
@ -124,22 +124,22 @@ public class ModelPonyArmour<T extends LivingEntity> extends AbstractPonyModel<T
float armY = THIRDP_ARM_CENTRE_Y; float armY = THIRDP_ARM_CENTRE_Y;
float armZ = BODY_CENTRE_Z / 2 - 1 - armDepth; float armZ = BODY_CENTRE_Z / 2 - 1 - armDepth;
steveLeftLeg .setRotationPoint( rarmX, yOffset, 0); steveLeftLeg .setPivot( rarmX, yOffset, 0);
steveRightLeg.setRotationPoint(-rarmX, yOffset, 0); steveRightLeg.setPivot(-rarmX, yOffset, 0);
steveLeftLeg .addBox(armX, armY, armZ, armWidth, armLength, armDepth, stretch); steveLeftLeg .addCuboid(armX, armY, armZ, armWidth, armLength, armDepth, stretch);
steveRightLeg.addBox(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch); steveRightLeg.addCuboid(armX - armWidth, armY, armZ, armWidth, armLength, armDepth, stretch);
} }
@Override @Override
public void setInVisible() { public void setInVisible() {
setVisible(false); setVisible(false);
body.visible = true; torso.visible = true;
chestPiece.visible = false; chestPiece.visible = false;
head.visible = false; head.visible = false;
neck.visible = false; neck.visible = false;
tail.setVisible(false); tail.setVisible(false);
upperTorso.field_3664 = true; upperTorso.visible = false;
snout.isHidden = true; snout.isHidden = true;
steveLeftLeg.visible = false; steveLeftLeg.visible = false;
steveRightLeg.visible = false; steveRightLeg.visible = false;
@ -172,7 +172,6 @@ public class ModelPonyArmour<T extends LivingEntity> extends AbstractPonyModel<T
neck.visible = true; neck.visible = true;
if (variant == ArmourVariant.LEGACY) { if (variant == ArmourVariant.LEGACY) {
upperTorso.field_3664 = false;
upperTorso.visible = true; upperTorso.visible = true;
} }
} }

View file

@ -6,9 +6,9 @@ public class ModelDeadMau5Ears extends SkullEntityModel {
public ModelDeadMau5Ears() { public ModelDeadMau5Ears() {
super(24, 0, 64, 64); super(24, 0, 64, 64);
skull.boxes.clear(); skull.cuboids.clear();
skull.addBox(-9, -13, -1, 6, 6, 1, 0); skull.addCuboid(-9, -13, -1, 6, 6, 1, 0);
skull.addBox(3, -13, -1, 6, 6, 1, 0); skull.addCuboid(3, -13, -1, 6, 6, 1, 0);
} }
public void setVisible(boolean show) { public void setVisible(boolean show) {

View file

@ -4,11 +4,10 @@ import com.minelittlepony.client.pony.PonyData;
import com.minelittlepony.client.util.render.Part; import com.minelittlepony.client.util.render.Part;
import com.minelittlepony.model.ICapitated; import com.minelittlepony.model.ICapitated;
import com.minelittlepony.pony.IPonyData; import com.minelittlepony.pony.IPonyData;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.model.Cuboid;
import net.minecraft.client.render.entity.model.SkullOverlayEntityModel; import net.minecraft.client.render.entity.model.SkullOverlayEntityModel;
public class ModelPonyHead extends SkullOverlayEntityModel implements ICapitated<Cuboid> { public class ModelPonyHead extends SkullOverlayEntityModel implements ICapitated<ModelPart> {
private PonySnout snout; private PonySnout snout;
@ -35,7 +34,7 @@ public class ModelPonyHead extends SkullOverlayEntityModel implements ICapitated
} }
@Override @Override
public Cuboid getHead() { public ModelPart getHead() {
return skull; return skull;
} }

View file

@ -1,8 +1,7 @@
package com.minelittlepony.client.model.components; package com.minelittlepony.client.model.components;
import net.minecraft.client.model.Cuboid;
import net.minecraft.client.model.Model; import net.minecraft.client.model.Model;
import net.minecraft.client.model.ModelPart;
import com.minelittlepony.client.util.render.Part; import com.minelittlepony.client.util.render.Part;
import com.minelittlepony.model.ICapitated; import com.minelittlepony.model.ICapitated;
import com.minelittlepony.model.IPart; import com.minelittlepony.model.IPart;
@ -17,7 +16,7 @@ public class PonyEars implements IPart {
private Part right; private Part right;
private Part left; private Part left;
public <T extends Model & ICapitated<Cuboid>> PonyEars(Part head, boolean bat) { public <T extends Model & ICapitated<ModelPart>> PonyEars(Part head, boolean bat) {
this.head = head; this.head = head;
this.bat = bat; this.bat = bat;
} }

View file

@ -71,8 +71,8 @@ public class PonyElytra<T extends LivingEntity> extends EntityModel<T> {
rpY = BODY_RP_Y_SNEAK; rpY = BODY_RP_Y_SNEAK;
} }
leftWing.rotationPointX = 5; leftWing.pivotX = 5;
leftWing.rotationPointY = rpY; leftWing.pivotY = rpY;
if (entity instanceof AbstractClientPlayerEntity) { if (entity instanceof AbstractClientPlayerEntity) {
AbstractClientPlayerEntity player = (AbstractClientPlayerEntity) entity; AbstractClientPlayerEntity player = (AbstractClientPlayerEntity) entity;
@ -90,8 +90,8 @@ public class PonyElytra<T extends LivingEntity> extends EntityModel<T> {
leftWing.roll = rotateY; leftWing.roll = rotateY;
} }
rightWing.rotationPointX = -leftWing.rotationPointX; rightWing.pivotX = -leftWing.pivotX;
rightWing.rotationPointY = leftWing.rotationPointY; rightWing.pivotY = leftWing.pivotY;
rightWing.pitch = leftWing.pitch; rightWing.pitch = leftWing.pitch;
rightWing.yaw = -leftWing.yaw; rightWing.yaw = -leftWing.yaw;
rightWing.roll = -leftWing.roll; rightWing.roll = -leftWing.roll;

View file

@ -1,8 +1,7 @@
package com.minelittlepony.client.model.components; package com.minelittlepony.client.model.components;
import net.minecraft.client.model.Cuboid;
import net.minecraft.client.model.Model; import net.minecraft.client.model.Model;
import net.minecraft.client.model.ModelPart;
import com.minelittlepony.client.MineLittlePony; import com.minelittlepony.client.MineLittlePony;
import com.minelittlepony.client.util.render.Part; import com.minelittlepony.client.util.render.Part;
import com.minelittlepony.model.ICapitated; import com.minelittlepony.model.ICapitated;
@ -18,13 +17,13 @@ public class PonySnout implements IPart {
private Part mare; private Part mare;
private Part stallion; private Part stallion;
private final ICapitated<Cuboid> head; private final ICapitated<ModelPart> head;
public <T extends Model & ICapitated<Cuboid>> PonySnout(T pony) { public <T extends Model & ICapitated<ModelPart>> PonySnout(T pony) {
this(pony, 0, 0, 0); this(pony, 0, 0, 0);
} }
public <T extends Model & ICapitated<Cuboid>> PonySnout(T pony, int x, int y, int z) { public <T extends Model & ICapitated<ModelPart>> PonySnout(T pony, int x, int y, int z) {
head = pony; head = pony;
mare = new Part(pony).offset(HEAD_CENTRE_X + x, HEAD_CENTRE_Y + y, HEAD_CENTRE_Z + z + 0.25F); mare = new Part(pony).offset(HEAD_CENTRE_X + x, HEAD_CENTRE_Y + y, HEAD_CENTRE_Z + z + 0.25F);

View file

@ -37,11 +37,11 @@ public class PonyTail extends Part implements IPart {
if (theModel.getAttributes().isCrouching && !rainboom) { if (theModel.getAttributes().isCrouching && !rainboom) {
rotateSneak(); rotateSneak();
} else if (theModel.isRiding()) { } else if (theModel.isRiding()) {
rotationPointZ = TAIL_RP_Z_RIDING; pivotZ = TAIL_RP_Z_RIDING;
rotationPointY = TAIL_RP_Y_RIDING; pivotY = TAIL_RP_Y_RIDING;
pitch = PI / 5; pitch = PI / 5;
} else { } 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) { if (rainboom) {
pitch = ROTATE_90 + MathHelper.sin(move) / 10; pitch = ROTATE_90 + MathHelper.sin(move) / 10;
} else { } else {
@ -52,8 +52,8 @@ public class PonyTail extends Part implements IPart {
} }
if (rainboom) { if (rainboom) {
rotationPointY += 6; pivotY += 6;
rotationPointZ++; pivotZ++;
} }
tailStop = theModel.getMetadata().getTail().ordinal(); tailStop = theModel.getMetadata().getTail().ordinal();
@ -66,7 +66,7 @@ public class PonyTail extends Part implements IPart {
} }
private void rotateSneak() { 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; pitch = -BODY_ROT_X_SNEAK + 0.1F;
} }

View file

@ -1,9 +1,8 @@
package com.minelittlepony.client.model.components; package com.minelittlepony.client.model.components;
import net.minecraft.client.MinecraftClient; import net.minecraft.client.MinecraftClient;
import net.minecraft.client.model.Cuboid;
import net.minecraft.client.model.Model; 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.Color;
import com.minelittlepony.client.util.render.Part; import com.minelittlepony.client.util.render.Part;
import com.minelittlepony.model.ICapitated; import com.minelittlepony.model.ICapitated;
@ -24,11 +23,11 @@ public class UnicornHorn implements IPart {
protected boolean isVisible = true; protected boolean isVisible = true;
public <T extends Model & ICapitated<Cuboid>> UnicornHorn(T pony, float yOffset, float stretch) { public <T extends Model & ICapitated<ModelPart>> UnicornHorn(T pony, float yOffset, float stretch) {
this(pony, yOffset, stretch, 0, 0, 0); this(pony, yOffset, stretch, 0, 0, 0);
} }
public <T extends Model & ICapitated<Cuboid>> UnicornHorn(T pony, float yOffset, float stretch, int x, int y, int z) { public <T extends Model & ICapitated<ModelPart>> UnicornHorn(T pony, float yOffset, float stretch, int x, int y, int z) {
horn = new Part(pony, 0, 3); horn = new Part(pony, 0, 3);
glow = new Part(pony, 0, 3); glow = new Part(pony, 0, 3);

View file

@ -1,6 +1,6 @@
package com.minelittlepony.client.model.entities; 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.client.render.entity.model.BipedEntityModel;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.util.Arm; import net.minecraft.util.Arm;
@ -23,7 +23,7 @@ public class ModelBreezie<T extends LivingEntity> extends BipedEntityModel<T> {
textureWidth = 64; textureWidth = 64;
textureHeight = 64; textureHeight = 64;
headwear.visible = false; helmet.visible = false;
head = new Part(this) head = new Part(this)
.child(new Part(this) .child(new Part(this)
.addBox(-3, -6, -3, 6, 6, 6).around(0, 0, -4) .addBox(-3, -6, -3, 6, 6, 6).around(0, 0, -4)
@ -35,7 +35,7 @@ public class ModelBreezie<T extends LivingEntity> extends BipedEntityModel<T> {
.tex(24, 2).addBox(-2, -11, -3, 1, 6, 1) .tex(24, 2).addBox(-2, -11, -3, 1, 6, 1)
.rotate(-0.2617994F, 0, 0)); .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); .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); leftArm = new Part(this, 28, 12).addBox(0, 0, 0, 2, 12, 2).around( 1, 8, -5);
@ -67,7 +67,7 @@ public class ModelBreezie<T extends LivingEntity> extends BipedEntityModel<T> {
@Override @Override
public void render(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) { 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); neck.render(scale);
tailStub.render(scale); tailStub.render(scale);
tail.render(scale); tail.render(scale);
@ -124,36 +124,36 @@ public class ModelBreezie<T extends LivingEntity> extends BipedEntityModel<T> {
} }
protected void swingArms(Arm mainHand) { 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) { if (mainHand == Arm.LEFT) {
body.yaw *= -1; torso.yaw *= -1;
} }
float sin = MathHelper.sin(body.yaw) * 5; float sin = MathHelper.sin(torso.yaw) * 5;
float cos = MathHelper.cos(body.yaw) * 5; float cos = MathHelper.cos(torso.yaw) * 5;
leftArm.pitch += body.yaw; leftArm.pitch += torso.yaw;
leftArm.yaw += body.yaw; leftArm.yaw += torso.yaw;
leftArm.rotationPointX = cos; leftArm.pivotX = cos;
leftArm.rotationPointZ = -sin; leftArm.pivotZ = -sin;
rightArm.yaw += body.yaw; rightArm.yaw += torso.yaw;
rightArm.rotationPointX = -cos; rightArm.pivotX = -cos;
rightArm.rotationPointZ = sin; rightArm.pivotZ = sin;
float swingAmount = 1 - (float)Math.pow(1 - handSwingProgress, 4); float swingAmount = 1 - (float)Math.pow(1 - handSwingProgress, 4);
float swingFactorX = MathHelper.sin(swingAmount * PI); float swingFactorX = MathHelper.sin(swingAmount * PI);
float swingX = MathHelper.sin(handSwingProgress * PI) * (0.7F - head.pitch) * 0.75F; 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.pitch -= swingFactorX * 1.2F + swingX;
mainArm.yaw += body.yaw * 2; mainArm.yaw += torso.yaw * 2;
mainArm.roll -= MathHelper.sin(handSwingProgress * PI) * 0.4F; 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) { switch (pose) {
case EMPTY: case EMPTY:
arm.yaw = 0; arm.yaw = 0;
@ -169,7 +169,7 @@ public class ModelBreezie<T extends LivingEntity> extends BipedEntityModel<T> {
} }
} }
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.yaw = head.yaw + (factor / 10);
up.pitch = head.pitch - (PI / 2); up.pitch = head.pitch - (PI / 2);

View file

@ -1,6 +1,6 @@
package com.minelittlepony.client.model.entities; 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.entity.mob.EndermanEntity;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
@ -42,11 +42,11 @@ public class ModelEnderStallion extends ModelSkeletonPony<EndermanEntity> {
tail.setVisible(false); tail.setVisible(false);
snout.isHidden = true; snout.isHidden = true;
leftArmOverlay.field_3664 = true; leftSleeve.field_3664 = true;
rightArmOverlay.field_3664 = true; rightSleeve.field_3664 = true;
leftLegOverlay.field_3664 = true; leftPantLeg.field_3664 = true;
rightLegOverlay.field_3664 = true; rightPantLeg.field_3664 = true;
leftHorn.pitch = 0.5F; leftHorn.pitch = 0.5F;
rightHorn.pitch = 0.5F; rightHorn.pitch = 0.5F;
@ -57,7 +57,7 @@ public class ModelEnderStallion extends ModelSkeletonPony<EndermanEntity> {
super.setAngles(entity, move, swing, ticks, headYaw, headPitch, scale); super.setAngles(entity, move, swing, ticks, headYaw, headPitch, scale);
if (isAttacking) { if (isAttacking) {
head.rotationPointY -= 5; head.pivotY -= 5;
} }
} }
@ -103,7 +103,7 @@ public class ModelEnderStallion extends ModelSkeletonPony<EndermanEntity> {
.around(3.9F, -6, 0.001F) .around(3.9F, -6, 0.001F)
.box(0, 0, 0, 2, 6, 2, stretch); .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) .offset(HEAD_CENTRE_X, HEAD_CENTRE_Y, HEAD_CENTRE_Z)
.around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2) .around(HEAD_RP_X, HEAD_RP_Y + yOffset, HEAD_RP_Z - 2)
.box(-4, -4, -4, 8, 8, 8, stretch - 0.5F); .box(-4, -4, -4, 8, 8, 8, stretch - 0.5F);
@ -113,18 +113,18 @@ public class ModelEnderStallion extends ModelSkeletonPony<EndermanEntity> {
} }
@Override @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.3707964F;
arm.pitch += 0.4F + MathHelper.sin(ticks * 0.067F) / 10; arm.pitch += 0.4F + MathHelper.sin(ticks * 0.067F) / 10;
} }
@Override @Override
protected void preInitLegs() { protected void preInitLegs() {
leftArm = new Cuboid(this, 0, 20); leftArm = new ModelPart(this, 0, 20);
rightArm = new Cuboid(this, 0, 20); rightArm = new ModelPart(this, 0, 20);
leftLeg = new Cuboid(this, 0, 20); leftLeg = new ModelPart(this, 0, 20);
rightLeg = new Cuboid(this, 0, 20); rightLeg = new ModelPart(this, 0, 20);
} }
@Override @Override

View file

@ -1,6 +1,6 @@
package com.minelittlepony.client.model.entities; 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.entity.mob.IllagerEntity;
import net.minecraft.util.Arm; import net.minecraft.util.Arm;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
@ -21,7 +21,7 @@ public class ModelIllagerPony<T extends IllagerEntity> extends ModelAlicorn<T> {
boolean rightHanded = illager.getMainArm() == Arm.RIGHT; boolean rightHanded = illager.getMainArm() == Arm.RIGHT;
float mult = rightHanded ? 1 : -1; float mult = rightHanded ? 1 : -1;
Cuboid arm = getArm(illager.getMainArm()); ModelPart arm = getArm(illager.getMainArm());
if (pose == IllagerEntity.State.ATTACKING) { if (pose == IllagerEntity.State.ATTACKING) {
// vindicator attacking // vindicator attacking

View file

@ -3,6 +3,7 @@ package com.minelittlepony.client.model.entities;
import com.minelittlepony.client.model.armour.ModelPonyArmour; import com.minelittlepony.client.model.armour.ModelPonyArmour;
import com.minelittlepony.client.model.armour.ArmourWrapper; import com.minelittlepony.client.model.armour.ArmourWrapper;
import com.minelittlepony.client.model.components.SeaponyTail; 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.model.races.ModelUnicorn;
import com.minelittlepony.client.util.render.Part; import com.minelittlepony.client.util.render.Part;
import com.minelittlepony.model.BodyPart; import com.minelittlepony.model.BodyPart;
@ -62,8 +63,8 @@ public class ModelSeapony<T extends LivingEntity> extends ModelUnicorn<T> {
// hide the back legs // hide the back legs
leftLeg.visible = false; leftLeg.visible = false;
rightLeg.visible = false; rightLeg.visible = false;
leftLegOverlay.visible = false; leftPantLeg.visible = false;
rightLegOverlay.visible = false; rightPantLeg.visible = false;
centerFin = new Part(this, 58, 28) centerFin = new Part(this, 58, 28)
.rotate(PI / 2 - 0.1F, 0, 0).around(0, 6, 9) .rotate(PI / 2 - 0.1F, 0, 0).around(0, 6, 9)
@ -138,7 +139,7 @@ public class ModelSeapony<T extends LivingEntity> extends ModelUnicorn<T> {
@Override @Override
public void render(T entity, float move, float swing, float ticks, float headYaw, float headPitch, float scale) { 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); super.render(entity, move, swing, ticks, headYaw, headPitch, scale);
} }
@ -152,9 +153,9 @@ public class ModelSeapony<T extends LivingEntity> extends ModelUnicorn<T> {
@Override @Override
protected void renderBody(float scale) { protected void renderBody(float scale) {
body.render(scale); torso.render(scale);
bodyCenter.render(scale); bodyCenter.render(scale);
body.applyTransform(scale); torso.applyTransform(scale);
tail.renderPart(scale, attributes.interpolatorId); tail.renderPart(scale, attributes.interpolatorId);
@ -182,8 +183,8 @@ public class ModelSeapony<T extends LivingEntity> extends ModelUnicorn<T> {
// hide the back legs // hide the back legs
leftLeg.visible = false; leftLeg.visible = false;
rightLeg.visible = false; rightLeg.visible = false;
leftLegOverlay.visible = false; leftPantLeg.visible = false;
rightLegOverlay.visible = false; rightPantLeg.visible = false;
bodyCenter.visible = visible; bodyCenter.visible = visible;

View file

@ -100,13 +100,13 @@ public class ModelVillagerPony<T extends LivingEntity & VillagerDataContainer> e
float roll = 0.3F * MathHelper.sin(0.45F * ticks); float roll = 0.3F * MathHelper.sin(0.45F * ticks);
this.head.roll = roll; this.head.roll = roll;
this.headwear.roll = roll; this.helmet.roll = roll;
this.head.pitch = 0.4F; this.head.pitch = 0.4F;
this.headwear.pitch = 0.4F; this.helmet.pitch = 0.4F;
} else { } else {
this.head.roll = 0.0F; this.head.roll = 0.0F;
this.headwear.roll = 0.0F; this.helmet.roll = 0.0F;
} }
} }
} }

View file

@ -46,21 +46,21 @@ public class ModelWitchPony extends ModelZebra<WitchEntity> {
float legDrinkingAngle = -1 * PI/3 + rot; float legDrinkingAngle = -1 * PI/3 + rot;
rightArm.pitch = legDrinkingAngle; rightArm.pitch = legDrinkingAngle;
rightArmOverlay.pitch = legDrinkingAngle; rightSleeve.pitch = legDrinkingAngle;
rightArm.yaw = 0.1F; rightArm.yaw = 0.1F;
rightArmOverlay.yaw = 0.1F; rightSleeve.yaw = 0.1F;
rightArm.z = 0.1F; rightArm.z = 0.1F;
rightArmOverlay.z = 0.1F; rightSleeve.z = 0.1F;
if (rot > 0) { if (rot > 0) {
rot = 0; rot = 0;
} }
head.pitch = -rot / 2; head.pitch = -rot / 2;
headwear.pitch = -rot / 2; helmet.pitch = -rot / 2;
} else { } else {
rightArm.z = 0; rightArm.z = 0;
rightArmOverlay.z = 0; rightSleeve.z = 0;
} }
} }

View file

@ -27,7 +27,7 @@ public class ModelEarthPony<T extends LivingEntity> extends AbstractPonyModel<T>
super.setAngles(entity, move, swing, ticks, headYaw, headPitch, scale); super.setAngles(entity, move, swing, ticks, headYaw, headPitch, scale);
if (bipedCape != null) { if (bipedCape != null) {
bipedCape.rotationPointY = isSneaking ? 2 : isRiding ? -4 : 0; bipedCape.pivotY = isSneaking ? 2 : isRiding ? -4 : 0;
} }
} }

View file

@ -3,8 +3,7 @@ package com.minelittlepony.client.model.races;
import com.minelittlepony.client.model.components.UnicornHorn; import com.minelittlepony.client.model.components.UnicornHorn;
import com.minelittlepony.client.util.render.Part; import com.minelittlepony.client.util.render.Part;
import com.minelittlepony.model.IUnicorn; import com.minelittlepony.model.IUnicorn;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.model.Cuboid;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.util.Arm; import net.minecraft.util.Arm;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
@ -119,7 +118,7 @@ public class ModelUnicorn<T extends LivingEntity> extends ModelEarthPony<T> impl
} }
@Override @Override
public Cuboid getArm(Arm side) { public ModelPart getArm(Arm side) {
if (canCast() && getArmPoseForSide(side) != ArmPose.EMPTY) { if (canCast() && getArmPoseForSide(side) != ArmPose.EMPTY) {
return getUnicornArmForSide(side); return getUnicornArmForSide(side);
} }

View file

@ -6,8 +6,10 @@ import net.minecraft.entity.LivingEntity;
import net.minecraft.util.math.Box; import net.minecraft.util.math.Box;
import com.minelittlepony.pony.IPony; 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 { public class DebugBoundingBoxRenderer {

View file

@ -5,7 +5,8 @@ import org.lwjgl.opengl.GL14;
import com.minelittlepony.client.MineLittlePony; import com.minelittlepony.client.MineLittlePony;
import com.minelittlepony.client.util.render.Color; import com.minelittlepony.client.util.render.Color;
import com.minelittlepony.pony.IPony; 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.MinecraftClient;
import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.render.FirstPersonRenderer; import net.minecraft.client.render.FirstPersonRenderer;
@ -16,7 +17,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.Arm; import net.minecraft.util.Arm;
import net.minecraft.util.UseAction; import net.minecraft.util.UseAction;
import static com.mojang.blaze3d.platform.GlStateManager.*; import static com.mojang.blaze3d.systems.RenderSystem.*;
public class LevitatingItemRenderer { public class LevitatingItemRenderer {

View file

@ -70,7 +70,7 @@ public class RenderPony<T extends LivingEntity, M extends EntityModel<T> & IPony
if (entity.hasVehicle()) { if (entity.hasVehicle()) {
Entity mount = entity.getVehicle(); Entity mount = entity.getVehicle();
if (mount instanceof LivingEntity) { 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);
} }
} }

View file

@ -8,6 +8,8 @@ import net.minecraft.util.Identifier;
import com.minelittlepony.client.model.IPonyModel; import com.minelittlepony.client.model.IPonyModel;
import com.minelittlepony.client.render.IPonyRender; import com.minelittlepony.client.render.IPonyRender;
import com.mojang.blaze3d.platform.GLX; 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.*; import static com.mojang.blaze3d.platform.GlStateManager.*;
@ -37,7 +39,7 @@ public class LayerEyeGlow<T extends LivingEntity, M extends EntityModel<T> & IPo
MinecraftClient.getInstance().gameRenderer.setFogBlack(true); 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); MinecraftClient.getInstance().gameRenderer.setFogBlack(false);

View file

@ -33,7 +33,7 @@ public abstract class LayerOverlayBase<T extends LivingEntity, M extends BipedEn
renderer.bindTexture(getOverlayTexture()); renderer.bindTexture(getOverlayTexture());
overlayModel.render(entity, move, swing, ticks, headYaw, headPitch, scale); overlayModel.setAngles(entity, move, swing, ticks, headYaw, headPitch, scale);
} }
protected abstract M getOverlayModel(); protected abstract M getOverlayModel();

View file

@ -39,7 +39,7 @@ public class LayerPonyCape<M extends ClientPonyModel<AbstractClientPlayerEntity>
double capeY = MathHelper.lerp(partialTicks, player.field_7502, player.field_7521) - MathHelper.lerp(partialTicks, player.prevY, player.y); 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); 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 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); //double capeY = player.prevRenderY + (player.y - player.prevRenderY) * scale - (player.prevY + (player.y - player.prevY) * scale);

View file

@ -20,7 +20,7 @@ import net.minecraft.item.BlockItem;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.TagHelper; import net.minecraft.nbt.NbtHelper;
import net.minecraft.village.VillagerDataContainer; import net.minecraft.village.VillagerDataContainer;
import static com.mojang.blaze3d.platform.GlStateManager.*; import static com.mojang.blaze3d.platform.GlStateManager.*;
@ -87,11 +87,11 @@ public class LayerPonyCustomHead<T extends LivingEntity, M extends EntityModel<T
assert nbt != null; assert nbt != null;
if (nbt.containsKey("SkullOwner", 10)) { if (nbt.contains("SkullOwner", 10)) {
profile = TagHelper.deserializeProfile(nbt.getCompound("SkullOwner")); profile = NbtHelper.toGameProfile(nbt.getCompound("SkullOwner"));
} else if (nbt.containsKey("SkullOwner", 8)) { } else if (nbt.contains("SkullOwner", 8)) {
profile = SkullBlockEntity.loadProperties(new GameProfile(null, nbt.getString("SkullOwner"))); profile = SkullBlockEntity.loadProperties(new GameProfile(null, nbt.getString("SkullOwner")));
nbt.put("SkullOwner", TagHelper.serializeProfile(new CompoundTag(), profile)); nbt.put("SkullOwner", NbtHelper.fromGameProfile(new CompoundTag(), profile));
} }
} }

View file

@ -12,7 +12,7 @@ import net.minecraft.block.SkullBlock;
import net.minecraft.block.entity.SkullBlockEntity; import net.minecraft.block.entity.SkullBlockEntity;
import net.minecraft.client.render.block.entity.SkullBlockEntityRenderer; import net.minecraft.client.render.block.entity.SkullBlockEntityRenderer;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.SystemUtil; import net.minecraft.util.Util;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
@ -30,7 +30,7 @@ public class PonySkullRenderer extends SkullBlockEntityRenderer {
private static final PonySkullRenderer ponyInstance = new PonySkullRenderer(); private static final PonySkullRenderer ponyInstance = new PonySkullRenderer();
private static SkullBlockEntityRenderer backup = null; private static SkullBlockEntityRenderer backup = null;
private static final Map<SkullBlock.SkullType, ISkull> skullMap = SystemUtil.consume(Maps.newHashMap(), (skullMap) -> { private static final Map<SkullBlock.SkullType, ISkull> skullMap = Util.create(Maps.newHashMap(), (skullMap) -> {
skullMap.put(SkullBlock.Type.SKELETON, new SkeletonSkullRenderer()); skullMap.put(SkullBlock.Type.SKELETON, new SkeletonSkullRenderer());
skullMap.put(SkullBlock.Type.WITHER_SKELETON, new WitherSkullRenderer()); skullMap.put(SkullBlock.Type.WITHER_SKELETON, new WitherSkullRenderer());
skullMap.put(SkullBlock.Type.ZOMBIE, new ZombieSkullRenderer()); skullMap.put(SkullBlock.Type.ZOMBIE, new ZombieSkullRenderer());

View file

@ -12,6 +12,8 @@ import java.util.function.Function;
import static com.mojang.blaze3d.platform.GlStateManager.getTexLevelParameter; import static com.mojang.blaze3d.platform.GlStateManager.getTexLevelParameter;
import static org.lwjgl.opengl.GL11.*; import static org.lwjgl.opengl.GL11.*;
import com.minelittlepony.client.util.render.NativeUtil.InternalFormat;
public class NativeUtil { public class NativeUtil {
enum InternalFormat { enum InternalFormat {
RGB(NativeImage.Format.RGB), RGB(NativeImage.Format.RGB),
@ -98,7 +100,7 @@ public class NativeUtil {
} }
// recreate NativeImage from the GL matrix // recreate NativeImage from the GL matrix
textures.bindTexture(resource); textures.bindTextureInner(resource);
// TODO: This returns values that are too specific. // TODO: This returns values that are too specific.
// Can we change the level (0) here to something // Can we change the level (0) here to something

View file

@ -1,13 +1,13 @@
package com.minelittlepony.client.util.render; package com.minelittlepony.client.util.render;
import net.minecraft.client.model.Box; import net.minecraft.client.model.Box;
import net.minecraft.client.model.Cuboid;
import net.minecraft.client.model.Model; import net.minecraft.client.model.Model;
import net.minecraft.client.model.ModelPart;
import net.minecraft.client.model.Quad; import net.minecraft.client.model.Quad;
import net.minecraft.client.model.Vertex; import net.minecraft.client.model.Vertex;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
public class Part extends Cuboid { public class Part extends ModelPart {
protected final Model baseModel; 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. * 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) { public static void shiftRotationPoint(ModelPart renderer, float x, float y, float z) {
renderer.rotationPointX += x; renderer.pivotX += x;
renderer.rotationPointY += y; renderer.pivotY += y;
renderer.rotationPointZ += z; renderer.pivotZ += z;
} }
/** /**
@ -112,7 +112,7 @@ public class Part extends Cuboid {
* Positions a given model in space by setting its offset values divided * Positions a given model in space by setting its offset values divided
* by 16 to account for scaling applied inside the model. * by 16 to account for scaling applied inside the model.
*/ */
public static <T extends Cuboid> T at(T renderer, float x, float y, float z) { public static <T extends ModelPart> T at(T renderer, float x, float y, float z) {
renderer.x = x / 16; renderer.x = x / 16;
renderer.y = y / 16; renderer.y = y / 16;
renderer.z = z / 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. * 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); rotate(other.pitch, other.yaw, other.roll);
} }
/** /**
* Shifts this model to align its center with the center of another. * Shifts this model to align its center with the center of another.
*/ */
public Part rotateAt(Cuboid other) { public Part rotateAt(ModelPart other) {
return around(other.rotationPointX, other.rotationPointY, other.rotationPointZ); return around(other.pivotX, other.pivotY, other.pivotZ);
} }
/** /**
* Sets the rotation point. * Sets the rotation point.
*/ */
public Part around(float x, float y, float z) { public Part around(float x, float y, float z) {
setRotationPoint(x, y, z); setPivot(x, y, z);
return this; return this;
} }
@ -166,7 +166,7 @@ public class Part extends Cuboid {
/** /**
* Adds a new child renderer and returns itself for chaining. * Adds a new child renderer and returns itself for chaining.
*/ */
public <K extends Cuboid> Part child(K child) { public <K extends ModelPart> Part child(K child) {
addChild(child); addChild(child);
return this; 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) { 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; return this;
} }
@ -223,30 +223,30 @@ public class Part extends Cuboid {
setTextureOffset(texX, texY); setTextureOffset(texX, texY);
addBox(offX, offY, offZ, width, height, depth); addBox(offX, offY, offZ, width, height, depth);
boxes.get(boxes.size() - 1).setName(partName); cuboids.get(cuboids.size() - 1).setName(partName);
return this; return this;
} }
@Override @Override
public Part addBox(float offX, float offY, float offZ, int width, int height, int depth) { 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; return this;
} }
@Override @Override
public Part addBox(float offX, float offY, float offZ, int width, int height, int depth, boolean mirrored) { 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; return this;
} }
@Override @Override
public void addBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor) { public void addCuboid(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);
} }
@Override @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); createBox(offX, offY, offZ, width, height, depth, scaleFactor, mirrored);
} }
@ -254,19 +254,19 @@ public class Part extends Cuboid {
* Creates a textured box. * Creates a textured box.
*/ */
public Part box(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor) { 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; return this;
} }
public Part cone(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor) { 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; return this;
} }
protected void createBox(float offX, float offY, float offZ, int width, int height, int depth, float scaleFactor, boolean mirrored) { 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));
} }
/** /**

View file

@ -95,7 +95,7 @@ public enum TriggerPixels {
public int readValue(int x, int y, NativeImage image) { public int readValue(int x, int y, NativeImage image) {
/*getPixelABGR*/ /*getPixelABGR*/
return (Color.abgrToArgb(image.getPixelRGBA(x, y)) >> offset) & mask; return (Color.abgrToArgb(image.getPixelRgba(x, y)) >> offset) & mask;
} }
} }
} }

View file

@ -18,9 +18,9 @@ public abstract class MotionCompositor {
protected double calculateRoll(PlayerEntity player, double motionX, double motionY, double motionZ) { 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... // 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); 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 // 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) { if (Math.abs(MathUtil.sensibleAngle((float) Math.toDegrees(Math.atan2(motionX, motionZ)) + modelYaw)) > 90) {