diff --git a/src/main/java/com/minelittlepony/api/model/ModelAttributes.java b/src/main/java/com/minelittlepony/api/model/ModelAttributes.java index 6d3dd29d..825190af 100644 --- a/src/main/java/com/minelittlepony/api/model/ModelAttributes.java +++ b/src/main/java/com/minelittlepony/api/model/ModelAttributes.java @@ -61,7 +61,7 @@ public class ModelAttributes { */ public boolean isLeftHanded; /** - * True if the model is sitting as in boats. + * True if the model is riding on the back of another pony. */ public boolean isRidingInteractive; /** diff --git a/src/main/java/com/minelittlepony/client/PonyBounds.java b/src/main/java/com/minelittlepony/client/PonyBounds.java index 12389d98..e6da895e 100644 --- a/src/main/java/com/minelittlepony/client/PonyBounds.java +++ b/src/main/java/com/minelittlepony/client/PonyBounds.java @@ -1,50 +1,28 @@ package com.minelittlepony.client; import com.minelittlepony.api.pony.Pony; -import com.minelittlepony.api.pony.PonyPosture; -import com.minelittlepony.client.transform.PonyTransformation; import net.minecraft.client.MinecraftClient; -import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.util.math.Box; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; public class PonyBounds { - public static Vec3d getAbsoluteRidingOffset(LivingEntity entity) { - return PonyPosture.getMountPony(entity).map(ridingPony -> { - LivingEntity vehicle = (LivingEntity)entity.getVehicle(); - - Vec3d offset = PonyTransformation.forSize(ridingPony.size()).getRiderOffset(); - float scale = ridingPony.metadata().size().scaleFactor(); - - return getAbsoluteRidingOffset(vehicle).add( - 0, - offset.y - vehicle.getHeight() * 1 / scale, - 0 - ); - }).orElseGet(() -> getBaseRidingOffset(entity)); - } - private static Vec3d getBaseRidingOffset(LivingEntity entity) { float delta = MinecraftClient.getInstance().getTickDelta(); - - Entity vehicle = entity.getVehicle(); - double vehicleOffset = vehicle == null ? 0 : vehicle.getHeight(); - return new Vec3d( MathHelper.lerp(delta, entity.prevX, entity.getX()), - MathHelper.lerp(delta, entity.prevY, entity.getY()) + vehicleOffset, + MathHelper.lerp(delta, entity.prevY, entity.getY()), MathHelper.lerp(delta, entity.prevZ, entity.getZ()) ); } public static Box getBoundingBox(Pony pony, LivingEntity entity) { - final float scale = pony.size().scaleFactor() + 0.1F; + final float scale = pony.size().scaleFactor(); final float width = entity.getWidth() * scale; final float height = entity.getHeight() * scale; - return new Box(-width, height, -width, width, 0, width).offset(getAbsoluteRidingOffset(entity)); + return new Box(-width, 0, -width, width, height, width).offset(getBaseRidingOffset(entity)); } } diff --git a/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java b/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java index 940a9c54..e128c980 100644 --- a/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java +++ b/src/main/java/com/minelittlepony/client/model/AbstractPonyModel.java @@ -204,14 +204,9 @@ public abstract class AbstractPonyModel extends ClientPo } protected void ponySit() { - adjustBodyComponents(BODY_RIDING_PITCH * (attributes.isRidingInteractive ? 2 : 1), BODY_RIDING); - if (attributes.isRidingInteractive) { - neck.setPivot(NECK_X, 0, -4); - head.setPivot(0, -2, -5); - } else { - neck.setPivot(NECK_X, 0, 0); - head.setPivot(0, 0, 0); - } + adjustBodyComponents(BODY_RIDING_PITCH, BODY_RIDING); + neck.setPivot(NECK_X, 0, 0); + head.setPivot(0, 0, 0); leftLeg.pivotZ = 14; leftLeg.pivotY = 17; @@ -231,26 +226,6 @@ public abstract class AbstractPonyModel extends ClientPo leftArm.pitch += body.pitch; rightArm.roll = MathHelper.PI * 0.06f; rightArm.pitch += body.pitch; - - if (attributes.isRidingInteractive) { - leftLeg.yaw = MathHelper.PI / 15; - leftLeg.pitch = MathHelper.PI / 9; - - leftLeg.pivotZ = 10; - leftLeg.pivotY = 7; - - rightLeg.yaw = -MathHelper.PI / 15; - rightLeg.pitch = MathHelper.PI / 9; - - rightLeg.pivotZ = 10; - rightLeg.pivotY = 7; - - leftArm.pitch = MathHelper.PI / 6; - rightArm.pitch = MathHelper.PI / 6; - - leftArm.roll *= 2; - rightArm.roll *= 2; - } } /** @@ -600,10 +575,6 @@ public abstract class AbstractPonyModel extends ClientPo } } - if (getAttributes().isRidingInteractive) { - matrices.translate(left / 10, -0.2F, -0.5F); - } - matrices.translate(-left * 0.1F, 0.45F, 0); if (getAttributes().heldStack.getUseAction() == UseAction.BLOCK && getAttributes().itemUseTime == 0) { diff --git a/src/main/java/com/minelittlepony/client/render/EquineRenderManager.java b/src/main/java/com/minelittlepony/client/render/EquineRenderManager.java index 88f2c8dc..9d1f6f48 100644 --- a/src/main/java/com/minelittlepony/client/render/EquineRenderManager.java +++ b/src/main/java/com/minelittlepony/client/render/EquineRenderManager.java @@ -5,7 +5,6 @@ import com.minelittlepony.api.events.Channel; import com.minelittlepony.api.events.PonyDataCallback; import com.minelittlepony.api.model.*; import com.minelittlepony.api.pony.Pony; -import com.minelittlepony.client.MineLittlePony; import com.minelittlepony.client.transform.PonyPosture; import com.minelittlepony.mson.api.ModelKey; import com.minelittlepony.util.MathUtil; @@ -19,7 +18,6 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.Frustum; import net.minecraft.client.render.entity.model.EntityModel; import net.minecraft.client.util.math.MatrixStack; -import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; @@ -90,19 +88,6 @@ public class EquineRenderManager renderer = MineLittlePony.getInstance().getRenderDispatcher().getPonyRenderer(livingVehicles); - - if (renderer != null) { - // negate vanilla translations so the rider begins at the ridees feet. - stack.translate(0, -livingVehicles.getHeight(), 0); - Pony pony = context.getEntityPony(entity); - if (!pony.race().isHuman()) { - renderer.getInternalRenderer().translateRider(livingVehicles, renderer.getEntityPony(livingVehicles), entity, pony, stack, tickDelta); - } - } - } - if (entity instanceof PlayerEntity) { if (getModels().body().getAttributes().isSitting) { stack.translate(0, 0.125D, 0); @@ -115,26 +100,11 @@ public class EquineRenderManager & PonyModel & ModelWithArms> extends MobEntityRenderer implements PonyRenderContext { @@ -95,9 +94,9 @@ public abstract class AbstractPonyRenderer> { private final Function>> modelsCache; @@ -71,10 +70,9 @@ public class PlayerPonyRenderer extends PlayerEntityRenderer implements PonyRend @Override protected void scale(AbstractClientPlayerEntity entity, MatrixStack stack, float tickDelta) { if (manager.getModels().body().getAttributes().isSitting && entity.hasVehicle()) { - // TODO: Check this - Vec3d attachmentPos = entity.getVehicleAttachmentPos(entity.getVehicle()); - stack.translate(attachmentPos.getX(), attachmentPos.getY(), attachmentPos.getZ()); + stack.translate(0, -0.25F * manager.getScaleFactor(), 0); } + super.scale(entity, stack, tickDelta); } @Override