]> git.lizzy.rs Git - BoundingBoxOutlineReloaded.git/blobdiff - src/main/java/com/irtimaled/bbor/client/providers/SpawningSphereProvider.java
Add max Y configuration for Biome Borders
[BoundingBoxOutlineReloaded.git] / src / main / java / com / irtimaled / bbor / client / providers / SpawningSphereProvider.java
index eb024a77e3e6d8dd25bb9d55a08d53d3da4d29a1..7b9460cbd559b56e0009ec7afbbdd6c3e080de36 100644 (file)
@@ -1,6 +1,6 @@
 package com.irtimaled.bbor.client.providers;
 
-import com.irtimaled.bbor.client.PlayerCoords;
+import com.irtimaled.bbor.client.Player;
 import com.irtimaled.bbor.client.interop.SpawningSphereHelper;
 import com.irtimaled.bbor.client.models.Point;
 import com.irtimaled.bbor.common.MathHelper;
@@ -11,18 +11,18 @@ public class SpawningSphereProvider implements IBoundingBoxProvider<BoundingBoxS
     private static BoundingBoxSpawningSphere spawningSphere;
     private static Integer dimensionId;
 
-    public static void setSphere() {
-        Coords coords = PlayerCoords.get();
-        double xOffset = snapToNearestHalf(PlayerCoords.getX() -coords.getX());
-        double yOffset = PlayerCoords.getY()- coords.getY();
-        double zOffset = snapToNearestHalf(PlayerCoords.getZ()-coords.getZ());
+    public static void setSphere(double x, double y, double z) {
+        Coords coords = new Coords(x, y, z);
+        double xOffset = snapToNearestHalf(x -coords.getX());
+        double yOffset = y- coords.getY();
+        double zOffset = snapToNearestHalf(z-coords.getZ());
 
         if(spawningSphere != null && spawningSphere.isCenter(coords, xOffset, yOffset, zOffset)) {
             return;
         }
         clear();
 
-        dimensionId = PlayerCoords.getDimensionId();
+        dimensionId = Player.getDimensionId();
         spawningSphere = new BoundingBoxSpawningSphere(coords, xOffset, yOffset, zOffset);
     }
 
@@ -59,7 +59,7 @@ public class SpawningSphereProvider implements IBoundingBoxProvider<BoundingBoxS
         return SpawningSphereHelper.findSpawnableSpaces(center, center.getCoords(), size, size, (x, y, z) -> true);
     }
 
-    private static Iterable<BoundingBoxSpawningSphere> iterable = Iterators.singleton(() -> spawningSphere);
+    private static final Iterable<BoundingBoxSpawningSphere> iterable = Iterators.singleton(() -> spawningSphere);
 
     public Iterable<BoundingBoxSpawningSphere> get(int dimensionId) {
         if(spawningSphere == null || SpawningSphereProvider.dimensionId != dimensionId) {
@@ -67,4 +67,4 @@ public class SpawningSphereProvider implements IBoundingBoxProvider<BoundingBoxS
         }
         return iterable;
     }
-}
\ No newline at end of file
+}