Finally bearable

- Entities can now jump on Mechanical Belts
- Entities on belts no longer get force-centered while actively moving or strafing
This commit is contained in:
simibubi 2021-06-17 11:28:29 +02:00
parent 761fa2c1e9
commit 4265a2855c

View File

@ -95,9 +95,8 @@ public class BeltMovementHandler {
// Lock entities in place
boolean isPlayer = entityIn instanceof PlayerEntity;
if (entityIn instanceof LivingEntity && !isPlayer) {
if (entityIn instanceof LivingEntity && !isPlayer)
((LivingEntity) entityIn).addPotionEffect(new EffectInstance(Effects.SLOWNESS, 10, 1, false, false));
}
final Direction beltFacing = blockState.get(BlockStateProperties.HORIZONTAL_FACING);
final BeltSlope slope = blockState.get(BeltBlock.SLOPE);
@ -138,12 +137,14 @@ public class BeltMovementHandler {
movement = movement.add(0, -Math.abs(axis.getCoordinate(movement.x, movement.y, movement.z)), 0);
Vector3d centering = Vector3d.of(centeringDirection).scale(diffCenter * Math.min(Math.abs(movementSpeed), .1f) * 4);
float step = entityIn.stepHeight;
if (!isPlayer) {
if (!(entityIn instanceof LivingEntity)
|| ((LivingEntity) entityIn).moveForward == 0 && ((LivingEntity) entityIn).moveStrafing == 0)
movement = movement.add(centering);
float step = entityIn.stepHeight;
if (!isPlayer)
entityIn.stepHeight = 1;
}
// Entity Collisions
if (Math.abs(movementSpeed) < .5f) {
@ -175,6 +176,8 @@ public class BeltMovementHandler {
} else {
entityIn.move(SELF, movement);
}
entityIn.onGround = true;
if (!isPlayer)
entityIn.stepHeight = step;
@ -189,6 +192,7 @@ public class BeltMovementHandler {
entityIn.setMotion(movement);
entityIn.velocityChanged = true;
}
}
public static boolean shouldIgnoreBlocking(Entity me, Entity other) {