From b37bbcfd984a325c47d6dee200634b5fa189c64b Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Sat, 25 Nov 2023 15:03:02 -0800 Subject: [PATCH] Use ? super in Consumer/Predicate API (#9939) --- ...tional-world.getNearbyEntities-API-s.patch | 102 +++++++-------- ...ld.spawnParticle-API-and-add-Builder.patch | 4 +- ...ion.toBlockLocation-toCenterLocation.patch | 9 +- ...Add-getNearbyXXX-methods-to-Location.patch | 117 ++++++++---------- patches/api/0115-Expand-Explosions-API.patch | 32 ++--- .../0119-Add-World.getEntity-UUID-API.patch | 4 +- ...129-Expand-Location-Manipulation-API.patch | 19 +-- ...ile-Entities-from-a-chunk-without-sn.patch | 4 +- ...Blocks-to-be-accessed-via-a-long-key.patch | 6 +- patches/api/0141-isChunkGenerated-API.patch | 13 +- patches/api/0143-Async-Chunks-API.patch | 98 +++++++-------- patches/api/0157-Add-sun-related-API.patch | 4 +- .../0173-Fix-Spigot-annotation-mistakes.patch | 14 +-- patches/api/0176-Add-Heightmap-API.patch | 8 +- patches/api/0272-More-World-API.patch | 4 +- patches/api/0352-Custom-Potion-Mixes.patch | 40 +++--- .../api/0364-Expand-FallingBlock-API.patch | 8 +- ...arameter-to-ProjectileSource-launchP.patch | 11 +- ...predicate-for-blocks-when-raytracing.patch | 8 +- ...ile-Entities-from-a-chunk-without-sn.patch | 4 +- ...arameter-to-ProjectileSource-launchP.patch | 8 +- 21 files changed, 240 insertions(+), 277 deletions(-) diff --git a/patches/api/0099-Additional-world.getNearbyEntities-API-s.patch b/patches/api/0099-Additional-world.getNearbyEntities-API-s.patch index 62ccb90725..22a6b6dc4f 100644 --- a/patches/api/0099-Additional-world.getNearbyEntities-API-s.patch +++ b/patches/api/0099-Additional-world.getNearbyEntities-API-s.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Additional world.getNearbyEntities API's Provides more methods to get nearby entities, and filter by types and predicates diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 609e4908ed21f69b9e813500e702bbe784bff00c..7a6caf93606203198369030a295f1edbffde3c31 100644 +index 609e4908ed21f69b9e813500e702bbe784bff00c..a5be4e073d3406e876e54824aca5449f3262ee75 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -1,6 +1,9 @@ @@ -19,20 +19,19 @@ index 609e4908ed21f69b9e813500e702bbe784bff00c..7a6caf93606203198369030a295f1edb import java.util.Collection; import java.util.HashMap; import java.util.List; -@@ -625,6 +628,256 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient +@@ -625,6 +628,238 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient @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 609e4908ed21f69b9e813500e702bbe784bff00c..7a6caf93606203198369030a295f1edb + * @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 609e4908ed21f69b9e813500e702bbe784bff00c..7a6caf93606203198369030a295f1edb + * @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 609e4908ed21f69b9e813500e702bbe784bff00c..7a6caf93606203198369030a295f1edb + * @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 609e4908ed21f69b9e813500e702bbe784bff00c..7a6caf93606203198369030a295f1edb + * @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 609e4908ed21f69b9e813500e702bbe784bff00c..7a6caf93606203198369030a295f1edb + * @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 609e4908ed21f69b9e813500e702bbe784bff00c..7a6caf93606203198369030a295f1edb + * @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 609e4908ed21f69b9e813500e702bbe784bff00c..7a6caf93606203198369030a295f1edb + * @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 609e4908ed21f69b9e813500e702bbe784bff00c..7a6caf93606203198369030a295f1edb + * @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 609e4908ed21f69b9e813500e702bbe784bff00c..7a6caf93606203198369030a295f1edb + * @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 609e4908ed21f69b9e813500e702bbe784bff00c..7a6caf93606203198369030a295f1edb + * @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 609e4908ed21f69b9e813500e702bbe784bff00c..7a6caf93606203198369030a295f1edb + * @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 609e4908ed21f69b9e813500e702bbe784bff00c..7a6caf93606203198369030a295f1edb + * @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 609e4908ed21f69b9e813500e702bbe784bff00c..7a6caf93606203198369030a295f1edb + * @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 609e4908ed21f69b9e813500e702bbe784bff00c..7a6caf93606203198369030a295f1edb + * @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 609e4908ed21f69b9e813500e702bbe784bff00c..7a6caf93606203198369030a295f1edb + * @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 609e4908ed21f69b9e813500e702bbe784bff00c..7a6caf93606203198369030a295f1edb + * @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 609e4908ed21f69b9e813500e702bbe784bff00c..7a6caf93606203198369030a295f1edb + * @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 609e4908ed21f69b9e813500e702bbe784bff00c..7a6caf93606203198369030a295f1edb + } + return nearby; + } -+ // Paper end ++ // Paper end - additional getNearbyEntities API + /** * Get a list of all players in this World diff --git a/patches/api/0101-Expand-World.spawnParticle-API-and-add-Builder.patch b/patches/api/0101-Expand-World.spawnParticle-API-and-add-Builder.patch index 16dc915b54..44d6571c95 100644 --- a/patches/api/0101-Expand-World.spawnParticle-API-and-add-Builder.patch +++ b/patches/api/0101-Expand-World.spawnParticle-API-and-add-Builder.patch @@ -523,10 +523,10 @@ index e2adb9901cc92ede9d44ca9939c6a54d4762eb4b..81bd12c8addcee754c71e5e030c729c7 * Options which can be applied to redstone dust particles - a particle * color and size. diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index c7e6e1ef1191ffde924600ed3beb46ffe129c15f..d02b6743e4401004e75501e99b717b58e5acc5ae 100644 +index 58a15d8fd57d55848b37bfc8fffa101692efce87..93c46d40efd73293d84c7eaadf4e360cc3706e2a 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java -@@ -2859,7 +2859,57 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient +@@ -2841,7 +2841,57 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient * @param data the data to use for the particle or null, * the type of this depends on {@link Particle#getDataType()} */ diff --git a/patches/api/0105-Location.toBlockLocation-toCenterLocation.patch b/patches/api/0105-Location.toBlockLocation-toCenterLocation.patch index 30032ac6cf..c86b874f5f 100644 --- a/patches/api/0105-Location.toBlockLocation-toCenterLocation.patch +++ b/patches/api/0105-Location.toBlockLocation-toCenterLocation.patch @@ -6,15 +6,15 @@ Subject: [PATCH] Location.toBlockLocation/toCenterLocation() Convert location objects to their block coordinates, or the center of the block diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java -index e71beb48f2e35d97b9d5bf8dbf5ddbc0673565fe..5a219f132747eb62204e98de4cb850748a43c9b4 100644 +index 251d26e6870490abd3e915c5e7c06ce1075a24ab..24a872dfc8cf1f4a567b6ebd5a5e742593616ede 100644 --- a/src/main/java/org/bukkit/Location.java +++ b/src/main/java/org/bukkit/Location.java -@@ -534,6 +534,31 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm +@@ -534,6 +534,32 @@ 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 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 e71beb48f2e35d97b9d5bf8dbf5ddbc0673565fe..5a219f132747eb62204e98de4cb85074 + 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/0112-Add-getNearbyXXX-methods-to-Location.patch b/patches/api/0112-Add-getNearbyXXX-methods-to-Location.patch index f34c5396b7..1898cc3ed6 100644 --- a/patches/api/0112-Add-getNearbyXXX-methods-to-Location.patch +++ b/patches/api/0112-Add-getNearbyXXX-methods-to-Location.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add "getNearbyXXX" methods to Location diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java -index 5a219f132747eb62204e98de4cb850748a43c9b4..6693e3d8dc2519facb12db981a6b6325faa095bf 100644 +index 24a872dfc8cf1f4a567b6ebd5a5e742593616ede..3161eae2fa5f03b7d3a5e9945ab659c15cf568c6 100644 --- a/src/main/java/org/bukkit/Location.java +++ b/src/main/java/org/bukkit/Location.java @@ -12,6 +12,15 @@ import org.bukkit.util.Vector; @@ -24,24 +24,23 @@ index 5a219f132747eb62204e98de4cb850748a43c9b4..6693e3d8dc2519facb12db981a6b6325 /** * Represents a 3-dimensional position in a world. *
-@@ -558,6 +567,248 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm - centerLoc.setZ(getBlockZ() + 0.5); - return centerLoc; +@@ -560,6 +569,231 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm } -+ + // 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 5a219f132747eb62204e98de4cb850748a43c9b4..6693e3d8dc2519facb12db981a6b6325 + * @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 5a219f132747eb62204e98de4cb850748a43c9b4..6693e3d8dc2519facb12db981a6b6325 + * @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 5a219f132747eb62204e98de4cb850748a43c9b4..6693e3d8dc2519facb12db981a6b6325 + * @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 5a219f132747eb62204e98de4cb850748a43c9b4..6693e3d8dc2519facb12db981a6b6325 + * @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 5a219f132747eb62204e98de4cb850748a43c9b4..6693e3d8dc2519facb12db981a6b6325 + * @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 5a219f132747eb62204e98de4cb850748a43c9b4..6693e3d8dc2519facb12db981a6b6325 + * @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 5a219f132747eb62204e98de4cb850748a43c9b4..6693e3d8dc2519facb12db981a6b6325 + * @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 5a219f132747eb62204e98de4cb850748a43c9b4..6693e3d8dc2519facb12db981a6b6325 + * @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 5a219f132747eb62204e98de4cb850748a43c9b4..6693e3d8dc2519facb12db981a6b6325 + * @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 5a219f132747eb62204e98de4cb850748a43c9b4..6693e3d8dc2519facb12db981a6b6325 + * @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 5a219f132747eb62204e98de4cb850748a43c9b4..6693e3d8dc2519facb12db981a6b6325 + * @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 5a219f132747eb62204e98de4cb850748a43c9b4..6693e3d8dc2519facb12db981a6b6325 + * @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 5a219f132747eb62204e98de4cb850748a43c9b4..6693e3d8dc2519facb12db981a6b6325 + * @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 5a219f132747eb62204e98de4cb850748a43c9b4..6693e3d8dc2519facb12db981a6b6325 + * @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 5a219f132747eb62204e98de4cb850748a43c9b4..6693e3d8dc2519facb12db981a6b6325 + * @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 5a219f132747eb62204e98de4cb850748a43c9b4..6693e3d8dc2519facb12db981a6b6325 + * @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 5a219f132747eb62204e98de4cb850748a43c9b4..6693e3d8dc2519facb12db981a6b6325 + * @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 5a219f132747eb62204e98de4cb850748a43c9b4..6693e3d8dc2519facb12db981a6b6325 + * @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/0115-Expand-Explosions-API.patch b/patches/api/0115-Expand-Explosions-API.patch index aa0f999351..3be51b350e 100644 --- a/patches/api/0115-Expand-Explosions-API.patch +++ b/patches/api/0115-Expand-Explosions-API.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Expand Explosions API Add Entity as a Source capability, and add more API choices, and on Location. diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java -index 556e4524c30f8c7faeb591e272546c78090170fc..e8067e91dea3c5f8654c65ea5ec4d3db36d85a6c 100644 +index 3161eae2fa5f03b7d3a5e9945ab659c15cf568c6..af737017ee397f80c44ee02c6cc60cefa07f59c1 100644 --- a/src/main/java/org/bukkit/Location.java +++ b/src/main/java/org/bukkit/Location.java @@ -7,6 +7,7 @@ import java.util.HashMap; @@ -17,14 +17,14 @@ index 556e4524c30f8c7faeb591e272546c78090170fc..e8067e91dea3c5f8654c65ea5ec4d3db import org.bukkit.util.NumberConversions; import org.bukkit.util.Vector; import org.jetbrains.annotations.NotNull; -@@ -568,6 +569,89 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm - return centerLoc; +@@ -569,6 +570,89 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm } + // 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 556e4524c30f8c7faeb591e272546c78090170fc..e8067e91dea3c5f8654c65ea5ec4d3db + /** + * 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 556e4524c30f8c7faeb591e272546c78090170fc..e8067e91dea3c5f8654c65ea5ec4d3db + * 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 556e4524c30f8c7faeb591e272546c78090170fc..e8067e91dea3c5f8654c65ea5ec4d3db + + /** + * 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 556e4524c30f8c7faeb591e272546c78090170fc..e8067e91dea3c5f8654c65ea5ec4d3db + /** + * 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 556e4524c30f8c7faeb591e272546c78090170fc..e8067e91dea3c5f8654c65ea5ec4d3db + * + * @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,14 +104,14 @@ index 556e4524c30f8c7faeb591e272546c78090170fc..e8067e91dea3c5f8654c65ea5ec4d3db + } + // 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 d02b6743e4401004e75501e99b717b58e5acc5ae..de896af6006f791625bb388b105983fb64489071 100644 +index 93c46d40efd73293d84c7eaadf4e360cc3706e2a..cd946f2de8a09fdb6ff9b256ca7eba64e6ed9aab 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java -@@ -1398,6 +1398,88 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient +@@ -1380,6 +1380,88 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient */ public boolean createExplosion(@NotNull Location loc, float power, boolean setFire); diff --git a/patches/api/0119-Add-World.getEntity-UUID-API.patch b/patches/api/0119-Add-World.getEntity-UUID-API.patch index 97c7cea1fa..40debf25c1 100644 --- a/patches/api/0119-Add-World.getEntity-UUID-API.patch +++ b/patches/api/0119-Add-World.getEntity-UUID-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add World.getEntity(UUID) API diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 266ed71b79d32f9b812be322563c247051ccd9d0..ffe6c8be86fc93d39e256a89e5016e3025afbe5c 100644 +index c0e45f4c964ae262a894d92cff8f0750660cd41d..17b9e695a3f2eab94714b2124c657ee4d8b5ef51 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java -@@ -912,6 +912,17 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient +@@ -894,6 +894,17 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient @NotNull public Collection getNearbyEntities(@NotNull Location location, double x, double y, double z); diff --git a/patches/api/0129-Expand-Location-Manipulation-API.patch b/patches/api/0129-Expand-Location-Manipulation-API.patch index 05fe72fd36..aa3764628e 100644 --- a/patches/api/0129-Expand-Location-Manipulation-API.patch +++ b/patches/api/0129-Expand-Location-Manipulation-API.patch @@ -6,18 +6,20 @@ Subject: [PATCH] Expand Location Manipulation API Adds set(x, y, z), add(base, x, y, z), subtract(base, x, y, z); diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java -index b7ff09ffdd3aecc1843d175bc76fe5fae1f48dde..aa6821aa33d3c579a139bd7c0378253c43b3754a 100644 +index 14aa275b0fb89d361ee5ec690684053e5e8b4e11..189c2159941712a6f22bb5aaf1e8ca80b4eb54f6 100644 --- a/src/main/java/org/bukkit/Location.java +++ b/src/main/java/org/bukkit/Location.java -@@ -546,6 +546,54 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm +@@ -545,6 +545,59 @@ 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 b7ff09ffdd3aecc1843d175bc76fe5fae1f48dde..aa6821aa33d3c579a139bd7c0378253c + + /** + * 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 b7ff09ffdd3aecc1843d175bc76fe5fae1f48dde..aa6821aa33d3c579a139bd7c0378253c + + /** + * 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 b7ff09ffdd3aecc1843d175bc76fe5fae1f48dde..aa6821aa33d3c579a139bd7c0378253c + 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/0134-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch b/patches/api/0134-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch index 8c532bba78..c6a3048377 100644 --- a/patches/api/0134-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch +++ b/patches/api/0134-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Ability to get Tile Entities from a chunk without snapshots diff --git a/src/main/java/org/bukkit/Chunk.java b/src/main/java/org/bukkit/Chunk.java -index 766d643f0fe79660942fdad25e39e488e9379419..4418c41f75e9a190dd77abdd6048b0a4fb2a57ed 100644 +index 766d643f0fe79660942fdad25e39e488e9379419..eca55d8d3464f0e13a3b7984f74559ccda87edba 100644 --- a/src/main/java/org/bukkit/Chunk.java +++ b/src/main/java/org/bukkit/Chunk.java @@ -122,7 +122,30 @@ public interface Chunk extends PersistentDataHolder { @@ -35,7 +35,7 @@ index 766d643f0fe79660942fdad25e39e488e9379419..4418c41f75e9a190dd77abdd6048b0a4 + * @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/0136-Allow-Blocks-to-be-accessed-via-a-long-key.patch b/patches/api/0136-Allow-Blocks-to-be-accessed-via-a-long-key.patch index 5ba59b0ca5..cc8ba286d6 100644 --- a/patches/api/0136-Allow-Blocks-to-be-accessed-via-a-long-key.patch +++ b/patches/api/0136-Allow-Blocks-to-be-accessed-via-a-long-key.patch @@ -18,7 +18,7 @@ Y range: [0, 1023] X, Z range: [-67 108 864, 67 108 863] diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java -index aa6821aa33d3c579a139bd7c0378253c43b3754a..6e6e65c40813ccce618fa7a3df2c0030aa0a3bbe 100644 +index 189c2159941712a6f22bb5aaf1e8ca80b4eb54f6..09d1f9f909c971d6a785e9f98278f8c55cd44637 100644 --- a/src/main/java/org/bukkit/Location.java +++ b/src/main/java/org/bukkit/Location.java @@ -15,7 +15,6 @@ import org.jetbrains.annotations.Nullable; @@ -29,7 +29,7 @@ index aa6821aa33d3c579a139bd7c0378253c43b3754a..6e6e65c40813ccce618fa7a3df2c0030 import java.util.function.Predicate; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; -@@ -605,6 +604,19 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm +@@ -610,6 +609,19 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm blockLoc.setZ(getBlockZ()); return blockLoc; } @@ -50,7 +50,7 @@ index aa6821aa33d3c579a139bd7c0378253c43b3754a..6e6e65c40813ccce618fa7a3df2c0030 * @return A new location where X/Y/Z are the center of the block */ diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 315ecb5dc0f33edfef893ead1297c8165d292250..ad5afa7a05636cee82b517c673d281f0f4e38644 100644 +index f21d3ab534a64a5445975968b63fc78d7dc2fa72..fef21d398d9c9349e10e59b62cbbe28e9538482d 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -97,6 +97,41 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient diff --git a/patches/api/0141-isChunkGenerated-API.patch b/patches/api/0141-isChunkGenerated-API.patch index 1309083cfc..bea676d6ba 100644 --- a/patches/api/0141-isChunkGenerated-API.patch +++ b/patches/api/0141-isChunkGenerated-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] isChunkGenerated API diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java -index 6e6e65c40813ccce618fa7a3df2c0030aa0a3bbe..8508aa2c6fb7c9f41f3d185f5228c86dd3b8b627 100644 +index 09d1f9f909c971d6a785e9f98278f8c55cd44637..7fea9af96c97d9f60af6fe30fed1ec05d05a1a25 100644 --- a/src/main/java/org/bukkit/Location.java +++ b/src/main/java/org/bukkit/Location.java @@ -3,6 +3,7 @@ package org.bukkit; @@ -16,10 +16,11 @@ index 6e6e65c40813ccce618fa7a3df2c0030aa0a3bbe..8508aa2c6fb7c9f41f3d185f5228c86d import java.util.HashMap; import java.util.Map; import org.bukkit.block.Block; -@@ -545,6 +546,16 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm +@@ -544,6 +545,19 @@ 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,11 +31,13 @@ index 6e6e65c40813ccce618fa7a3df2c0030aa0a3bbe..8508aa2c6fb7c9f41f3d185f5228c86d + 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 ad5afa7a05636cee82b517c673d281f0f4e38644..880ff5ee1237096ac2da115b665dc663c677e57b 100644 +index fef21d398d9c9349e10e59b62cbbe28e9538482d..213ec372ab639179da65e67a1326c1e08bfbc943 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -246,6 +246,19 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient diff --git a/patches/api/0143-Async-Chunks-API.patch b/patches/api/0143-Async-Chunks-API.patch index d8422cf04a..251c1669af 100644 --- a/patches/api/0143-Async-Chunks-API.patch +++ b/patches/api/0143-Async-Chunks-API.patch @@ -8,14 +8,14 @@ Adds API's to load or generate chunks asynchronously. Also adds utility methods to Entity to teleport asynchronously. diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 880ff5ee1237096ac2da115b665dc663c677e57b..fc6b99e4f37179b15254bf0b398b1a800de1b73f 100644 +index 213ec372ab639179da65e67a1326c1e08bfbc943..e4a0d57535fa0fb51765ccdbf0e41d0478a28ee5 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java -@@ -955,6 +955,482 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient - } - return nearby; +@@ -939,6 +939,472 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient } -+ + // 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 880ff5ee1237096ac2da115b665dc663c677e57b..fc6b99e4f37179b15254bf0b398b1a80 + * @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 880ff5ee1237096ac2da115b665dc663c677e57b..fc6b99e4f37179b15254bf0b398b1a80 + * @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 880ff5ee1237096ac2da115b665dc663c677e57b..fc6b99e4f37179b15254bf0b398b1a80 + * @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 880ff5ee1237096ac2da115b665dc663c677e57b..fc6b99e4f37179b15254bf0b398b1a80 + * @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 880ff5ee1237096ac2da115b665dc663c677e57b..fc6b99e4f37179b15254bf0b398b1a80 + * @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 880ff5ee1237096ac2da115b665dc663c677e57b..fc6b99e4f37179b15254bf0b398b1a80 + * @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 880ff5ee1237096ac2da115b665dc663c677e57b..fc6b99e4f37179b15254bf0b398b1a80 + * @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 880ff5ee1237096ac2da115b665dc663c677e57b..fc6b99e4f37179b15254bf0b398b1a80 + * @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 880ff5ee1237096ac2da115b665dc663c677e57b..fc6b99e4f37179b15254bf0b398b1a80 + * @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 880ff5ee1237096ac2da115b665dc663c677e57b..fc6b99e4f37179b15254bf0b398b1a80 + * @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 880ff5ee1237096ac2da115b665dc663c677e57b..fc6b99e4f37179b15254bf0b398b1a80 + * @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 880ff5ee1237096ac2da115b665dc663c677e57b..fc6b99e4f37179b15254bf0b398b1a80 + * @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 880ff5ee1237096ac2da115b665dc663c677e57b..fc6b99e4f37179b15254bf0b398b1a80 + * @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 880ff5ee1237096ac2da115b665dc663c677e57b..fc6b99e4f37179b15254bf0b398b1a80 + * @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 880ff5ee1237096ac2da115b665dc663c677e57b..fc6b99e4f37179b15254bf0b398b1a80 + * @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 880ff5ee1237096ac2da115b665dc663c677e57b..fc6b99e4f37179b15254bf0b398b1a80 + * @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 880ff5ee1237096ac2da115b665dc663c677e57b..fc6b99e4f37179b15254bf0b398b1a80 + * @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 5fc085f785719933eef7ab1b3cf173579c64739b..711d95bfafac0d415895023bdaac4059395667ab 100644 --- a/src/main/java/org/bukkit/entity/Entity.java diff --git a/patches/api/0157-Add-sun-related-API.patch b/patches/api/0157-Add-sun-related-API.patch index 4530366053..540087547e 100644 --- a/patches/api/0157-Add-sun-related-API.patch +++ b/patches/api/0157-Add-sun-related-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add sun related API diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 7aa4103fdfd8a637ad77c2cb6d3521a9c4442459..3727e136dce6eb41c316c3607c946489cf7df7c8 100644 +index 99a31572fa393a2482548ec55a96cb8568d07199..561cfe701d76fa0c85cea4a76affa7e90de82da0 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java -@@ -1788,6 +1788,16 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient +@@ -1760,6 +1760,16 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient */ public void setFullTime(long time); diff --git a/patches/api/0173-Fix-Spigot-annotation-mistakes.patch b/patches/api/0173-Fix-Spigot-annotation-mistakes.patch index 7e30c405fb..5ef04b9ac7 100644 --- a/patches/api/0173-Fix-Spigot-annotation-mistakes.patch +++ b/patches/api/0173-Fix-Spigot-annotation-mistakes.patch @@ -254,7 +254,7 @@ index f9c9ae463aacd593e3aa9caf037ea1e23d56c780..f8ae143acbf586d5279b44f7311ca97f /** diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java -index 16df0568143a956309e6cab91a0818582fa4ed67..9e80988c71b77bbda1aca27a859537600a1439a6 100644 +index 0b202d378d50946f43434e70d9d511cac06749b0..cf42f6e57e96aa9cb4465e34a6e3f8709de4ca09 100644 --- a/src/main/java/org/bukkit/Location.java +++ b/src/main/java/org/bukkit/Location.java @@ -46,7 +46,7 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm @@ -600,7 +600,7 @@ index e455eb21abf121dc6ff10ff8a13dd06f67096a8f..bbc01e7c192ae6689c301670047ff114 return origin; } diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 3727e136dce6eb41c316c3607c946489cf7df7c8..f827e55a8dc57e8d29fce4c2c0545de89b54a800 100644 +index 561cfe701d76fa0c85cea4a76affa7e90de82da0..8a200ffe1851b24110c92bb3a9f7ffc39b8c63f2 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -416,9 +416,8 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient @@ -614,7 +614,7 @@ index 3727e136dce6eb41c316c3607c946489cf7df7c8..f827e55a8dc57e8d29fce4c2c0545de8 public boolean refreshChunk(int x, int z); /** -@@ -3790,6 +3789,10 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient +@@ -3762,6 +3761,10 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient // Paper end - view distance api // Spigot start @@ -625,7 +625,7 @@ index 3727e136dce6eb41c316c3607c946489cf7df7c8..f827e55a8dc57e8d29fce4c2c0545de8 public class Spigot { /** -@@ -3798,8 +3801,12 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient +@@ -3770,8 +3773,12 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient * @param loc The location to strike lightning * @param isSilent Whether this strike makes no sound * @return The lightning entity. @@ -638,7 +638,7 @@ index 3727e136dce6eb41c316c3607c946489cf7df7c8..f827e55a8dc57e8d29fce4c2c0545de8 public LightningStrike strikeLightning(@NotNull Location loc, boolean isSilent) { throw new UnsupportedOperationException("Not supported yet."); } -@@ -3810,14 +3817,22 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient +@@ -3782,14 +3789,22 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient * @param loc The location to strike lightning * @param isSilent Whether this strike makes no sound * @return The lightning entity. @@ -661,7 +661,7 @@ index 3727e136dce6eb41c316c3607c946489cf7df7c8..f827e55a8dc57e8d29fce4c2c0545de8 Spigot spigot(); // Spigot end -@@ -3948,9 +3963,9 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient +@@ -3920,9 +3935,9 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient * Gets the dimension ID of this environment * * @return dimension ID @@ -673,7 +673,7 @@ index 3727e136dce6eb41c316c3607c946489cf7df7c8..f827e55a8dc57e8d29fce4c2c0545de8 public int getId() { return id; } -@@ -3960,9 +3975,9 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient +@@ -3932,9 +3947,9 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient * * @param id The ID of the environment * @return The environment diff --git a/patches/api/0176-Add-Heightmap-API.patch b/patches/api/0176-Add-Heightmap-API.patch index 5100bb0ae9..159fd3a0b0 100644 --- a/patches/api/0176-Add-Heightmap-API.patch +++ b/patches/api/0176-Add-Heightmap-API.patch @@ -51,12 +51,12 @@ index 0000000000000000000000000000000000000000..1c832d69bb3717dcfccf21e45f6f060a + SOLID_OR_LIQUID_NO_LEAVES; +} diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java -index f7564581c18425c903e54f949728dd3742ca7bf2..1bfe465b9aaeea7d3c871140145b7de1b8f1d93d 100644 +index dc7e69380e421f64d65b6dcb80909fc770d157fa..5edee59f24ef5f8adf2aa1f2f3c0289cf4bc0ec3 100644 --- a/src/main/java/org/bukkit/Location.java +++ b/src/main/java/org/bukkit/Location.java -@@ -640,6 +640,46 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm - return centerLoc; +@@ -649,6 +649,46 @@ public class Location implements Cloneable, ConfigurationSerializable, io.paperm } + // Paper end - expand Location API + // Paper start - Add heightmap api + /** @@ -102,7 +102,7 @@ index f7564581c18425c903e54f949728dd3742ca7bf2..1bfe465b9aaeea7d3c871140145b7de1 /** * Creates explosion at this location with given power diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index e673e05c3d94c28d6809a0de7f7d070712b85741..5d3b645eb24f5c0e3309143fc0e53545c6de8083 100644 +index fe5cc7b038516dd61d2d1af97073a60b76874db5..518158d70a8e7ba9a6aa54c22913d8a881adff1f 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java @@ -151,6 +151,87 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient diff --git a/patches/api/0272-More-World-API.patch b/patches/api/0272-More-World-API.patch index e1300d8b5b..1c79ad1a4b 100644 --- a/patches/api/0272-More-World-API.patch +++ b/patches/api/0272-More-World-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] More World API diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 7d2a7aff5b15a66663ef896fb1a7e0c6804e936a..372e3e40bb21f0185c59973d5c8ee48c07ea9725 100644 +index dd498e3ba46bd001028f7f9f94e18de42e875ff6..8735a0a359450a6cbea44c1b01c85a4135ba1f86 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java -@@ -3797,6 +3797,122 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient +@@ -3769,6 +3769,122 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient @Nullable StructureSearchResult locateNearestStructure(@NotNull Location origin, @NotNull Structure structure, int radius, boolean findUnexplored); diff --git a/patches/api/0352-Custom-Potion-Mixes.patch b/patches/api/0352-Custom-Potion-Mixes.patch index 3d48ba327b..125a13386a 100644 --- a/patches/api/0352-Custom-Potion-Mixes.patch +++ b/patches/api/0352-Custom-Potion-Mixes.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Custom Potion Mixes diff --git a/src/main/java/io/papermc/paper/potion/PotionMix.java b/src/main/java/io/papermc/paper/potion/PotionMix.java new file mode 100644 -index 0000000000000000000000000000000000000000..ae1f30e88fc5048627295187214aa7a288f4c184 +index 0000000000000000000000000000000000000000..3fc922ebf972418b84181cd02e68d8ef0efd739b --- /dev/null +++ b/src/main/java/io/papermc/paper/potion/PotionMix.java @@ -0,0 +1,105 @@ @@ -42,13 +42,25 @@ index 0000000000000000000000000000000000000000..ae1f30e88fc5048627295187214aa7a2 + * @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..ae1f30e88fc5048627295187214aa7a2 + 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..ae1f30e88fc5048627295187214aa7a2 + } + + @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); + } + @@ -117,7 +117,7 @@ index 0000000000000000000000000000000000000000..ae1f30e88fc5048627295187214aa7a2 +} diff --git a/src/main/java/io/papermc/paper/potion/PredicateRecipeChoice.java b/src/main/java/io/papermc/paper/potion/PredicateRecipeChoice.java new file mode 100644 -index 0000000000000000000000000000000000000000..1bf964605f681469fb364baaa18381c090260a94 +index 0000000000000000000000000000000000000000..3ede1e8f7bf0436fdc5bf395c0f9eaf11c252453 --- /dev/null +++ b/src/main/java/io/papermc/paper/potion/PredicateRecipeChoice.java @@ -0,0 +1,33 @@ @@ -132,7 +132,7 @@ index 0000000000000000000000000000000000000000..1bf964605f681469fb364baaa18381c0 + +@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..1bf964605f681469fb364baaa18381c0 + public RecipeChoice clone() { + try { + return (PredicateRecipeChoice) super.clone(); -+ } catch (CloneNotSupportedException ex) { ++ } catch (final CloneNotSupportedException ex) { + throw new AssertionError(ex); + } + } diff --git a/patches/api/0364-Expand-FallingBlock-API.patch b/patches/api/0364-Expand-FallingBlock-API.patch index 1005e55bac..d1138539df 100644 --- a/patches/api/0364-Expand-FallingBlock-API.patch +++ b/patches/api/0364-Expand-FallingBlock-API.patch @@ -10,10 +10,10 @@ Subject: [PATCH] Expand FallingBlock API Co-authored-by: Lukas Planz diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index 94e6fe6257b30112066b98ec4fdb1561dbcc93c4..bc6630345bb42eb365ba0057a4c52b1e10c6a05a 100644 +index b191d304832fe3475b76fdce131db51e5042ac01..298e63e0ca9d4cbac3172fd93a217af79fad91df 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java -@@ -2248,8 +2248,10 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient +@@ -2220,8 +2220,10 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient * @return The spawned {@link FallingBlock} instance * @throws IllegalArgumentException if {@link Location} or {@link * MaterialData} are null or {@link Material} of the {@link MaterialData} is not a block @@ -24,7 +24,7 @@ index 94e6fe6257b30112066b98ec4fdb1561dbcc93c4..bc6630345bb42eb365ba0057a4c52b1e public FallingBlock spawnFallingBlock(@NotNull Location location, @NotNull MaterialData data) throws IllegalArgumentException; /** -@@ -2262,8 +2264,10 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient +@@ -2234,8 +2236,10 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient * @return The spawned {@link FallingBlock} instance * @throws IllegalArgumentException if {@link Location} or {@link * BlockData} are null @@ -35,7 +35,7 @@ index 94e6fe6257b30112066b98ec4fdb1561dbcc93c4..bc6630345bb42eb365ba0057a4c52b1e public FallingBlock spawnFallingBlock(@NotNull Location location, @NotNull BlockData data) throws IllegalArgumentException; /** -@@ -2280,7 +2284,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient +@@ -2252,7 +2256,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient * @return The spawned {@link FallingBlock} instance * @throws IllegalArgumentException if {@link Location} or {@link * Material} are null or {@link Material} is not a block diff --git a/patches/api/0378-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch b/patches/api/0378-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch index f1884d2c5e..291761dadb 100644 --- a/patches/api/0378-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch +++ b/patches/api/0378-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch @@ -5,15 +5,15 @@ Subject: [PATCH] Add a consumer parameter to ProjectileSource#launchProjectile diff --git a/src/main/java/org/bukkit/projectiles/ProjectileSource.java b/src/main/java/org/bukkit/projectiles/ProjectileSource.java -index eabd8b926ec1c934cd7e77b7cc6adfae16771021..5a2dcb1dbd0a875ff9cf5fd01445196a947f2fdc 100644 +index eabd8b926ec1c934cd7e77b7cc6adfae16771021..96ebd30d339060758e726e9e1e7428d1d0813c17 100644 --- a/src/main/java/org/bukkit/projectiles/ProjectileSource.java +++ b/src/main/java/org/bukkit/projectiles/ProjectileSource.java -@@ -31,4 +31,24 @@ public interface ProjectileSource { +@@ -31,4 +31,23 @@ public interface ProjectileSource { */ @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 eabd8b926ec1c934cd7e77b7cc6adfae16771021..5a2dcb1dbd0a875ff9cf5fd01445196a + * @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/0445-Add-predicate-for-blocks-when-raytracing.patch b/patches/api/0445-Add-predicate-for-blocks-when-raytracing.patch index 23e9363021..04fc2e3ab9 100644 --- a/patches/api/0445-Add-predicate-for-blocks-when-raytracing.patch +++ b/patches/api/0445-Add-predicate-for-blocks-when-raytracing.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add predicate for blocks when raytracing diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java -index bc6630345bb42eb365ba0057a4c52b1e10c6a05a..5eb3521f5f91b0684b4beebf4f7ba2c795b41c42 100644 +index 298e63e0ca9d4cbac3172fd93a217af79fad91df..f72f0f0f8eee95f95adc969d55ba7de82ee30e2a 100644 --- a/src/main/java/org/bukkit/World.java +++ b/src/main/java/org/bukkit/World.java -@@ -1720,6 +1720,27 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient +@@ -1692,6 +1692,27 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient @Nullable public RayTraceResult rayTraceEntities(@NotNull Location start, @NotNull Vector direction, double maxDistance, double raySize, @Nullable Predicate filter); @@ -36,7 +36,7 @@ index bc6630345bb42eb365ba0057a4c52b1e10c6a05a..5eb3521f5f91b0684b4beebf4f7ba2c7 /** * Performs a ray trace that checks for block collisions using the blocks' * precise collision shapes. -@@ -1783,6 +1804,34 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient +@@ -1755,6 +1776,34 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient @Nullable public RayTraceResult rayTraceBlocks(@NotNull Location start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks); @@ -71,7 +71,7 @@ index bc6630345bb42eb365ba0057a4c52b1e10c6a05a..5eb3521f5f91b0684b4beebf4f7ba2c7 /** * Performs a ray trace that checks for both block and entity collisions. *

-@@ -1816,6 +1865,42 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient +@@ -1788,6 +1837,42 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient @Nullable public RayTraceResult rayTrace(@NotNull Location start, @NotNull Vector direction, double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode, boolean ignorePassableBlocks, double raySize, @Nullable Predicate filter); diff --git a/patches/server/0240-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch b/patches/server/0240-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch index fd2caa7226..45533e8ac2 100644 --- a/patches/server/0240-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch +++ b/patches/server/0240-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Ability to get Tile Entities from a chunk without snapshots diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index df02963faaf8f514f4175d394e67d2df10c8a3ea..593cfd68dc0f3679c684b6a1d2036419d4f3bc0c 100644 +index df02963faaf8f514f4175d394e67d2df10c8a3ea..545b14f02ac72dda30891d681eba585d19fd5e1d 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -127,6 +127,13 @@ public class CraftChunk implements Chunk { @@ -35,7 +35,7 @@ index df02963faaf8f514f4175d394e67d2df10c8a3ea..593cfd68dc0f3679c684b6a1d2036419 + } + + @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/0849-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch b/patches/server/0849-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch index 7e974ebb59..f0cff17ef6 100644 --- a/patches/server/0849-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch +++ b/patches/server/0849-Add-a-consumer-parameter-to-ProjectileSource-launchP.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add a consumer parameter to ProjectileSource#launchProjectile diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 03b1b9d8bf7b12343564ff6eb4fb865e4626b1e4..b31356c042b5262ccb47fe1ec56bed0791e84262 100644 +index 0faed04c7794dd4fd758a151d15ad5956e4f4907..c9396a55fddba47124ad5aebe7f816d99a03659c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -509,8 +509,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @@ -20,7 +20,7 @@ index 03b1b9d8bf7b12343564ff6eb4fb865e4626b1e4..b31356c042b5262ccb47fe1ec56bed07 + + @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"); @@ -38,7 +38,7 @@ index 03b1b9d8bf7b12343564ff6eb4fb865e4626b1e4..b31356c042b5262ccb47fe1ec56bed07 world.addFreshEntity(launch); return (T) launch.getBukkitEntity(); diff --git a/src/main/java/org/bukkit/craftbukkit/projectiles/CraftBlockProjectileSource.java b/src/main/java/org/bukkit/craftbukkit/projectiles/CraftBlockProjectileSource.java -index 7f9a716ea65f98d1c8487438949f1d5bc8becc4a..f880b0def6ee12d1e88a732ade348ac062f8ab69 100644 +index 7f9a716ea65f98d1c8487438949f1d5bc8becc4a..ab684fc1b09d4eade7dd11a95065e72b842a3667 100644 --- a/src/main/java/org/bukkit/craftbukkit/projectiles/CraftBlockProjectileSource.java +++ b/src/main/java/org/bukkit/craftbukkit/projectiles/CraftBlockProjectileSource.java @@ -56,6 +56,13 @@ public class CraftBlockProjectileSource implements BlockProjectileSource { @@ -50,7 +50,7 @@ index 7f9a716ea65f98d1c8487438949f1d5bc8becc4a..f880b0def6ee12d1e88a732ade348ac0 + } + + @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()