diff options
Diffstat (limited to 'Spigot-Server-Patches/0374-Optimize-Captured-TileEntity-Lookup.patch')
-rw-r--r-- | Spigot-Server-Patches/0374-Optimize-Captured-TileEntity-Lookup.patch | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Spigot-Server-Patches/0374-Optimize-Captured-TileEntity-Lookup.patch b/Spigot-Server-Patches/0374-Optimize-Captured-TileEntity-Lookup.patch new file mode 100644 index 0000000000..4a29a5cf18 --- /dev/null +++ b/Spigot-Server-Patches/0374-Optimize-Captured-TileEntity-Lookup.patch @@ -0,0 +1,35 @@ +From 44377891791b199d2a2e184c905942fe07ae24a5 Mon Sep 17 00:00:00 2001 +From: Aikar <[email protected]> +Date: Sat, 6 Apr 2019 10:16:48 -0400 +Subject: [PATCH] Optimize Captured TileEntity Lookup + +upstream was doing a containsKey/get pattern, and always doing it at that. +that scenario is only even valid if were in the middle of a block place. + +Optimize to check if the captured list even has values in it, and also to +just do a get call since the value can never be null. + +diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +index dad0c893f..dd2a9c6e5 100644 +--- a/src/main/java/net/minecraft/server/World.java ++++ b/src/main/java/net/minecraft/server/World.java +@@ -1082,12 +1082,13 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose + return null; + } else { + // CraftBukkit start +- if (capturedTileEntities.containsKey(blockposition)) { +- return capturedTileEntities.get(blockposition); ++ TileEntity tileentity = null; // Paper ++ if (!capturedTileEntities.isEmpty() && (tileentity = capturedTileEntities.get(blockposition)) != null) { // Paper ++ return tileentity; // Paper + } + // CraftBukkit end + +- TileEntity tileentity = null; ++ //TileEntity tileentity = null; // Paper - move up + + if (this.tickingTileEntities) { + tileentity = this.A(blockposition); +-- +2.23.0 + |