Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
10502558e9
2 people had issues where some plugin is doing some reallly insane NMS hackery that created invalid worlds, which caused some errors... Really don't understand what in the world they did, but putting in a dumb guard that shouldn't even be necessary to just not send the sound effect rather than erroring.
33 Zeilen
1.5 KiB
Diff
33 Zeilen
1.5 KiB
Diff
From 0000000000000000000000000000000000000000 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 98ea9bb98a1a447e1ab8a54839d263ee1cad58ff..7821d4cd05200ca32ba7e2c7cc7e9ff476d3a236 100644
|
|
--- a/src/main/java/net/minecraft/server/World.java
|
|
+++ b/src/main/java/net/minecraft/server/World.java
|
|
@@ -999,12 +999,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
|
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.e(blockposition);
|