Update swimming mechanics to be in line with 1.13

This commit is contained in:
Sollace 2019-05-29 20:46:10 +02:00
parent f7a92ea3e9
commit 6e3ae73d89
2 changed files with 8 additions and 5 deletions

View file

@ -121,8 +121,8 @@ public class Pony extends Touchable<Pony> implements IPony {
@Override @Override
public boolean isPerformingRainboom(LivingEntity entity) { public boolean isPerformingRainboom(LivingEntity entity) {
Vec3d velocity = entity.getVelocity(); Vec3d motion = entity.getVelocity();
double zMotion = Math.sqrt(velocity.x * velocity.x + velocity.z * velocity.z); double zMotion = Math.sqrt(motion.x * motion.x + motion.z * motion.z);
return (isFlying(entity) && canFly()) || entity.isFallFlying() & zMotion > 0.4F; return (isFlying(entity) && canFly()) || entity.isFallFlying() & zMotion > 0.4F;
} }
@ -148,7 +148,7 @@ public class Pony extends Touchable<Pony> implements IPony {
@Override @Override
public boolean isSwimming(LivingEntity entity) { public boolean isSwimming(LivingEntity entity) {
return isFullySubmerged(entity) && !(entity.onGround || entity.isClimbing()); return entity.isSwimming();
} }
@Override @Override

View file

@ -3,6 +3,7 @@ package com.minelittlepony.client.transform;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import com.minelittlepony.util.math.MathUtil; import com.minelittlepony.util.math.MathUtil;
import com.mojang.blaze3d.platform.GlStateManager;
public class PostureSwimming extends PostureFlight { public class PostureSwimming extends PostureFlight {
@ -16,8 +17,10 @@ public class PostureSwimming extends PostureFlight {
@Override @Override
protected double calculateIncline(PlayerEntity player, double motionX, double motionY, double motionZ) { protected double calculateIncline(PlayerEntity player, double motionX, double motionY, double motionZ) {
double motionLerp = MathUtil.clampLimit(Math.sqrt(motionX * motionX + motionZ * motionZ) * 30, 1); double motionLerp = MathUtil.clampLimit(Math.sqrt(motionX * motionX + motionZ * motionZ) * 30, 1) / 2;
return super.calculateIncline(player, motionX, motionY, motionZ) * motionLerp; GlStateManager.translated(0, 0, -1);
return 90 + super.calculateIncline(player, motionX, motionY, motionZ) * motionLerp;
} }
} }