2019-12-23 02:37:47 +00:00
|
|
|
From 2b71f54314ccc158d0be01e9ea15d667e9c88e95 Mon Sep 17 00:00:00 2001
|
2019-04-06 14:25:21 +00:00
|
|
|
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
|
2019-12-23 02:37:47 +00:00
|
|
|
index e07e63e55..3e57546a3 100644
|
2019-04-06 14:25:21 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
2019-12-23 02:37:47 +00:00
|
|
|
@@ -1023,12 +1023,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
2019-04-06 14:25:21 +00:00
|
|
|
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 17:19:34 +00:00
|
|
|
if (this.tickingTileEntities) {
|
2019-12-12 16:20:43 +00:00
|
|
|
tileentity = this.e(blockposition);
|
2019-04-06 14:25:21 +00:00
|
|
|
--
|
2019-12-13 16:22:16 +00:00
|
|
|
2.24.1
|
2019-04-06 14:25:21 +00:00
|
|
|
|