From b79a86edeb47ba7fcdf1eef01d4d86f47c09fbc0 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 7 Sep 2019 16:40:30 +1000 Subject: [PATCH] SPIGOT-5250: Add ChunkSnapshot.contains --- .../org/bukkit/craftbukkit/CraftChunkSnapshot.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java index ee99b61f94..8cf0502af0 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java @@ -58,6 +58,20 @@ public class CraftChunkSnapshot implements ChunkSnapshot { return worldname; } + @Override + public boolean contains(BlockData block) { + Preconditions.checkArgument(block != null, "Block cannot be null"); + + IBlockData nms = ((CraftBlockData) block).getState(); + for (DataPaletteBlock palette : blockids) { + if (palette.a(nms)) { + return true; + } + } + + return false; + } + @Override public Material getBlockType(int x, int y, int z) { CraftChunk.validateChunkCoordinates(x, y, z);