mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-20 15:29:33 +00:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@9e51f94 Fix ping event always receiving protocol version 0 (#10671) PaperMC/Paper@89ad61f Fix hopper pull event being skipped after the first call (#10667) PaperMC/Paper@eee55d0 Correctly compare holders in BeaconMenu (#10673) PaperMC/Paper@5729b29 Update Adventure to 4.17.0 Release PaperMC/Paper@ab2a85a [ci skip] Clarify var entry in contributing file PaperMC/Paper@f2512b1 Print data component type on encoding error PaperMC/Paper@1b67e02 Fix entity tracker desync when new players are added to the tracker PaperMC/Paper@cc29d2b Invalidate PathTypeCache when pathfinding updates are disabled PaperMC/Paper@b56e92f Fix chunk data version check not running in chunk system PaperMC/Paper@2df1dac Fix DataConverter ConverterParticleToNBT.parseProperties PaperMC/Paper@8748ae1 Use MCDataConverter instead of raw convert call for cmd converter PaperMC/Paper@7f1a154 Add validation to player profile and properties (#10680) PaperMC/Paper@4fd58a1 Add conversion for summon command PaperMC/Paper@39532a1 Fix stacks losing empty attr modifiers PaperMC/Paper@cdb6ba8 Fix keepalive time interval (#10690) PaperMC/Paper@a61d58d adjust ItemMeta to distinguish null and empty modifiers PaperMC/Paper@6c02dbc handle recent ItemMeta changes in serialization logic PaperMC/Paper@447f9a1 [ci skip] Fix paperclip PR label PaperMC/Paper@b98d20a Brigadier Command Support (#8235) PaperMC/Paper@ac554ad Updated Upstream (Bukkit/CraftBukkit) (#10691) PaperMC/Paper@711f82e Fix signed book page serialization (#10696) PaperMC/Paper@7e48f66 Properly pass requirement on namespaced redirects (#10701) PaperMC/Paper@f041f48 Prevent infinite recursion on cyclic brig redirect (#10705) PaperMC/Paper@11c3963 Improve Recipe validation (#10707) PaperMC/Paper@0688f21 Better way to keep paper datapack enabled PaperMC/Paper@218d33c fix creating complex recipes that have air results PaperMC/Paper@fa8a407 Remove Adventure snapshot repo from dev bundle (#10716) PaperMC/Paper@bebcc9c Make exception during command conversion non-fatal PaperMC/Paper@2faa3b2 Correctly copy alias requirements in command upgrader PaperMC/Paper@3fc9358 Show stacktrace when modifyItemStack fails PaperMC/Paper@f175193 Expose server build information (#10729) PaperMC/Paper@d8d59e0 Fix NPE sending resource pack without prompt PaperMC/Paper@5a9afbe Fixes issues in the suppress dismount cancellation patch (#10735) PaperMC/Paper@0ad09de Make PaperSimplePluginClassLoader show class which is not found PaperMC/Paper@b3b3406 fix CompassMeta not being correct (#10737) PaperMC/Paper@591521e Check for more correct profile validation (#10730) PaperMC/Paper@7d2e5c3 Add an 'empty' RecipeChoice for certain ingredient slots (#10710) PaperMC/Paper@9bf4855 Add a better warning message than "Server performance will be affected" for CommandRegisteredEvent use (#10754) PaperMC/Paper@66cb880 Remove ThreadedWorldUpgrader patch PaperMC/Paper@980cff9 Fix compile PaperMC/Paper@d3ffa62 fix default item attributes PaperMC/Paper@b149584 Always show command exception stack traces in logs (#10766) PaperMC/Paper@a9201d4 [ci skip] Move logic in our patches to ItemType/BlockType (#10772) PaperMC/Paper@3de408e Fix equipment slot and group API (#10767) PaperMC/Paper@d408381 Print CommandRegisteredEvent deprecation warnings again (#10756) PaperMC/Paper@6de7a1f Improve default item attributes API (#10765) PaperMC/Paper@2a90732 Remove incorrect logic for Fireball#setVelocity (#10764) PaperMC/Paper@5e7b65a Allow using PluginLoader classpath API from Bukkit plugins (#10758) PaperMC/Paper@3004717 Do not re-wrap vanilla goals (#10751) PaperMC/Paper@377733d Use getter/setter on Mob for equipment drop chances (#10780) PaperMC/Paper@dff591d Allow to define new map cursor types (#10782) PaperMC/Paper@4fd3ac0 [ci skip] Update Player#getListeningPluginChannels Jdoc (#10778) PaperMC/Paper@535dca5 Fix a few issues with ItemMeta (#10740) PaperMC/Paper@26e90b9 Fix CraftMetaBlockState for data components (#10731) PaperMC/Paper@f0bd0cc Expose anvil cost in the API (#10682) PaperMC/Paper@41bee55 Fix NPE for color-related metas PaperMC/Paper@4e10fad reset meta block state on BlockStateMeta#setBlockState PaperMC/Paper@a7ae966 readd itemstack data sanitization (#10454) PaperMC/Paper@ca50b87 Clear firework item properly (#10793) PaperMC/Paper@9774a52 fix and cleanup loot table patches (#10100) PaperMC/Paper@ac4ee06 Fix integer overflow for lag compensating eating check (#10797) PaperMC/Paper@6649a17 Fix BlockStateMeta equals (#10795) PaperMC/Paper@1b8cdc6 Extend Player Interact cancellation to cover Jigsaw blocks (#10719) PaperMC/Paper@841ab41 Fix more item desync when an event is cancelled (#10654) PaperMC/Paper@b0e3ca4 Prevent NPE if hooked entity was cleared (#10712) PaperMC/Paper@347bbe3 Fix Cancelling BlockPlaceEvent calling onRemove (#10773) PaperMC/Paper@23fe116 Fix missing debug trace PaperMC/Paper@b0c9b9c Only remove worldgen block entity on changed block (#10794) PaperMC/Paper@9c917fe [ci skip] Clean up paperclip build-pr workflow (#10802) PaperMC/Paper@9d6f2cc [ci skip] Rebuild patches (#10803)
375 lines
19 KiB
Diff
375 lines
19 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Samsuik <kfian294ma4@gmail.com>
|
|
Date: Thu, 23 Sep 2021 15:19:31 +0100
|
|
Subject: [PATCH] Limited Get Entities
|
|
|
|
|
|
diff --git a/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java b/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java
|
|
index 15ee41452992714108efe53b708b5a4e1da7c1ff..b62a1ae53a891802db17046271b9981ab3af1df0 100644
|
|
--- a/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java
|
|
+++ b/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java
|
|
@@ -522,6 +522,128 @@ public final class EntityLookup implements LevelEntityGetter<Entity> {
|
|
return slices;
|
|
}
|
|
|
|
+ // Sakura start - limited get entities
|
|
+ public void getLimitedEntities(final Entity except, final AABB box, final List<Entity> into,
|
|
+ final Predicate<? super Entity> predicate, final int limit, final int search) {
|
|
+ final int minChunkX = (Mth.floor(box.minX) - 2) >> 4;
|
|
+ final int minChunkZ = (Mth.floor(box.minZ) - 2) >> 4;
|
|
+ final int maxChunkX = (Mth.floor(box.maxX) + 2) >> 4;
|
|
+ final int maxChunkZ = (Mth.floor(box.maxZ) + 2) >> 4;
|
|
+
|
|
+ final int minRegionX = minChunkX >> REGION_SHIFT;
|
|
+ final int minRegionZ = minChunkZ >> REGION_SHIFT;
|
|
+ final int maxRegionX = maxChunkX >> REGION_SHIFT;
|
|
+ final int maxRegionZ = maxChunkZ >> REGION_SHIFT;
|
|
+
|
|
+ for (int currRegionZ = minRegionZ; currRegionZ <= maxRegionZ; ++currRegionZ) {
|
|
+ final int minZ = currRegionZ == minRegionZ ? minChunkZ & REGION_MASK : 0;
|
|
+ final int maxZ = currRegionZ == maxRegionZ ? maxChunkZ & REGION_MASK : REGION_MASK;
|
|
+
|
|
+ for (int currRegionX = minRegionX; currRegionX <= maxRegionX; ++currRegionX) {
|
|
+ final ChunkSlicesRegion region = this.getRegion(currRegionX, currRegionZ);
|
|
+
|
|
+ if (region == null) {
|
|
+ continue;
|
|
+ }
|
|
+
|
|
+ final int minX = currRegionX == minRegionX ? minChunkX & REGION_MASK : 0;
|
|
+ final int maxX = currRegionX == maxRegionX ? maxChunkX & REGION_MASK : REGION_MASK;
|
|
+
|
|
+ for (int currZ = minZ; currZ <= maxZ; ++currZ) {
|
|
+ for (int currX = minX; currX <= maxX; ++currX) {
|
|
+ final ChunkEntitySlices chunk = region.get(currX | (currZ << REGION_SHIFT));
|
|
+ if (chunk == null || !chunk.status.isOrAfter(FullChunkStatus.FULL)) {
|
|
+ continue;
|
|
+ }
|
|
+
|
|
+ chunk.getLimitedEntities(except, box, into, predicate, limit, search);
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public <T extends Entity> void getLimitedEntities(final EntityType<?> type, final AABB box, final List<? super T> into,
|
|
+ final Predicate<? super T> predicate, final int limit, final int search) {
|
|
+ final int minChunkX = (Mth.floor(box.minX) - 2) >> 4;
|
|
+ final int minChunkZ = (Mth.floor(box.minZ) - 2) >> 4;
|
|
+ final int maxChunkX = (Mth.floor(box.maxX) + 2) >> 4;
|
|
+ final int maxChunkZ = (Mth.floor(box.maxZ) + 2) >> 4;
|
|
+
|
|
+ final int minRegionX = minChunkX >> REGION_SHIFT;
|
|
+ final int minRegionZ = minChunkZ >> REGION_SHIFT;
|
|
+ final int maxRegionX = maxChunkX >> REGION_SHIFT;
|
|
+ final int maxRegionZ = maxChunkZ >> REGION_SHIFT;
|
|
+
|
|
+ for (int currRegionZ = minRegionZ; currRegionZ <= maxRegionZ; ++currRegionZ) {
|
|
+ final int minZ = currRegionZ == minRegionZ ? minChunkZ & REGION_MASK : 0;
|
|
+ final int maxZ = currRegionZ == maxRegionZ ? maxChunkZ & REGION_MASK : REGION_MASK;
|
|
+
|
|
+ for (int currRegionX = minRegionX; currRegionX <= maxRegionX; ++currRegionX) {
|
|
+ final ChunkSlicesRegion region = this.getRegion(currRegionX, currRegionZ);
|
|
+
|
|
+ if (region == null) {
|
|
+ continue;
|
|
+ }
|
|
+
|
|
+ final int minX = currRegionX == minRegionX ? minChunkX & REGION_MASK : 0;
|
|
+ final int maxX = currRegionX == maxRegionX ? maxChunkX & REGION_MASK : REGION_MASK;
|
|
+
|
|
+ for (int currZ = minZ; currZ <= maxZ; ++currZ) {
|
|
+ for (int currX = minX; currX <= maxX; ++currX) {
|
|
+ final ChunkEntitySlices chunk = region.get(currX | (currZ << REGION_SHIFT));
|
|
+ if (chunk == null || !chunk.status.isOrAfter(FullChunkStatus.FULL)) {
|
|
+ continue;
|
|
+ }
|
|
+
|
|
+ chunk.getLimitedEntities(type, box, (List)into, (Predicate)predicate, limit, search);
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public <T extends Entity> void getLimitedEntities(final Class<? extends T> clazz, final Entity except, final AABB box, final List<? super T> into,
|
|
+ final Predicate<? super T> predicate, final int limit, final int search) {
|
|
+ final int minChunkX = (Mth.floor(box.minX) - 2) >> 4;
|
|
+ final int minChunkZ = (Mth.floor(box.minZ) - 2) >> 4;
|
|
+ final int maxChunkX = (Mth.floor(box.maxX) + 2) >> 4;
|
|
+ final int maxChunkZ = (Mth.floor(box.maxZ) + 2) >> 4;
|
|
+
|
|
+ final int minRegionX = minChunkX >> REGION_SHIFT;
|
|
+ final int minRegionZ = minChunkZ >> REGION_SHIFT;
|
|
+ final int maxRegionX = maxChunkX >> REGION_SHIFT;
|
|
+ final int maxRegionZ = maxChunkZ >> REGION_SHIFT;
|
|
+
|
|
+ for (int currRegionZ = minRegionZ; currRegionZ <= maxRegionZ; ++currRegionZ) {
|
|
+ final int minZ = currRegionZ == minRegionZ ? minChunkZ & REGION_MASK : 0;
|
|
+ final int maxZ = currRegionZ == maxRegionZ ? maxChunkZ & REGION_MASK : REGION_MASK;
|
|
+
|
|
+ for (int currRegionX = minRegionX; currRegionX <= maxRegionX; ++currRegionX) {
|
|
+ final ChunkSlicesRegion region = this.getRegion(currRegionX, currRegionZ);
|
|
+
|
|
+ if (region == null) {
|
|
+ continue;
|
|
+ }
|
|
+
|
|
+ final int minX = currRegionX == minRegionX ? minChunkX & REGION_MASK : 0;
|
|
+ final int maxX = currRegionX == maxRegionX ? maxChunkX & REGION_MASK : REGION_MASK;
|
|
+
|
|
+ for (int currZ = minZ; currZ <= maxZ; ++currZ) {
|
|
+ for (int currX = minX; currX <= maxX; ++currX) {
|
|
+ final ChunkEntitySlices chunk = region.get(currX | (currZ << REGION_SHIFT));
|
|
+ if (chunk == null || !chunk.status.isOrAfter(FullChunkStatus.FULL)) {
|
|
+ continue;
|
|
+ }
|
|
+
|
|
+ chunk.getLimitedEntities(clazz, except, box, into, predicate, limit, search);
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ // Sakura end
|
|
+
|
|
public void getEntitiesWithoutDragonParts(final Entity except, final AABB box, final List<Entity> into, final Predicate<? super Entity> predicate) {
|
|
final int minChunkX = (Mth.floor(box.minX) - 2) >> 4;
|
|
final int minChunkZ = (Mth.floor(box.minZ) - 2) >> 4;
|
|
diff --git a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
|
index 8fcaa00e461c7f4413bf655ddd8165a2b908f900..404b99def4562942e036089085a667979b1cac81 100644
|
|
--- a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
|
+++ b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
|
@@ -259,6 +259,30 @@ public final class ChunkEntitySlices {
|
|
}
|
|
// Sakura end
|
|
|
|
+ // Sakura start - limited get entities
|
|
+ public void getLimitedEntities(final Entity except, final AABB box, final List<Entity> into, final Predicate<? super Entity> predicate, final int limit, final int search) {
|
|
+ this.allEntities.getLimitedEntities(except, box, into, predicate, limit, search);
|
|
+ }
|
|
+
|
|
+ public <T extends Entity> void getLimitedEntities(final EntityType<?> type, final AABB box, final List<? super T> into,
|
|
+ final Predicate<? super T> predicate, final int limit, final int search) {
|
|
+ this.allEntities.getLimitedEntities(type, box, (List)into, (Predicate)predicate, limit, search);
|
|
+ }
|
|
+
|
|
+ public <T extends Entity> void getLimitedEntities(final Class<? extends T> clazz, final Entity except, final AABB box, final List<? super T> into,
|
|
+ final Predicate<? super T> predicate, final int limit, final int search) {
|
|
+ EntityCollectionBySection collection = this.entitiesByClass.get(clazz);
|
|
+ if (collection != null) {
|
|
+ collection.getLimitedEntities(except, clazz, box, (List)into, (Predicate)predicate, limit, search);
|
|
+ } else {
|
|
+ synchronized (this) {
|
|
+ this.entitiesByClass.putIfAbsent(clazz, collection = this.initClass(clazz));
|
|
+ }
|
|
+ collection.getLimitedEntities(except, clazz, box, (List)into, (Predicate)predicate, limit, search);
|
|
+ }
|
|
+ }
|
|
+ // Sakura end
|
|
+
|
|
public void getHardCollidingEntities(final Entity except, final AABB box, final List<Entity> into, final Predicate<? super Entity> predicate) {
|
|
this.hardCollidingEntities.getEntities(except, box, into, predicate);
|
|
}
|
|
@@ -449,6 +473,155 @@ public final class ChunkEntitySlices {
|
|
}
|
|
// Sakura end
|
|
|
|
+ // Sakura start - limited get entities
|
|
+ public void getLimitedEntities(final Entity except, final Class<?> clazz, final AABB box, final List<Entity> into,
|
|
+ final Predicate<? super Entity> predicate, final int limit, int search) {
|
|
+ if (this.count == 0) {
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ final int minSection = this.manager.minSection;
|
|
+ final int maxSection = this.manager.maxSection;
|
|
+
|
|
+ final int min = Mth.clamp(Mth.floor(box.minY - 2.0) >> 4, minSection, maxSection);
|
|
+ final int max = Mth.clamp(Mth.floor(box.maxY + 2.0) >> 4, minSection, maxSection);
|
|
+
|
|
+ // TODO use the bitset
|
|
+
|
|
+ final BasicEntityList<Entity>[] entitiesBySection = this.entitiesBySection;
|
|
+
|
|
+ for (int section = min; section <= max; ++section) {
|
|
+ final BasicEntityList<Entity> list = entitiesBySection[section - minSection];
|
|
+
|
|
+ if (list == null) {
|
|
+ continue;
|
|
+ }
|
|
+
|
|
+ final Entity[] storage = list.storage;
|
|
+
|
|
+ int len = Math.min(storage.length, list.size());
|
|
+ int index = manager.world.random.nextInt(len); // starting position
|
|
+
|
|
+ for (int i = 0; i < len; ++i) {
|
|
+ index = (index + 1) % len; // Update index
|
|
+ final Entity entity = storage[index];
|
|
+
|
|
+ if (into.size() >= limit || search-- <= 0) {
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ if (entity == null || entity == except || !clazz.isInstance(entity) || !entity.getBoundingBox().intersects(box)) {
|
|
+ continue;
|
|
+ }
|
|
+
|
|
+ if (predicate != null && !predicate.test(entity)) {
|
|
+ continue;
|
|
+ }
|
|
+
|
|
+ into.add(entity);
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public <T extends Entity> void getLimitedEntities(final EntityType<?> type, final AABB box, final List<? super T> into,
|
|
+ final Predicate<? super T> predicate, final int limit, int search) {
|
|
+ if (this.count == 0) {
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ final int minSection = this.manager.minSection;
|
|
+ final int maxSection = this.manager.maxSection;
|
|
+
|
|
+ final int min = Mth.clamp(Mth.floor(box.minY - 2.0) >> 4, minSection, maxSection);
|
|
+ final int max = Mth.clamp(Mth.floor(box.maxY + 2.0) >> 4, minSection, maxSection);
|
|
+
|
|
+ // TODO use the bitset
|
|
+
|
|
+ final BasicEntityList<Entity>[] entitiesBySection = this.entitiesBySection;
|
|
+
|
|
+ for (int section = min; section <= max; ++section) {
|
|
+ final BasicEntityList<Entity> list = entitiesBySection[section - minSection];
|
|
+
|
|
+ if (list == null) {
|
|
+ continue;
|
|
+ }
|
|
+
|
|
+ final Entity[] storage = list.storage;
|
|
+
|
|
+ int len = Math.min(storage.length, list.size());
|
|
+ int index = manager.world.random.nextInt(len); // starting position
|
|
+
|
|
+ for (int i = 0; i < len; ++i) {
|
|
+ index = (index + 1) % len; // Update index
|
|
+ final Entity entity = storage[index];
|
|
+
|
|
+ if (into.size() >= limit || search-- <= 0) {
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ if (entity == null || (type != null && entity.getType() != type) || !entity.getBoundingBox().intersects(box)) {
|
|
+ continue;
|
|
+ }
|
|
+
|
|
+ if (predicate != null && !predicate.test((T)entity)) {
|
|
+ continue;
|
|
+ }
|
|
+
|
|
+ into.add((T)entity);
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
+ public void getLimitedEntities(final Entity except, final AABB box, final List<Entity> into,
|
|
+ final Predicate<? super Entity> predicate, final int limit, int search) {
|
|
+ if (this.count == 0) {
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ final int minSection = this.manager.minSection;
|
|
+ final int maxSection = this.manager.maxSection;
|
|
+
|
|
+ final int min = Mth.clamp(Mth.floor(box.minY - 2.0) >> 4, minSection, maxSection);
|
|
+ final int max = Mth.clamp(Mth.floor(box.maxY + 2.0) >> 4, minSection, maxSection);
|
|
+
|
|
+ // TODO use the bitset
|
|
+
|
|
+ final BasicEntityList<Entity>[] entitiesBySection = this.entitiesBySection;
|
|
+
|
|
+ for (int section = min; section <= max; ++section) {
|
|
+ final BasicEntityList<Entity> list = entitiesBySection[section - minSection];
|
|
+
|
|
+ if (list == null) {
|
|
+ continue;
|
|
+ }
|
|
+
|
|
+ final Entity[] storage = list.storage;
|
|
+
|
|
+ int len = Math.min(storage.length, list.size());
|
|
+ int index = manager.world.random.nextInt(len); // starting position
|
|
+
|
|
+ for (int i = 0; i < len; ++i) {
|
|
+ index = (index + 1) % len; // Update index
|
|
+ final Entity entity = storage[index];
|
|
+
|
|
+ if (into.size() >= limit || search-- <= 0) {
|
|
+ return;
|
|
+ }
|
|
+
|
|
+ if (entity == null || entity == except || !entity.getBoundingBox().intersects(box)) {
|
|
+ continue;
|
|
+ }
|
|
+
|
|
+ if (predicate != null && !predicate.test(entity)) {
|
|
+ continue;
|
|
+ }
|
|
+
|
|
+ into.add(entity);
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ // Sakura end
|
|
+
|
|
public void getEntities(final Entity except, final AABB box, final List<Entity> into, final Predicate<? super Entity> predicate) {
|
|
if (this.count == 0) {
|
|
return;
|
|
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
|
index 507d676c58daf2297eb729543a7f86c896a984d6..d041ad1e52c78c553da4d92745d2b07fc3eab522 100644
|
|
--- a/src/main/java/net/minecraft/world/level/Level.java
|
|
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
|
@@ -221,6 +221,39 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
|
public final me.samsuik.sakura.entity.merge.MergeHistory mergeHistory = new me.samsuik.sakura.entity.merge.MergeHistory(); // Sakura - cannon entity merging
|
|
public final me.samsuik.sakura.explosion.density.BlockDensityCache densityCache = new me.samsuik.sakura.explosion.density.BlockDensityCache(); // Sakura - explosion density cache
|
|
|
|
+ // Sakura start - add entity retrival methods with search limits
|
|
+ public final void getLimitedEntities(Entity except, AABB box, Predicate<? super Entity> predicate, List<Entity> into, int limit, int search) {
|
|
+ ((ServerLevel)this).getEntityLookup().getLimitedEntities(except, box, into, predicate, limit, search);
|
|
+ }
|
|
+
|
|
+ public final <T extends Entity> List<T> getLimitedEntities(net.minecraft.world.entity.EntityType<?> filter, AABB box, Predicate<? super T> predicate, int limit, int search) {
|
|
+ List<T> ret = new java.util.ArrayList<>();
|
|
+ ((ServerLevel)this).getEntityLookup().getLimitedEntities(filter, box, ret, predicate, limit, search);
|
|
+ return ret;
|
|
+ }
|
|
+
|
|
+ public final <T> void getLimitedEntitiesByClass(Class<? extends T> clazz, Entity except, final AABB box, List<? super T> into,
|
|
+ Predicate<? super T> predicate, int limit, int search) {
|
|
+ ((ServerLevel)this).getEntityLookup().getLimitedEntities((Class)clazz, except, box, (List)into, (Predicate)predicate, limit, search);
|
|
+ }
|
|
+
|
|
+ public final <T extends Entity> List<T> getLimitedEntitiesOfClass(Class<T> entityClass, AABB box, Predicate<? super T> predicate, int limit, int search) {
|
|
+ List<T> ret = new java.util.ArrayList<>();
|
|
+ ((ServerLevel)this).getEntityLookup().getLimitedEntities(entityClass, null, box, ret, predicate, limit, search);
|
|
+ return ret;
|
|
+ }
|
|
+
|
|
+ public final List<Entity> getLimitedEntities(@Nullable Entity except, AABB box, Predicate<? super Entity> predicate, int limit, int search) {
|
|
+ List<Entity> list = Lists.newArrayList();
|
|
+ getLimitedEntities(except, box, predicate, list, limit, search);
|
|
+ return list;
|
|
+ }
|
|
+
|
|
+ public final List<Entity> getLimitedEntities(@Nullable Entity except, AABB box, int limit, int search) {
|
|
+ return this.getLimitedEntities(except, box, net.minecraft.world.entity.EntitySelector.NO_SPECTATORS, limit, search);
|
|
+ }
|
|
+ // Sakura end - add entity retrival methods with search limits
|
|
+
|
|
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, Supplier<me.samsuik.sakura.configuration.WorldConfiguration> sakuraWorldConfigCreator, java.util.concurrent.Executor executor) { // Sakura - sakura configuration files // Paper - create paper world config; Async-Anti-Xray: Pass executor
|
|
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
|
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
|