mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
Use ? super in Consumer/Predicate API (#9939)
This commit is contained in:
parent
3d12fa65fa
commit
cea171de11
13 changed files with 186 additions and 223 deletions
|
@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @return The tile entities.
|
+ * @return The tile entities.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ @NotNull
|
||||||
+ Collection<BlockState> getTileEntities(java.util.function.@NotNull Predicate<Block> blockPredicate, boolean useSnapshot);
|
+ Collection<BlockState> getTileEntities(java.util.function.@NotNull Predicate<? super Block> blockPredicate, boolean useSnapshot);
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -55,8 +55,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/java/org/bukkit/Location.java
|
--- a/src/main/java/org/bukkit/Location.java
|
||||||
+++ b/src/main/java/org/bukkit/Location.java
|
+++ b/src/main/java/org/bukkit/Location.java
|
||||||
@@ -0,0 +0,0 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm
|
@@ -0,0 +0,0 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm
|
||||||
return centerLoc;
|
|
||||||
}
|
}
|
||||||
|
// Paper end - expand Location API
|
||||||
|
|
||||||
+ // Paper start - Add heightmap api
|
+ // Paper start - Add heightmap api
|
||||||
+ /**
|
+ /**
|
||||||
|
|
|
@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
@NotNull
|
@NotNull
|
||||||
public <T extends Projectile> T launchProjectile(@NotNull Class<? extends T> projectile, @Nullable Vector velocity);
|
public <T extends Projectile> T launchProjectile(@NotNull Class<? extends T> projectile, @Nullable Vector velocity);
|
||||||
+
|
+
|
||||||
+ // Paper start
|
+ // Paper start - add consumer to launchProjectile
|
||||||
+ /**
|
+ /**
|
||||||
+ * Launches a {@link Projectile} from the ProjectileSource with an
|
+ * Launches a {@link Projectile} from the ProjectileSource with an
|
||||||
+ * initial velocity, with the supplied function run before the
|
+ * initial velocity, with the supplied function run before the
|
||||||
|
@ -29,7 +29,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param function the function to be run before the entity is spawned
|
+ * @param function the function to be run before the entity is spawned
|
||||||
+ * @return the launched projectile
|
+ * @return the launched projectile
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ <T extends Projectile> @NotNull T launchProjectile(@NotNull Class<? extends T> projectile, @Nullable Vector velocity, java.util.function.@Nullable Consumer<? super T> function);
|
||||||
+ public <T extends Projectile> T launchProjectile(@NotNull Class<? extends T> projectile, @Nullable Vector velocity, @Nullable java.util.function.Consumer<T> function);
|
+ // Paper end - add consumer to launchProjectile
|
||||||
+ // Paper end
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,23 +25,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
* Represents a 3-dimensional position in a world.
|
* Represents a 3-dimensional position in a world.
|
||||||
* <br>
|
* <br>
|
||||||
@@ -0,0 +0,0 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm
|
@@ -0,0 +0,0 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm
|
||||||
centerLoc.setZ(getBlockZ() + 0.5);
|
|
||||||
return centerLoc;
|
|
||||||
}
|
}
|
||||||
+
|
// Paper end - expand Location API
|
||||||
|
|
||||||
|
+ // Paper start - additional getNearbyEntities API
|
||||||
+ /**
|
+ /**
|
||||||
+ * Returns a list of entities within a bounding box centered around a Location.
|
+ * Returns a list of entities within a bounding box centered around a Location.
|
||||||
+ *
|
+ * <p>
|
||||||
+ * Some implementations may impose artificial restrictions on the size of the search bounding box.
|
+ * Some implementations may impose artificial restrictions on the size of the search bounding box.
|
||||||
+ *
|
+ *
|
||||||
+ * @param x 1/2 the size of the box along x axis
|
+ * @param x 1/2 the size of the box along the x-axis
|
||||||
+ * @param y 1/2 the size of the box along y axis
|
+ * @param y 1/2 the size of the box along the y-axis
|
||||||
+ * @param z 1/2 the size of the box along z axis
|
+ * @param z 1/2 the size of the box along the z-axis
|
||||||
+ * @return the collection of entities near location. This will always be a non-null collection.
|
+ * @return the collection of entities near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ public @NotNull Collection<Entity> getNearbyEntities(final double x, final double y, final double z) {
|
||||||
+ public Collection<Entity> getNearbyEntities(double x, double y, double z) {
|
+ final World world = this.getWorld();
|
||||||
+ World world = this.getWorld();
|
|
||||||
+ if (world == null) {
|
+ if (world == null) {
|
||||||
+ throw new IllegalArgumentException("Location has no world");
|
+ throw new IllegalArgumentException("Location has no world");
|
||||||
+ }
|
+ }
|
||||||
|
@ -53,9 +52,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param radius X Radius
|
+ * @param radius X Radius
|
||||||
+ * @return the collection of entities near location. This will always be a non-null collection.
|
+ * @return the collection of entities near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ public @NotNull Collection<LivingEntity> getNearbyLivingEntities(final double radius) {
|
||||||
+ public Collection<LivingEntity> getNearbyLivingEntities(double radius) {
|
+ return this.getNearbyEntitiesByType(LivingEntity.class, radius, radius, radius);
|
||||||
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, radius, radius, radius);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -64,9 +62,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param yRadius Y Radius
|
+ * @param yRadius Y Radius
|
||||||
+ * @return the collection of living entities near location. This will always be a non-null collection.
|
+ * @return the collection of living entities near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ public @NotNull Collection<LivingEntity> getNearbyLivingEntities(final double xzRadius, final double yRadius) {
|
||||||
+ public Collection<LivingEntity> getNearbyLivingEntities(double xzRadius, double yRadius) {
|
+ return this.getNearbyEntitiesByType(LivingEntity.class, xzRadius, yRadius, xzRadius);
|
||||||
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, xzRadius, yRadius, xzRadius);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -76,9 +73,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param zRadius Z radius
|
+ * @param zRadius Z radius
|
||||||
+ * @return the collection of living entities near location. This will always be a non-null collection.
|
+ * @return the collection of living entities near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ public @NotNull Collection<LivingEntity> getNearbyLivingEntities(final double xRadius, final double yRadius, final double zRadius) {
|
||||||
+ public Collection<LivingEntity> getNearbyLivingEntities(double xRadius, double yRadius, double zRadius) {
|
+ return this.getNearbyEntitiesByType(LivingEntity.class, xRadius, yRadius, zRadius);
|
||||||
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, xRadius, yRadius, zRadius);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -87,9 +83,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param predicate a predicate used to filter results
|
+ * @param predicate a predicate used to filter results
|
||||||
+ * @return the collection of living entities near location. This will always be a non-null collection.
|
+ * @return the collection of living entities near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ public @NotNull Collection<LivingEntity> getNearbyLivingEntities(final double radius, final @Nullable Predicate<? super LivingEntity> predicate) {
|
||||||
+ public Collection<LivingEntity> getNearbyLivingEntities(double radius, @Nullable Predicate<LivingEntity> predicate) {
|
+ return this.getNearbyEntitiesByType(LivingEntity.class, radius, radius, radius, predicate);
|
||||||
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, radius, radius, radius, predicate);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -99,9 +94,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param predicate a predicate used to filter results
|
+ * @param predicate a predicate used to filter results
|
||||||
+ * @return the collection of living entities near location. This will always be a non-null collection.
|
+ * @return the collection of living entities near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ public @NotNull Collection<LivingEntity> getNearbyLivingEntities(final double xzRadius, final double yRadius, final @Nullable Predicate<? super LivingEntity> predicate) {
|
||||||
+ public Collection<LivingEntity> getNearbyLivingEntities(double xzRadius, double yRadius, @Nullable Predicate<LivingEntity> predicate) {
|
+ return this.getNearbyEntitiesByType(LivingEntity.class, xzRadius, yRadius, xzRadius, predicate);
|
||||||
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, xzRadius, yRadius, xzRadius, predicate);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -112,9 +106,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param predicate a predicate used to filter results
|
+ * @param predicate a predicate used to filter results
|
||||||
+ * @return the collection of living entities near location. This will always be a non-null collection.
|
+ * @return the collection of living entities near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ public @NotNull Collection<LivingEntity> getNearbyLivingEntities(final double xRadius, final double yRadius, final double zRadius, final @Nullable Predicate<? super LivingEntity> predicate) {
|
||||||
+ public Collection<LivingEntity> getNearbyLivingEntities(double xRadius, double yRadius, double zRadius, @Nullable Predicate<LivingEntity> predicate) {
|
+ return this.getNearbyEntitiesByType(LivingEntity.class, xRadius, yRadius, zRadius, predicate);
|
||||||
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, xRadius, yRadius, zRadius, predicate);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -122,9 +115,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param radius X/Y/Z Radius
|
+ * @param radius X/Y/Z Radius
|
||||||
+ * @return the collection of players near location. This will always be a non-null collection.
|
+ * @return the collection of players near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ public @NotNull Collection<Player> getNearbyPlayers(final double radius) {
|
||||||
+ public Collection<Player> getNearbyPlayers(double radius) {
|
+ return this.getNearbyEntitiesByType(Player.class, radius, radius, radius);
|
||||||
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, radius, radius, radius);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -133,9 +125,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param yRadius Y Radius
|
+ * @param yRadius Y Radius
|
||||||
+ * @return the collection of players near location. This will always be a non-null collection.
|
+ * @return the collection of players near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ public @NotNull Collection<Player> getNearbyPlayers(final double xzRadius, final double yRadius) {
|
||||||
+ public Collection<Player> getNearbyPlayers(double xzRadius, double yRadius) {
|
+ return this.getNearbyEntitiesByType(Player.class, xzRadius, yRadius, xzRadius);
|
||||||
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, xzRadius, yRadius, xzRadius);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -145,9 +136,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param zRadius Z Radius
|
+ * @param zRadius Z Radius
|
||||||
+ * @return the collection of players near location. This will always be a non-null collection.
|
+ * @return the collection of players near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ public @NotNull Collection<Player> getNearbyPlayers(final double xRadius, final double yRadius, final double zRadius) {
|
||||||
+ public Collection<Player> getNearbyPlayers(double xRadius, double yRadius, double zRadius) {
|
+ return this.getNearbyEntitiesByType(Player.class, xRadius, yRadius, zRadius);
|
||||||
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, xRadius, yRadius, zRadius);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -156,9 +146,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param predicate a predicate used to filter results
|
+ * @param predicate a predicate used to filter results
|
||||||
+ * @return the collection of players near location. This will always be a non-null collection.
|
+ * @return the collection of players near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ public @NotNull Collection<Player> getNearbyPlayers(final double radius, final @Nullable Predicate<? super Player> predicate) {
|
||||||
+ public Collection<Player> getNearbyPlayers(double radius, @Nullable Predicate<Player> predicate) {
|
+ return this.getNearbyEntitiesByType(Player.class, radius, radius, radius, predicate);
|
||||||
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, radius, radius, radius, predicate);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -168,9 +157,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param predicate a predicate used to filter results
|
+ * @param predicate a predicate used to filter results
|
||||||
+ * @return the collection of players near location. This will always be a non-null collection.
|
+ * @return the collection of players near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ public @NotNull Collection<Player> getNearbyPlayers(final double xzRadius, final double yRadius, final @Nullable Predicate<? super Player> predicate) {
|
||||||
+ public Collection<Player> getNearbyPlayers(double xzRadius, double yRadius, @Nullable Predicate<Player> predicate) {
|
+ return this.getNearbyEntitiesByType(Player.class, xzRadius, yRadius, xzRadius, predicate);
|
||||||
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, xzRadius, yRadius, xzRadius, predicate);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -181,9 +169,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param predicate a predicate used to filter results
|
+ * @param predicate a predicate used to filter results
|
||||||
+ * @return the collection of players near location. This will always be a non-null collection.
|
+ * @return the collection of players near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ public @NotNull Collection<Player> getNearbyPlayers(final double xRadius, final double yRadius, final double zRadius, final @Nullable Predicate<? super Player> predicate) {
|
||||||
+ public Collection<Player> getNearbyPlayers(double xRadius, double yRadius, double zRadius, @Nullable Predicate<Player> predicate) {
|
+ return this.getNearbyEntitiesByType(Player.class, xRadius, yRadius, zRadius, predicate);
|
||||||
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, xRadius, yRadius, zRadius, predicate);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -193,9 +180,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param <T> the entity type
|
+ * @param <T> the entity type
|
||||||
+ * @return the collection of entities of type clazz near location. This will always be a non-null collection.
|
+ * @return the collection of entities of type clazz near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ public @NotNull <T extends Entity> Collection<T> getNearbyEntitiesByType(final @Nullable Class<? extends T> clazz, final double radius) {
|
||||||
+ public <T extends Entity> Collection<T> getNearbyEntitiesByType(@Nullable Class<? extends T> clazz, double radius) {
|
+ return this.getNearbyEntitiesByType(clazz, radius, radius, radius, null);
|
||||||
+ return getNearbyEntitiesByType(clazz, radius, radius, radius, null);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -206,9 +192,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param <T> the entity type
|
+ * @param <T> the entity type
|
||||||
+ * @return the collection of entities near location. This will always be a non-null collection.
|
+ * @return the collection of entities near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ public @NotNull <T extends Entity> Collection<T> getNearbyEntitiesByType(final @Nullable Class<? extends T> clazz, final double xzRadius, final double yRadius) {
|
||||||
+ public <T extends Entity> Collection<T> getNearbyEntitiesByType(@Nullable Class<? extends T> clazz, double xzRadius, double yRadius) {
|
+ return this.getNearbyEntitiesByType(clazz, xzRadius, yRadius, xzRadius, null);
|
||||||
+ return getNearbyEntitiesByType(clazz, xzRadius, yRadius, xzRadius, null);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -220,9 +205,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param <T> the entity type
|
+ * @param <T> the entity type
|
||||||
+ * @return the collection of entities near location. This will always be a non-null collection.
|
+ * @return the collection of entities near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ public @NotNull <T extends Entity> Collection<T> getNearbyEntitiesByType(final @Nullable Class<? extends T> clazz, final double xRadius, final double yRadius, final double zRadius) {
|
||||||
+ public <T extends Entity> Collection<T> getNearbyEntitiesByType(@Nullable Class<? extends T> clazz, double xRadius, double yRadius, double zRadius) {
|
+ return this.getNearbyEntitiesByType(clazz, xRadius, yRadius, zRadius, null);
|
||||||
+ return getNearbyEntitiesByType(clazz, xRadius, yRadius, zRadius, null);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -233,9 +217,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param <T> the entity type
|
+ * @param <T> the entity type
|
||||||
+ * @return the collection of entities near location. This will always be a non-null collection.
|
+ * @return the collection of entities near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ public @NotNull <T extends Entity> Collection<T> getNearbyEntitiesByType(final @Nullable Class<? extends T> clazz, final double radius, final @Nullable Predicate<? super T> predicate) {
|
||||||
+ public <T extends Entity> Collection<T> getNearbyEntitiesByType(@Nullable Class<? extends T> clazz, double radius, @Nullable Predicate<T> predicate) {
|
+ return this.getNearbyEntitiesByType(clazz, radius, radius, radius, predicate);
|
||||||
+ return getNearbyEntitiesByType(clazz, radius, radius, radius, predicate);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -247,9 +230,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param <T> the entity type
|
+ * @param <T> the entity type
|
||||||
+ * @return the collection of entities near location. This will always be a non-null collection.
|
+ * @return the collection of entities near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ public @NotNull <T extends Entity> Collection<T> getNearbyEntitiesByType(final @Nullable Class<? extends T> clazz, final double xzRadius, final double yRadius, final @Nullable Predicate<? super T> predicate) {
|
||||||
+ public <T extends Entity> Collection<T> getNearbyEntitiesByType(@Nullable Class<? extends T> clazz, double xzRadius, double yRadius, @Nullable Predicate<T> predicate) {
|
+ return this.getNearbyEntitiesByType(clazz, xzRadius, yRadius, xzRadius, predicate);
|
||||||
+ return getNearbyEntitiesByType(clazz, xzRadius, yRadius, xzRadius, predicate);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -262,14 +244,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param <T> the entity type
|
+ * @param <T> the entity type
|
||||||
+ * @return the collection of entities near location. This will always be a non-null collection.
|
+ * @return the collection of entities near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ public @NotNull <T extends Entity> Collection<T> getNearbyEntitiesByType(final @Nullable Class<? extends Entity> clazz, final double xRadius, final double yRadius, final double zRadius, final @Nullable Predicate<? super T> predicate) {
|
||||||
+ public <T extends Entity> Collection<T> getNearbyEntitiesByType(@Nullable Class<? extends Entity> clazz, double xRadius, double yRadius, double zRadius, @Nullable Predicate<T> predicate) {
|
+ final World world = this.getWorld();
|
||||||
+ World world = this.getWorld();
|
|
||||||
+ if (world == null) {
|
+ if (world == null) {
|
||||||
+ throw new IllegalArgumentException("Location has no world");
|
+ throw new IllegalArgumentException("Location has no world");
|
||||||
+ }
|
+ }
|
||||||
+ return world.getNearbyEntitiesByType(clazz, this, xRadius, yRadius, zRadius, predicate);
|
+ return world.getNearbyEntitiesByType(clazz, this, xRadius, yRadius, zRadius, predicate);
|
||||||
+ }
|
+ }
|
||||||
// Paper end
|
+ // Paper end - additional getNearbyEntities API
|
||||||
|
+
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
|
if (obj == null) {
|
||||||
|
|
|
@ -23,16 +23,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
@NotNull
|
@NotNull
|
||||||
public Collection<Entity> getEntitiesByClasses(@NotNull Class<?>... classes);
|
public Collection<Entity> getEntitiesByClasses(@NotNull Class<?>... classes);
|
||||||
|
|
||||||
+ // Paper start
|
+ // Paper start - additional getNearbyEntities API
|
||||||
+ /**
|
+ /**
|
||||||
+ * Gets nearby LivingEntities within the specified radius (bounding box)
|
+ * Gets nearby LivingEntities within the specified radius (bounding box)
|
||||||
+ * @param loc Center location
|
+ * @param loc Center location
|
||||||
+ * @param radius Radius
|
+ * @param radius Radius
|
||||||
+ * @return the collection of entities near location. This will always be a non-null collection.
|
+ * @return the collection of entities near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ default @NotNull Collection<LivingEntity> getNearbyLivingEntities(final @NotNull Location loc, final double radius) {
|
||||||
+ public default Collection<LivingEntity> getNearbyLivingEntities(@NotNull Location loc, double radius) {
|
+ return this.getNearbyEntitiesByType(LivingEntity.class, loc, radius, radius, radius);
|
||||||
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, loc, radius, radius, radius);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -42,9 +41,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param yRadius Y Radius
|
+ * @param yRadius Y Radius
|
||||||
+ * @return the collection of entities near location. This will always be a non-null collection.
|
+ * @return the collection of entities near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ default @NotNull Collection<LivingEntity> getNearbyLivingEntities(final @NotNull Location loc, final double xzRadius, final double yRadius) {
|
||||||
+ public default Collection<LivingEntity> getNearbyLivingEntities(@NotNull Location loc, double xzRadius, double yRadius) {
|
+ return this.getNearbyEntitiesByType(LivingEntity.class, loc, xzRadius, yRadius, xzRadius);
|
||||||
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, loc, xzRadius, yRadius, xzRadius);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -55,9 +53,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param zRadius Z radius
|
+ * @param zRadius Z radius
|
||||||
+ * @return the collection of entities near location. This will always be a non-null collection.
|
+ * @return the collection of entities near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ default @NotNull Collection<LivingEntity> getNearbyLivingEntities(final @NotNull Location loc, final double xRadius, final double yRadius, final double zRadius) {
|
||||||
+ public default Collection<LivingEntity> getNearbyLivingEntities(@NotNull Location loc, double xRadius, double yRadius, double zRadius) {
|
+ return this.getNearbyEntitiesByType(LivingEntity.class, loc, xRadius, yRadius, zRadius);
|
||||||
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, loc, xRadius, yRadius, zRadius);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -67,9 +64,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param predicate a predicate used to filter results
|
+ * @param predicate a predicate used to filter results
|
||||||
+ * @return the collection of living entities near location. This will always be a non-null collection
|
+ * @return the collection of living entities near location. This will always be a non-null collection
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ default @NotNull Collection<LivingEntity> getNearbyLivingEntities(final @NotNull Location loc, final double radius, final @Nullable Predicate<? super LivingEntity> predicate) {
|
||||||
+ public default Collection<LivingEntity> getNearbyLivingEntities(@NotNull Location loc, double radius, @Nullable Predicate<LivingEntity> predicate) {
|
+ return this.getNearbyEntitiesByType(LivingEntity.class, loc, radius, radius, radius, predicate);
|
||||||
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, loc, radius, radius, radius, predicate);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -80,9 +76,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param predicate a predicate used to filter results
|
+ * @param predicate a predicate used to filter results
|
||||||
+ * @return the collection of living entities near location. This will always be a non-null collection
|
+ * @return the collection of living entities near location. This will always be a non-null collection
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ default @NotNull Collection<LivingEntity> getNearbyLivingEntities(final @NotNull Location loc, final double xzRadius, final double yRadius, final @Nullable Predicate<? super LivingEntity> predicate) {
|
||||||
+ public default Collection<LivingEntity> getNearbyLivingEntities(@NotNull Location loc, double xzRadius, double yRadius, @Nullable Predicate<LivingEntity> predicate) {
|
+ return this.getNearbyEntitiesByType(LivingEntity.class, loc, xzRadius, yRadius, xzRadius, predicate);
|
||||||
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, loc, xzRadius, yRadius, xzRadius, predicate);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -94,9 +89,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param predicate a predicate used to filter results
|
+ * @param predicate a predicate used to filter results
|
||||||
+ * @return the collection of living entities near location. This will always be a non-null collection.
|
+ * @return the collection of living entities near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ default @NotNull Collection<LivingEntity> getNearbyLivingEntities(final @NotNull Location loc, final double xRadius, final double yRadius, final double zRadius, final @Nullable Predicate<? super LivingEntity> predicate) {
|
||||||
+ public default Collection<LivingEntity> getNearbyLivingEntities(@NotNull Location loc, double xRadius, double yRadius, double zRadius, @Nullable Predicate<LivingEntity> predicate) {
|
+ return this.getNearbyEntitiesByType(LivingEntity.class, loc, xRadius, yRadius, zRadius, predicate);
|
||||||
+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, loc, xRadius, yRadius, zRadius, predicate);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -105,9 +99,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param radius X/Y/Z Radius
|
+ * @param radius X/Y/Z Radius
|
||||||
+ * @return the collection of living entities near location. This will always be a non-null collection.
|
+ * @return the collection of living entities near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ default @NotNull Collection<Player> getNearbyPlayers(final @NotNull Location loc, final double radius) {
|
||||||
+ public default Collection<Player> getNearbyPlayers(@NotNull Location loc, double radius) {
|
+ return this.getNearbyEntitiesByType(Player.class, loc, radius, radius, radius);
|
||||||
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, loc, radius, radius, radius);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -117,9 +110,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param yRadius Y Radius
|
+ * @param yRadius Y Radius
|
||||||
+ * @return the collection of living entities near location. This will always be a non-null collection.
|
+ * @return the collection of living entities near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ default @NotNull Collection<Player> getNearbyPlayers(final @NotNull Location loc, final double xzRadius, final double yRadius) {
|
||||||
+ public default Collection<Player> getNearbyPlayers(@NotNull Location loc, double xzRadius, double yRadius) {
|
+ return this.getNearbyEntitiesByType(Player.class, loc, xzRadius, yRadius, xzRadius);
|
||||||
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, loc, xzRadius, yRadius, xzRadius);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -130,9 +122,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param zRadius Z Radius
|
+ * @param zRadius Z Radius
|
||||||
+ * @return the collection of players near location. This will always be a non-null collection.
|
+ * @return the collection of players near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ default @NotNull Collection<Player> getNearbyPlayers(final @NotNull Location loc, final double xRadius, final double yRadius, final double zRadius) {
|
||||||
+ public default Collection<Player> getNearbyPlayers(@NotNull Location loc, double xRadius, double yRadius, double zRadius) {
|
+ return this.getNearbyEntitiesByType(Player.class, loc, xRadius, yRadius, zRadius);
|
||||||
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, loc, xRadius, yRadius, zRadius);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -142,9 +133,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param predicate a predicate used to filter results
|
+ * @param predicate a predicate used to filter results
|
||||||
+ * @return the collection of players near location. This will always be a non-null collection.
|
+ * @return the collection of players near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ default @NotNull Collection<Player> getNearbyPlayers(final @NotNull Location loc, final double radius, final @Nullable Predicate<? super Player> predicate) {
|
||||||
+ public default Collection<Player> getNearbyPlayers(@NotNull Location loc, double radius, @Nullable Predicate<Player> predicate) {
|
+ return this.getNearbyEntitiesByType(Player.class, loc, radius, radius, radius, predicate);
|
||||||
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, loc, radius, radius, radius, predicate);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -155,9 +145,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param predicate a predicate used to filter results
|
+ * @param predicate a predicate used to filter results
|
||||||
+ * @return the collection of players near location. This will always be a non-null collection.
|
+ * @return the collection of players near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ default @NotNull Collection<Player> getNearbyPlayers(final @NotNull Location loc, final double xzRadius, final double yRadius, final @Nullable Predicate<? super Player> predicate) {
|
||||||
+ public default Collection<Player> getNearbyPlayers(@NotNull Location loc, double xzRadius, double yRadius, @Nullable Predicate<Player> predicate) {
|
+ return this.getNearbyEntitiesByType(Player.class, loc, xzRadius, yRadius, xzRadius, predicate);
|
||||||
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, loc, xzRadius, yRadius, xzRadius, predicate);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -169,9 +158,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param predicate a predicate used to filter results
|
+ * @param predicate a predicate used to filter results
|
||||||
+ * @return the collection of players near location. This will always be a non-null collection.
|
+ * @return the collection of players near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ default @NotNull Collection<Player> getNearbyPlayers(final @NotNull Location loc, final double xRadius, final double yRadius, final double zRadius, final @Nullable Predicate<? super Player> predicate) {
|
||||||
+ public default Collection<Player> getNearbyPlayers(@NotNull Location loc, double xRadius, double yRadius, double zRadius, @Nullable Predicate<Player> predicate) {
|
+ return this.getNearbyEntitiesByType(Player.class, loc, xRadius, yRadius, zRadius, predicate);
|
||||||
+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, loc, xRadius, yRadius, zRadius, predicate);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -182,9 +170,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param <T> the entity type
|
+ * @param <T> the entity type
|
||||||
+ * @return the collection of entities near location. This will always be a non-null collection.
|
+ * @return the collection of entities near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ default @NotNull <T extends Entity> Collection<T> getNearbyEntitiesByType(final @Nullable Class<? extends T> clazz, final @NotNull Location loc, final double radius) {
|
||||||
+ public default <T extends Entity> Collection<T> getNearbyEntitiesByType(@Nullable Class<? extends T> clazz, @NotNull Location loc, double radius) {
|
+ return this.getNearbyEntitiesByType(clazz, loc, radius, radius, radius, null);
|
||||||
+ return getNearbyEntitiesByType(clazz, loc, radius, radius, radius, null);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -196,9 +183,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param <T> the entity type
|
+ * @param <T> the entity type
|
||||||
+ * @return the collection of entities near location. This will always be a non-null collection.
|
+ * @return the collection of entities near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ default @NotNull <T extends Entity> Collection<T> getNearbyEntitiesByType(final @Nullable Class<? extends T> clazz, final @NotNull Location loc, final double xzRadius, final double yRadius) {
|
||||||
+ public default <T extends Entity> Collection<T> getNearbyEntitiesByType(@Nullable Class<? extends T> clazz, @NotNull Location loc, double xzRadius, double yRadius) {
|
+ return this.getNearbyEntitiesByType(clazz, loc, xzRadius, yRadius, xzRadius, null);
|
||||||
+ return getNearbyEntitiesByType(clazz, loc, xzRadius, yRadius, xzRadius, null);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -211,9 +197,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param <T> the entity type
|
+ * @param <T> the entity type
|
||||||
+ * @return the collection of entities near location. This will always be a non-null collection.
|
+ * @return the collection of entities near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ default @NotNull <T extends Entity> Collection<T> getNearbyEntitiesByType(final @Nullable Class<? extends T> clazz, final @NotNull Location loc, final double xRadius, final double yRadius, final double zRadius) {
|
||||||
+ public default <T extends Entity> Collection<T> getNearbyEntitiesByType(@Nullable Class<? extends T> clazz, @NotNull Location loc, double xRadius, double yRadius, double zRadius) {
|
+ return this.getNearbyEntitiesByType(clazz, loc, xRadius, yRadius, zRadius, null);
|
||||||
+ return getNearbyEntitiesByType(clazz, loc, xRadius, yRadius, zRadius, null);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -225,9 +210,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param <T> the entity type
|
+ * @param <T> the entity type
|
||||||
+ * @return the collection of entities near location. This will always be a non-null collection.
|
+ * @return the collection of entities near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ default @NotNull <T extends Entity> Collection<T> getNearbyEntitiesByType(final @Nullable Class<? extends T> clazz, final @NotNull Location loc, final double radius, final @Nullable Predicate<? super T> predicate) {
|
||||||
+ public default <T extends Entity> Collection<T> getNearbyEntitiesByType(@Nullable Class<? extends T> clazz, @NotNull Location loc, double radius, @Nullable Predicate<T> predicate) {
|
+ return this.getNearbyEntitiesByType(clazz, loc, radius, radius, radius, predicate);
|
||||||
+ return getNearbyEntitiesByType(clazz, loc, radius, radius, radius, predicate);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -240,9 +224,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param <T> the entity type
|
+ * @param <T> the entity type
|
||||||
+ * @return the collection of entities near location. This will always be a non-null collection.
|
+ * @return the collection of entities near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ default @NotNull <T extends Entity> Collection<T> getNearbyEntitiesByType(final @Nullable Class<? extends T> clazz, final @NotNull Location loc, final double xzRadius, final double yRadius, final @Nullable Predicate<? super T> predicate) {
|
||||||
+ public default <T extends Entity> Collection<T> getNearbyEntitiesByType(@Nullable Class<? extends T> clazz, @NotNull Location loc, double xzRadius, double yRadius, @Nullable Predicate<T> predicate) {
|
+ return this.getNearbyEntitiesByType(clazz, loc, xzRadius, yRadius, xzRadius, predicate);
|
||||||
+ return getNearbyEntitiesByType(clazz, loc, xzRadius, yRadius, xzRadius, predicate);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -256,13 +239,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param <T> the entity type
|
+ * @param <T> the entity type
|
||||||
+ * @return the collection of entities near location. This will always be a non-null collection.
|
+ * @return the collection of entities near location. This will always be a non-null collection.
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ default <T extends Entity> @NotNull Collection<T> getNearbyEntitiesByType(@Nullable Class<? extends Entity> clazz, final @NotNull Location loc, final double xRadius, final double yRadius, final double zRadius, final @Nullable Predicate<? super T> predicate) {
|
||||||
+ public default <T extends Entity> Collection<T> getNearbyEntitiesByType(@Nullable Class<? extends Entity> clazz, @NotNull Location loc, double xRadius, double yRadius, double zRadius, @Nullable Predicate<T> predicate) {
|
+ if (clazz == null) {
|
||||||
+ if (clazz == null) {
|
|
||||||
+ clazz = Entity.class;
|
+ clazz = Entity.class;
|
||||||
+ }
|
+ }
|
||||||
+ List<T> nearby = new ArrayList<>();
|
+ final List<T> nearby = new ArrayList<>();
|
||||||
+ for (Entity bukkitEntity : getNearbyEntities(loc, xRadius, yRadius, zRadius)) {
|
+ for (final Entity bukkitEntity : this.getNearbyEntities(loc, xRadius, yRadius, zRadius)) {
|
||||||
+ //noinspection unchecked
|
+ //noinspection unchecked
|
||||||
+ if (clazz.isAssignableFrom(bukkitEntity.getClass()) && (predicate == null || predicate.test((T) bukkitEntity))) {
|
+ if (clazz.isAssignableFrom(bukkitEntity.getClass()) && (predicate == null || predicate.test((T) bukkitEntity))) {
|
||||||
+ //noinspection unchecked
|
+ //noinspection unchecked
|
||||||
|
@ -271,7 +253,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ }
|
+ }
|
||||||
+ return nearby;
|
+ return nearby;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - additional getNearbyEntities API
|
||||||
+
|
+
|
||||||
/**
|
/**
|
||||||
* Get a list of all players in this World
|
* Get a list of all players in this World
|
||||||
|
|
|
@ -12,10 +12,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/java/org/bukkit/World.java
|
--- a/src/main/java/org/bukkit/World.java
|
||||||
+++ b/src/main/java/org/bukkit/World.java
|
+++ b/src/main/java/org/bukkit/World.java
|
||||||
@@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
@@ -0,0 +0,0 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||||
}
|
|
||||||
return nearby;
|
|
||||||
}
|
}
|
||||||
+
|
// Paper end - additional getNearbyEntities API
|
||||||
|
|
||||||
|
+ // Paper start - async chunks API
|
||||||
+ /**
|
+ /**
|
||||||
+ * This is the Legacy API before Java 8 was supported. Java 8 Consumer is provided,
|
+ * This is the Legacy API before Java 8 was supported. Java 8 Consumer is provided,
|
||||||
+ * as well as future support
|
+ * as well as future support
|
||||||
|
@ -139,8 +139,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param cb Callback to receive the chunk when it is loaded.
|
+ * @param cb Callback to receive the chunk when it is loaded.
|
||||||
+ * will be executed synchronously
|
+ * will be executed synchronously
|
||||||
+ */
|
+ */
|
||||||
+ public default void getChunkAtAsync(int x, int z, @NotNull java.util.function.Consumer<Chunk> cb) {
|
+ default void getChunkAtAsync(final int x, final int z, final @NotNull Consumer<? super Chunk> cb) {
|
||||||
+ getChunkAtAsync(x, z, true).thenAccept(cb).exceptionally((ex) -> {
|
+ this.getChunkAtAsync(x, z, true).thenAccept(cb).exceptionally((ex) -> {
|
||||||
+ Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Exception in chunk load callback", ex);
|
+ Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Exception in chunk load callback", ex);
|
||||||
+ return null;
|
+ return null;
|
||||||
+ });
|
+ });
|
||||||
|
@ -165,8 +165,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param cb Callback to receive the chunk when it is loaded.
|
+ * @param cb Callback to receive the chunk when it is loaded.
|
||||||
+ * will be executed synchronously
|
+ * will be executed synchronously
|
||||||
+ */
|
+ */
|
||||||
+ public default void getChunkAtAsync(int x, int z, boolean gen, @NotNull java.util.function.Consumer<Chunk> cb) {
|
+ default void getChunkAtAsync(final int x, final int z, final boolean gen, final @NotNull Consumer<? super Chunk> cb) {
|
||||||
+ getChunkAtAsync(x, z, gen).thenAccept(cb).exceptionally((ex) -> {
|
+ this.getChunkAtAsync(x, z, gen).thenAccept(cb).exceptionally((ex) -> {
|
||||||
+ Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Exception in chunk load callback", ex);
|
+ Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Exception in chunk load callback", ex);
|
||||||
+ return null;
|
+ return null;
|
||||||
+ });
|
+ });
|
||||||
|
@ -189,8 +189,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param cb Callback to receive the chunk when it is loaded.
|
+ * @param cb Callback to receive the chunk when it is loaded.
|
||||||
+ * will be executed synchronously
|
+ * will be executed synchronously
|
||||||
+ */
|
+ */
|
||||||
+ public default void getChunkAtAsync(@NotNull Location loc, @NotNull java.util.function.Consumer<Chunk> cb) {
|
+ default void getChunkAtAsync(final @NotNull Location loc, final @NotNull Consumer<? super Chunk> cb) {
|
||||||
+ getChunkAtAsync((int)Math.floor(loc.getX()) >> 4, (int)Math.floor(loc.getZ()) >> 4, true, cb);
|
+ this.getChunkAtAsync((int) Math.floor(loc.getX()) >> 4, (int) Math.floor(loc.getZ()) >> 4, true, cb);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -211,8 +211,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param cb Callback to receive the chunk when it is loaded.
|
+ * @param cb Callback to receive the chunk when it is loaded.
|
||||||
+ * will be executed synchronously
|
+ * will be executed synchronously
|
||||||
+ */
|
+ */
|
||||||
+ public default void getChunkAtAsync(@NotNull Location loc, boolean gen, @NotNull java.util.function.Consumer<Chunk> cb) {
|
+ default void getChunkAtAsync(final @NotNull Location loc, final boolean gen, final @NotNull Consumer<? super Chunk> cb) {
|
||||||
+ getChunkAtAsync((int)Math.floor(loc.getX()) >> 4, (int)Math.floor(loc.getZ()) >> 4, gen, cb);
|
+ this.getChunkAtAsync((int) Math.floor(loc.getX()) >> 4, (int) Math.floor(loc.getZ()) >> 4, gen, cb);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -232,8 +232,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param cb Callback to receive the chunk when it is loaded.
|
+ * @param cb Callback to receive the chunk when it is loaded.
|
||||||
+ * will be executed synchronously
|
+ * will be executed synchronously
|
||||||
+ */
|
+ */
|
||||||
+ public default void getChunkAtAsync(@NotNull Block block, @NotNull java.util.function.Consumer<Chunk> cb) {
|
+ default void getChunkAtAsync(final @NotNull Block block, final @NotNull Consumer<? super Chunk> cb) {
|
||||||
+ getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, true, cb);
|
+ this.getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, true, cb);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -254,8 +254,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param cb Callback to receive the chunk when it is loaded.
|
+ * @param cb Callback to receive the chunk when it is loaded.
|
||||||
+ * will be executed synchronously
|
+ * will be executed synchronously
|
||||||
+ */
|
+ */
|
||||||
+ public default void getChunkAtAsync(@NotNull Block block, boolean gen, @NotNull java.util.function.Consumer<Chunk> cb) {
|
+ default void getChunkAtAsync(final @NotNull Block block, final boolean gen, final @NotNull Consumer<? super Chunk> cb) {
|
||||||
+ getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, gen, cb);
|
+ this.getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, gen, cb);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -273,9 +273,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param loc Location to load the corresponding chunk from
|
+ * @param loc Location to load the corresponding chunk from
|
||||||
+ * @return Future that will resolve when the chunk is loaded
|
+ * @return Future that will resolve when the chunk is loaded
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ default @NotNull java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(final @NotNull Location loc) {
|
||||||
+ public default java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(@NotNull Location loc) {
|
+ return this.getChunkAtAsync((int) Math.floor(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);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -294,9 +293,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param gen Should the chunk generate if it doesn't exist
|
+ * @param gen Should the chunk generate if it doesn't exist
|
||||||
+ * @return Future that will resolve when the chunk is loaded
|
+ * @return Future that will resolve when the chunk is loaded
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ default @NotNull java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(final @NotNull Location loc, final boolean gen) {
|
||||||
+ public default java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(@NotNull Location loc, boolean gen) {
|
+ return this.getChunkAtAsync((int) Math.floor(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);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -314,9 +312,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param block Block to load the corresponding chunk from
|
+ * @param block Block to load the corresponding chunk from
|
||||||
+ * @return Future that will resolve when the chunk is loaded
|
+ * @return Future that will resolve when the chunk is loaded
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ default @NotNull java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(final @NotNull Block block) {
|
||||||
+ public default java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(@NotNull Block block) {
|
+ return this.getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, true);
|
||||||
+ return getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, true);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -335,9 +332,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param gen Should the chunk generate if it doesn't exist
|
+ * @param gen Should the chunk generate if it doesn't exist
|
||||||
+ * @return Future that will resolve when the chunk is loaded
|
+ * @return Future that will resolve when the chunk is loaded
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ default @NotNull java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(final @NotNull Block block, final boolean gen) {
|
||||||
+ public default java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(@NotNull Block block, boolean gen) {
|
+ return this.getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, gen);
|
||||||
+ return getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, gen);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -357,9 +353,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param z Chunk Z-coordinate of the chunk - floor(world coordinate / 16)
|
+ * @param z Chunk Z-coordinate of the chunk - floor(world coordinate / 16)
|
||||||
+ * @return Future that will resolve when the chunk is loaded
|
+ * @return Future that will resolve when the chunk is loaded
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ default @NotNull java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(final int x, final int z) {
|
||||||
+ public default java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(int x, int z) {
|
+ return this.getChunkAtAsync(x, z, true);
|
||||||
+ return getChunkAtAsync(x, z, true);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -380,9 +375,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param gen Should we generate a chunk if it doesn't exist or not
|
+ * @param gen Should we generate a chunk if it doesn't exist or not
|
||||||
+ * @return Future that will resolve when the chunk is loaded
|
+ * @return Future that will resolve when the chunk is loaded
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ default @NotNull java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(final int x, final int z, final boolean gen) {
|
||||||
+ public default java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(int x, int z, boolean gen) {
|
+ return this.getChunkAtAsync(x, z, gen, false);
|
||||||
+ return getChunkAtAsync(x, z, gen, false);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -400,9 +394,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param loc Location to load the corresponding chunk from
|
+ * @param loc Location to load the corresponding chunk from
|
||||||
+ * @return Future that will resolve when the chunk is loaded
|
+ * @return Future that will resolve when the chunk is loaded
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ default @NotNull java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsyncUrgently(final @NotNull Location loc) {
|
||||||
+ public default java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsyncUrgently(@NotNull Location loc) {
|
+ return this.getChunkAtAsync((int) Math.floor(loc.getX()) >> 4, (int) Math.floor(loc.getZ()) >> 4, true, true);
|
||||||
+ return getChunkAtAsync((int)Math.floor(loc.getX()) >> 4, (int)Math.floor(loc.getZ()) >> 4, true, true);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -421,9 +414,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param gen Should the chunk generate if it doesn't exist
|
+ * @param gen Should the chunk generate if it doesn't exist
|
||||||
+ * @return Future that will resolve when the chunk is loaded
|
+ * @return Future that will resolve when the chunk is loaded
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ default @NotNull java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsyncUrgently(final @NotNull Location loc, final boolean gen) {
|
||||||
+ public default java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsyncUrgently(@NotNull Location loc, boolean gen) {
|
+ return this.getChunkAtAsync((int) Math.floor(loc.getX()) >> 4, (int) Math.floor(loc.getZ()) >> 4, gen, true);
|
||||||
+ return getChunkAtAsync((int)Math.floor(loc.getX()) >> 4, (int)Math.floor(loc.getZ()) >> 4, gen, true);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -441,9 +433,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param block Block to load the corresponding chunk from
|
+ * @param block Block to load the corresponding chunk from
|
||||||
+ * @return Future that will resolve when the chunk is loaded
|
+ * @return Future that will resolve when the chunk is loaded
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ default @NotNull java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsyncUrgently(final @NotNull Block block) {
|
||||||
+ public default java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsyncUrgently(@NotNull Block block) {
|
+ return this.getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, true, true);
|
||||||
+ return getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, true, true);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -462,9 +453,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param gen Should the chunk generate if it doesn't exist
|
+ * @param gen Should the chunk generate if it doesn't exist
|
||||||
+ * @return Future that will resolve when the chunk is loaded
|
+ * @return Future that will resolve when the chunk is loaded
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ default @NotNull java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsyncUrgently(final @NotNull Block block, final boolean gen) {
|
||||||
+ public default java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsyncUrgently(@NotNull Block block, boolean gen) {
|
+ return this.getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, gen, true);
|
||||||
+ return getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, gen, true);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
|
@ -484,16 +474,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param z Z Coord
|
+ * @param z Z Coord
|
||||||
+ * @return Future that will resolve when the chunk is loaded
|
+ * @return Future that will resolve when the chunk is loaded
|
||||||
+ */
|
+ */
|
||||||
+ @NotNull
|
+ default @NotNull java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsyncUrgently(final int x, final int z) {
|
||||||
+ public default java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsyncUrgently(int x, int z) {
|
+ return this.getChunkAtAsync(x, z, true, true);
|
||||||
+ return getChunkAtAsync(x, z, true, true);
|
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @NotNull
|
+ java.util.concurrent.@NotNull CompletableFuture<Chunk> getChunkAtAsync(int x, int z, boolean gen, boolean urgent);
|
||||||
+ java.util.concurrent.CompletableFuture<Chunk> getChunkAtAsync(int x, int z, boolean gen, boolean urgent);
|
+ // Paper end - async chunks API
|
||||||
// Paper end
|
+
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get a list of all players in this World
|
||||||
|
*
|
||||||
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
|
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/entity/Entity.java
|
--- a/src/main/java/org/bukkit/entity/Entity.java
|
||||||
|
|
|
@ -42,13 +42,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * @param input the input placed into the bottom 3 slots
|
+ * @param input the input placed into the bottom 3 slots
|
||||||
+ * @param ingredient the ingredient placed into the top slot
|
+ * @param ingredient the ingredient placed into the top slot
|
||||||
+ */
|
+ */
|
||||||
+ public PotionMix(@NotNull NamespacedKey key, @NotNull ItemStack result, @NotNull RecipeChoice input, @NotNull RecipeChoice ingredient) {
|
+ public PotionMix(final @NotNull NamespacedKey key, final @NotNull ItemStack result, final @NotNull RecipeChoice input, final @NotNull RecipeChoice ingredient) {
|
||||||
+ this.key = key;
|
+ this.key = key;
|
||||||
+ this.result = result;
|
+ this.result = result;
|
||||||
+ this.input = input;
|
+ this.input = input;
|
||||||
+ this.ingredient = ingredient;
|
+ this.ingredient = ingredient;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
+ /**
|
||||||
|
+ * Create a {@link RecipeChoice} based on a Predicate. These RecipeChoices are only
|
||||||
|
+ * valid for {@link PotionMix}, not anywhere else RecipeChoices may be used.
|
||||||
|
+ *
|
||||||
|
+ * @param stackPredicate a predicate for an itemstack.
|
||||||
|
+ * @return a new RecipeChoice
|
||||||
|
+ */
|
||||||
|
+ @Contract(value = "_ -> new", pure = true)
|
||||||
|
+ public static @NotNull RecipeChoice createPredicateChoice(final @NotNull Predicate<? super ItemStack> stackPredicate) {
|
||||||
|
+ return new PredicateRecipeChoice(stackPredicate);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public @NotNull NamespacedKey getKey() {
|
+ public @NotNull NamespacedKey getKey() {
|
||||||
+ return this.key;
|
+ return this.key;
|
||||||
|
@ -81,18 +93,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ return this.ingredient;
|
+ return this.ingredient;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ /**
|
|
||||||
+ * Create a {@link RecipeChoice} based on a Predicate. These RecipeChoices are only
|
|
||||||
+ * valid for {@link PotionMix}, not anywhere else RecipeChoices may be used.
|
|
||||||
+ *
|
|
||||||
+ * @param stackPredicate a predicate for an itemstack.
|
|
||||||
+ * @return a new RecipeChoice
|
|
||||||
+ */
|
|
||||||
+ @Contract(value = "_ -> new", pure = true)
|
|
||||||
+ public static @NotNull RecipeChoice createPredicateChoice(@NotNull Predicate<ItemStack> stackPredicate) {
|
|
||||||
+ return new PredicateRecipeChoice(stackPredicate);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public String toString() {
|
+ public String toString() {
|
||||||
+ return "PotionMix{" +
|
+ return "PotionMix{" +
|
||||||
|
@ -103,10 +103,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public boolean equals(Object o) {
|
+ public boolean equals(final Object o) {
|
||||||
+ if (this == o) return true;
|
+ if (this == o) return true;
|
||||||
+ if (o == null || getClass() != o.getClass()) return false;
|
+ if (o == null || this.getClass() != o.getClass()) return false;
|
||||||
+ PotionMix potionMix = (PotionMix) o;
|
+ final PotionMix potionMix = (PotionMix) o;
|
||||||
+ return this.key.equals(potionMix.key) && this.result.equals(potionMix.result) && this.input.equals(potionMix.input) && this.ingredient.equals(potionMix.ingredient);
|
+ return this.key.equals(potionMix.key) && this.result.equals(potionMix.result) && this.input.equals(potionMix.input) && this.ingredient.equals(potionMix.ingredient);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
@ -132,7 +132,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+
|
+
|
||||||
+@ApiStatus.Internal
|
+@ApiStatus.Internal
|
||||||
+@DefaultQualifier(NonNull.class)
|
+@DefaultQualifier(NonNull.class)
|
||||||
+record PredicateRecipeChoice(Predicate<ItemStack> itemStackPredicate) implements RecipeChoice, Cloneable {
|
+record PredicateRecipeChoice(Predicate<? super ItemStack> itemStackPredicate) implements RecipeChoice, Cloneable {
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ @Deprecated
|
+ @Deprecated
|
||||||
|
@ -144,7 +144,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ public RecipeChoice clone() {
|
+ public RecipeChoice clone() {
|
||||||
+ try {
|
+ try {
|
||||||
+ return (PredicateRecipeChoice) super.clone();
|
+ return (PredicateRecipeChoice) super.clone();
|
||||||
+ } catch (CloneNotSupportedException ex) {
|
+ } catch (final CloneNotSupportedException ex) {
|
||||||
+ throw new AssertionError(ex);
|
+ throw new AssertionError(ex);
|
||||||
+ }
|
+ }
|
||||||
+ }
|
+ }
|
||||||
|
|
|
@ -18,13 +18,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
@@ -0,0 +0,0 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm
|
@@ -0,0 +0,0 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm
|
||||||
return centerLoc;
|
|
||||||
}
|
}
|
||||||
|
// Paper end - expand Location API
|
||||||
|
|
||||||
+ // Paper start - Expand Explosions API
|
+ // Paper start - Expand Explosions API
|
||||||
+ /**
|
+ /**
|
||||||
+ * Creates explosion at this location with given power
|
+ * Creates explosion at this location with given power
|
||||||
+ *
|
+ * <p>
|
||||||
+ * Will break blocks and ignite blocks on fire.
|
+ * Will break blocks and ignite blocks on fire.
|
||||||
+ *
|
+ *
|
||||||
+ * @param power The power of explosion, where 4F is TNT
|
+ * @param power The power of explosion, where 4F is TNT
|
||||||
|
@ -37,11 +37,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ /**
|
+ /**
|
||||||
+ * Creates explosion at this location with given power and optionally
|
+ * Creates explosion at this location with given power and optionally
|
||||||
+ * setting blocks on fire.
|
+ * setting blocks on fire.
|
||||||
+ *
|
+ * <p>
|
||||||
+ * Will break blocks.
|
+ * Will break blocks.
|
||||||
+ *
|
+ *
|
||||||
+ * @param power The power of explosion, where 4F is TNT
|
+ * @param power The power of explosion, where 4F is TNT
|
||||||
+ * @param setFire Whether or not to set blocks on fire
|
+ * @param setFire Whether to set blocks on fire
|
||||||
+ * @return false if explosion was canceled, otherwise true
|
+ * @return false if explosion was canceled, otherwise true
|
||||||
+ */
|
+ */
|
||||||
+ public boolean createExplosion(float power, boolean setFire) {
|
+ public boolean createExplosion(float power, boolean setFire) {
|
||||||
|
@ -53,8 +53,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ * setting blocks on fire.
|
+ * setting blocks on fire.
|
||||||
+ *
|
+ *
|
||||||
+ * @param power The power of explosion, where 4F is TNT
|
+ * @param power The power of explosion, where 4F is TNT
|
||||||
+ * @param setFire Whether or not to set blocks on fire
|
+ * @param setFire Whether to set blocks on fire
|
||||||
+ * @param breakBlocks Whether or not to have blocks be destroyed
|
+ * @param breakBlocks Whether to have blocks be destroyed
|
||||||
+ * @return false if explosion was canceled, otherwise true
|
+ * @return false if explosion was canceled, otherwise true
|
||||||
+ */
|
+ */
|
||||||
+ public boolean createExplosion(float power, boolean setFire, boolean breakBlocks) {
|
+ public boolean createExplosion(float power, boolean setFire, boolean breakBlocks) {
|
||||||
|
@ -63,7 +63,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
+ * Creates explosion at this location with given power, with the specified entity as the source.
|
+ * Creates explosion at this location with given power, with the specified entity as the source.
|
||||||
+ *
|
+ * <p>
|
||||||
+ * Will break blocks and ignite blocks on fire.
|
+ * Will break blocks and ignite blocks on fire.
|
||||||
+ *
|
+ *
|
||||||
+ * @param source The source entity of the explosion
|
+ * @param source The source entity of the explosion
|
||||||
|
@ -77,12 +77,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ /**
|
+ /**
|
||||||
+ * Creates explosion at this location with given power and optionally
|
+ * Creates explosion at this location with given power and optionally
|
||||||
+ * setting blocks on fire, with the specified entity as the source.
|
+ * setting blocks on fire, with the specified entity as the source.
|
||||||
+ *
|
+ * <p>
|
||||||
+ * Will break blocks.
|
+ * Will break blocks.
|
||||||
+ *
|
+ *
|
||||||
+ * @param source The source entity of the explosion
|
+ * @param source The source entity of the explosion
|
||||||
+ * @param power The power of explosion, where 4F is TNT
|
+ * @param power The power of explosion, where 4F is TNT
|
||||||
+ * @param setFire Whether or not to set blocks on fire
|
+ * @param setFire Whether to set blocks on fire
|
||||||
+ * @return false if explosion was canceled, otherwise true
|
+ * @return false if explosion was canceled, otherwise true
|
||||||
+ */
|
+ */
|
||||||
+ public boolean createExplosion(@Nullable Entity source, float power, boolean setFire) {
|
+ public boolean createExplosion(@Nullable Entity source, float power, boolean setFire) {
|
||||||
|
@ -95,8 +95,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ *
|
+ *
|
||||||
+ * @param source The source entity of the explosion
|
+ * @param source The source entity of the explosion
|
||||||
+ * @param power The power of explosion, where 4F is TNT
|
+ * @param power The power of explosion, where 4F is TNT
|
||||||
+ * @param setFire Whether or not to set blocks on fire
|
+ * @param setFire Whether to set blocks on fire
|
||||||
+ * @param breakBlocks Whether or not to have blocks be destroyed
|
+ * @param breakBlocks Whether to have blocks be destroyed
|
||||||
+ * @return false if explosion was canceled, otherwise true
|
+ * @return false if explosion was canceled, otherwise true
|
||||||
+ */
|
+ */
|
||||||
+ public boolean createExplosion(@Nullable Entity source, float power, boolean setFire, boolean breakBlocks) {
|
+ public boolean createExplosion(@Nullable Entity source, float power, boolean setFire, boolean breakBlocks) {
|
||||||
|
@ -104,9 +104,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end - Expand Explosions API
|
+ // Paper end - Expand Explosions API
|
||||||
+
|
+
|
||||||
|
// Paper start - additional getNearbyEntities API
|
||||||
/**
|
/**
|
||||||
* Returns a list of entities within a bounding box centered around a Location.
|
* Returns a list of entities within a bounding box centered around a Location.
|
||||||
*
|
|
||||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/World.java
|
--- a/src/main/java/org/bukkit/World.java
|
||||||
|
|
|
@ -10,14 +10,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
--- a/src/main/java/org/bukkit/Location.java
|
--- a/src/main/java/org/bukkit/Location.java
|
||||||
+++ b/src/main/java/org/bukkit/Location.java
|
+++ b/src/main/java/org/bukkit/Location.java
|
||||||
@@ -0,0 +0,0 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm
|
@@ -0,0 +0,0 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm
|
||||||
|
|
||||||
public boolean isChunkLoaded() { return this.getWorld().isChunkLoaded(locToBlock(x) >> 4, locToBlock(z) >> 4); } // Paper
|
public boolean isChunkLoaded() { return this.getWorld().isChunkLoaded(locToBlock(x) >> 4, locToBlock(z) >> 4); } // Paper
|
||||||
|
|
||||||
// Paper start
|
+ // Paper start - expand location manipulation API
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
+ * Sets the position of this Location and returns itself
|
+ * Sets the position of this Location and returns itself
|
||||||
+ *
|
+ * <p>
|
||||||
+ * This mutates this object, clone first.
|
+ * This mutates this object, clone first.
|
||||||
|
+ *
|
||||||
+ * @param x X coordinate
|
+ * @param x X coordinate
|
||||||
+ * @param y Y coordinate
|
+ * @param y Y coordinate
|
||||||
+ * @param z Z coordinate
|
+ * @param z Z coordinate
|
||||||
|
@ -33,8 +35,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
+ * Takes the x/y/z from base and adds the specified x/y/z to it and returns self
|
+ * Takes the x/y/z from base and adds the specified x/y/z to it and returns self
|
||||||
+ *
|
+ * <p>
|
||||||
+ * This mutates this object, clone first.
|
+ * This mutates this object, clone first.
|
||||||
|
+ *
|
||||||
+ * @param base The base coordinate to modify
|
+ * @param base The base coordinate to modify
|
||||||
+ * @param x X coordinate to add to base
|
+ * @param x X coordinate to add to base
|
||||||
+ * @param y Y coordinate to add to base
|
+ * @param y Y coordinate to add to base
|
||||||
|
@ -48,8 +51,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+
|
+
|
||||||
+ /**
|
+ /**
|
||||||
+ * Takes the x/y/z from base and subtracts the specified x/y/z to it and returns self
|
+ * Takes the x/y/z from base and subtracts the specified x/y/z to it and returns self
|
||||||
+ *
|
+ * <p>
|
||||||
+ * This mutates this object, clone first.
|
+ * This mutates this object, clone first.
|
||||||
|
+ *
|
||||||
+ * @param base The base coordinate to modify
|
+ * @param base The base coordinate to modify
|
||||||
+ * @param x X coordinate to subtract from base
|
+ * @param x X coordinate to subtract from base
|
||||||
+ * @param y Y coordinate to subtract from base
|
+ * @param y Y coordinate to subtract from base
|
||||||
|
@ -60,7 +64,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ public Location subtract(@NotNull Location base, double x, double y, double z) {
|
+ public Location subtract(@NotNull Location base, double x, double y, double z) {
|
||||||
+ return this.set(base.x - x, base.y - y, base.z - z);
|
+ return this.set(base.x - x, base.y - y, base.z - z);
|
||||||
+ }
|
+ }
|
||||||
|
+ // Paper end - expand location manipulation API
|
||||||
+
|
+
|
||||||
|
// Paper start - expand Location API
|
||||||
/**
|
/**
|
||||||
* @return A new location where X/Y/Z are on the Block location (integer value of X/Y/Z)
|
* @return A new location where X/Y/Z are on the Block location (integer value of X/Y/Z)
|
||||||
*/
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
|
|
||||||
public boolean isChunkLoaded() { return this.getWorld().isChunkLoaded(locToBlock(x) >> 4, locToBlock(z) >> 4); } // Paper
|
public boolean isChunkLoaded() { return this.getWorld().isChunkLoaded(locToBlock(x) >> 4, locToBlock(z) >> 4); } // Paper
|
||||||
+
|
+
|
||||||
+ // Paper start
|
+ // Paper start - expand Location API
|
||||||
+ /**
|
+ /**
|
||||||
+ * @return A new location where X/Y/Z are on the Block location (integer value of X/Y/Z)
|
+ * @return A new location where X/Y/Z are on the Block location (integer value of X/Y/Z)
|
||||||
+ */
|
+ */
|
||||||
|
@ -37,7 +37,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ centerLoc.setZ(getBlockZ() + 0.5);
|
+ centerLoc.setZ(getBlockZ() + 0.5);
|
||||||
+ return centerLoc;
|
+ return centerLoc;
|
||||||
+ }
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end - expand Location API
|
||||||
|
+
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj == null) {
|
if (obj == null) {
|
||||||
|
|
|
@ -17,9 +17,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
@@ -0,0 +0,0 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm
|
@@ -0,0 +0,0 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm
|
||||||
|
|
||||||
public boolean isChunkLoaded() { return this.getWorld().isChunkLoaded(locToBlock(x) >> 4, locToBlock(z) >> 4); } // Paper
|
public boolean isChunkLoaded() { return this.getWorld().isChunkLoaded(locToBlock(x) >> 4, locToBlock(z) >> 4); } // Paper
|
||||||
|
|
||||||
// Paper start
|
+ // Paper start - isGenerated API
|
||||||
+ /**
|
+ /**
|
||||||
+ * Checks if a {@link Chunk} has been generated at this location.
|
+ * Checks if a {@link Chunk} has been generated at this location.
|
||||||
+ *
|
+ *
|
||||||
|
@ -30,9 +31,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ Preconditions.checkNotNull(world, "Location has no world!");
|
+ Preconditions.checkNotNull(world, "Location has no world!");
|
||||||
+ return world.isChunkGenerated(locToBlock(x) >> 4, locToBlock(z) >> 4);
|
+ return world.isChunkGenerated(locToBlock(x) >> 4, locToBlock(z) >> 4);
|
||||||
+ }
|
+ }
|
||||||
|
+ // Paper end - isGenerated API
|
||||||
|
+
|
||||||
|
// Paper start - expand location manipulation API
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the position of this Location and returns itself
|
|
||||||
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
||||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||||
--- a/src/main/java/org/bukkit/World.java
|
--- a/src/main/java/org/bukkit/World.java
|
||||||
|
|
|
@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public Collection<BlockState> getTileEntities(Predicate<Block> blockPredicate, boolean useSnapshot) {
|
+ public Collection<BlockState> getTileEntities(Predicate<? super Block> blockPredicate, boolean useSnapshot) {
|
||||||
+ Preconditions.checkNotNull(blockPredicate, "blockPredicate");
|
+ Preconditions.checkNotNull(blockPredicate, "blockPredicate");
|
||||||
+ if (!this.isLoaded()) {
|
+ if (!this.isLoaded()) {
|
||||||
+ this.getWorld().getChunkAt(this.x, this.z); // Transient load for this tick
|
+ this.getWorld().getChunkAt(this.x, this.z); // Transient load for this tick
|
||||||
|
|
|
@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ @SuppressWarnings("unchecked")
|
+ @SuppressWarnings("unchecked")
|
||||||
+ public <T extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity, java.util.function.Consumer<T> function) {
|
+ public <T extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity, java.util.function.Consumer<? super T> function) {
|
||||||
+ // Paper end - launchProjectile consumer
|
+ // Paper end - launchProjectile consumer
|
||||||
Preconditions.checkState(!this.getHandle().generation, "Cannot launch projectile during world generation");
|
Preconditions.checkState(!this.getHandle().generation, "Cannot launch projectile during world generation");
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ @Override
|
+ @Override
|
||||||
+ public <T extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity, java.util.function.Consumer<T> function) {
|
+ public <T extends Projectile> T launchProjectile(Class<? extends T> projectile, Vector velocity, java.util.function.Consumer<? super T> function) {
|
||||||
+ // Paper end - launchProjectile consumer
|
+ // Paper end - launchProjectile consumer
|
||||||
Preconditions.checkArgument(this.getBlock().getType() == Material.DISPENSER, "Block is no longer dispenser");
|
Preconditions.checkArgument(this.getBlock().getType() == Material.DISPENSER, "Block is no longer dispenser");
|
||||||
// Copied from BlockDispenser.dispense()
|
// Copied from BlockDispenser.dispense()
|
||||||
|
|
Loading…
Reference in a new issue