2020-05-06 11:48:49 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2019-04-06 16:25:21 +02: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
|
2020-11-26 00:45:25 +01:00
|
|
|
index e3ed6b92d95f4fd061f9de1a17e776358af71763..a86d56ebe2cfecca96e8dbf2f108fd2842a7939a 100644
|
2019-04-06 16:25:21 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
2020-11-03 03:22:15 +01:00
|
|
|
@@ -908,12 +908,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
2019-04-06 16:25:21 +02: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 19:19:34 +02:00
|
|
|
if (this.tickingTileEntities) {
|
2020-08-25 04:22:08 +02:00
|
|
|
tileentity = this.E(blockposition);
|