mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Fixed crouching getting stuck when gravity is inverted
This commit is contained in:
parent
76667f95ac
commit
882627cd3f
1 changed files with 9 additions and 0 deletions
|
@ -12,6 +12,7 @@ import com.minelittlepony.unicopia.util.NbtSerialisable;
|
|||
import com.minelittlepony.unicopia.util.MutableVector;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityPose;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.sound.SoundCategory;
|
||||
|
@ -86,6 +87,14 @@ public class PlayerPhysics extends EntityPhysics<Pony> implements Tickable, Moti
|
|||
public void tick() {
|
||||
PlayerEntity entity = pony.getOwner();
|
||||
|
||||
if (isGravityNegative() && !entity.isSneaking() && entity.isInSneakingPose()) {
|
||||
float currentHeight = entity.getDimensions(entity.getPose()).height;
|
||||
float sneakingHeight = entity.getDimensions(EntityPose.STANDING).height;
|
||||
|
||||
entity.setPos(entity.getX(), entity.getY() + currentHeight - sneakingHeight, entity.getZ());
|
||||
entity.setPose(EntityPose.STANDING);
|
||||
}
|
||||
|
||||
MutableVector velocity = new MutableVector(entity.getVelocity());
|
||||
|
||||
if (isExperienceCritical() && pony.isClient()) {
|
||||
|
|
Loading…
Reference in a new issue