SPIGOT-6719: Add getTileEntities() to LimitedRegion
This commit is contained in:
parent
e167f28088
commit
cbd747afcd
@ -6,6 +6,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import net.minecraft.core.BlockPosition;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.server.level.RegionLimitedWorldAccess;
|
import net.minecraft.server.level.RegionLimitedWorldAccess;
|
||||||
import net.minecraft.world.entity.EntityTypes;
|
import net.minecraft.world.entity.EntityTypes;
|
||||||
@ -119,6 +120,22 @@ public class CraftLimitedRegion extends CraftRegionAccessor implements LimitedRe
|
|||||||
return region.contains(x, y, z);
|
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
|
@Override
|
||||||
public Biome getBiome(int x, int y, int z) {
|
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);
|
Preconditions.checkArgument(isInRegion(x, y, z), "Coordinates %s, %s, %s are not in the region", x, y, z);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user