Skip to content

Commit

Permalink
Teleporting resets fall damage.
Browse files Browse the repository at this point in the history
  • Loading branch information
Provismet committed Dec 23, 2023
1 parent e8f4078 commit f074014
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public static void action (SerializableData.Instance data, Entity entity) {
BlockHitResult blockHit = entity.getWorld().raycast(new RaycastContext(start, end, shapeType, fluidHandling, entity));
if (blockHit.getType() != HitResult.Type.MISS) {
if (destination.equals(DIRECT)) {
entity.fallDistance = 0f;
entity.setPosition(blockHit.getPos());
if (successAction != null) successAction.accept(entity);
}
Expand All @@ -58,6 +59,7 @@ else if (destination.equals(ON_TOP)) {
CachedBlockPosition upByTwo = new CachedBlockPosition(entity.getWorld(), blockHit.getBlockPos().add(0, 2, 0), true);

if (isValid(upByOne, allowWater, allowLava) && isValid(upByTwo, allowWater, allowLava)) {
entity.fallDistance = 0f;
entity.setPosition(blockHit.getBlockPos().getX() + 0.5, blockHit.getBlockPos().getY() + 1, blockHit.getBlockPos().getZ() + 0.5);
if (successAction != null) successAction.accept(entity);
}
Expand Down

0 comments on commit f074014

Please sign in to comment.