diff --git a/Spigot-Server-Patches/Add-MinecraftKey-Information-to-Objects.patch b/Spigot-Server-Patches/Add-MinecraftKey-Information-to-Objects.patch index 7d720bca4c..50f2857e0d 100644 --- a/Spigot-Server-Patches/Add-MinecraftKey-Information-to-Objects.patch +++ b/Spigot-Server-Patches/Add-MinecraftKey-Information-to-Objects.patch @@ -6,12 +6,12 @@ Subject: [PATCH] Add MinecraftKey Information to Objects Stores the reference to the objects respective MinecraftKey diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index 841edd010..3354fdd60 100644 +index b5f318c00..ce190d88d 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -0,0 +0,0 @@ public class PaperCommand extends Command { - List entities = world.globalEntityList; + Collection entities = world.entitiesById.values(); entities.forEach(e -> { - MinecraftKey key = new MinecraftKey(""); // TODO: update in next patch + MinecraftKey key = e.getMinecraftKey(); diff --git a/Spigot-Server-Patches/Ignore-Dead-Entities-in-entityList-iteration.patch b/Spigot-Server-Patches/Ignore-Dead-Entities-in-entityList-iteration.patch index ca1e1c0a49..ba2c694cff 100644 --- a/Spigot-Server-Patches/Ignore-Dead-Entities-in-entityList-iteration.patch +++ b/Spigot-Server-Patches/Ignore-Dead-Entities-in-entityList-iteration.patch @@ -11,11 +11,11 @@ This will ensure that dead entities are skipped from iteration since they shouldn't of been in the list in the first place. diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index 3354fdd60..ab0910454 100644 +index ce190d88d..352a39dcb 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -0,0 +0,0 @@ public class PaperCommand extends Command { - List entities = world.globalEntityList; + Collection entities = world.entitiesById.values(); entities.forEach(e -> { MinecraftKey key = e.getMinecraftKey(); + if (e.shouldBeRemoved) return; // Paper @@ -63,7 +63,7 @@ index f8e837fae..aac0146fd 100644 private float av; private float aw; diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 402aac677..219c71ff6 100644 +index 0a57f9f2b..d17c2eeb7 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World { @@ -91,7 +91,7 @@ index 402aac677..219c71ff6 100644 } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 209e72648..3b0f9c86f 100644 +index 19fa15d79..79a5adf48 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -0,0 +0,0 @@ public class CraftWorld implements World { diff --git a/Spigot-Server-Patches/Paper-config-files.patch b/Spigot-Server-Patches/Paper-config-files.patch index 7569dfca68..eae5a2dfa6 100644 --- a/Spigot-Server-Patches/Paper-config-files.patch +++ b/Spigot-Server-Patches/Paper-config-files.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Paper config files diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java new file mode 100644 -index 000000000..841edd010 +index 000000000..b5f318c00 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -0,0 +0,0 @@ @@ -185,7 +185,7 @@ index 000000000..841edd010 + } + WorldServer world = ((CraftWorld) Bukkit.getWorld(worldName)).getHandle(); + -+ List entities = world.globalEntityList; ++ Collection entities = world.entitiesById.values(); + entities.forEach(e -> { + MinecraftKey key = new MinecraftKey(""); // TODO: update in next patch + diff --git a/Spigot-Server-Patches/Provide-E-TE-Chunk-count-stat-methods.patch b/Spigot-Server-Patches/Provide-E-TE-Chunk-count-stat-methods.patch index 276c6412bc..6ab472f6bb 100644 --- a/Spigot-Server-Patches/Provide-E-TE-Chunk-count-stat-methods.patch +++ b/Spigot-Server-Patches/Provide-E-TE-Chunk-count-stat-methods.patch @@ -6,21 +6,8 @@ Subject: [PATCH] Provide E/TE/Chunk count stat methods Provides counts without the ineffeciency of using .getEntities().size() which creates copy of the collections. -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index ff75bb3c6..5ed0fbe5a 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -0,0 +0,0 @@ import org.bukkit.event.weather.LightningStrikeEvent; - public class WorldServer extends World { - - private static final Logger LOGGER = LogManager.getLogger(); -- private final List globalEntityList = Lists.newArrayList(); -+ public final List globalEntityList = Lists.newArrayList(); // Paper - private -> public - public final Int2ObjectMap entitiesById = new Int2ObjectLinkedOpenHashMap(); - private final Map entitiesByUUID = Maps.newHashMap(); - private final Queue entitiesToAdd = Queues.newArrayDeque(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index b8de76007..c79b0f42a 100644 +index b8de76007..b3a77ec3c 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -0,0 +0,0 @@ public class CraftWorld implements World { @@ -30,7 +17,7 @@ index b8de76007..c79b0f42a 100644 + // Paper start - Provide fast information methods + // TODO review these changes + public int getEntityCount() { -+ return world.globalEntityList.size(); ++ return world.entitiesById.size(); + } + public int getTileEntityCount() { + // We don't use the full world tile entity list, so we must iterate chunks