mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Fixed incorrect angles/improved rotation when in negative gravity
This commit is contained in:
parent
a69bcb5419
commit
8ebead92a9
1 changed files with 14 additions and 15 deletions
|
@ -26,6 +26,7 @@ import net.minecraft.client.util.math.MatrixStack;
|
|||
import net.minecraft.client.util.math.Vector3f;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.LivingEntity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.state.property.Properties;
|
||||
import net.minecraft.util.math.Direction;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
|
@ -69,15 +70,13 @@ public class WorldRenderDelegate {
|
|||
|
||||
roll = pony instanceof Pony ? ((Pony)pony).getInterpolator().interpolate("g_roll", roll, 15) : roll;
|
||||
|
||||
if (negative) {
|
||||
matrices.translate(x, y, z);
|
||||
matrices.translate(0, owner.getHeight(), 0);
|
||||
matrices.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(roll));
|
||||
matrices.translate(-x, -y, -z);
|
||||
matrices.translate(x, y + owner.getHeight() / 2, z);
|
||||
matrices.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(roll));
|
||||
matrices.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(roll));
|
||||
matrices.translate(-x, -y - owner.getHeight() / 2, -z);
|
||||
|
||||
if (negative) {
|
||||
flipAngles(owner);
|
||||
} else {
|
||||
matrices.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(roll));
|
||||
}
|
||||
|
||||
if (pony instanceof Caster<?>) {
|
||||
|
@ -183,9 +182,10 @@ public class WorldRenderDelegate {
|
|||
}
|
||||
|
||||
private void flipAngles(Entity entity) {
|
||||
if (!MinecraftClient.getInstance().options.getPerspective().isFirstPerson()) {
|
||||
if (entity instanceof PlayerEntity) {
|
||||
entity.prevYaw *= -1;
|
||||
entity.yaw *= -1;
|
||||
}
|
||||
|
||||
if (entity instanceof LivingEntity) {
|
||||
LivingEntity living = (LivingEntity)entity;
|
||||
|
@ -195,7 +195,6 @@ public class WorldRenderDelegate {
|
|||
living.headYaw = -living.headYaw;
|
||||
living.prevHeadYaw = -living.prevHeadYaw;
|
||||
}
|
||||
}
|
||||
entity.prevPitch *= -1;
|
||||
entity.pitch *= -1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue