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();
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

View file

@ -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(

View file

@ -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<T extends LivingEntity> 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<T extends LivingEntity> 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<T extends LivingEntity> 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<T extends LivingEntity> 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<T extends LivingEntity> 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<T extends LivingEntity> 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<T extends LivingEntity> 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<T extends LivingEntity> 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<T extends LivingEntity> 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<T extends LivingEntity> 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<T extends LivingEntity> 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<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.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<T extends LivingEntity> 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<T extends LivingEntity> 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<T extends LivingEntity> 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<T extends LivingEntity> 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<T extends LivingEntity> 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<T extends LivingEntity> 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<T extends LivingEntity> 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<T extends LivingEntity> 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<T extends LivingEntity> 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<T extends LivingEntity> 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<T extends LivingEntity> 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

View file

@ -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<T extends LivingEntity> extends PlayerEnti
}
@Override
public Cuboid getHead() {
public ModelPart getHead() {
return head;
}
@ -81,7 +81,7 @@ public abstract class ClientPonyModel<T extends LivingEntity> 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<T extends LivingEntity> 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!");
}

View file

@ -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);

View file

@ -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<T extends LivingEntity, M extends IPonyModel<T>
}
@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);
}

View file

@ -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<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);

View file

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

View file

@ -6,9 +6,9 @@ public class ModelDeadMau5Ears extends SkullEntityModel {
public ModelDeadMau5Ears() {
super(24, 0, 64, 64);
skull.boxes.clear();
skull.addBox(-9, -13, -1, 6, 6, 1, 0);
skull.addBox(3, -13, -1, 6, 6, 1, 0);
skull.cuboids.clear();
skull.addCuboid(-9, -13, -1, 6, 6, 1, 0);
skull.addCuboid(3, -13, -1, 6, 6, 1, 0);
}
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.model.ICapitated;
import com.minelittlepony.pony.IPonyData;
import net.minecraft.client.model.Cuboid;
import net.minecraft.client.model.ModelPart;
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;
@ -35,7 +34,7 @@ public class ModelPonyHead extends SkullOverlayEntityModel implements ICapitated
}
@Override
public Cuboid getHead() {
public ModelPart getHead() {
return skull;
}

View file

@ -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 <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.bat = bat;
}

View file

@ -71,8 +71,8 @@ public class PonyElytra<T extends LivingEntity> extends EntityModel<T> {
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<T extends LivingEntity> extends EntityModel<T> {
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;

View file

@ -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<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);
}
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;
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) {
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;
}

View file

@ -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 <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);
}
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);
glow = new Part(pony, 0, 3);

View file

@ -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<T extends LivingEntity> extends BipedEntityModel<T> {
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<T extends LivingEntity> extends BipedEntityModel<T> {
.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<T extends LivingEntity> extends BipedEntityModel<T> {
@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<T extends LivingEntity> extends BipedEntityModel<T> {
}
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<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.pitch = head.pitch - (PI / 2);

View file

@ -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<EndermanEntity> {
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<EndermanEntity> {
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<EndermanEntity> {
.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<EndermanEntity> {
}
@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

View file

@ -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<T extends IllagerEntity> extends ModelAlicorn<T> {
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

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.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<T extends LivingEntity> extends ModelUnicorn<T> {
// 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<T extends LivingEntity> extends ModelUnicorn<T> {
@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<T extends LivingEntity> extends ModelUnicorn<T> {
@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<T extends LivingEntity> extends ModelUnicorn<T> {
// 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;

View file

@ -100,13 +100,13 @@ public class ModelVillagerPony<T extends LivingEntity & VillagerDataContainer> 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;
}
}
}

View file

@ -46,21 +46,21 @@ public class ModelWitchPony extends ModelZebra<WitchEntity> {
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;
}
}

View file

@ -27,7 +27,7 @@ public class ModelEarthPony<T extends LivingEntity> extends AbstractPonyModel<T>
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;
}
}

View file

@ -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<T extends LivingEntity> extends ModelEarthPony<T> impl
}
@Override
public Cuboid getArm(Arm side) {
public ModelPart getArm(Arm side) {
if (canCast() && getArmPoseForSide(side) != ArmPose.EMPTY) {
return getUnicornArmForSide(side);
}

View file

@ -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 {

View file

@ -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 {

View file

@ -70,7 +70,7 @@ public class RenderPony<T extends LivingEntity, M extends EntityModel<T> & 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);
}
}

View file

@ -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<T extends LivingEntity, M extends EntityModel<T> & 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);

View file

@ -33,7 +33,7 @@ public abstract class LayerOverlayBase<T extends LivingEntity, M extends BipedEn
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();

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 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);

View file

@ -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<T extends LivingEntity, M extends EntityModel<T
assert nbt != null;
if (nbt.containsKey("SkullOwner", 10)) {
profile = TagHelper.deserializeProfile(nbt.getCompound("SkullOwner"));
} else if (nbt.containsKey("SkullOwner", 8)) {
if (nbt.contains("SkullOwner", 10)) {
profile = NbtHelper.toGameProfile(nbt.getCompound("SkullOwner"));
} else if (nbt.contains("SkullOwner", 8)) {
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.client.render.block.entity.SkullBlockEntityRenderer;
import net.minecraft.util.Identifier;
import net.minecraft.util.SystemUtil;
import net.minecraft.util.Util;
import net.minecraft.util.math.Direction;
import org.lwjgl.opengl.GL11;
@ -30,7 +30,7 @@ public class PonySkullRenderer extends SkullBlockEntityRenderer {
private static final PonySkullRenderer ponyInstance = new PonySkullRenderer();
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.WITHER_SKELETON, new WitherSkullRenderer());
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 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

View file

@ -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 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.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 <K extends Cuboid> Part child(K child) {
public <K extends ModelPart> 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));
}
/**

View file

@ -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;
}
}
}

View file

@ -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) {