diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java b/paper-server/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java index 550416bef0..791017258a 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java @@ -1,5 +1,8 @@ package org.bukkit.craftbukkit.generator; +import java.util.HashSet; +import java.util.Set; +import net.minecraft.server.BlockPosition; import net.minecraft.server.Blocks; import net.minecraft.server.ChunkSection; import net.minecraft.server.IBlockData; @@ -17,6 +20,7 @@ import org.bukkit.material.MaterialData; public final class CraftChunkData implements ChunkGenerator.ChunkData { private final int maxHeight; private final ChunkSection[] sections; + private Set tiles; public CraftChunkData(World world) { this(world.getMaxHeight()); @@ -140,6 +144,14 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData { } ChunkSection section = getChunkSection(y, true); section.setType(x, y & 0xf, z, type); + + if (type.getBlock().isTileEntity()) { + if (tiles == null) { + tiles = new HashSet<>(); + } + + tiles.add(new BlockPosition(x, y, z)); + } } private ChunkSection getChunkSection(int y, boolean create) { @@ -153,4 +165,8 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData { ChunkSection[] getRawChunkData() { return sections; } + + Set getTiles() { + return tiles; + } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java b/paper-server/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java index 3f2948a5e1..91d528fb39 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java @@ -60,7 +60,8 @@ public class CustomChunkGenerator extends InternalChunkGenerator