mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-06 00:07:56 +01:00
Fix World#getChunkAtAsync(Location) variants incorectly calculating chunk x
The blockX needs to be floored before converted to int, as float -> integer operations are truncation. (i.e -0.5 -> 0, we want -0.5 -> -1)
This commit is contained in:
parent
7af07de57b
commit
e98c779a36
@ -8,7 +8,7 @@ Adds API's to load or generate chunks asynchronously.
|
||||
Also adds utility methods to Entity to teleport asynchronously.
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||
index 807bd7fc..61f2cd9a 100644
|
||||
index 807bd7fc..51cf7fd3 100644
|
||||
--- a/src/main/java/org/bukkit/World.java
|
||||
+++ b/src/main/java/org/bukkit/World.java
|
||||
@@ -0,0 +0,0 @@ public interface World extends PluginMessageRecipient, Metadatable {
|
||||
@ -175,7 +175,7 @@ index 807bd7fc..61f2cd9a 100644
|
||||
+ * will be executed synchronously
|
||||
+ */
|
||||
+ public default void getChunkAtAsync(Location loc, java.util.function.Consumer<Chunk> cb) {
|
||||
+ getChunkAtAsync((int)loc.getX() >> 4, (int)Math.floor(loc.getZ()) >> 4, true, cb);
|
||||
+ getChunkAtAsync((int)Math.floor(loc.getX()) >> 4, (int)Math.floor(loc.getZ()) >> 4, true, cb);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -197,7 +197,7 @@ index 807bd7fc..61f2cd9a 100644
|
||||
+ * will be executed synchronously
|
||||
+ */
|
||||
+ public default void getChunkAtAsync(Location loc, boolean gen, java.util.function.Consumer<Chunk> cb) {
|
||||
+ getChunkAtAsync((int)loc.getX() >> 4, (int)Math.floor(loc.getZ()) >> 4, gen, cb);
|
||||
+ getChunkAtAsync((int)Math.floor(loc.getX()) >> 4, (int)Math.floor(loc.getZ()) >> 4, gen, cb);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -259,7 +259,7 @@ index 807bd7fc..61f2cd9a 100644
|
||||
+ * @return Future that will resolve when the chunk is loaded
|
||||
+ */
|
||||
+ public default java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(Location loc) {
|
||||
+ return getChunkAtAsync((int)loc.getX() >> 4, (int)Math.floor(loc.getZ()) >> 4, true);
|
||||
+ return getChunkAtAsync((int)Math.floor(loc.getX()) >> 4, (int)Math.floor(loc.getZ()) >> 4, true);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
@ -279,7 +279,7 @@ index 807bd7fc..61f2cd9a 100644
|
||||
+ * @return Future that will resolve when the chunk is loaded
|
||||
+ */
|
||||
+ public default java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(Location loc, boolean gen) {
|
||||
+ return getChunkAtAsync((int)loc.getX() >> 4, (int)Math.floor(loc.getZ()) >> 4, gen);
|
||||
+ return getChunkAtAsync((int)Math.floor(loc.getX()) >> 4, (int)Math.floor(loc.getZ()) >> 4, gen);
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
Loading…
Reference in New Issue
Block a user