Implement missing AsyncChunk#getTileEntities

Dieser Commit ist enthalten in:
Alexander Söderberg 2020-12-26 21:00:45 +01:00 committet von N0tMyFaultOG
Ursprung 6e49427b26
Commit 71059505d1

Datei anzeigen

@ -6,6 +6,7 @@ import com.boydti.fawe.util.TaskManager;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.ChunkSnapshot; import org.bukkit.ChunkSnapshot;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -14,6 +15,8 @@ import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.function.Predicate;
import java.util.function.Supplier; import java.util.function.Supplier;
public class AsyncChunk implements Chunk { public class AsyncChunk implements Chunk {
@ -120,6 +123,16 @@ public class AsyncChunk implements Chunk {
return TaskManager.IMP.sync(() -> world.getChunkAt(x, z).getTileEntities(useSnapshot)); return TaskManager.IMP.sync(() -> world.getChunkAt(x, z).getTileEntities(useSnapshot));
} }
@NotNull @Override
public Collection<BlockState> getTileEntities(@NotNull Predicate<Block> blockPredicate,
boolean useSnapshot) {
if (!isLoaded()) {
return Collections.emptyList();
}
return TaskManager.IMP.sync(() -> world.getChunkAt(x, z)
.getTileEntities(blockPredicate, useSnapshot));
}
@Override @Override
public boolean isLoaded() { public boolean isLoaded() {
return world.isChunkLoaded(x, z); return world.isChunkLoaded(x, z);