mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-30 16:28:00 +01:00
Fix changeling climbing bugs
This commit is contained in:
parent
a5c7a5e3a6
commit
04cefd8961
1 changed files with 7 additions and 4 deletions
|
@ -396,13 +396,15 @@ public class Pony extends Living<PlayerEntity> implements Copyable<Pony>, Update
|
||||||
|
|
||||||
BlockPos climbingPos = entity.getClimbingPos().orElse(null);
|
BlockPos climbingPos = entity.getClimbingPos().orElse(null);
|
||||||
|
|
||||||
if (!getPhysics().isFlying() && !entity.getAbilities().flying && climbingPos != null && getObservedSpecies() == Race.CHANGELING) {
|
if (!getPhysics().isFlying() && !entity.getAbilities().flying
|
||||||
|
&& climbingPos != null
|
||||||
|
&& getObservedSpecies() == Race.CHANGELING) {
|
||||||
Vec3d vel = entity.getVelocity();
|
Vec3d vel = entity.getVelocity();
|
||||||
if (entity.isSneaking()) {
|
if (entity.isSneaking()) {
|
||||||
entity.setVelocity(vel.x, 0, vel.z);
|
entity.setVelocity(vel.x, 0, vel.z);
|
||||||
}
|
}
|
||||||
|
|
||||||
distanceClimbed += vel.length();
|
distanceClimbed += Math.abs(getMotion().getClientVelocity().y);
|
||||||
BlockPos hangingPos = entity.getBlockPos().up();
|
BlockPos hangingPos = entity.getBlockPos().up();
|
||||||
boolean canhangHere = canHangAt(hangingPos);
|
boolean canhangHere = canHangAt(hangingPos);
|
||||||
|
|
||||||
|
@ -450,6 +452,7 @@ public class Pony extends Living<PlayerEntity> implements Copyable<Pony>, Update
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
distanceClimbed = 0;
|
distanceClimbed = 0;
|
||||||
|
attachDirection = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getObservedSpecies() == Race.KIRIN) {
|
if (getObservedSpecies() == Race.KIRIN) {
|
||||||
|
@ -521,7 +524,7 @@ public class Pony extends Living<PlayerEntity> implements Copyable<Pony>, Update
|
||||||
pos = pos.up();
|
pos = pos.up();
|
||||||
BlockState state = asWorld().getBlockState(pos);
|
BlockState state = asWorld().getBlockState(pos);
|
||||||
|
|
||||||
return state.isSolidSurface(asWorld(), pos, entity, Direction.DOWN);
|
return state.isSolidSurface(asWorld(), pos, entity, Direction.DOWN) && entity.getWorld().isAir(entity.getBlockPos().down());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -563,7 +566,7 @@ public class Pony extends Living<PlayerEntity> implements Copyable<Pony>, Update
|
||||||
|
|
||||||
if (isHanging()) {
|
if (isHanging()) {
|
||||||
((LivingEntityDuck)entity).setLeaningPitch(0);
|
((LivingEntityDuck)entity).setLeaningPitch(0);
|
||||||
if (!getObservedSpecies().canHang() || (ticksHanging++ > 2 && getHangingPosition().filter(getOrigin().down()::equals).filter(this::canHangAt).isEmpty())) {
|
if (!getObservedSpecies().canHang() || (ticksHanging++ > 2 && getHangingPosition().filter(this::canHangAt).isEmpty())) {
|
||||||
if (!isClient()) {
|
if (!isClient()) {
|
||||||
stopHanging();
|
stopHanging();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue