1.21.6 dev
Co-authored-by: Bjarne Koll <git@lynxplay.dev> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Co-authored-by: Noah van der Aa <ndvdaa@gmail.com> Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com>
This commit is contained in:
committed by
Nassim Jahnke
parent
39203a65e0
commit
a24f9b204c
@@ -729,7 +729,10 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
* @param location Location to spawn the tree
|
||||
* @param type Type of the tree to create
|
||||
* @return true if the tree was created successfully, otherwise false
|
||||
* @deprecated in favor of {@link #generateTree(Location, java.util.Random, TreeType)} to specify its own random instance
|
||||
* and this method is not accessible through {@link RegionAccessor}
|
||||
*/
|
||||
@Deprecated(since = "1.21.6")
|
||||
public boolean generateTree(@NotNull Location location, @NotNull TreeType type);
|
||||
|
||||
/**
|
||||
@@ -850,6 +853,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
// 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.
|
||||
@@ -860,6 +864,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
|
||||
/**
|
||||
* Gets nearby LivingEntities within the specified radius (bounding box)
|
||||
*
|
||||
* @param loc Center location
|
||||
* @param xzRadius X/Z Radius
|
||||
* @param yRadius Y Radius
|
||||
@@ -871,6 +876,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
|
||||
/**
|
||||
* Gets nearby LivingEntities within the specified radius (bounding box)
|
||||
*
|
||||
* @param loc Center location
|
||||
* @param xRadius X Radius
|
||||
* @param yRadius Y Radius
|
||||
@@ -883,6 +889,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
|
||||
/**
|
||||
* Gets nearby LivingEntities within the specified radius (bounding box)
|
||||
*
|
||||
* @param loc Center location
|
||||
* @param radius X Radius
|
||||
* @param predicate a predicate used to filter results
|
||||
@@ -894,6 +901,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
|
||||
/**
|
||||
* Gets nearby LivingEntities within the specified radius (bounding box)
|
||||
*
|
||||
* @param loc Center location
|
||||
* @param xzRadius X/Z Radius
|
||||
* @param yRadius Y Radius
|
||||
@@ -906,6 +914,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
|
||||
/**
|
||||
* Gets nearby LivingEntities within the specified radius (bounding box)
|
||||
*
|
||||
* @param loc Center location
|
||||
* @param xRadius X Radius
|
||||
* @param yRadius Y Radius
|
||||
@@ -919,6 +928,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
|
||||
/**
|
||||
* Gets nearby players within the specified radius (bounding box)
|
||||
*
|
||||
* @param loc Center location
|
||||
* @param radius X/Y/Z Radius
|
||||
* @return the collection of living entities near location. This will always be a non-null collection.
|
||||
@@ -929,6 +939,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
|
||||
/**
|
||||
* Gets nearby players within the specified radius (bounding box)
|
||||
*
|
||||
* @param loc Center location
|
||||
* @param xzRadius X/Z Radius
|
||||
* @param yRadius Y Radius
|
||||
@@ -940,6 +951,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
|
||||
/**
|
||||
* Gets nearby players within the specified radius (bounding box)
|
||||
*
|
||||
* @param loc Center location
|
||||
* @param xRadius X Radius
|
||||
* @param yRadius Y Radius
|
||||
@@ -952,6 +964,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
|
||||
/**
|
||||
* Gets nearby players within the specified radius (bounding box)
|
||||
*
|
||||
* @param loc Center location
|
||||
* @param radius X/Y/Z Radius
|
||||
* @param predicate a predicate used to filter results
|
||||
@@ -963,6 +976,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
|
||||
/**
|
||||
* Gets nearby players within the specified radius (bounding box)
|
||||
*
|
||||
* @param loc Center location
|
||||
* @param xzRadius X/Z Radius
|
||||
* @param yRadius Y Radius
|
||||
@@ -975,6 +989,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
|
||||
/**
|
||||
* Gets nearby players within the specified radius (bounding box)
|
||||
*
|
||||
* @param loc Center location
|
||||
* @param xRadius X Radius
|
||||
* @param yRadius Y Radius
|
||||
@@ -988,6 +1003,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
|
||||
/**
|
||||
* Gets all nearby entities of the specified type, within the specified radius (bounding box)
|
||||
*
|
||||
* @param clazz Type to filter by
|
||||
* @param loc Center location
|
||||
* @param radius X/Y/Z radius to search within
|
||||
@@ -1000,6 +1016,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
|
||||
/**
|
||||
* Gets all nearby entities of the specified type, within the specified radius, with x and x radius matching (bounding box)
|
||||
*
|
||||
* @param clazz Type to filter by
|
||||
* @param loc Center location
|
||||
* @param xzRadius X/Z radius to search within
|
||||
@@ -1013,6 +1030,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
|
||||
/**
|
||||
* Gets all nearby entities of the specified type, within the specified radius (bounding box)
|
||||
*
|
||||
* @param clazz Type to filter by
|
||||
* @param loc Center location
|
||||
* @param xRadius X Radius
|
||||
@@ -1027,6 +1045,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
|
||||
/**
|
||||
* Gets all nearby entities of the specified type, within the specified radius (bounding box)
|
||||
*
|
||||
* @param clazz Type to filter by
|
||||
* @param loc Center location
|
||||
* @param radius X/Y/Z radius to search within
|
||||
@@ -1040,6 +1059,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
|
||||
/**
|
||||
* Gets all nearby entities of the specified type, within the specified radius, with x and x radius matching (bounding box)
|
||||
*
|
||||
* @param clazz Type to filter by
|
||||
* @param loc Center location
|
||||
* @param xzRadius X/Z radius to search within
|
||||
@@ -1054,6 +1074,7 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
|
||||
/**
|
||||
* Gets all nearby entities of the specified type, within the specified radius (bounding box)
|
||||
*
|
||||
* @param clazz Type to filter by
|
||||
* @param loc Center location
|
||||
* @param xRadius X Radius
|
||||
@@ -1063,16 +1084,13 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
||||
* @param <T> the entity type
|
||||
* @return the collection of entities near location. This will always be a non-null collection.
|
||||
*/
|
||||
default <T extends Entity> @NotNull Collection<T> getNearbyEntitiesByType(@Nullable Class<? extends Entity> clazz, final @NotNull Location loc, final double xRadius, final double yRadius, final double zRadius, final @Nullable Predicate<? super T> predicate) {
|
||||
if (clazz == null) {
|
||||
clazz = Entity.class;
|
||||
}
|
||||
default <T extends Entity> @NotNull Collection<T> getNearbyEntitiesByType(@Nullable Class<? extends T> clazz, final @NotNull Location loc, final double xRadius, final double yRadius, final double zRadius, final @Nullable Predicate<? super T> predicate) {
|
||||
final List<T> nearby = new ArrayList<>();
|
||||
for (final Entity bukkitEntity : this.getNearbyEntities(loc, xRadius, yRadius, zRadius)) {
|
||||
for (final Entity entity : this.getNearbyEntities(loc, xRadius, yRadius, zRadius)) {
|
||||
//noinspection unchecked
|
||||
if (clazz.isAssignableFrom(bukkitEntity.getClass()) && (predicate == null || predicate.test((T) bukkitEntity))) {
|
||||
if ((clazz == null || clazz.isInstance(entity)) && (predicate == null || predicate.test((T) entity))) {
|
||||
//noinspection unchecked
|
||||
nearby.add((T) bukkitEntity);
|
||||
nearby.add((T) entity);
|
||||
}
|
||||
}
|
||||
return nearby;
|
||||
|
||||
Reference in New Issue
Block a user