Fix transformations when flying, swimming, sleeping, and using the elytra. Also fix player rotations in the inventory.

This commit is contained in:
Sollace 2023-03-27 16:45:39 +01:00
parent c65b543978
commit efab9094e4
18 changed files with 117 additions and 193 deletions

View file

@ -8,7 +8,6 @@ import com.minelittlepony.util.MathUtil;
import java.util.*;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.Arm;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;
@ -32,10 +31,6 @@ public class ModelAttributes {
* from regular flying in that there are actual "wings" involved.
*/
public boolean isGliding;
/**
* True if the model is rotated 90degs (players)
*/
public boolean isHorizontal;
/**
* True if the model is using riptide (players)
*/
@ -123,6 +118,7 @@ public class ModelAttributes {
isGoingFast = (isFlying && hasWings) || isGliding;
isGoingFast &= zMotion > 0.4F;
isGoingFast |= entity.isUsingRiptide();
isGoingFast |= entity.isFallFlying();
motionLerp = MathUtil.clampLimit(zMotion * 30, 1);
@ -143,13 +139,12 @@ public class ModelAttributes {
visualHeight = entity.getHeight() + 0.125F;
isSitting = PonyPosture.isSitting(entity);
isCrouching = !isSitting && mode == Mode.THIRD_PERSON && PonyPosture.isCrouching(pony, entity);
isSleeping = entity.isSleeping();
isSleeping = entity.isAlive() && entity.isSleeping();
isFlying = mode == Mode.THIRD_PERSON && PonyPosture.isFlying(entity);
isGliding = entity.isFallFlying();
isSwimming = mode == Mode.THIRD_PERSON && PonyPosture.isSwimming(entity);
isSwimmingRotated = isSwimming && (entity instanceof PlayerEntity || entity instanceof Swimmer);
isSwimmingRotated = isSwimming;
isRiptide = entity.isUsingRiptide();
isHorizontal = isSwimming;
isRidingInteractive = PonyPosture.isRidingAPony(entity);
interpolatorId = entity.getUuid();
isLeftHanded = entity.getMainArm() == Arm.LEFT;
@ -161,10 +156,4 @@ public class ModelAttributes {
THIRD_PERSON,
OTHER
}
/**
* Special interface to mark entities that rotate horizontally when they swim.
*/
public interface Swimmer {
}
}

View file

@ -2,7 +2,6 @@ package com.minelittlepony.client.hdskins;
import net.minecraft.client.world.ClientWorld;
import com.minelittlepony.api.model.ModelAttributes;
import com.minelittlepony.api.pony.IPony;
import com.minelittlepony.api.pony.IPonyManager;
import com.minelittlepony.client.IPreviewModel;
@ -14,7 +13,7 @@ import java.util.UUID;
/**
* Dummy model used for the skin uploading screen.
*/
class DummyPony extends DummyPlayer implements IPreviewModel, ModelAttributes.Swimmer, IPonyManager.ForcedPony, EquineRenderManager.RegistrationHandler {
class DummyPony extends DummyPlayer implements IPreviewModel, IPonyManager.ForcedPony, EquineRenderManager.RegistrationHandler {
public DummyPony(ClientWorld world, PlayerSkins<?> textures) {
super(world, textures);

View file

@ -147,8 +147,6 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
}
if (attributes.isSwimmingRotated) {
head.setPivot(0, HEAD_RP_Y_SWIM, HEAD_RP_Z_SWIM);
rightLeg.pivotZ -= 1.5F;
leftLeg.pivotZ -= 1.5F;
}
@ -270,15 +268,11 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
headYaw = attributes.isSleeping ? (Math.abs(attributes.interpolatorId.getMostSignificantBits()) % 2.8F) - 1.9F : headYaw / 57.29578F;
headPitch = attributes.isSleeping ? 0.1f : headPitch / 57.29578F;
if (attributes.isSwimming && attributes.motionPitch != 0) {
headPitch -= 0.9F;
}
float pitch = (float)Math.toRadians(attributes.motionPitch);
head.setAngles(
MathHelper.clamp(headPitch, -1.25f - pitch, 0.5f - pitch),
attributes.isSwimmingRotated ? 0 : headYaw,
attributes.isSwimmingRotated ? -headYaw : 0
headYaw,
0
);
}
@ -601,10 +595,6 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
stack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(180));
}
if (part == BodyPart.HEAD) {
stack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(attributes.motionPitch));
}
PonyTransformation.forSize(getSize()).transform(this, part, stack);
}
}

View file

@ -17,8 +17,6 @@ import com.mojang.blaze3d.systems.RenderSystem;
import java.util.Objects;
import org.jetbrains.annotations.NotNull;
import net.fabricmc.api.EnvType;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.Frustum;
@ -31,7 +29,7 @@ import net.minecraft.util.Identifier;
public class EquineRenderManager<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> {
public ModelWrapper<T, M> playerModel;
private ModelWrapper<T, M> playerModel;
private IPony pony;
@ -107,34 +105,14 @@ public class EquineRenderManager<T extends LivingEntity, M extends EntityModel<T
@SuppressWarnings("unchecked")
public void applyPostureTransform(T player, MatrixStack stack, float yaw, float ticks) {
((PonyPosture<T>) getPosture(player)).apply(player, getModel(), stack, yaw, ticks, 1);
((PonyPosture<T>) PonyPosture.getPosture(getModel().getAttributes(), player)).apply(player, getModel(), stack, yaw, ticks, 1);
}
@SuppressWarnings("unchecked")
public void applyPostureRiding(T player, MatrixStack stack, float yaw, float ticks) {
((PonyPosture<T>) getPosture(player)).apply(player, getModel(), stack, yaw, ticks, -1);
((PonyPosture<T>) PonyPosture.getPosture(getModel().getAttributes(), player)).apply(player, getModel(), stack, yaw, ticks, -1);
}
@NotNull
private PonyPosture<?> getPosture(T entity) {
if (entity.isFallFlying()) {
return PonyPosture.ELYTRA;
}
if (entity.isAlive() && entity.isSleeping()) {
return PonyPosture.STANDING;
}
if (getModel().getAttributes().isHorizontal) {
return PonyPosture.SWIMMING;
}
if (getModel().getAttributes().isGoingFast && !getModel().getAttributes().isRiptide) {
return PonyPosture.FLYING;
}
return PonyPosture.FALLING;
}
public M getModel() {
return playerModel.body();
@ -159,7 +137,7 @@ public class EquineRenderManager<T extends LivingEntity, M extends EntityModel<T
playerModel.applyMetadata(pony.metadata());
}
public void updateModel(T entity, ModelAttributes.Mode mode) {
public IPony updateModel(T entity, ModelAttributes.Mode mode) {
pony = renderer.getEntityPony(entity);
playerModel.applyMetadata(pony.metadata());
@ -176,11 +154,12 @@ public class EquineRenderManager<T extends LivingEntity, M extends EntityModel<T
}
getModel().updateLivingState(entity, pony, mode);
return pony;
}
public IPony getPony(T entity) {
updateModel(entity, ModelAttributes.Mode.THIRD_PERSON);
return pony;
return updateModel(entity, ModelAttributes.Mode.THIRD_PERSON);
}
public Identifier getTexture(T entity) {

View file

@ -4,8 +4,7 @@ import com.minelittlepony.api.model.BodyPart;
import com.minelittlepony.api.model.PonyModelConstants;
import com.minelittlepony.api.model.gear.IGear;
import com.minelittlepony.api.pony.IPony;
import com.minelittlepony.client.model.IPonyModel;
import com.minelittlepony.client.model.ModelWrapper;
import com.minelittlepony.client.model.*;
import com.minelittlepony.util.MathUtil;
import net.minecraft.client.render.entity.model.EntityModel;
@ -14,11 +13,6 @@ import net.minecraft.entity.LivingEntity;
public interface IPonyRenderContext<T extends LivingEntity, M extends EntityModel<T> & IPonyModel<T>> extends PonyModelConstants, IGear.Context<T, M> {
/**
* Gets the wrapped pony model for this renderer.
*/
ModelWrapper<T, M> getModelWrapper();
IPony getEntityPony(T entity);
EquineRenderManager<T, M> getInternalRenderer();
@ -30,8 +24,8 @@ public interface IPonyRenderContext<T extends LivingEntity, M extends EntityMode
if (!passengerPony.race().isHuman()) {
float yaw = MathUtil.interpolateDegress((float)entity.prevY, (float)entity.getY(), ticks);
getModelWrapper().applyMetadata(entityPony.metadata());
M model = getModelWrapper().body();
getInternalRenderer().getModelWrapper().applyMetadata(entityPony.metadata());
M model = getInternalRenderer().getModelWrapper().body();
model.transform(BodyPart.BACK, stack);

View file

@ -107,11 +107,6 @@ public abstract class AbstractPonyRenderer<T extends MobEntity, M extends Entity
stack.scale(scale, scale, scale);
}
@Override
public ModelWrapper<T, M> getModelWrapper() {
return manager.playerModel;
}
@Override
protected void renderLabelIfPresent(T entity, Text name, MatrixStack stack, VertexConsumerProvider renderContext, int maxDistance) {
stack.push();

View file

@ -171,11 +171,6 @@ public class PlayerPonyRenderer extends PlayerEntityRenderer implements IPonyRen
return manager.getTexture(player);
}
@Override
public ModelWrapper<AbstractClientPlayerEntity, ClientPonyModel<AbstractClientPlayerEntity>> getModelWrapper() {
return manager.playerModel;
}
@Override
public EquineRenderManager<AbstractClientPlayerEntity, ClientPonyModel<AbstractClientPlayerEntity>> getInternalRenderer() {
return manager;

View file

@ -23,7 +23,7 @@ public class PlayerSeaponyRenderer extends PlayerPonyRenderer {
super(context, slim, key);
normalPony = ModelType.getPlayerModel(Race.UNICORN).<AbstractClientPlayerEntity, ClientPonyModel<AbstractClientPlayerEntity>>create(slim);
seapony = getModelWrapper();
seapony = getInternalRenderer().getModelWrapper();
}
@Override

View file

@ -43,7 +43,7 @@ public abstract class AbstractPonyFeature<T extends LivingEntity, M extends Enti
return (C)context;
}
public ModelWrapper<T, M> getModelWrapper() {
return getContext().getModelWrapper();
protected ModelWrapper<T, M> getModelWrapper() {
return context.getInternalRenderer().getModelWrapper();
}
}

View file

@ -30,7 +30,7 @@ public class ArmourFeature<T extends LivingEntity, M extends EntityModel<T> & IP
@Override
public void render(MatrixStack stack, VertexConsumerProvider renderContext, int lightUv, T entity, float limbDistance, float limbAngle, float tickDelta, float age, float headYaw, float headPitch) {
ModelWrapper<T, M> pony = getContext().getModelWrapper();
ModelWrapper<T, M> pony = getModelWrapper();
for (EquipmentSlot i : EquipmentSlot.values()) {
if (i.getType() == EquipmentSlot.Type.ARMOR) {

View file

@ -43,7 +43,7 @@ public class SkullFeature<T extends LivingEntity, M extends EntityModel<T> & IPo
public void render(MatrixStack stack, VertexConsumerProvider renderContext, int lightUv, T entity, float limbDistance, float limbAngle, float tickDelta, float age, float headYaw, float headPitch) {
ItemStack itemstack = entity.getEquippedStack(EquipmentSlot.HEAD);
if (!itemstack.isEmpty()) {
M model = getContext().getModelWrapper().body();
M model = getModelWrapper().body();
Item item = itemstack.getItem();
stack.push();

View file

@ -1,33 +1,95 @@
package com.minelittlepony.client.transform;
import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.math.*;
import com.minelittlepony.api.model.IModel;
import com.minelittlepony.api.model.RenderPass;
import org.jetbrains.annotations.NotNull;
import com.minelittlepony.api.model.*;
public interface PonyPosture<T extends LivingEntity> {
PonyPosture<LivingEntity> STANDING = (IModel model, LivingEntity entity, MatrixStack stack, double motionX, double motionY, double motionZ, float yaw, float tickDelta) -> {
model.getAttributes().motionPitch /= 10;
model.getAttributes().motionLerp /= 10;
model.getAttributes().motionRoll /= 10;
};
PonyPosture<LivingEntity> ELYTRA = (IModel model, LivingEntity entity, MatrixStack stack, double motionX, double motionY, double motionZ, float yaw, float tickDelta) -> {
stack.translate(0, entity.isInSneakingPose() ? -0.825F : -1, 0);
};
PonyPosture<LivingEntity> FLYING = new PostureFlight(1, 0);
PonyPosture<LivingEntity> SWIMMING = new PostureFlight(2, -0.9F);
PonyPosture<LivingEntity> FALLING = STANDING;
PonyPosture<LivingEntity> STANDING = new PostureStanding();;
PonyPosture<LivingEntity> ELYTRA = new PostureElytra();
PonyPosture<PlayerEntity> FLYING = new PostureFlight();
PonyPosture<PlayerEntity> SWIMMING = new PostureSwimming();
PonyPosture<LivingEntity> FALLING = new PostureFalling();
default boolean applies(LivingEntity entity) {
return true;
}
default void apply(T player, IModel model, MatrixStack stack, float yaw, float ticks, int invert) {
if (RenderPass.getCurrent() == RenderPass.WORLD && applies(player)) {
double motionX = player.getX() - player.prevX;
double motionY = player.isOnGround() ? 0 : player.getY() - player.prevY;
double motionZ = player.getZ() - player.prevZ;
transform(model, player, stack, motionX, invert * motionY, motionZ, yaw, ticks);
@NotNull
static PonyPosture<?> getPosture(ModelAttributes attributes, LivingEntity entity) {
if (attributes.isGliding) {
return ELYTRA;
}
if (attributes.isSleeping) {
return STANDING;
}
if (attributes.isSwimming) {
return SWIMMING;
}
if (attributes.isGoingFast && !attributes.isRiptide) {
return FLYING;
}
return FALLING;
}
void transform(IModel model, T entity, MatrixStack stack, double motionX, double motionY, double motionZ, float yaw, float ticks);
default void apply(T player, IModel model, MatrixStack stack, float yaw, float tickDelta, int invert) {
if (RenderPass.getCurrent() == RenderPass.GUI || RenderPass.getCurrent() == RenderPass.WORLD) {
// this reverts the rotations done in PlayerEntityRenderer#setupTransforms
if (player instanceof PlayerEntity) {
float leaningPitch = player.getLeaningPitch(tickDelta);
if (player.isFallFlying()) {
if (RenderPass.getCurrent() == RenderPass.GUI) {
Vec3d vec3d = player.getRotationVec(tickDelta);
Vec3d vec3d2 = ((AbstractClientPlayerEntity)player).lerpVelocity(tickDelta);
double d = vec3d2.horizontalLengthSquared();
double e = vec3d.horizontalLengthSquared();
if (d > 0.0 && e > 0.0) {
double l = (vec3d2.x * vec3d.x + vec3d2.z * vec3d.z) / Math.sqrt(d * e);
double m = vec3d2.x * vec3d.z - vec3d2.z * vec3d.x;
stack.multiply(RotationAxis.NEGATIVE_Y.rotation((float)(Math.signum(m) * Math.acos(l))));
}
}
float roll = (float)player.getRoll() + tickDelta;
float targetRoll = MathHelper.clamp(roll * roll / 100F, 0, 1);
if (!player.isUsingRiptide()) {
stack.multiply(RotationAxis.NEGATIVE_X.rotationDegrees(targetRoll * (-90 - player.getPitch())));
}
} else if (leaningPitch > 0) {
if (player.isInSwimmingPose()) {
stack.translate(0.0f, 1.0f, -0.3f);
}
float pitch = MathHelper.lerp(leaningPitch, 0, player.isTouchingWater() ? -90 - player.getPitch() : -90);
stack.multiply(RotationAxis.NEGATIVE_X.rotationDegrees(pitch));
}
}
}
if (RenderPass.getCurrent() != RenderPass.WORLD) {
return;
}
double motionX = player.getX() - player.prevX;
double motionY = player.isOnGround() ? 0 : player.getY() - player.prevY;
double motionZ = player.getZ() - player.prevZ;
transform(model, player, stack, motionX, invert * motionY, motionZ, yaw, tickDelta);
}
void transform(IModel model, T entity, MatrixStack stack, double motionX, double motionY, double motionZ, float yaw, float tickDelta);
}

View file

@ -27,7 +27,6 @@ public enum PonyTransformation {
break;
case HEAD:
if (model.getAttributes().isCrouching) stack.translate(0, 0.1F, 0);
if (model.getAttributes().isSwimmingRotated) stack.translate(0, 0.37F, 0.45F);
break;
case BACK:
stack.translate(riderOffset.x, riderOffset.y, riderOffset.z);
@ -49,13 +48,11 @@ public enum PonyTransformation {
stack.translate(0, -0.2F, -0.05F);
stack.scale(1, 1.3F, 1);
if (model.getAttributes().isCrouching) stack.translate(-0.03F, 0.01F, 0.2F);
if (model.getAttributes().isSwimmingRotated) stack.translate(0, 0.5F, 0.25F);
break;
case HEAD:
stack.translate(0, -0.14F, -0.04F);
if (model.getAttributes().isSleeping) stack.translate(0, 0, -0.1F);
if (model.getAttributes().isCrouching) stack.translate(0, 0.15F, 0);
if (model.getAttributes().isSwimmingRotated) stack.translate(0, 0.45F, 0.45F);
break;
case BODY:
stack.translate(0, -0.2F, -0.04F);
@ -86,13 +83,11 @@ public enum PonyTransformation {
stack.translate(0, -0.2F, -0.07F);
stack.scale(1, 1.3F, 1);
if (model.getAttributes().isCrouching) stack.translate(-0.03F, -0.07F, 0.09F);
if (model.getAttributes().isSwimmingRotated) stack.translate(0, 0.5F, 0.25F);
break;
case HEAD:
stack.translate(0, -0.14F, -0.06F);
if (model.getAttributes().isSleeping) stack.translate(0, 0, -0.1F);
if (model.getAttributes().isCrouching) stack.translate(0, 0.15F, 0);
if (model.getAttributes().isSwimmingRotated) stack.translate(0, 0.15F, 0.25F);
break;
case BODY:
stack.translate(0, -0.2F, -0.04F);
@ -116,7 +111,7 @@ public enum PonyTransformation {
public void transform(IModel model, BodyPart part, MatrixStack stack) {
if (model.getAttributes().isSwimming) stack.translate(0, -0.9F, 0);
if (model.getAttributes().isCrouching) stack.translate(0, -0.2F, 0);
if (model.getAttributes().isSleeping) stack.translate(0, -0.65F, -0.3F);
if (model.getAttributes().isSleeping) stack.translate(0, -0.8F, -0.3F);
if (model.isRiding()) stack.translate(0, -0.6F, -0.2F);
stack.translate(0, 0.2F, 0);
@ -128,7 +123,6 @@ public enum PonyTransformation {
if (model.getAttributes().isCrouching) stack.translate(-0.03F, -0.16F, 0.15F);
break;
case HEAD:
if (model.getAttributes().isSwimmingRotated) stack.translate(0, 0.9F, 0.9F);
stack.scale(1.3F, 1.3F, 1.3F);
break;
case LEGS:
@ -158,7 +152,6 @@ public enum PonyTransformation {
case HEAD:
stack.translate(0, -0.11F, 0);
if (model.getAttributes().isCrouching) stack.translate(0, 0.04F, 0);
if (model.getAttributes().isSwimmingRotated) stack.translate(0, 0.17F, 0.25F);
break;
case BODY:
case TAIL:
@ -181,7 +174,7 @@ public enum PonyTransformation {
public void transform(IModel model, BodyPart part, MatrixStack stack) {
if (model.getAttributes().isSwimming) stack.translate(0, -0.6F, 0);
if (model.getAttributes().isCrouching) stack.translate(0, -0.15F, 0);
if (model.getAttributes().isSleeping) stack.translate(0, -0.4F, -0.3F);
if (model.getAttributes().isSleeping) stack.translate(0, -0.45F, -0.3F);
if (model.isRiding()) stack.translate(0, -0.4F, -0.2F);
switch (part) {
@ -193,7 +186,6 @@ public enum PonyTransformation {
case HEAD:
stack.translate(0, -0.15F, 0);
if (model.getAttributes().isCrouching) stack.translate(0, 0.04F, 0);
if (model.getAttributes().isSwimmingRotated) stack.translate(0, 0.8F, 0.85F);
stack.scale(1.15F, 1.15F, 1.15F);
break;
case BODY:

View file

@ -1,16 +0,0 @@
package com.minelittlepony.client.transform;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.RotationAxis;
import com.minelittlepony.api.model.IModel;
import net.minecraft.entity.LivingEntity;
public class PostureElytra implements PonyPosture<LivingEntity> {
@Override
public void transform(IModel model, LivingEntity entity, MatrixStack stack, double motionX, double motionY, double motionZ, float yaw, float ticks) {
stack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(90));
stack.translate(0, model.getAttributes().isCrouching ? 0.2F : -1, 0);
}
}

View file

@ -1,13 +0,0 @@
package com.minelittlepony.client.transform;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.LivingEntity;
import com.minelittlepony.api.model.IModel;
public class PostureFalling implements PonyPosture<LivingEntity> {
@Override
public void transform(IModel model, LivingEntity entity, MatrixStack stack, double motionX, double motionY, double motionZ, float yaw, float ticks) {
model.getAttributes().motionPitch = 0;
}
}

View file

@ -3,25 +3,29 @@ package com.minelittlepony.client.transform;
import com.minelittlepony.api.model.IModel;
import com.minelittlepony.common.util.animation.MotionCompositor;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.RotationAxis;
import net.minecraft.entity.LivingEntity;
public class PostureFlight extends MotionCompositor implements PonyPosture<PlayerEntity> {
@Override
public boolean applies(LivingEntity entity) {
return entity instanceof PlayerEntity;
public class PostureFlight extends MotionCompositor implements PonyPosture<LivingEntity> {
private final float xScale;
private final float yOffset;
public PostureFlight(float xScale, float yOffset) {
this.xScale = xScale;
this.yOffset = yOffset;
}
@Override
public void transform(IModel model, PlayerEntity player, MatrixStack stack, double motionX, double motionY, double motionZ, float yaw, float ticks) {
model.getAttributes().motionPitch = (float) calculateIncline(player, motionX, motionY, motionZ);
model.getAttributes().motionRoll = (float)calculateRoll(player, motionX, motionY, motionZ);
public void transform(IModel model, LivingEntity player, MatrixStack stack, double motionX, double motionY, double motionZ, float yaw, float ticks) {
model.getAttributes().motionPitch = (float)calculateIncline(player, motionX, motionY, motionZ);
model.getAttributes().motionRoll = (float)calculateRoll(player, motionX * xScale, motionY, motionZ * xScale);
model.getAttributes().motionRoll = model.getMetadata().getInterpolator(model.getAttributes().interpolatorId).interpolate("pegasusRoll", model.getAttributes().motionRoll, 10);
stack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(model.getAttributes().motionPitch));
stack.multiply(RotationAxis.POSITIVE_Z.rotationDegrees(model.getAttributes().motionRoll));
stack.translate(0, yOffset, 0);
}
}

View file

@ -1,17 +0,0 @@
package com.minelittlepony.client.transform;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.LivingEntity;
import com.minelittlepony.api.model.IModel;
public class PostureStanding implements PonyPosture<LivingEntity> {
@Override
public boolean applies(LivingEntity entity) {
return false;
}
@Override
public void transform(IModel model, LivingEntity entity, MatrixStack stack, double motionX, double motionY, double motionZ, float yaw, float ticks) {
}
}

View file

@ -1,29 +0,0 @@
package com.minelittlepony.client.transform;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import com.minelittlepony.api.model.IModel;
public class PostureSwimming extends PostureFlight {
@Override
public double calculateRoll(LivingEntity entity, double motionX, double motionY, double motionZ) {
motionX *= 2;
motionZ *= 2;
return super.calculateRoll(entity, motionX, motionY, motionZ);
}
@Override
public double calculateIncline(LivingEntity entity, double motionX, double motionY, double motionZ) {
return 90; // mojang handles this
}
@Override
public void transform(IModel model, PlayerEntity player, MatrixStack stack, double motionX, double motionY, double motionZ, float yaw, float ticks) {
stack.translate(0, 0.9, -1);
super.transform(model, player, stack, motionX, motionY, motionZ, yaw, ticks);
}
}