Skip to content

Commit

Permalink
fix mod/datapack compat #10634 (#10635)
Browse files Browse the repository at this point in the history
Compat for significantly deeper worlds
  • Loading branch information
Raycoms authored Feb 3, 2025
1 parent c4f9b36 commit fe8489a
Showing 1 changed file with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,7 @@ protected int getGroundHeight(final MNode node, final int x, final int y, final
{
if (!pathingOptions.canWalkUnderWater() && PathfindingUtils.isLiquid(cachedBlockLookup.getBlockState(x, y + 1, z)))
{
return -100;
return Integer.MIN_VALUE;
}
// Check (y+1) first, as it's always needed, either for the upper body (level),
// lower body (headroom drop) or lower body (jump up)
Expand All @@ -1208,7 +1208,7 @@ protected int getGroundHeight(final MNode node, final int x, final int y, final
}
else if (walkability == SurfaceType.NOT_PASSABLE)
{
return -100;
return Integer.MIN_VALUE;
}

return handleNotStanding(node, x, y, z, below);
Expand Down Expand Up @@ -1415,7 +1415,7 @@ private int handleTargetNotPassable(@Nullable final MNode parent, final int x, f
// Need to try jumping up one, if we can
if (!canJump || SurfaceType.getSurfaceType(world, target, tempWorldPos.set(x, y, z), getPathingOptions()) != SurfaceType.WALKABLE)
{
return -100;
return Integer.MIN_VALUE;
}

// Check for headroom in the target space
Expand All @@ -1425,13 +1425,13 @@ private int handleTargetNotPassable(@Nullable final MNode parent, final int x, f
final VoxelShape bb2 = cachedBlockLookup.getBlockState(x, y + 2, z).getCollisionShape(world, tempWorldPos.set(x, y + 2, z));
if ((y + 2 + ShapeUtil.getStartY(bb2, 1)) - (y + ShapeUtil.getEndY(bb1, 0)) < 2)
{
return -100;
return Integer.MIN_VALUE;
}
}

if (!canLeaveBlock(x, y + 2, z, parent, true))
{
return -100;
return Integer.MIN_VALUE;
}

// Check for jump room from the origin space
Expand All @@ -1441,11 +1441,10 @@ private int handleTargetNotPassable(@Nullable final MNode parent, final int x, f
final VoxelShape bb2 = cachedBlockLookup.getBlockState(parent.x, parent.y + 2, parent.z).getCollisionShape(world, tempWorldPos.set(parent.x, parent.y + 2, parent.z));
if ((parent.y + 2 + ShapeUtil.getStartY(bb2, 1)) - (y + ShapeUtil.getEndY(bb1, 0)) < 2)
{
return -100;
return Integer.MIN_VALUE;
}
}


final BlockState parentBelow = cachedBlockLookup.getBlockState(parent.x, parent.y - 1, parent.z);
final VoxelShape parentBB = parentBelow.getCollisionShape(world, tempWorldPos.set(parent.x, parent.y - 1, parent.z));

Expand All @@ -1463,7 +1462,7 @@ private int handleTargetNotPassable(@Nullable final MNode parent, final int x, f
{
return y + 1;
}
return -100;
return Integer.MIN_VALUE;
}

/**
Expand Down Expand Up @@ -1515,7 +1514,7 @@ private int checkDrop(@Nullable final MNode parent, final int x, final int y, fi
getPathingOptions())
== SurfaceType.DROPABLE))
{
return -100;
return Integer.MIN_VALUE;
}

for (int i = 2; i <= (pathingOptions.canDrop ? 10 : 2); i++)
Expand All @@ -1528,11 +1527,11 @@ private int checkDrop(@Nullable final MNode parent, final int x, final int y, fi
}
else if (!below.isAir())
{
return -100;
return Integer.MIN_VALUE;
}
}

return -100;
return Integer.MIN_VALUE;
}

/**
Expand Down Expand Up @@ -1560,7 +1559,7 @@ private int handleInLiquid(final int x, final int y, final int z, @NotNull final
}

// Not allowed to swim or this isn't water, and we're on dry land
return -100;
return Integer.MIN_VALUE;
}

/**
Expand Down

0 comments on commit fe8489a

Please sign in to comment.