Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-16 03:20:07 +01:00
05466e3b47
Upstream has released updates that appear to apply compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing. Bukkit Changes: d2834556 SPIGOT-4219: Event for PigZombies angering. CraftBukkit Changes:a9c796f1
SPIGOT-4184: Fix furnaces not matching Vanilla smelt or animations195f071e
SPIGOT-4219: Event for PigZombies angering.5e3082c7
SPIGOT-4230: Improve legacy block types
41 Zeilen
1.3 KiB
Diff
41 Zeilen
1.3 KiB
Diff
From 4849096581eda2911fc4f3dd36f58e4678e5dc29 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Thu, 27 Aug 2015 01:15:02 -0400
|
|
Subject: [PATCH] Optimize Chunk Access
|
|
|
|
getting a loaded chunk is one of the most hottest pieces of code in the game.
|
|
getChunkAt is called for the same chunk multiple times in a row, often from getType();
|
|
|
|
Optimize this look up by using a Last Access cache.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/ChunkMap.java b/src/main/java/net/minecraft/server/ChunkMap.java
|
|
index 4e51bd301a..7100ec7747 100644
|
|
--- a/src/main/java/net/minecraft/server/ChunkMap.java
|
|
+++ b/src/main/java/net/minecraft/server/ChunkMap.java
|
|
@@ -98,8 +98,22 @@ public class ChunkMap extends Long2ObjectOpenHashMap<Chunk> {
|
|
}
|
|
}
|
|
|
|
+ // Paper start
|
|
+ if (lastChunkByPos != null && i == lastChunkByPos.chunkKey) {
|
|
+ lastChunkByPos = null;
|
|
+ }
|
|
return chunk;
|
|
}
|
|
+ private Chunk lastChunkByPos = null; // Paper
|
|
+
|
|
+ @Override
|
|
+ public Chunk get(long l) {
|
|
+ if (lastChunkByPos != null && l == lastChunkByPos.chunkKey) {
|
|
+ return lastChunkByPos;
|
|
+ }
|
|
+ return super.get(l);
|
|
+ }
|
|
+ // Paper end
|
|
|
|
public Chunk a(Object object) {
|
|
return this.a(((Long) object).longValue());
|
|
--
|
|
2.18.0
|
|
|