35 lines
1.2 KiB
Diff
35 lines
1.2 KiB
Diff
From 5479183572b20794e13a31078bb9e15b04252a18 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 6f8e6db820..82d8aca47f 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;
|
|
@@ -1198,7 +1199,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
|
|
|