Skip to content
Open
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@
this.tickingBlockEntities = true;
if (!this.pendingBlockEntityTickers.isEmpty()) {
this.blockEntityTickers.addAll(this.pendingBlockEntityTickers);
@@ -2127,6 +_,13 @@
@@ -2127,6 +_,22 @@
public BiomeManager getBiomeManager() {
return this.biomeManager;
}
Expand All @@ -300,5 +300,18 @@
+ }
+ // Gale end - Cache - BiomeManager.getBiome()

+ // Gale start - use reusable entity list
+ @Override
+ public List<Entity> getEntities(@Nullable Entity except, AABB area) {
+ List<Entity> list = org.galemc.gale.util.entity.EntityCollectionUtil.getEntityList();
+ this.getEntities().get(net.minecraft.world.level.entity.EntityTypeTest.forClass(Entity.class), area, (net.minecraft.util.AbortableIterationConsumer<Entity>) entity -> {
+ if (entity != except && !entity.isSpectator()) {
+ list.add(entity);
+ }
+ return net.minecraft.util.AbortableIterationConsumer.Continuation.CONTINUE;
+ });
+ return list;
+ }
+ // Gale end - use reusable entity list
public final boolean isDebug() {
return this.isDebug;
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package org.galemc.gale.util.entity;

import java.util.ArrayList;
import java.util.List;
import net.minecraft.world.entity.Entity;

public final class EntityCollectionUtil {

private static final int EXPECTED_ENTITIES = 64;

private static final List<Entity> ENTITY_LIST = new ArrayList<>(EXPECTED_ENTITIES);

private EntityCollectionUtil() {}

public static List<Entity> getEntityList() {
ENTITY_LIST.clear();
return ENTITY_LIST;
}
}
Loading