From 30748518b49e2421398e5fc51d92d7bc619c33d6 Mon Sep 17 00:00:00 2001 From: Aikar Date: Tue, 22 Mar 2016 23:44:35 -0400 Subject: [PATCH] Setting the cache is important to access a cache --- ...lingBlock-and-TNTPrimed-source-location-API.patch | 12 ++++++------ .../0101-Optimize-Chunk-Unload-Queue.patch | 6 +++--- .../0107-Optimize-Chunk-Access.patch | 9 ++++----- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/Spigot-Server-Patches/0024-FallingBlock-and-TNTPrimed-source-location-API.patch b/Spigot-Server-Patches/0024-FallingBlock-and-TNTPrimed-source-location-API.patch index e0487925ae..948a2ddfc0 100644 --- a/Spigot-Server-Patches/0024-FallingBlock-and-TNTPrimed-source-location-API.patch +++ b/Spigot-Server-Patches/0024-FallingBlock-and-TNTPrimed-source-location-API.patch @@ -1,4 +1,4 @@ -From 5c3d517ea581e47e6071bf2665291596bda05a15 Mon Sep 17 00:00:00 2001 +From 612db7f839d4b23bf5000cbf90370cbc8bebe158 Mon Sep 17 00:00:00 2001 From: Byteflux Date: Tue, 1 Mar 2016 23:45:08 -0600 Subject: [PATCH] FallingBlock and TNTPrimed source location API @@ -74,7 +74,7 @@ index d7bea3d..c1c0c7c 100644 world.addEntity(entitytntprimed); diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java -index 6246c05..5e8523d 100644 +index 4c8e336..c44e493 100644 --- a/src/main/java/net/minecraft/server/EntityFallingBlock.java +++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java @@ -17,13 +17,25 @@ public class EntityFallingBlock extends Entity { @@ -193,10 +193,10 @@ index 564ea37..1820c7b 100644 public EntityLiving getSource() { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 83e3003..25edfb8 100644 +index a487c2f..33c3428 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -921,7 +921,10 @@ public class CraftWorld implements World { +@@ -916,7 +916,10 @@ public class CraftWorld implements World { double y = location.getBlockY() + 0.5; double z = location.getBlockZ() + 0.5; @@ -208,7 +208,7 @@ index 83e3003..25edfb8 100644 entity.ticksLived = 1; world.addEntity(entity, SpawnReason.CUSTOM); -@@ -957,7 +960,10 @@ public class CraftWorld implements World { +@@ -952,7 +955,10 @@ public class CraftWorld implements World { int type = CraftMagicNumbers.getId(blockData.getBlock()); int data = blockData.getBlock().toLegacyData(blockData); @@ -220,7 +220,7 @@ index 83e3003..25edfb8 100644 } else if (Projectile.class.isAssignableFrom(clazz)) { if (Snowball.class.isAssignableFrom(clazz)) { entity = new EntitySnowball(world, x, y, z); -@@ -1162,7 +1168,8 @@ public class CraftWorld implements World { +@@ -1157,7 +1163,8 @@ public class CraftWorld implements World { throw new IllegalArgumentException("Cannot spawn hanging entity for " + clazz.getName() + " at " + location); } } else if (TNTPrimed.class.isAssignableFrom(clazz)) { diff --git a/Spigot-Server-Patches/0101-Optimize-Chunk-Unload-Queue.patch b/Spigot-Server-Patches/0101-Optimize-Chunk-Unload-Queue.patch index 894040b45c..14d020980b 100644 --- a/Spigot-Server-Patches/0101-Optimize-Chunk-Unload-Queue.patch +++ b/Spigot-Server-Patches/0101-Optimize-Chunk-Unload-Queue.patch @@ -1,4 +1,4 @@ -From 48991a207b2252026559f74e4c497434ff6202e9 Mon Sep 17 00:00:00 2001 +From a874e0b69442dee64c02b4600d6551283bc13f0c Mon Sep 17 00:00:00 2001 From: Aikar Date: Fri, 18 Mar 2016 17:57:25 -0400 Subject: [PATCH] Optimize Chunk Unload Queue @@ -261,7 +261,7 @@ index a6c8e53..d8bd36c 100644 this.spigotConfig = new org.spigotmc.SpigotWorldConfig( worlddata.getName() ); // Spigot this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(worlddata.getName(), this.spigotConfig); // Paper diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index c51c74b..caa5e62 100644 +index be311cd..6307c19 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -206,7 +206,7 @@ public class CraftWorld implements World { @@ -299,7 +299,7 @@ index c51c74b..caa5e62 100644 if (neighbor != null) { neighbor.setNeighborLoaded(-x, -z); chunk.setNeighborLoaded(x, z); -@@ -1543,7 +1544,7 @@ public class CraftWorld implements World { +@@ -1538,7 +1539,7 @@ public class CraftWorld implements World { } // Already unloading? diff --git a/Spigot-Server-Patches/0107-Optimize-Chunk-Access.patch b/Spigot-Server-Patches/0107-Optimize-Chunk-Access.patch index 0581db7efe..fdd77185d2 100644 --- a/Spigot-Server-Patches/0107-Optimize-Chunk-Access.patch +++ b/Spigot-Server-Patches/0107-Optimize-Chunk-Access.patch @@ -1,11 +1,10 @@ -From d52945bca9e8748091ae1f2d8d63118701f011a6 Mon Sep 17 00:00:00 2001 +From 8c50e5009f1cb259ff523b25166d23696d0b9b08 Mon Sep 17 00:00:00 2001 From: Aikar Date: Thu, 27 Aug 2015 01:15:02 -0400 Subject: [PATCH] Optimize Chunk Access getting a loaded chunk is one of the most hottest pieces of code in the game. -Often, getChunkAt is called for the same chunk multiple times in a row, often -from getType(); +getChunkAt is called for the same chunk multiple times in a row, often from getType(); Optimize this look up by using a Last Access cache. @@ -30,7 +29,7 @@ index 7ba45c8..fd65117 100644 for (int k = 0; k < this.entitySlices.length; ++k) { diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index f9375eb..0ed894c 100644 +index f9375eb..90348d5 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -24,7 +24,18 @@ public class ChunkProviderServer implements IChunkProvider { @@ -46,7 +45,7 @@ index f9375eb..0ed894c 100644 + if (lastChunkByPos != null && key == lastChunkByPos.chunkKey) { + return lastChunkByPos; + } -+ return super.get(key); ++ return lastChunkByPos = super.get(key); + } + }; // CraftBukkit + // Paper end