diff --git a/patches/api/Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch b/patches/api/Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch index 82790c9b61..35fc9b634e 100644 --- a/patches/api/Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch +++ b/patches/api/Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch @@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @return The tile entities. + */ + @NotNull -+ Collection getTileEntities(java.util.function.@NotNull Predicate blockPredicate, boolean useSnapshot); ++ Collection getTileEntities(java.util.function.@NotNull Predicate blockPredicate, boolean useSnapshot); + // Paper end /** diff --git a/patches/api/Add-Heightmap-API.patch b/patches/api/Add-Heightmap-API.patch index 2c5837e3aa..fc06929944 100644 --- a/patches/api/Add-Heightmap-API.patch +++ b/patches/api/Add-Heightmap-API.patch @@ -55,8 +55,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/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 - return centerLoc; } + // Paper end - expand Location API + // Paper start - Add heightmap api + /** diff --git a/patches/api/Add-a-consumer-parameter-to-ProjectileSource-launchP.patch b/patches/api/Add-a-consumer-parameter-to-ProjectileSource-launchP.patch index 4dcfafb1ed..c4ba37c2a8 100644 --- a/patches/api/Add-a-consumer-parameter-to-ProjectileSource-launchP.patch +++ b/patches/api/Add-a-consumer-parameter-to-ProjectileSource-launchP.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @NotNull public T launchProjectile(@NotNull Class projectile, @Nullable Vector velocity); + -+ // Paper start ++ // Paper start - add consumer to launchProjectile + /** + * Launches a {@link Projectile} from the ProjectileSource with an + * 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 + * @return the launched projectile + */ -+ @NotNull -+ public T launchProjectile(@NotNull Class projectile, @Nullable Vector velocity, @Nullable java.util.function.Consumer function); -+ // Paper end ++ @NotNull T launchProjectile(@NotNull Class projectile, @Nullable Vector velocity, java.util.function.@Nullable Consumer function); ++ // Paper end - add consumer to launchProjectile } diff --git a/patches/api/Add-getNearbyXXX-methods-to-Location.patch b/patches/api/Add-getNearbyXXX-methods-to-Location.patch index 3b22cf5b4b..52f914acf0 100644 --- a/patches/api/Add-getNearbyXXX-methods-to-Location.patch +++ b/patches/api/Add-getNearbyXXX-methods-to-Location.patch @@ -25,23 +25,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 * Represents a 3-dimensional position in a world. *
@@ -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. -+ * ++ *

+ * 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 y 1/2 the size of the box along y axis -+ * @param z 1/2 the size of the box along z axis ++ * @param x 1/2 the size of the box along the x-axis ++ * @param y 1/2 the size of the box along the y-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. + */ -+ @NotNull -+ public Collection getNearbyEntities(double x, double y, double z) { -+ World world = this.getWorld(); ++ public @NotNull Collection getNearbyEntities(final double x, final double y, final double z) { ++ final World world = this.getWorld(); + if (world == null) { + throw new IllegalArgumentException("Location has no world"); + } @@ -53,9 +52,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param radius X Radius + * @return the collection of entities near location. This will always be a non-null collection. + */ -+ @NotNull -+ public Collection getNearbyLivingEntities(double radius) { -+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, radius, radius, radius); ++ public @NotNull Collection getNearbyLivingEntities(final double radius) { ++ return this.getNearbyEntitiesByType(LivingEntity.class, radius, radius, radius); + } + + /** @@ -64,9 +62,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param yRadius Y Radius + * @return the collection of living entities near location. This will always be a non-null collection. + */ -+ @NotNull -+ public Collection getNearbyLivingEntities(double xzRadius, double yRadius) { -+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, xzRadius, yRadius, xzRadius); ++ public @NotNull Collection getNearbyLivingEntities(final double xzRadius, final double yRadius) { ++ return this.getNearbyEntitiesByType(LivingEntity.class, xzRadius, yRadius, xzRadius); + } + + /** @@ -76,9 +73,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param zRadius Z radius + * @return the collection of living entities near location. This will always be a non-null collection. + */ -+ @NotNull -+ public Collection getNearbyLivingEntities(double xRadius, double yRadius, double zRadius) { -+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, xRadius, yRadius, zRadius); ++ public @NotNull Collection getNearbyLivingEntities(final double xRadius, final double yRadius, final double zRadius) { ++ return this.getNearbyEntitiesByType(LivingEntity.class, xRadius, yRadius, zRadius); + } + + /** @@ -87,9 +83,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param predicate a predicate used to filter results + * @return the collection of living entities near location. This will always be a non-null collection. + */ -+ @NotNull -+ public Collection getNearbyLivingEntities(double radius, @Nullable Predicate predicate) { -+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, radius, radius, radius, predicate); ++ public @NotNull Collection getNearbyLivingEntities(final double radius, final @Nullable Predicate predicate) { ++ return this.getNearbyEntitiesByType(LivingEntity.class, radius, radius, radius, predicate); + } + + /** @@ -99,9 +94,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param predicate a predicate used to filter results + * @return the collection of living entities near location. This will always be a non-null collection. + */ -+ @NotNull -+ public Collection getNearbyLivingEntities(double xzRadius, double yRadius, @Nullable Predicate predicate) { -+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, xzRadius, yRadius, xzRadius, predicate); ++ public @NotNull Collection getNearbyLivingEntities(final double xzRadius, final double yRadius, final @Nullable Predicate predicate) { ++ return this.getNearbyEntitiesByType(LivingEntity.class, xzRadius, yRadius, xzRadius, predicate); + } + + /** @@ -112,9 +106,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param predicate a predicate used to filter results + * @return the collection of living entities near location. This will always be a non-null collection. + */ -+ @NotNull -+ public Collection getNearbyLivingEntities(double xRadius, double yRadius, double zRadius, @Nullable Predicate predicate) { -+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, xRadius, yRadius, zRadius, predicate); ++ public @NotNull Collection getNearbyLivingEntities(final double xRadius, final double yRadius, final double zRadius, final @Nullable Predicate predicate) { ++ return this.getNearbyEntitiesByType(LivingEntity.class, xRadius, yRadius, zRadius, predicate); + } + + /** @@ -122,9 +115,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param radius X/Y/Z Radius + * @return the collection of players near location. This will always be a non-null collection. + */ -+ @NotNull -+ public Collection getNearbyPlayers(double radius) { -+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, radius, radius, radius); ++ public @NotNull Collection getNearbyPlayers(final double radius) { ++ return this.getNearbyEntitiesByType(Player.class, radius, radius, radius); + } + + /** @@ -133,9 +125,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param yRadius Y Radius + * @return the collection of players near location. This will always be a non-null collection. + */ -+ @NotNull -+ public Collection getNearbyPlayers(double xzRadius, double yRadius) { -+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, xzRadius, yRadius, xzRadius); ++ public @NotNull Collection getNearbyPlayers(final double xzRadius, final double yRadius) { ++ return this.getNearbyEntitiesByType(Player.class, xzRadius, yRadius, xzRadius); + } + + /** @@ -145,9 +136,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param zRadius Z Radius + * @return the collection of players near location. This will always be a non-null collection. + */ -+ @NotNull -+ public Collection getNearbyPlayers(double xRadius, double yRadius, double zRadius) { -+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, xRadius, yRadius, zRadius); ++ public @NotNull Collection getNearbyPlayers(final double xRadius, final double yRadius, final double zRadius) { ++ return this.getNearbyEntitiesByType(Player.class, xRadius, yRadius, zRadius); + } + + /** @@ -156,9 +146,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param predicate a predicate used to filter results + * @return the collection of players near location. This will always be a non-null collection. + */ -+ @NotNull -+ public Collection getNearbyPlayers(double radius, @Nullable Predicate predicate) { -+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, radius, radius, radius, predicate); ++ public @NotNull Collection getNearbyPlayers(final double radius, final @Nullable Predicate predicate) { ++ return this.getNearbyEntitiesByType(Player.class, radius, radius, radius, predicate); + } + + /** @@ -168,9 +157,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param predicate a predicate used to filter results + * @return the collection of players near location. This will always be a non-null collection. + */ -+ @NotNull -+ public Collection getNearbyPlayers(double xzRadius, double yRadius, @Nullable Predicate predicate) { -+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, xzRadius, yRadius, xzRadius, predicate); ++ public @NotNull Collection getNearbyPlayers(final double xzRadius, final double yRadius, final @Nullable Predicate predicate) { ++ return this.getNearbyEntitiesByType(Player.class, xzRadius, yRadius, xzRadius, predicate); + } + + /** @@ -181,9 +169,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param predicate a predicate used to filter results + * @return the collection of players near location. This will always be a non-null collection. + */ -+ @NotNull -+ public Collection getNearbyPlayers(double xRadius, double yRadius, double zRadius, @Nullable Predicate predicate) { -+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, xRadius, yRadius, zRadius, predicate); ++ public @NotNull Collection getNearbyPlayers(final double xRadius, final double yRadius, final double zRadius, final @Nullable Predicate predicate) { ++ return this.getNearbyEntitiesByType(Player.class, xRadius, yRadius, zRadius, predicate); + } + + /** @@ -193,9 +180,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param the entity type + * @return the collection of entities of type clazz near location. This will always be a non-null collection. + */ -+ @NotNull -+ public Collection getNearbyEntitiesByType(@Nullable Class clazz, double radius) { -+ return getNearbyEntitiesByType(clazz, radius, radius, radius, null); ++ public @NotNull Collection getNearbyEntitiesByType(final @Nullable Class clazz, final double radius) { ++ return this.getNearbyEntitiesByType(clazz, radius, radius, radius, null); + } + + /** @@ -206,9 +192,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param the entity type + * @return the collection of entities near location. This will always be a non-null collection. + */ -+ @NotNull -+ public Collection getNearbyEntitiesByType(@Nullable Class clazz, double xzRadius, double yRadius) { -+ return getNearbyEntitiesByType(clazz, xzRadius, yRadius, xzRadius, null); ++ public @NotNull Collection getNearbyEntitiesByType(final @Nullable Class clazz, final double xzRadius, final double yRadius) { ++ return this.getNearbyEntitiesByType(clazz, xzRadius, yRadius, xzRadius, null); + } + + /** @@ -220,9 +205,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param the entity type + * @return the collection of entities near location. This will always be a non-null collection. + */ -+ @NotNull -+ public Collection getNearbyEntitiesByType(@Nullable Class clazz, double xRadius, double yRadius, double zRadius) { -+ return getNearbyEntitiesByType(clazz, xRadius, yRadius, zRadius, null); ++ public @NotNull Collection getNearbyEntitiesByType(final @Nullable Class clazz, final double xRadius, final double yRadius, final double zRadius) { ++ return this.getNearbyEntitiesByType(clazz, xRadius, yRadius, zRadius, null); + } + + /** @@ -233,9 +217,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param the entity type + * @return the collection of entities near location. This will always be a non-null collection. + */ -+ @NotNull -+ public Collection getNearbyEntitiesByType(@Nullable Class clazz, double radius, @Nullable Predicate predicate) { -+ return getNearbyEntitiesByType(clazz, radius, radius, radius, predicate); ++ public @NotNull Collection getNearbyEntitiesByType(final @Nullable Class clazz, final double radius, final @Nullable Predicate predicate) { ++ return this.getNearbyEntitiesByType(clazz, radius, radius, radius, predicate); + } + + /** @@ -247,9 +230,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param the entity type + * @return the collection of entities near location. This will always be a non-null collection. + */ -+ @NotNull -+ public Collection getNearbyEntitiesByType(@Nullable Class clazz, double xzRadius, double yRadius, @Nullable Predicate predicate) { -+ return getNearbyEntitiesByType(clazz, xzRadius, yRadius, xzRadius, predicate); ++ public @NotNull Collection getNearbyEntitiesByType(final @Nullable Class clazz, final double xzRadius, final double yRadius, final @Nullable Predicate predicate) { ++ return this.getNearbyEntitiesByType(clazz, xzRadius, yRadius, xzRadius, predicate); + } + + /** @@ -262,14 +244,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param the entity type + * @return the collection of entities near location. This will always be a non-null collection. + */ -+ @NotNull -+ public Collection getNearbyEntitiesByType(@Nullable Class clazz, double xRadius, double yRadius, double zRadius, @Nullable Predicate predicate) { -+ World world = this.getWorld(); ++ public @NotNull Collection getNearbyEntitiesByType(final @Nullable Class clazz, final double xRadius, final double yRadius, final double zRadius, final @Nullable Predicate predicate) { ++ final World world = this.getWorld(); + if (world == null) { + throw new IllegalArgumentException("Location has no world"); + } + return world.getNearbyEntitiesByType(clazz, this, xRadius, yRadius, zRadius, predicate); + } - // Paper end ++ // Paper end - additional getNearbyEntities API ++ @Override public boolean equals(Object obj) { + if (obj == null) { diff --git a/patches/api/Additional-world.getNearbyEntities-API-s.patch b/patches/api/Additional-world.getNearbyEntities-API-s.patch index f57a5b08c1..bdb80efe42 100644 --- a/patches/api/Additional-world.getNearbyEntities-API-s.patch +++ b/patches/api/Additional-world.getNearbyEntities-API-s.patch @@ -23,16 +23,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @NotNull public Collection getEntitiesByClasses(@NotNull Class... classes); -+ // Paper start ++ // Paper start - additional getNearbyEntities API + /** + * Gets nearby LivingEntities within the specified radius (bounding box) + * @param loc Center location + * @param radius Radius + * @return the collection of entities near location. This will always be a non-null collection. + */ -+ @NotNull -+ public default Collection getNearbyLivingEntities(@NotNull Location loc, double radius) { -+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, loc, radius, radius, radius); ++ default @NotNull Collection getNearbyLivingEntities(final @NotNull Location loc, final double radius) { ++ return this.getNearbyEntitiesByType(LivingEntity.class, loc, radius, radius, radius); + } + + /** @@ -42,9 +41,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param yRadius Y Radius + * @return the collection of entities near location. This will always be a non-null collection. + */ -+ @NotNull -+ public default Collection getNearbyLivingEntities(@NotNull Location loc, double xzRadius, double yRadius) { -+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, loc, xzRadius, yRadius, xzRadius); ++ default @NotNull Collection getNearbyLivingEntities(final @NotNull Location loc, final double xzRadius, final double yRadius) { ++ return this.getNearbyEntitiesByType(LivingEntity.class, loc, xzRadius, yRadius, xzRadius); + } + + /** @@ -55,9 +53,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param zRadius Z radius + * @return the collection of entities near location. This will always be a non-null collection. + */ -+ @NotNull -+ public default Collection getNearbyLivingEntities(@NotNull Location loc, double xRadius, double yRadius, double zRadius) { -+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, loc, xRadius, yRadius, zRadius); ++ default @NotNull Collection getNearbyLivingEntities(final @NotNull Location loc, final double xRadius, final double yRadius, final double zRadius) { ++ return this.getNearbyEntitiesByType(LivingEntity.class, loc, xRadius, yRadius, zRadius); + } + + /** @@ -67,9 +64,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param predicate a predicate used to filter results + * @return the collection of living entities near location. This will always be a non-null collection + */ -+ @NotNull -+ public default Collection getNearbyLivingEntities(@NotNull Location loc, double radius, @Nullable Predicate predicate) { -+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, loc, radius, radius, radius, predicate); ++ default @NotNull Collection getNearbyLivingEntities(final @NotNull Location loc, final double radius, final @Nullable Predicate predicate) { ++ return this.getNearbyEntitiesByType(LivingEntity.class, loc, radius, radius, radius, predicate); + } + + /** @@ -80,9 +76,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param predicate a predicate used to filter results + * @return the collection of living entities near location. This will always be a non-null collection + */ -+ @NotNull -+ public default Collection getNearbyLivingEntities(@NotNull Location loc, double xzRadius, double yRadius, @Nullable Predicate predicate) { -+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, loc, xzRadius, yRadius, xzRadius, predicate); ++ default @NotNull Collection getNearbyLivingEntities(final @NotNull Location loc, final double xzRadius, final double yRadius, final @Nullable Predicate predicate) { ++ return this.getNearbyEntitiesByType(LivingEntity.class, loc, xzRadius, yRadius, xzRadius, predicate); + } + + /** @@ -94,9 +89,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param predicate a predicate used to filter results + * @return the collection of living entities near location. This will always be a non-null collection. + */ -+ @NotNull -+ public default Collection getNearbyLivingEntities(@NotNull Location loc, double xRadius, double yRadius, double zRadius, @Nullable Predicate predicate) { -+ return getNearbyEntitiesByType(org.bukkit.entity.LivingEntity.class, loc, xRadius, yRadius, zRadius, predicate); ++ default @NotNull Collection getNearbyLivingEntities(final @NotNull Location loc, final double xRadius, final double yRadius, final double zRadius, final @Nullable Predicate predicate) { ++ return this.getNearbyEntitiesByType(LivingEntity.class, loc, xRadius, yRadius, zRadius, predicate); + } + + /** @@ -105,9 +99,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param radius X/Y/Z Radius + * @return the collection of living entities near location. This will always be a non-null collection. + */ -+ @NotNull -+ public default Collection getNearbyPlayers(@NotNull Location loc, double radius) { -+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, loc, radius, radius, radius); ++ default @NotNull Collection getNearbyPlayers(final @NotNull Location loc, final double radius) { ++ return this.getNearbyEntitiesByType(Player.class, loc, radius, radius, radius); + } + + /** @@ -117,9 +110,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param yRadius Y Radius + * @return the collection of living entities near location. This will always be a non-null collection. + */ -+ @NotNull -+ public default Collection getNearbyPlayers(@NotNull Location loc, double xzRadius, double yRadius) { -+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, loc, xzRadius, yRadius, xzRadius); ++ default @NotNull Collection getNearbyPlayers(final @NotNull Location loc, final double xzRadius, final double yRadius) { ++ return this.getNearbyEntitiesByType(Player.class, loc, xzRadius, yRadius, xzRadius); + } + + /** @@ -130,9 +122,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param zRadius Z Radius + * @return the collection of players near location. This will always be a non-null collection. + */ -+ @NotNull -+ public default Collection getNearbyPlayers(@NotNull Location loc, double xRadius, double yRadius, double zRadius) { -+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, loc, xRadius, yRadius, zRadius); ++ default @NotNull Collection getNearbyPlayers(final @NotNull Location loc, final double xRadius, final double yRadius, final double zRadius) { ++ return this.getNearbyEntitiesByType(Player.class, loc, xRadius, yRadius, zRadius); + } + + /** @@ -142,9 +133,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param predicate a predicate used to filter results + * @return the collection of players near location. This will always be a non-null collection. + */ -+ @NotNull -+ public default Collection getNearbyPlayers(@NotNull Location loc, double radius, @Nullable Predicate predicate) { -+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, loc, radius, radius, radius, predicate); ++ default @NotNull Collection getNearbyPlayers(final @NotNull Location loc, final double radius, final @Nullable Predicate predicate) { ++ return this.getNearbyEntitiesByType(Player.class, loc, radius, radius, radius, predicate); + } + + /** @@ -155,9 +145,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param predicate a predicate used to filter results + * @return the collection of players near location. This will always be a non-null collection. + */ -+ @NotNull -+ public default Collection getNearbyPlayers(@NotNull Location loc, double xzRadius, double yRadius, @Nullable Predicate predicate) { -+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, loc, xzRadius, yRadius, xzRadius, predicate); ++ default @NotNull Collection getNearbyPlayers(final @NotNull Location loc, final double xzRadius, final double yRadius, final @Nullable Predicate predicate) { ++ return this.getNearbyEntitiesByType(Player.class, loc, xzRadius, yRadius, xzRadius, predicate); + } + + /** @@ -169,9 +158,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param predicate a predicate used to filter results + * @return the collection of players near location. This will always be a non-null collection. + */ -+ @NotNull -+ public default Collection getNearbyPlayers(@NotNull Location loc, double xRadius, double yRadius, double zRadius, @Nullable Predicate predicate) { -+ return getNearbyEntitiesByType(org.bukkit.entity.Player.class, loc, xRadius, yRadius, zRadius, predicate); ++ default @NotNull Collection getNearbyPlayers(final @NotNull Location loc, final double xRadius, final double yRadius, final double zRadius, final @Nullable Predicate predicate) { ++ return this.getNearbyEntitiesByType(Player.class, loc, xRadius, yRadius, zRadius, predicate); + } + + /** @@ -182,9 +170,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param the entity type + * @return the collection of entities near location. This will always be a non-null collection. + */ -+ @NotNull -+ public default Collection getNearbyEntitiesByType(@Nullable Class clazz, @NotNull Location loc, double radius) { -+ return getNearbyEntitiesByType(clazz, loc, radius, radius, radius, null); ++ default @NotNull Collection getNearbyEntitiesByType(final @Nullable Class clazz, final @NotNull Location loc, final double radius) { ++ return this.getNearbyEntitiesByType(clazz, loc, radius, radius, radius, null); + } + + /** @@ -196,9 +183,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param the entity type + * @return the collection of entities near location. This will always be a non-null collection. + */ -+ @NotNull -+ public default Collection getNearbyEntitiesByType(@Nullable Class clazz, @NotNull Location loc, double xzRadius, double yRadius) { -+ return getNearbyEntitiesByType(clazz, loc, xzRadius, yRadius, xzRadius, null); ++ default @NotNull Collection getNearbyEntitiesByType(final @Nullable Class clazz, final @NotNull Location loc, final double xzRadius, final double yRadius) { ++ return this.getNearbyEntitiesByType(clazz, loc, xzRadius, yRadius, xzRadius, null); + } + + /** @@ -211,9 +197,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param the entity type + * @return the collection of entities near location. This will always be a non-null collection. + */ -+ @NotNull -+ public default Collection getNearbyEntitiesByType(@Nullable Class clazz, @NotNull Location loc, double xRadius, double yRadius, double zRadius) { -+ return getNearbyEntitiesByType(clazz, loc, xRadius, yRadius, zRadius, null); ++ default @NotNull Collection getNearbyEntitiesByType(final @Nullable Class clazz, final @NotNull Location loc, final double xRadius, final double yRadius, final double zRadius) { ++ return this.getNearbyEntitiesByType(clazz, loc, xRadius, yRadius, zRadius, null); + } + + /** @@ -225,9 +210,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param the entity type + * @return the collection of entities near location. This will always be a non-null collection. + */ -+ @NotNull -+ public default Collection getNearbyEntitiesByType(@Nullable Class clazz, @NotNull Location loc, double radius, @Nullable Predicate predicate) { -+ return getNearbyEntitiesByType(clazz, loc, radius, radius, radius, predicate); ++ default @NotNull Collection getNearbyEntitiesByType(final @Nullable Class clazz, final @NotNull Location loc, final double radius, final @Nullable Predicate predicate) { ++ return this.getNearbyEntitiesByType(clazz, loc, radius, radius, radius, predicate); + } + + /** @@ -240,9 +224,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param the entity type + * @return the collection of entities near location. This will always be a non-null collection. + */ -+ @NotNull -+ public default Collection getNearbyEntitiesByType(@Nullable Class clazz, @NotNull Location loc, double xzRadius, double yRadius, @Nullable Predicate predicate) { -+ return getNearbyEntitiesByType(clazz, loc, xzRadius, yRadius, xzRadius, predicate); ++ default @NotNull Collection getNearbyEntitiesByType(final @Nullable Class clazz, final @NotNull Location loc, final double xzRadius, final double yRadius, final @Nullable Predicate predicate) { ++ return this.getNearbyEntitiesByType(clazz, loc, xzRadius, yRadius, xzRadius, predicate); + } + + /** @@ -256,13 +239,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param the entity type + * @return the collection of entities near location. This will always be a non-null collection. + */ -+ @NotNull -+ public default Collection getNearbyEntitiesByType(@Nullable Class clazz, @NotNull Location loc, double xRadius, double yRadius, double zRadius, @Nullable Predicate predicate) { -+ if (clazz == null) { ++ default @NotNull Collection getNearbyEntitiesByType(@Nullable Class clazz, final @NotNull Location loc, final double xRadius, final double yRadius, final double zRadius, final @Nullable Predicate predicate) { ++ if (clazz == null) { + clazz = Entity.class; + } -+ List nearby = new ArrayList<>(); -+ for (Entity bukkitEntity : getNearbyEntities(loc, xRadius, yRadius, zRadius)) { ++ final List nearby = new ArrayList<>(); ++ for (final Entity bukkitEntity : this.getNearbyEntities(loc, xRadius, yRadius, zRadius)) { + //noinspection unchecked + if (clazz.isAssignableFrom(bukkitEntity.getClass()) && (predicate == null || predicate.test((T) bukkitEntity))) { + //noinspection unchecked @@ -271,7 +253,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + return nearby; + } -+ // Paper end ++ // Paper end - additional getNearbyEntities API + /** * Get a list of all players in this World diff --git a/patches/api/Async-Chunks-API.patch b/patches/api/Async-Chunks-API.patch index ca05877a8c..61f2443870 100644 --- a/patches/api/Async-Chunks-API.patch +++ b/patches/api/Async-Chunks-API.patch @@ -12,10 +12,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/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 - } - 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, + * as well as future support @@ -139,8 +139,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param cb Callback to receive the chunk when it is loaded. + * will be executed synchronously + */ -+ public default void getChunkAtAsync(int x, int z, @NotNull java.util.function.Consumer cb) { -+ getChunkAtAsync(x, z, true).thenAccept(cb).exceptionally((ex) -> { ++ default void getChunkAtAsync(final int x, final int z, final @NotNull Consumer cb) { ++ this.getChunkAtAsync(x, z, true).thenAccept(cb).exceptionally((ex) -> { + Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Exception in chunk load callback", ex); + return null; + }); @@ -165,8 +165,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param cb Callback to receive the chunk when it is loaded. + * will be executed synchronously + */ -+ public default void getChunkAtAsync(int x, int z, boolean gen, @NotNull java.util.function.Consumer cb) { -+ getChunkAtAsync(x, z, gen).thenAccept(cb).exceptionally((ex) -> { ++ default void getChunkAtAsync(final int x, final int z, final boolean gen, final @NotNull Consumer cb) { ++ this.getChunkAtAsync(x, z, gen).thenAccept(cb).exceptionally((ex) -> { + Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Exception in chunk load callback", ex); + return null; + }); @@ -189,8 +189,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param cb Callback to receive the chunk when it is loaded. + * will be executed synchronously + */ -+ public default void getChunkAtAsync(@NotNull Location loc, @NotNull java.util.function.Consumer cb) { -+ getChunkAtAsync((int)Math.floor(loc.getX()) >> 4, (int)Math.floor(loc.getZ()) >> 4, true, cb); ++ default void getChunkAtAsync(final @NotNull Location loc, final @NotNull Consumer 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. + * will be executed synchronously + */ -+ public default void getChunkAtAsync(@NotNull Location loc, boolean gen, @NotNull java.util.function.Consumer cb) { -+ getChunkAtAsync((int)Math.floor(loc.getX()) >> 4, (int)Math.floor(loc.getZ()) >> 4, gen, cb); ++ default void getChunkAtAsync(final @NotNull Location loc, final boolean gen, final @NotNull Consumer 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. + * will be executed synchronously + */ -+ public default void getChunkAtAsync(@NotNull Block block, @NotNull java.util.function.Consumer cb) { -+ getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, true, cb); ++ default void getChunkAtAsync(final @NotNull Block block, final @NotNull Consumer 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. + * will be executed synchronously + */ -+ public default void getChunkAtAsync(@NotNull Block block, boolean gen, @NotNull java.util.function.Consumer cb) { -+ getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, gen, cb); ++ default void getChunkAtAsync(final @NotNull Block block, final boolean gen, final @NotNull Consumer 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 + * @return Future that will resolve when the chunk is loaded + */ -+ @NotNull -+ public default java.util.concurrent.CompletableFuture getChunkAtAsync(@NotNull Location loc) { -+ return getChunkAtAsync((int)Math.floor(loc.getX()) >> 4, (int)Math.floor(loc.getZ()) >> 4, true); ++ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsync(final @NotNull Location loc) { ++ return this.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 + * @return Future that will resolve when the chunk is loaded + */ -+ @NotNull -+ public default java.util.concurrent.CompletableFuture getChunkAtAsync(@NotNull Location loc, boolean gen) { -+ return getChunkAtAsync((int)Math.floor(loc.getX()) >> 4, (int)Math.floor(loc.getZ()) >> 4, gen); ++ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsync(final @NotNull Location loc, final boolean gen) { ++ return this.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 + * @return Future that will resolve when the chunk is loaded + */ -+ @NotNull -+ public default java.util.concurrent.CompletableFuture getChunkAtAsync(@NotNull Block block) { -+ return getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, true); ++ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsync(final @NotNull Block block) { ++ return this.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 + * @return Future that will resolve when the chunk is loaded + */ -+ @NotNull -+ public default java.util.concurrent.CompletableFuture getChunkAtAsync(@NotNull Block block, boolean gen) { -+ return getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, gen); ++ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsync(final @NotNull Block block, final boolean gen) { ++ return this.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) + * @return Future that will resolve when the chunk is loaded + */ -+ @NotNull -+ public default java.util.concurrent.CompletableFuture getChunkAtAsync(int x, int z) { -+ return getChunkAtAsync(x, z, true); ++ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsync(final int x, final int z) { ++ return this.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 + * @return Future that will resolve when the chunk is loaded + */ -+ @NotNull -+ public default java.util.concurrent.CompletableFuture getChunkAtAsync(int x, int z, boolean gen) { -+ return getChunkAtAsync(x, z, gen, false); ++ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsync(final int x, final int z, final boolean gen) { ++ return this.getChunkAtAsync(x, z, gen, false); + } + + /** @@ -400,9 +394,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param loc Location to load the corresponding chunk from + * @return Future that will resolve when the chunk is loaded + */ -+ @NotNull -+ public default java.util.concurrent.CompletableFuture getChunkAtAsyncUrgently(@NotNull Location loc) { -+ return getChunkAtAsync((int)Math.floor(loc.getX()) >> 4, (int)Math.floor(loc.getZ()) >> 4, true, true); ++ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsyncUrgently(final @NotNull Location loc) { ++ return this.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 + * @return Future that will resolve when the chunk is loaded + */ -+ @NotNull -+ public default java.util.concurrent.CompletableFuture getChunkAtAsyncUrgently(@NotNull Location loc, boolean gen) { -+ return getChunkAtAsync((int)Math.floor(loc.getX()) >> 4, (int)Math.floor(loc.getZ()) >> 4, gen, true); ++ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsyncUrgently(final @NotNull Location loc, final boolean gen) { ++ return this.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 + * @return Future that will resolve when the chunk is loaded + */ -+ @NotNull -+ public default java.util.concurrent.CompletableFuture getChunkAtAsyncUrgently(@NotNull Block block) { -+ return getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, true, true); ++ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsyncUrgently(final @NotNull Block block) { ++ return this.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 + * @return Future that will resolve when the chunk is loaded + */ -+ @NotNull -+ public default java.util.concurrent.CompletableFuture getChunkAtAsyncUrgently(@NotNull Block block, boolean gen) { -+ return getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, gen, true); ++ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsyncUrgently(final @NotNull Block block, final boolean gen) { ++ return this.getChunkAtAsync(block.getX() >> 4, block.getZ() >> 4, gen, true); + } + + /** @@ -484,16 +474,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param z Z Coord + * @return Future that will resolve when the chunk is loaded + */ -+ @NotNull -+ public default java.util.concurrent.CompletableFuture getChunkAtAsyncUrgently(int x, int z) { -+ return getChunkAtAsync(x, z, true, true); ++ default @NotNull java.util.concurrent.CompletableFuture getChunkAtAsyncUrgently(final int x, final int z) { ++ return this.getChunkAtAsync(x, z, true, true); + } + -+ @NotNull -+ java.util.concurrent.CompletableFuture getChunkAtAsync(int x, int z, boolean gen, boolean urgent); - // Paper end - ++ java.util.concurrent.@NotNull CompletableFuture getChunkAtAsync(int x, int z, boolean gen, boolean urgent); ++ // Paper end - async chunks API ++ /** + * 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 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/entity/Entity.java diff --git a/patches/api/Custom-Potion-Mixes.patch b/patches/api/Custom-Potion-Mixes.patch index 2e58ee4ded..895a15ec03 100644 --- a/patches/api/Custom-Potion-Mixes.patch +++ b/patches/api/Custom-Potion-Mixes.patch @@ -42,13 +42,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @param input the input placed into the bottom 3 slots + * @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.result = result; + this.input = input; + 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 stackPredicate) { ++ return new PredicateRecipeChoice(stackPredicate); ++ } ++ + @Override + public @NotNull NamespacedKey getKey() { + return this.key; @@ -81,18 +93,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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 stackPredicate) { -+ return new PredicateRecipeChoice(stackPredicate); -+ } -+ + @Override + public String toString() { + return "PotionMix{" + @@ -103,10 +103,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + @Override -+ public boolean equals(Object o) { ++ public boolean equals(final Object o) { + if (this == o) return true; -+ if (o == null || getClass() != o.getClass()) return false; -+ PotionMix potionMix = (PotionMix) o; ++ if (o == null || this.getClass() != o.getClass()) return false; ++ 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); + } + @@ -132,7 +132,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +@ApiStatus.Internal +@DefaultQualifier(NonNull.class) -+record PredicateRecipeChoice(Predicate itemStackPredicate) implements RecipeChoice, Cloneable { ++record PredicateRecipeChoice(Predicate itemStackPredicate) implements RecipeChoice, Cloneable { + + @Override + @Deprecated @@ -144,7 +144,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public RecipeChoice clone() { + try { + return (PredicateRecipeChoice) super.clone(); -+ } catch (CloneNotSupportedException ex) { ++ } catch (final CloneNotSupportedException ex) { + throw new AssertionError(ex); + } + } diff --git a/patches/api/Expand-Explosions-API.patch b/patches/api/Expand-Explosions-API.patch index 0c731379f3..f9fdbc350c 100644 --- a/patches/api/Expand-Explosions-API.patch +++ b/patches/api/Expand-Explosions-API.patch @@ -18,13 +18,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import org.bukkit.util.Vector; import org.jetbrains.annotations.NotNull; @@ -0,0 +0,0 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm - return centerLoc; } + // Paper end - expand Location API + // Paper start - Expand Explosions API + /** + * Creates explosion at this location with given power -+ * ++ *

+ * Will break blocks and ignite blocks on fire. + * + * @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 + * setting blocks on fire. -+ * ++ *

+ * Will break blocks. + * + * @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 + */ + public boolean createExplosion(float power, boolean setFire) { @@ -53,8 +53,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * setting blocks on fire. + * + * @param power The power of explosion, where 4F is TNT -+ * @param setFire Whether or not to set blocks on fire -+ * @param breakBlocks Whether or not to have blocks be destroyed ++ * @param setFire Whether to set blocks on fire ++ * @param breakBlocks Whether to have blocks be destroyed + * @return false if explosion was canceled, otherwise true + */ + 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. -+ * ++ *

+ * Will break blocks and ignite blocks on fire. + * + * @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 + * setting blocks on fire, with the specified entity as the source. -+ * ++ *

+ * Will break blocks. + * + * @param source The source entity of the explosion + * @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 + */ + 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 power The power of explosion, where 4F is TNT -+ * @param setFire Whether or not to set blocks on fire -+ * @param breakBlocks Whether or not to have blocks be destroyed ++ * @param setFire Whether to set blocks on fire ++ * @param breakBlocks Whether to have blocks be destroyed + * @return false if explosion was canceled, otherwise true + */ + 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 start - additional getNearbyEntities API /** * 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 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/World.java diff --git a/patches/api/Expand-Location-Manipulation-API.patch b/patches/api/Expand-Location-Manipulation-API.patch index 553d77767e..8f5428f442 100644 --- a/patches/api/Expand-Location-Manipulation-API.patch +++ b/patches/api/Expand-Location-Manipulation-API.patch @@ -10,14 +10,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/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 + 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 -+ * ++ *

+ * This mutates this object, clone first. ++ * + * @param x X coordinate + * @param y Y 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 -+ * ++ *

+ * This mutates this object, clone first. ++ * + * @param base The base coordinate to modify + * @param x X 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 -+ * ++ *

+ * This mutates this object, clone first. ++ * + * @param base The base coordinate to modify + * @param x X 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) { + 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) - */ diff --git a/patches/api/Location.toBlockLocation-toCenterLocation.patch b/patches/api/Location.toBlockLocation-toCenterLocation.patch index 1fb63da78e..60fabd5908 100644 --- a/patches/api/Location.toBlockLocation-toCenterLocation.patch +++ b/patches/api/Location.toBlockLocation-toCenterLocation.patch @@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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) + */ @@ -37,7 +37,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + centerLoc.setZ(getBlockZ() + 0.5); + return centerLoc; + } -+ // Paper end ++ // Paper end - expand Location API ++ @Override public boolean equals(Object obj) { if (obj == null) { diff --git a/patches/api/isChunkGenerated-API.patch b/patches/api/isChunkGenerated-API.patch index 1782cb7fc1..2f53ea0524 100644 --- a/patches/api/isChunkGenerated-API.patch +++ b/patches/api/isChunkGenerated-API.patch @@ -17,9 +17,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import java.util.Map; import org.bukkit.block.Block; @@ -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 - // Paper start ++ // Paper start - isGenerated API + /** + * 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!"); + 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 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/World.java diff --git a/patches/server/Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch b/patches/server/Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch index 5cd03bed44..179ea7e44b 100644 --- a/patches/server/Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch +++ b/patches/server/Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch @@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + @Override -+ public Collection getTileEntities(Predicate blockPredicate, boolean useSnapshot) { ++ public Collection getTileEntities(Predicate blockPredicate, boolean useSnapshot) { + Preconditions.checkNotNull(blockPredicate, "blockPredicate"); + if (!this.isLoaded()) { + this.getWorld().getChunkAt(this.x, this.z); // Transient load for this tick diff --git a/patches/server/Add-a-consumer-parameter-to-ProjectileSource-launchP.patch b/patches/server/Add-a-consumer-parameter-to-ProjectileSource-launchP.patch index 026d8b9b2b..fb64a29595 100644 --- a/patches/server/Add-a-consumer-parameter-to-ProjectileSource-launchP.patch +++ b/patches/server/Add-a-consumer-parameter-to-ProjectileSource-launchP.patch @@ -20,7 +20,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + @Override + @SuppressWarnings("unchecked") -+ public T launchProjectile(Class projectile, Vector velocity, java.util.function.Consumer function) { ++ public T launchProjectile(Class projectile, Vector velocity, java.util.function.Consumer function) { + // Paper end - launchProjectile consumer Preconditions.checkState(!this.getHandle().generation, "Cannot launch projectile during world generation"); @@ -50,7 +50,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + @Override -+ public T launchProjectile(Class projectile, Vector velocity, java.util.function.Consumer function) { ++ public T launchProjectile(Class projectile, Vector velocity, java.util.function.Consumer function) { + // Paper end - launchProjectile consumer Preconditions.checkArgument(this.getBlock().getType() == Material.DISPENSER, "Block is no longer dispenser"); // Copied from BlockDispenser.dispense()