mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-03 21:44:40 +01:00
17fe7a1b43
Looking over the code, this appears to be one "high risk but hopefully unlikely that plugins are causing this to break", this line is however redundant leftovers from spigots tick limiter patch, which should be doing nothing as-is.
35 lines
1.5 KiB
Diff
35 lines
1.5 KiB
Diff
From bbf5a5ff04d56b217118ab54e6c2d91bb16ce7bb 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 aa04b9564..f5156a89a 100644
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
|
@@ -1934,12 +1934,13 @@ public abstract class World implements IEntityAccess, GeneratorAccess, IIBlockAc
|
|
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.J) {
|
|
tileentity = this.E(blockposition);
|
|
--
|
|
2.21.0
|
|
|