13
0
geforkt von Mirrors/Paper
Paper/Spigot-Server-Patches/0381-Optimize-Captured-TileEntity-Lookup.patch

36 Zeilen
1.5 KiB
Diff

2019-05-27 02:16:47 +02:00
From dd363bdf7c277f900fb5c05ac99ed1e04b31a734 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
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 774bb4d0d7..ad58d4fd63 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1051,12 +1051,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
2019-05-05 19:19:34 +02:00
if (this.tickingTileEntities) {
tileentity = this.B(blockposition);
--
2.21.0