From 274a38539d9ad8c166467053010a380b4d89eb86 Mon Sep 17 00:00:00 2001 From: shakytom Date: Wed, 20 Feb 2013 23:16:49 -0500 Subject: [PATCH] Improved tile entity lookup for chunk sending We already have direct access to the chunks tile entities, there is no reason to look them up again. --- ...tile-entity-lookup-for-chunk-sending.patch | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 CraftBukkit-Patches/0030-Improved-tile-entity-lookup-for-chunk-sending.patch diff --git a/CraftBukkit-Patches/0030-Improved-tile-entity-lookup-for-chunk-sending.patch b/CraftBukkit-Patches/0030-Improved-tile-entity-lookup-for-chunk-sending.patch new file mode 100644 index 0000000000..79693fc068 --- /dev/null +++ b/CraftBukkit-Patches/0030-Improved-tile-entity-lookup-for-chunk-sending.patch @@ -0,0 +1,30 @@ +From 18c3488b099973cb0c3b6acefe23baecf4acf9bd Mon Sep 17 00:00:00 2001 +From: shakytom +Date: Wed, 20 Feb 2013 22:34:38 -0500 +Subject: [PATCH] Improved tile entity lookup for chunk sending + +Instead of scanning the entire worlds tile entities to find out what tile entities are in the chunk... just use the arraylist of tile entities we already have. +This results in a good reduction of time spent in player ticking. +--- + src/main/java/net/minecraft/server/EntityPlayer.java | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +index 8d61ca6..28f462b 100644 +--- a/src/main/java/net/minecraft/server/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/EntityPlayer.java +@@ -163,8 +163,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + + iterator1.remove(); + if (chunkcoordintpair != null && this.world.isLoaded(chunkcoordintpair.x << 4, 0, chunkcoordintpair.z << 4)) { +- arraylist.add(this.world.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z)); +- arraylist1.addAll(((WorldServer) this.world).getTileEntities(chunkcoordintpair.x * 16, 0, chunkcoordintpair.z * 16, chunkcoordintpair.x * 16 + 16, 256, chunkcoordintpair.z * 16 + 16)); ++ Chunk chunk = this.world.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z); // Spigot ++ arraylist.add(chunk); // Spigot ++ arraylist1.addAll(chunk.tileEntities.values()); // Spigot + } + } + +-- +1.8.1.1 +