diff --git a/Spigot-API-Patches/Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch b/Spigot-API-Patches/Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch new file mode 100644 index 0000000000..76fb048bdd --- /dev/null +++ b/Spigot-API-Patches/Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Wed, 15 Aug 2018 01:04:58 -0400 +Subject: [PATCH] Ability to get Tile Entities from a chunk without snapshots + + +diff --git a/src/main/java/org/bukkit/Chunk.java b/src/main/java/org/bukkit/Chunk.java +index c75bce07a..dc847340f 100644 +--- a/src/main/java/org/bukkit/Chunk.java ++++ b/src/main/java/org/bukkit/Chunk.java +@@ -0,0 +0,0 @@ public interface Chunk { + */ + Entity[] getEntities(); + ++ // Paper start + /** + * Get a list of all tile entities in the chunk. + * + * @return The tile entities. + */ +- BlockState[] getTileEntities(); ++ default BlockState[] getTileEntities() { ++ return getTileEntities(true); ++ } ++ ++ /** ++ * Get a list of all tile entities in the chunk. ++ * ++ * @param useSnapshot Take snapshots or direct references ++ * @return The tile entities. ++ */ ++ BlockState[] getTileEntities(boolean useSnapshot); ++ // Paper end + + /** + * Checks if the chunk is loaded. +-- \ No newline at end of file diff --git a/Spigot-API-Patches/Don-t-use-snapshots-for-Timings-Tile-Entity-reports.patch b/Spigot-API-Patches/Don-t-use-snapshots-for-Timings-Tile-Entity-reports.patch new file mode 100644 index 0000000000..4fa0d7435e --- /dev/null +++ b/Spigot-API-Patches/Don-t-use-snapshots-for-Timings-Tile-Entity-reports.patch @@ -0,0 +1,20 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Wed, 15 Aug 2018 01:19:37 -0400 +Subject: [PATCH] Don't use snapshots for Timings Tile Entity reports + + +diff --git a/src/main/java/co/aikar/timings/TimingHistory.java b/src/main/java/co/aikar/timings/TimingHistory.java +index c2c2fb838..769facd80 100644 +--- a/src/main/java/co/aikar/timings/TimingHistory.java ++++ b/src/main/java/co/aikar/timings/TimingHistory.java +@@ -0,0 +0,0 @@ public class TimingHistory { + data.entityCounts.get(entity.getType()).increment(); + } + +- for (BlockState tileEntity : chunk.getTileEntities()) { ++ for (BlockState tileEntity : chunk.getTileEntities(false)) { + if (tileEntity == null) { + Bukkit.getLogger().warning("Null tileentity detected in chunk at position x: " + chunk.getX() + ", z: " + chunk.getZ()); + continue; +-- \ No newline at end of file diff --git a/Spigot-Server-Patches/Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch b/Spigot-Server-Patches/Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch new file mode 100644 index 0000000000..e2b3c451df --- /dev/null +++ b/Spigot-Server-Patches/Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Wed, 15 Aug 2018 01:16:34 -0400 +Subject: [PATCH] Ability to get Tile Entities from a chunk without snapshots + + +diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +index 0a47353b48..3238ca7420 100644 +--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java ++++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +@@ -0,0 +0,0 @@ public class CraftChunk implements Chunk { + return entities; + } + ++ // Paper start + public BlockState[] getTileEntities() { ++ return getTileEntities(true); ++ } ++ public BlockState[] getTileEntities(boolean useSnapshot) { ++ // Paper end + int index = 0; + net.minecraft.server.Chunk chunk = getHandle(); + +@@ -0,0 +0,0 @@ public class CraftChunk implements Chunk { + } + + BlockPosition position = (BlockPosition) obj; +- entities[index++] = worldServer.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()).getState(); ++ entities[index++] = worldServer.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()).getState(useSnapshot); // Paper + } + + return entities; +-- \ No newline at end of file