13
0
geforkt von Mirrors/Paper

SPIGOT-6719: Add getTileEntities() to LimitedRegion

By: DerFrZocker <derrieple@gmail.com>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2021-08-30 18:44:44 +10:00
Ursprung 1dfe698f4f
Commit 768b5d52aa

Datei anzeigen

@ -6,6 +6,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Random;
import net.minecraft.core.BlockPosition;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.server.level.RegionLimitedWorldAccess;
import net.minecraft.world.entity.EntityTypes;
@ -119,6 +120,22 @@ public class CraftLimitedRegion extends CraftRegionAccessor implements LimitedRe
return region.contains(x, y, z);
}
@Override
public List<BlockState> getTileEntities() {
List<BlockState> blockStates = new ArrayList<>();
for (int x = -(buffer >> 4); x <= (buffer >> 4); x++) {
for (int z = -(buffer >> 4); z <= (buffer >> 4); z++) {
ProtoChunk chunk = (ProtoChunk) getHandle().getChunkAt(centerChunkX + x, centerChunkZ + z);
for (BlockPosition position : chunk.c()) { // PAIL rename getTilePositions
blockStates.add(getBlockState(position.getX(), position.getY(), position.getZ()));
}
}
}
return blockStates;
}
@Override
public Biome getBiome(int x, int y, int z) {
Preconditions.checkArgument(isInRegion(x, y, z), "Coordinates %s, %s, %s are not in the region", x, y, z);