From fe8489a01cd9a88a526fe9afef4cf0e0fe8cd3b7 Mon Sep 17 00:00:00 2001 From: Raycoms Date: Mon, 3 Feb 2025 19:17:07 +0100 Subject: [PATCH] fix mod/datapack compat #10634 (#10635) Compat for significantly deeper worlds --- .../pathfinding/pathjobs/AbstractPathJob.java | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/minecolonies/core/entity/pathfinding/pathjobs/AbstractPathJob.java b/src/main/java/com/minecolonies/core/entity/pathfinding/pathjobs/AbstractPathJob.java index 22d2ccfe6db..4dcd1df6722 100644 --- a/src/main/java/com/minecolonies/core/entity/pathfinding/pathjobs/AbstractPathJob.java +++ b/src/main/java/com/minecolonies/core/entity/pathfinding/pathjobs/AbstractPathJob.java @@ -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) @@ -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); @@ -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 @@ -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 @@ -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)); @@ -1463,7 +1462,7 @@ private int handleTargetNotPassable(@Nullable final MNode parent, final int x, f { return y + 1; } - return -100; + return Integer.MIN_VALUE; } /** @@ -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++) @@ -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; } /** @@ -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; } /**