@@ -80,15 +80,16 @@ private Stream<Vector3i> getBlockLocations(ServerLocation worldLocation, int hei
8080 int worldBorderMaxX = GenericMath .floor (worldBorder .getCenterX () + radius );
8181 int worldBorderMaxZ = GenericMath .floor (worldBorder .getCenterZ () + radius );
8282
83- // Get the World and get the maximum Y value.
83+ // Get the World and get the minimum and maximum Y value.
8484 int worldMaxY = worldLocation .world ().max ().y ();
85+ int worldMinY = worldLocation .world ().min ().y ();
8586
8687 Vector3i vectorLocation = worldLocation .blockPosition ();
8788
8889 // We use clamp to remain within the world confines, so we don't waste time checking blocks outside of the
8990 // world border and the world height.
90- int minY = GenericMath .clamp (vectorLocation .y () - height , 0 , worldMaxY );
91- int maxY = GenericMath .clamp (vectorLocation .y () + height , 0 , worldMaxY );
91+ int minY = GenericMath .clamp (vectorLocation .y () - height , worldMinY , worldMaxY );
92+ int maxY = GenericMath .clamp (vectorLocation .y () + height , worldMinY , worldMaxY );
9293
9394 int minX = GenericMath .clamp (vectorLocation .x () - width , worldBorderMinX , worldBorderMaxX );
9495 int maxX = GenericMath .clamp (vectorLocation .x () + width , worldBorderMinX , worldBorderMaxX );
@@ -182,7 +183,7 @@ private boolean isFloorSafe(Vector3i currentTarget, World world, Map<Vector3i, B
182183 }
183184
184185 private BlockData getBlockData (Vector3i vector3i , World world , Map <Vector3i , BlockData > cache , Collection <TeleportHelperFilter > filters ) {
185- if (vector3i .y () < 0 ) {
186+ if (vector3i .y () < world . min (). y () ) {
186187 // Anything below this isn't safe, no point going further.
187188 return new BlockData ();
188189 }
0 commit comments