mirror of
https://gitlab.com/SamB440/rpgregions-2.git
synced 2025-12-29 11:49:08 +00:00
Optimise entity regeneration
This commit is contained in:
@@ -99,11 +99,12 @@ public class RegenUtils {
|
||||
}
|
||||
|
||||
private static void generateRandomEntities(ProtectedRegion region, ConfiguredRegion configuredRegion) {
|
||||
Regenerate regenerate = configuredRegion.getRegenerate();
|
||||
if (regenerate == null) return;
|
||||
if (regenerate.getRegeneratingEntities().isEmpty() || configuredRegion.getWorld() == null) return;
|
||||
Random random = ThreadLocalRandom.current();
|
||||
Location min = new Location(configuredRegion.getWorld(), region.getMinimumPoint().getBlockX(), region.getMinimumPoint().getBlockY(), region.getMinimumPoint().getBlockZ());
|
||||
Location max = new Location(configuredRegion.getWorld(), region.getMaximumPoint().getBlockX(), region.getMaximumPoint().getBlockY(), region.getMaximumPoint().getBlockZ());
|
||||
Regenerate regenerate = configuredRegion.getRegenerate();
|
||||
if (regenerate == null) return;
|
||||
|
||||
for (int x = min.getBlockX(); x <= max.getBlockX(); x++) {
|
||||
for (int y = min.getBlockY(); y <= max.getBlockY(); y++) {
|
||||
|
||||
Reference in New Issue
Block a user