diff --git a/Spigot-Server-Patches/0002-Paper-config-files.patch b/Spigot-Server-Patches/0002-Paper-config-files.patch index 6af1d2820..854075564 100644 --- a/Spigot-Server-Patches/0002-Paper-config-files.patch +++ b/Spigot-Server-Patches/0002-Paper-config-files.patch @@ -1,4 +1,4 @@ -From ba575a4b6fb2e265f1ddc6aa212a88dc124d0a7e Mon Sep 17 00:00:00 2001 +From 5f483e81347904f34054cde2b04bc116ddddd96b Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Mon, 29 Feb 2016 21:02:09 -0600 Subject: [PATCH] Paper config files @@ -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 0000000000..841edd010f +index 0000000000..b5f318c00d --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -0,0 +1,241 @@ @@ -185,7 +185,7 @@ index 0000000000..841edd010f + } + 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/0006-Add-MinecraftKey-Information-to-Objects.patch b/Spigot-Server-Patches/0006-Add-MinecraftKey-Information-to-Objects.patch index c0e174ce7..bd5515829 100644 --- a/Spigot-Server-Patches/0006-Add-MinecraftKey-Information-to-Objects.patch +++ b/Spigot-Server-Patches/0006-Add-MinecraftKey-Information-to-Objects.patch @@ -1,4 +1,4 @@ -From 5ff4ed009bdf9fa16a49ad57060a1aba090ed1ae Mon Sep 17 00:00:00 2001 +From 4389a6628764d5dbda0afbbe6685f083d7490ef5 Mon Sep 17 00:00:00 2001 From: Aikar Date: Wed, 4 Jul 2018 01:40:13 -0400 Subject: [PATCH] Add MinecraftKey Information to Objects @@ -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 841edd010f..3354fdd60d 100644 +index b5f318c00d..ce190d88d6 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -175,7 +175,7 @@ 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/0141-Provide-E-TE-Chunk-count-stat-methods.patch b/Spigot-Server-Patches/0141-Provide-E-TE-Chunk-count-stat-methods.patch index 2e6dc283d..d00c4a38f 100644 --- a/Spigot-Server-Patches/0141-Provide-E-TE-Chunk-count-stat-methods.patch +++ b/Spigot-Server-Patches/0141-Provide-E-TE-Chunk-count-stat-methods.patch @@ -1,4 +1,4 @@ -From 47e948d519f3c35a4e0eef53c0d0d81eb0ca6dcd Mon Sep 17 00:00:00 2001 +From 4ef25893309e1d6628834e36eaeedc142f64bc21 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 7 Jan 2017 15:24:46 -0500 Subject: [PATCH] Provide E/TE/Chunk count stat methods @@ -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 f32c4913c5..606ec3c482 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -51,7 +51,7 @@ 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 b8de760079..c79b0f42a6 100644 +index b8de760079..b3a77ec3c5 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -265,6 +265,35 @@ public class CraftWorld implements World { @@ -30,7 +17,7 @@ index b8de760079..c79b0f42a6 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 diff --git a/Spigot-Server-Patches/0273-Ignore-Dead-Entities-in-entityList-iteration.patch b/Spigot-Server-Patches/0273-Ignore-Dead-Entities-in-entityList-iteration.patch index a2ed16728..85146849f 100644 --- a/Spigot-Server-Patches/0273-Ignore-Dead-Entities-in-entityList-iteration.patch +++ b/Spigot-Server-Patches/0273-Ignore-Dead-Entities-in-entityList-iteration.patch @@ -1,4 +1,4 @@ -From 3255a5046a0949487ce88bfec42c7bf2e8765c9b Mon Sep 17 00:00:00 2001 +From 1c457fce53a45ff0246f01e6902749c035cbff96 Mon Sep 17 00:00:00 2001 From: Aikar Date: Sat, 28 Jul 2018 12:18:27 -0400 Subject: [PATCH] Ignore Dead Entities in entityList iteration @@ -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 3354fdd60d..ab09104542 100644 +index ce190d88d6..352a39dcb3 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -176,6 +176,7 @@ 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 @@ -51,7 +51,7 @@ index d787a4ab30..d313b9b3ca 100644 if (oclass.isInstance(t0) && t0.getBoundingBox().c(axisalignedbb) && (predicate == null || predicate.test(t0))) { // Spigot - instance check list.add(t0); diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index cbd7793c53..a217cb0fe7 100644 +index f8e837faec..aac0146fd2 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -126,6 +126,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -63,7 +63,7 @@ index cbd7793c53..a217cb0fe7 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 cc8d80e95d..2843a61315 100644 +index d9f8223fec..fc04e736a4 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -843,6 +843,7 @@ public class WorldServer extends World { @@ -91,7 +91,7 @@ index cc8d80e95d..2843a61315 100644 } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 209e726485..3b0f9c86f1 100644 +index 19fa15d793..79a5adf482 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -864,6 +864,7 @@ public class CraftWorld implements World {