Fixed player getting stuck on slabs and stairs when in inverted gravity

This commit is contained in:
Sollace 2021-02-23 18:46:05 +02:00
parent 1ef7e1bf73
commit 8f75122d79
3 changed files with 5 additions and 3 deletions

View file

@ -74,7 +74,7 @@ public class EntityPhysics<T extends Owned<? extends Entity>> implements Physics
return below;
}
} else {
pony.getMaster().setOnGround(true);
entity.setOnGround(true);
}
return pos;

View file

@ -19,6 +19,7 @@ import net.minecraft.entity.projectile.ProjectileEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.util.Hand;
import net.minecraft.util.math.BlockPos;
public abstract class Living<T extends LivingEntity> implements Equine<T>, Caster<T> {
@ -99,6 +100,9 @@ public abstract class Living<T extends LivingEntity> implements Equine<T>, Caste
if (getPhysics().isGravityNegative() && entity.getY() > entity.world.getHeight() + 64) {
entity.damage(DamageSource.OUT_OF_WORLD, 4.0F);
}
if (getPhysics().isGravityNegative()) {
entity.setOnGround(!entity.world.isAir(new BlockPos(entity.getX(), Math.floor(entity.getBoundingBox().maxY + 0.25), entity.getZ())));
}
enchants.tick();
}

View file

@ -111,8 +111,6 @@ public class PlayerPhysics extends EntityPhysics<Pony> implements Tickable, Moti
isFlyingEither = isFlyingSurvival || (creative && entity.abilities.flying);
if (isGravityNegative()) {
entity.setOnGround(!entity.world.isAir(new BlockPos(entity.getX(), entity.getY() + entity.getHeight() + 0.5F, entity.getZ())));
if (entity.isOnGround() || (!creative && entity.horizontalCollision)) {
entity.abilities.flying = false;
isFlyingEither = false;