aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0326-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch
blob: 3d9476b5d4e03ee1b05b6cc04a895721e15df59b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
From 1a56c638a04b91d269ab30d436c954e23c239ec2 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
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 e65768499..9ba2fa5de 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java
@@ -99,7 +99,12 @@ 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();
 
@@ -111,7 +116,7 @@ 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;
-- 
2.21.0