mirror of https://github.com/YatopiaMC/Yatopia.git
37 lines
2.3 KiB
Diff
37 lines
2.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Paul Sauve <paul@technove.co>
|
|
Date: Mon, 26 Apr 2021 11:26:37 -0500
|
|
Subject: [PATCH] Cache coordinate key for micro opt
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java
|
|
index 86f156587a0939b28c5cf6f64907255c1c4f8b35..06157bb07cce3ba24087ceaca7138b5609b37b5b 100644
|
|
--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java
|
|
+++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java
|
|
@@ -58,6 +58,7 @@ public class PlayerChunk {
|
|
private int ticketLevel; public final void setTicketLevel(final int level) { this.ticketLevel = level; } // Tuinity - OBFHELPER
|
|
volatile int n; public final int getCurrentPriority() { return n; } // Paper - OBFHELPER - make volatile since this is concurrently accessed
|
|
public final ChunkCoordIntPair location; // Paper - private -> public
|
|
+ private final long coordinateKey; // Airplane - cache key for location
|
|
private boolean p;
|
|
private final ShortSet[] dirtyBlocks;
|
|
private int r;
|
|
@@ -80,7 +81,7 @@ public class PlayerChunk {
|
|
com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<EntityPlayer> playersInChunkTickRange;
|
|
|
|
void updateRanges() {
|
|
- long key = net.minecraft.server.MCUtil.getCoordinateKey(this.location);
|
|
+ long key = this.coordinateKey; //net.minecraft.server.MCUtil.getCoordinateKey(this.location); // Airplane - use cached key
|
|
this.playersInMobSpawnRange = this.chunkMap.playerMobSpawnMap.getObjectsInRange(key);
|
|
this.playersInChunkTickRange = this.chunkMap.playerChunkTickRangeMap.getObjectsInRange(key);
|
|
// Tuinity start - optimise checkDespawn
|
|
@@ -232,7 +233,7 @@ public class PlayerChunk {
|
|
this.entityTickingFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE;
|
|
this.chunkSave = CompletableFuture.completedFuture(null); // CraftBukkit - decompile error
|
|
this.dirtyBlocks = new ShortSet[16];
|
|
- this.location = chunkcoordintpair;
|
|
+ this.location = chunkcoordintpair; this.coordinateKey = net.minecraft.server.MCUtil.getCoordinateKey(this.location); // Airplane
|
|
this.lightEngine = lightengine;
|
|
this.u = playerchunk_c;
|
|
this.players = playerchunk_d;
|