Paper/Spigot-Server-Patches/0345-Optimize-Chunk-getPos.patch
Aikar 2a2d9fb508
Improvements to Logging Warnings/Dupe Entities - Resolves #1544
1) Removed "Regen" mode of Dupe UUID resolver, forced safe.
Some servers who updated before we had safe mode added still had this value.

There's really no reason to keep this mode, as we've seen that vanilla
triggers this often and 99.9999999% of cases will be an actual duplicate
that needs to be deleted.

2) Made Vanilla Debug messages about dupe UUIDs and dupe uuid resolve messages
only show up if the debug.entities flag is on. This will stop server owners
from panicing from seeing these logs, and stop opening bug reports on this,
only for us to tell you "don't worry about it".

3) Avoid adding entities to world that are already added to world.

This can be triggered by anything that causes an entity to be added
to the world during the chunk load process, such as chunk conversions.

Issue #1544 was a case of this.

4) Removed debug warning about ExpiringMap.

Nothing more I know to do about this anyways. We recover from it,
stop warning to reduce noise of issues to us.
2018-10-07 15:10:23 -04:00

35 Zeilen
1.2 KiB
Diff

From 7972c755053a2eb8570b3501e8eb955686b05914 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Tue, 28 Aug 2018 21:35:05 -0400
Subject: [PATCH] Optimize Chunk#getPos
Don't create an object just to get chunk coords.
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 80ec314599..6548bdbd31 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -169,8 +169,9 @@ public class Chunk implements IChunkAccess {
// CraftBukkit start
this.bukkitChunk = new org.bukkit.craftbukkit.CraftChunk(this);
this.chunkKey = ChunkCoordIntPair.a(this.locX, this.locZ);
+ this.chunkCoords = new ChunkCoordIntPair(this.locX, this.locZ); // Paper
}
-
+ private final ChunkCoordIntPair chunkCoords; // Paper
public org.bukkit.Chunk bukkitChunk;
public boolean mustSave;
private boolean needsDecoration;
@@ -1190,7 +1191,7 @@ public class Chunk implements IChunkAccess {
}
public ChunkCoordIntPair getPos() {
- return new ChunkCoordIntPair(this.locX, this.locZ);
+ return this.chunkCoords; // Paper
}
public boolean b(int i, int j) {
--
2.19.0