Commits
DerFrZocker authored and md_5 committed cbd747afcde
1 1 | package org.bukkit.craftbukkit.generator; |
2 2 | |
3 3 | import com.google.common.base.Preconditions; |
4 4 | import java.lang.ref.WeakReference; |
5 5 | import java.util.ArrayList; |
6 6 | import java.util.Collection; |
7 7 | import java.util.List; |
8 8 | import java.util.Random; |
9 + | import net.minecraft.core.BlockPosition; |
9 10 | import net.minecraft.nbt.NBTTagCompound; |
10 11 | import net.minecraft.server.level.RegionLimitedWorldAccess; |
11 12 | import net.minecraft.world.entity.EntityTypes; |
12 13 | import net.minecraft.world.level.GeneratorAccessSeed; |
13 14 | import net.minecraft.world.level.biome.BiomeBase; |
14 15 | import net.minecraft.world.level.chunk.ChunkStatus; |
15 16 | import net.minecraft.world.level.chunk.IChunkAccess; |
16 17 | import net.minecraft.world.level.chunk.ProtoChunk; |
17 18 | import org.bukkit.Location; |
18 19 | import org.bukkit.Material; |
112 113 | |
113 114 | public boolean isInRegion(Location location) { |
114 115 | return region.contains(location.getX(), location.getY(), location.getZ()); |
115 116 | } |
116 117 | |
117 118 | |
118 119 | public boolean isInRegion(int x, int y, int z) { |
119 120 | return region.contains(x, y, z); |
120 121 | } |
121 122 | |
123 + | |
124 + | public List<BlockState> getTileEntities() { |
125 + | List<BlockState> blockStates = new ArrayList<>(); |
126 + | |
127 + | for (int x = -(buffer >> 4); x <= (buffer >> 4); x++) { |
128 + | for (int z = -(buffer >> 4); z <= (buffer >> 4); z++) { |
129 + | ProtoChunk chunk = (ProtoChunk) getHandle().getChunkAt(centerChunkX + x, centerChunkZ + z); |
130 + | for (BlockPosition position : chunk.c()) { // PAIL rename getTilePositions |
131 + | blockStates.add(getBlockState(position.getX(), position.getY(), position.getZ())); |
132 + | } |
133 + | } |
134 + | } |
135 + | |
136 + | return blockStates; |
137 + | } |
138 + | |
122 139 | |
123 140 | public Biome getBiome(int x, int y, int z) { |
124 141 | Preconditions.checkArgument(isInRegion(x, y, z), "Coordinates %s, %s, %s are not in the region", x, y, z); |
125 142 | return super.getBiome(x, y, z); |
126 143 | } |
127 144 | |
128 145 | |
129 146 | public void setBiome(int x, int y, int z, BiomeBase biomeBase) { |
130 147 | Preconditions.checkArgument(isInRegion(x, y, z), "Coordinates %s, %s, %s are not in the region", x, y, z); |
131 148 | IChunkAccess chunk = getHandle().getChunkAt(x >> 4, z >> 4, ChunkStatus.EMPTY); |