@@ -141,63 +141,6 @@ public Chunk getChunkFromChunkCoords(int p_72964_1_, int p_72964_2_) {
141141 protected boolean chunkExists (int p_72916_1_ , int p_72916_2_ ) {
142142 return this .chunkProvider .chunkExists (p_72916_1_ , p_72916_2_ );
143143 }
144-
145- @ Inject (
146- method = "getEntitiesWithinAABBExcludingEntity" ,
147- at = @ At ("HEAD" ),
148- cancellable = true
149- )
150- private void cacheEntitySearchForMinions (
151- Entity entity ,
152- AxisAlignedBB aabb ,
153- CallbackInfoReturnable <List > cir
154- ) {
155- if (entity == null ) {
156- return ;
157- }
158- World world = (World ) (Object ) this ;
159- long currentTick = world .getTotalWorldTime ();
160-
161- if (currentTick - lastCacheCleanup > CLEANUP_INTERVAL ) {
162- lastCacheCleanup = currentTick ;
163- entitySearchCache .entrySet ().removeIf (
164- entry -> (currentTick - entry .getValue ().timestamp ) > CACHE_DURATION_TICKS * 2
165- );
166- }
167-
168- int cacheKey = generateCacheKey (entity , aabb );
169- CachedEntitySearch cached = entitySearchCache .get (cacheKey );
170-
171- if (cached != null && (currentTick - cached .timestamp ) < CACHE_DURATION_TICKS ) {
172- cir .setReturnValue (new ArrayList <>(cached .entities ));
173- return ;
174- }
175- }
176-
177- @ Inject (
178- method = "getEntitiesWithinAABBExcludingEntity" ,
179- at = @ At ("RETURN" )
180- )
181- private void cacheEntitySearchResult (
182- Entity entity ,
183- AxisAlignedBB aabb ,
184- CallbackInfoReturnable <List > cir
185- ) {
186- if (entity == null ) {
187- return ;
188- }
189-
190- World world = (World ) (Object ) this ;
191- long currentTick = world .getTotalWorldTime ();
192-
193- int cacheKey = generateCacheKey (entity , aabb );
194- List result = cir .getReturnValue ();
195-
196- entitySearchCache .put (
197- cacheKey ,
198- new CachedEntitySearch (new ArrayList <>(result ), currentTick )
199- );
200- }
201144
202145 @ Unique
203146 private static int generateCacheKey (Entity entity , AxisAlignedBB aabb ) {
0 commit comments