Add Position (#7639)

* Add Position

* move Position patch to start
This commit is contained in:
Jake Potrebic 2022-12-10 16:50:32 -08:00 committed by GitHub
parent ecfb76a73a
commit 1143b63663
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
413 changed files with 475 additions and 53 deletions

View File

@ -0,0 +1,422 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sun, 20 Mar 2022 10:42:28 -0700
Subject: [PATCH] Add Position
diff --git a/src/main/java/io/papermc/paper/math/BlockPosition.java b/src/main/java/io/papermc/paper/math/BlockPosition.java
new file mode 100644
index 0000000000000000000000000000000000000000..f164d32cfbd5bfd84f3067a149d34bb1185a7e00
--- /dev/null
+++ b/src/main/java/io/papermc/paper/math/BlockPosition.java
@@ -0,0 +1,98 @@
+package io.papermc.paper.math;
+
+import org.bukkit.Axis;
+import org.bukkit.block.BlockFace;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * A position represented with integers.
+ * <p>
+ * <b>May see breaking changes until Experimental annotation is removed.</b>
+ * @see FinePosition
+ */
+@ApiStatus.Experimental
+public interface BlockPosition extends Position {
+
+ @Override
+ default double x() {
+ return this.blockX();
+ }
+
+ @Override
+ default double y() {
+ return this.blockY();
+ }
+
+ @Override
+ default double z() {
+ return this.blockZ();
+ }
+
+ @Override
+ default boolean isBlock() {
+ return true;
+ }
+
+ @Override
+ default boolean isFine() {
+ return false;
+ }
+
+ @Override
+ default @NotNull BlockPosition toBlock() {
+ return this;
+ }
+
+ @Override
+ default @NotNull BlockPosition offset(int x, int y, int z) {
+ return x == 0 && y == 0 && z == 0 ? this : new BlockPositionImpl(this.blockX() + x, this.blockY() + y, this.blockZ() + z);
+ }
+
+ @Override
+ default @NotNull FinePosition offset(double x, double y, double z) {
+ return new FinePositionImpl(this.blockX() + z, this.blockY() + y, this.blockZ() + z);
+ }
+
+ /**
+ * Returns a block position offset by 1 in the direction specified.
+ *
+ * @param blockFace the block face to offset towards
+ * @return the offset block position
+ */
+ @Contract(value = "_ -> new", pure = true)
+ default @NotNull BlockPosition offset(@NotNull BlockFace blockFace) {
+ return this.offset(blockFace, 1);
+ }
+
+ /**
+ * Returns a block position offset in the direction specified
+ * multiplied by the amount.
+ *
+ * @param blockFace the block face to offset towards
+ * @param amount the number of times to move in that direction
+ * @return the offset block position
+ */
+ @Contract(pure = true)
+ default @NotNull BlockPosition offset(@NotNull BlockFace blockFace, int amount) {
+ return amount == 0 ? this : new BlockPositionImpl(this.blockX() + (blockFace.getModX() * amount), this.blockY() + (blockFace.getModY() * amount), this.blockZ() + (blockFace.getModZ() * amount));
+ }
+
+ /**
+ * Returns a block position offset by the amount along
+ * the specified axis.
+ *
+ * @param axis the axis to offset along
+ * @param amount the amount to offset along that axis
+ * @return the offset block position
+ */
+ @Contract(pure = true)
+ default @NotNull BlockPosition offset(@NotNull Axis axis, int amount) {
+ return amount == 0 ? this : switch (axis) {
+ case X -> new BlockPositionImpl(this.blockX() + amount, this.blockY(), this.blockZ());
+ case Y -> new BlockPositionImpl(this.blockX(), this.blockY() + amount, this.blockZ());
+ case Z -> new BlockPositionImpl(this.blockX(), this.blockY(), this.blockZ() + amount);
+ };
+ }
+}
diff --git a/src/main/java/io/papermc/paper/math/BlockPositionImpl.java b/src/main/java/io/papermc/paper/math/BlockPositionImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..eb5a3f26c7ba56c6715827f52c0013a860ec7d9a
--- /dev/null
+++ b/src/main/java/io/papermc/paper/math/BlockPositionImpl.java
@@ -0,0 +1,4 @@
+package io.papermc.paper.math;
+
+record BlockPositionImpl(int blockX, int blockY, int blockZ) implements BlockPosition {
+}
diff --git a/src/main/java/io/papermc/paper/math/FinePosition.java b/src/main/java/io/papermc/paper/math/FinePosition.java
new file mode 100644
index 0000000000000000000000000000000000000000..d8df70d731573cf2446044925f218876d62fd7cf
--- /dev/null
+++ b/src/main/java/io/papermc/paper/math/FinePosition.java
@@ -0,0 +1,56 @@
+package io.papermc.paper.math;
+
+import org.bukkit.util.NumberConversions;
+import org.bukkit.util.Vector;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * A position represented with doubles.
+ * <p>
+ * <b>May see breaking changes until Experimental annotation is removed.</b>
+ * @see BlockPosition
+ */
+@ApiStatus.Experimental
+public interface FinePosition extends Position {
+
+ @Override
+ default int blockX() {
+ return NumberConversions.floor(this.x());
+ }
+
+ @Override
+ default int blockY() {
+ return NumberConversions.floor(this.y());
+ }
+
+ @Override
+ default int blockZ() {
+ return NumberConversions.floor(this.z());
+ }
+
+ @Override
+ default boolean isBlock() {
+ return false;
+ }
+
+ @Override
+ default boolean isFine() {
+ return true;
+ }
+
+ @Override
+ default @NotNull BlockPosition toBlock() {
+ return new BlockPositionImpl(this.blockX(), this.blockY(), this.blockZ());
+ }
+
+ @Override
+ default @NotNull FinePosition offset(int x, int y, int z) {
+ return this.offset((double) x, y, z);
+ }
+
+ @Override
+ default @NotNull FinePosition offset(double x, double y, double z) {
+ return x == 0.0 && y == 0.0 && z == 0.0 ? this : new FinePositionImpl(this.x() + x, this.y() + y, this.z() + z);
+ }
+}
diff --git a/src/main/java/io/papermc/paper/math/FinePositionImpl.java b/src/main/java/io/papermc/paper/math/FinePositionImpl.java
new file mode 100644
index 0000000000000000000000000000000000000000..93476aaf8d21efb5a30b6d2cc2eeda8100fb72d0
--- /dev/null
+++ b/src/main/java/io/papermc/paper/math/FinePositionImpl.java
@@ -0,0 +1,4 @@
+package io.papermc.paper.math;
+
+record FinePositionImpl(double x, double y, double z) implements FinePosition {
+}
diff --git a/src/main/java/io/papermc/paper/math/Position.java b/src/main/java/io/papermc/paper/math/Position.java
new file mode 100644
index 0000000000000000000000000000000000000000..300da713dcc303b340efad70efe57facf5422964
--- /dev/null
+++ b/src/main/java/io/papermc/paper/math/Position.java
@@ -0,0 +1,184 @@
+package io.papermc.paper.math;
+
+import org.bukkit.Location;
+import org.bukkit.World;
+import org.bukkit.util.Vector;
+import org.jetbrains.annotations.ApiStatus;
+import org.jetbrains.annotations.Contract;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Common interface for {@link FinePosition} and {@link BlockPosition}.
+ * <p>
+ * <b>May see breaking changes until Experimental annotation is removed.</b>
+ */
+@ApiStatus.Experimental
+public interface Position {
+
+ FinePosition FINE_ZERO = new FinePositionImpl(0, 0, 0);
+ BlockPosition BLOCK_ZERO = new BlockPositionImpl(0, 0, 0);
+
+ /**
+ * Gets the block x value for this position
+ *
+ * @return the block x value
+ */
+ int blockX();
+
+ /**
+ * Gets the block x value for this position
+ *
+ * @return the block x value
+ */
+ int blockY();
+
+ /**
+ * Gets the block x value for this position
+ *
+ * @return the block x value
+ */
+ int blockZ();
+
+ /**
+ * Gets the x value for this position
+ *
+ * @return the x value
+ */
+ double x();
+
+ /**
+ * Gets the y value for this position
+ *
+ * @return the y value
+ */
+ double y();
+
+ /**
+ * Gets the z value for this position
+ *
+ * @return the z value
+ */
+ double z();
+
+ /**
+ * Checks of this position represents a {@link BlockPosition}
+ *
+ * @return true if block
+ */
+ boolean isBlock();
+
+ /**
+ * Checks if this position represents a {@link FinePosition}
+ *
+ * @return true if fine
+ */
+ boolean isFine();
+
+ /**
+ * Returns a position offset by the specified amounts.
+ *
+ * @param x x value to offset
+ * @param y y value to offset
+ * @param z z value to offset
+ * @return the offset position
+ */
+ @NotNull Position offset(int x, int y, int z);
+
+ /**
+ * Returns a position offset by the specified amounts.
+ *
+ * @param x x value to offset
+ * @param y y value to offset
+ * @param z z value to offset
+ * @return the offset position
+ */
+ @NotNull FinePosition offset(double x, double y, double z);
+
+ /**
+ * Returns a new position at the center of the block position this represents
+ *
+ * @return a new center position
+ */
+ @Contract(value = "-> new", pure = true)
+ default @NotNull FinePosition toCenter() {
+ return new FinePositionImpl(this.blockX() + 0.5, this.blockY() + 0.5, this.blockZ() + 0.5);
+ }
+
+ /**
+ * Returns the block position of this position
+ * or itself if it already is a block position
+ *
+ * @return the block position
+ */
+ @Contract(pure = true)
+ @NotNull BlockPosition toBlock();
+
+ /**
+ * Converts this position to a vector
+ *
+ * @return a new vector
+ */
+ @Contract(value = "-> new", pure = true)
+ default @NotNull Vector toVector() {
+ return new Vector(this.x(), this.y(), this.z());
+ }
+
+ /**
+ * Creates a new location object at this position with the specified world
+ *
+ * @param world the world for the location object
+ * @return a new location
+ */
+ @Contract(value = "_ -> new", pure = true)
+ default @NotNull Location toLocation(@NotNull World world) {
+ return new Location(world, this.x(), this.y(), this.z());
+ }
+
+ /**
+ * Creates a position at the coordinates
+ *
+ * @param x x coord
+ * @param y y coord
+ * @param z z coord
+ * @return a position with those coords
+ */
+ @Contract(value = "_, _, _ -> new", pure = true)
+ static @NotNull BlockPosition block(int x, int y, int z) {
+ return new BlockPositionImpl(x, y, z);
+ }
+
+ /**
+ * Creates a position from the location.
+ *
+ * @param location the location to copy the position of
+ * @return a new position at that location
+ */
+ @Contract(value = "_ -> new", pure = true)
+ static @NotNull BlockPosition block(@NotNull Location location) {
+ return new BlockPositionImpl(location.getBlockX(), location.getBlockY(), location.getBlockZ());
+ }
+
+ /**
+ * Creates a position at the coordinates
+ *
+ * @param x x coord
+ * @param y y coord
+ * @param z z coord
+ * @return a position with those coords
+ */
+ @Contract(value = "_, _, _ -> new", pure = true)
+ static @NotNull FinePosition fine(double x, double y, double z) {
+ return new FinePositionImpl(x, y, z);
+ }
+
+ /**
+ * Creates a position from the location.
+ *
+ * @param location the location to copy the position of
+ * @return a new position at that location
+ */
+ @Contract(value = "_ -> new", pure = true)
+ static @NotNull FinePosition fine(@NotNull Location location) {
+ return new FinePositionImpl(location.getX(), location.getY(), location.getZ());
+ }
+}
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
index 7c4db051472fb6a6c6d24092dc6f75487356690a..3b99f359f556e6f2c341d55fa69b7462e69b6546 100644
--- a/src/main/java/org/bukkit/Location.java
+++ b/src/main/java/org/bukkit/Location.java
@@ -20,7 +20,7 @@ import org.jetbrains.annotations.Nullable;
* magnitude than 360 are valid, but may be normalized to any other equivalent
* representation by the implementation.
*/
-public class Location implements Cloneable, ConfigurationSerializable {
+public class Location implements Cloneable, ConfigurationSerializable, io.papermc.paper.math.FinePosition { // Paper
private Reference<World> world;
private double x;
private double y;
@@ -706,4 +706,26 @@ public class Location implements Cloneable, ConfigurationSerializable {
}
return pitch;
}
+
+ // Paper - add Position
+ @Override
+ public double x() {
+ return this.getX();
+ }
+
+ @Override
+ public double y() {
+ return this.getY();
+ }
+
+ @Override
+ public double z() {
+ return this.getZ();
+ }
+
+ @Override
+ public @NotNull Location toLocation(@NotNull World world) {
+ return new Location(world, this.x(), this.y(), this.z(), this.getYaw(), this.getPitch());
+ }
+ // Paper end
}

View File

@ -7,7 +7,7 @@ Subject: [PATCH] Add command line option to load extra plugin jars not in the
ex: java -jar paperclip.jar nogui -add-plugin=/path/to/plugin.jar -add-plugin=/path/to/another/plugin_jar.jar
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 557cf1ff29e16fa942545ceca14696c2a50b2d4d..a5c02f744664248f46aa35452318b6a728cd4afd 100644
index e24589a4cb42b0163e4a1455b8b11d7130b5cd41..71a09ed2b9863d2d339967f41ab6373ec27429d3 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -76,6 +76,20 @@ public final class Bukkit {
@ -32,7 +32,7 @@ index 557cf1ff29e16fa942545ceca14696c2a50b2d4d..a5c02f744664248f46aa35452318b6a7
* Attempts to set the {@link Server} singleton.
* <p>
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index a2ae6b84fe20e43292f1442401a472dcce1600ec..da13ae75ca1892c21a35aff02f92b91783a868bf 100644
index ac087402c90dad4b3c499fcf8507e50e9099cea5..a4f8035b40eebff8afe01788781128b04247f28c 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -61,6 +61,18 @@ import org.jetbrains.annotations.Nullable;

View File

@ -56,7 +56,7 @@ index 0000000000000000000000000000000000000000..a736d7bcdc5861a01b66ba36158db1c7
+ }
+}
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index c9ecd5b1908e05a1b39dadcded27241672adcddf..355c46f1c1f08072446f3cc92c0d22898933a7fc 100644
index d45cc92ca30e79173f30aae10724beeec6d22398..c67d2e96e30261e480f1df96464befac03d78a69 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -95,5 +95,12 @@ public interface UnsafeValues {

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Entity Origin API
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index a829779ac56a271cad463806984991b4713a27be..20c529bdd94a6bac09d9f8222f33dfc9e8d53fa9 100644
index bdcf5219ff1e4d4c0dc8a3423bc17b453b779473..a4dfac73b8510f0dddd65751b8430be1abdabbdd 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -698,5 +698,15 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Graduate bungeecord chat API from spigot subclasses
Change Javadoc to be accurate
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 5475f7df443a31e839d353e251b0d9d55e53a84f..7a8eaf46ecd37163dbe34beb2cf8754bddae302f 100644
index 1035ce181415a19f8d6460f70d3d900e3f7017d3..316146305465b68b703e898206745de94ad5350f 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -379,6 +379,30 @@ public final class Bukkit {
@ -41,7 +41,7 @@ index 5475f7df443a31e839d353e251b0d9d55e53a84f..7a8eaf46ecd37163dbe34beb2cf8754b
* Gets the name of the update folder. The update folder is used to safely
* update plugins at the right moment on a plugin load.
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 2dac2c6e01b4f230750605ab1f49317927705c6b..1aed052ea337f2875b581064bd8e79d8a5a1a9ec 100644
index 6a7b91af3e738613cf79c13e2844efe9a2efd254..bef555b3de44fed312b45a5d5cd811b18fda88c8 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -312,6 +312,30 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Use ASM for event executors.
Uses method handles for private or static methods.
diff --git a/build.gradle.kts b/build.gradle.kts
index 3320666626cdadefc045331d33c3e9e9741344fc..68d751b045665f8006cc56e7fd3e2b2dcbda5a02 100644
index c9f9174a085174b96897c013e0ecb79738c2e9e3..9d650b937610d83748b30d724cee97afd715167f 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -39,6 +39,9 @@ dependencies {

View File

@ -7,7 +7,7 @@ Provides counts without the ineffeciency of using .getEntities().size()
which creates copy of the collections.
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 887b85849803cee22a41a701b43cdc9085ba0dc3..e0683e69029e8ac423bda79521045b06673eabf3 100644
index 75a87b221cc0f6334c5283130a7b2bfdf4eedd03..e6c9942f7820f2b8750c1bb0825c8bdbc6f4b99e 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -45,6 +45,33 @@ import org.jetbrains.annotations.Nullable;

View File

@ -5,7 +5,7 @@ Subject: [PATCH] Entity#fromMobSpawner()
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index 20c529bdd94a6bac09d9f8222f33dfc9e8d53fa9..e598c7c90d625313b8a935418bb68e0e6cb6bc6e 100644
index a4dfac73b8510f0dddd65751b8430be1abdabbdd..6b0bfcfd22105fbdf09c11bbec009ba19116abd9 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -708,5 +708,12 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent

View File

@ -14,7 +14,7 @@ it without having to shade it in the plugin and going through
several layers of logging abstraction.
diff --git a/build.gradle.kts b/build.gradle.kts
index f0f8047cb3a43b447dc50b730dab3d0bc471b25a..435db1ffe47476bcb7067802faad7aee7e4c3f54 100644
index 9d650b937610d83748b30d724cee97afd715167f..3c4dd6ebc2289c44c2f5723e7920aadffdc51884 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -39,6 +39,8 @@ dependencies {

View File

@ -578,7 +578,7 @@ index 270e6d8ad4358baa256cee5f16cff281f063ce3b..4a3451af454295ac3e1b688e6665cad9
@Override
diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java
index 93498307004b68b934fbfa1aeb3aaf0e97cbdac7..bbe81f7a420f913ffdcad913a3c43ff41ead41f5 100644
index 8275a5d7e1de39a5171e254f449a42c6defd3445..4bca64b2a44ae032730575ecba39f9737a5a1ec7 100644
--- a/src/test/java/org/bukkit/AnnotationTest.java
+++ b/src/test/java/org/bukkit/AnnotationTest.java
@@ -48,6 +48,8 @@ public class AnnotationTest {

View File

@ -9,7 +9,7 @@ In Offline Mode, will return an Offline UUID
This is a more performant way to obtain a UUID for a name than loading an OfflinePlayer
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index a452adcbf8657c501ad92f4cb361b551992f128f..908e1aba5257688bb70fbf1ed83d2212305263a1 100644
index ec1af46667d8590ea218370249286f86652f3ac4..aa4217c87756cffe774aaa2d390217b9056c4b95 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -657,6 +657,20 @@ public final class Bukkit {
@ -34,7 +34,7 @@ index a452adcbf8657c501ad92f4cb361b551992f128f..908e1aba5257688bb70fbf1ed83d2212
* Gets the plugin manager for interfacing with plugins.
*
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index e90056341407f58ff6ce2d9b80c8f3f64464e650..b0e6446c0dc49088878d7ae453dc3eee8b346f4e 100644
index 8539bac19bf9ba1a66689a9af90e088a03f9c152..c46cae77e6a1d3f01b08ff03407eb1a564d000de 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -559,6 +559,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi

View File

@ -6,7 +6,7 @@ Subject: [PATCH] Additional world.getNearbyEntities API's
Provides more methods to get nearby entities, and filter by types and predicates
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index e0683e69029e8ac423bda79521045b06673eabf3..cf7baa9cd691b02aeaa4d94d5e999e661e003a44 100644
index e6c9942f7820f2b8750c1bb0825c8bdbc6f4b99e..3539e63993cc21f9eecda9046b759cebdfec80ff 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -1,6 +1,9 @@

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Location.isChunkLoaded() API
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
index 7c4db051472fb6a6c6d24092dc6f75487356690a..3be91f6c9b355c9e8562796d719f5a6ce566d85a 100644
index 3b99f359f556e6f2c341d55fa69b7462e69b6546..e71beb48f2e35d97b9d5bf8dbf5ddbc0673565fe 100644
--- a/src/main/java/org/bukkit/Location.java
+++ b/src/main/java/org/bukkit/Location.java
@@ -533,6 +533,7 @@ public class Location implements Cloneable, ConfigurationSerializable {
@@ -533,6 +533,7 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm
return this;
}

View File

@ -522,7 +522,7 @@ index 9f646171b3ac617fb5217d5ab9c106c3100a8c8d..2315fffc4a1a5bebc50a703e9df59df8
* Options which can be applied to redstone dust particles - a particle
* color and size.
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index cf7baa9cd691b02aeaa4d94d5e999e661e003a44..9ffe69abd0aa706d56e4eff3587cb453a437ba26 100644
index 3539e63993cc21f9eecda9046b759cebdfec80ff..8b48ce606523528f4322296b61a64bd12067387c 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -2787,7 +2787,57 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Location.toBlockLocation/toCenterLocation()
Convert location objects to their block coordinates, or the center of the block
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
index 3be91f6c9b355c9e8562796d719f5a6ce566d85a..a90010fea189c5ac9a59a0e6d04c0457243a3280 100644
index e71beb48f2e35d97b9d5bf8dbf5ddbc0673565fe..5a219f132747eb62204e98de4cb850748a43c9b4 100644
--- a/src/main/java/org/bukkit/Location.java
+++ b/src/main/java/org/bukkit/Location.java
@@ -534,6 +534,31 @@ public class Location implements Cloneable, ConfigurationSerializable {
@@ -534,6 +534,31 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm
}
public boolean isChunkLoaded() { return this.getWorld().isChunkLoaded(locToBlock(x) >> 4, locToBlock(z) >> 4); } // Paper

Some files were not shown because too many files have changed in this diff Show More