Optimize Loaded Chunks Cache Lookups
Reduces number of instructions a chunk lookup does when accessing the last chunk cache. This reduces amount of work and opcodes and allows better inlining. In lots of profiling comparisons, this optimization was able to reduce the cost of repeated chunk lookups that hit the cache pretty significantly.
This commit is contained in:
parent
6bf12bff71
commit
4768e3c4ed
35 changed files with 182 additions and 181 deletions
|
@ -2411,7 +2411,7 @@ index 1b2f415e3ed7f6dca12d13cd098cb4ec3af54020..64e8088d394ddcda59d0209883b778ab
|
|||
@Override
|
||||
public BlockPosition immutableCopy() {
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 225e8fef6741d9bdbc8ac86cd17e54ddbf04a9e8..4e1e7cb088f1b5d07ace5025c486f2ee67667511 100644
|
||||
index 225e8fef6741d9bdbc8ac86cd17e54ddbf04a9e8..8d5598fab64ce3ac58121302dca4b528edd26563 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -26,7 +26,7 @@ public class Chunk implements IChunkAccess {
|
||||
|
@ -2428,20 +2428,21 @@ index 225e8fef6741d9bdbc8ac86cd17e54ddbf04a9e8..4e1e7cb088f1b5d07ace5025c486f2ee
|
|||
@Nullable
|
||||
private Consumer<Chunk> v;
|
||||
- private final ChunkCoordIntPair loc;
|
||||
+ private final ChunkCoordIntPair loc; public final long coordinateKey; // Paper - cache coordinate key
|
||||
+ private final ChunkCoordIntPair loc; public final long coordinateKey; public final int locX; public final int locZ; // Paper - cache coordinate key
|
||||
private volatile boolean x;
|
||||
|
||||
public Chunk(World world, ChunkCoordIntPair chunkcoordintpair, BiomeStorage biomestorage) {
|
||||
@@ -66,7 +66,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -66,7 +66,8 @@ public class Chunk implements IChunkAccess {
|
||||
this.n = new ShortList[16];
|
||||
this.entitySlices = (List[]) (new List[16]); // Spigot
|
||||
this.world = (WorldServer) world; // CraftBukkit - type
|
||||
- this.loc = chunkcoordintpair;
|
||||
+ this.loc = chunkcoordintpair; this.coordinateKey = MCUtil.getCoordinateKey(chunkcoordintpair); // Paper - cache coordinate key
|
||||
+ this.locX = chunkcoordintpair.x; this.locZ = chunkcoordintpair.z; // Paper - reduce need for field look ups
|
||||
+ this.loc = chunkcoordintpair; this.coordinateKey = ChunkCoordIntPair.pair(locX, locZ); // Paper - cache long key
|
||||
this.i = chunkconverter;
|
||||
HeightMap.Type[] aheightmap_type = HeightMap.Type.values();
|
||||
int j = aheightmap_type.length;
|
||||
@@ -112,6 +112,110 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -112,6 +113,110 @@ public class Chunk implements IChunkAccess {
|
||||
public final org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer persistentDataContainer = new org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer(DATA_TYPE_REGISTRY);
|
||||
// CraftBukkit end
|
||||
|
||||
|
@ -2552,7 +2553,7 @@ index 225e8fef6741d9bdbc8ac86cd17e54ddbf04a9e8..4e1e7cb088f1b5d07ace5025c486f2ee
|
|||
public Chunk(World world, ProtoChunk protochunk) {
|
||||
this(world, protochunk.getPos(), protochunk.getBiomeIndex(), protochunk.p(), protochunk.n(), protochunk.o(), protochunk.getInhabitedTime(), protochunk.getSections(), (Consumer) null);
|
||||
Iterator iterator = protochunk.y().iterator();
|
||||
@@ -217,6 +321,18 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -217,6 +322,18 @@ public class Chunk implements IChunkAccess {
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2571,7 +2572,7 @@ index 225e8fef6741d9bdbc8ac86cd17e54ddbf04a9e8..4e1e7cb088f1b5d07ace5025c486f2ee
|
|||
@Override
|
||||
public Fluid getFluid(BlockPosition blockposition) {
|
||||
return this.a(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
@@ -356,6 +472,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -356,6 +473,7 @@ public class Chunk implements IChunkAccess {
|
||||
entity.chunkX = this.loc.x;
|
||||
entity.chunkY = k;
|
||||
entity.chunkZ = this.loc.z;
|
||||
|
@ -2579,7 +2580,7 @@ index 225e8fef6741d9bdbc8ac86cd17e54ddbf04a9e8..4e1e7cb088f1b5d07ace5025c486f2ee
|
|||
this.entitySlices[k].add(entity);
|
||||
}
|
||||
|
||||
@@ -378,6 +495,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -378,6 +496,7 @@ public class Chunk implements IChunkAccess {
|
||||
}
|
||||
|
||||
this.entitySlices[i].remove(entity);
|
||||
|
@ -2587,7 +2588,7 @@ index 225e8fef6741d9bdbc8ac86cd17e54ddbf04a9e8..4e1e7cb088f1b5d07ace5025c486f2ee
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -399,6 +517,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -399,6 +518,7 @@ public class Chunk implements IChunkAccess {
|
||||
return this.a(blockposition, Chunk.EnumTileEntityState.CHECK);
|
||||
}
|
||||
|
||||
|
@ -2595,7 +2596,7 @@ index 225e8fef6741d9bdbc8ac86cd17e54ddbf04a9e8..4e1e7cb088f1b5d07ace5025c486f2ee
|
|||
@Nullable
|
||||
public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) {
|
||||
// CraftBukkit start
|
||||
@@ -510,7 +629,25 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -510,7 +630,25 @@ public class Chunk implements IChunkAccess {
|
||||
|
||||
// CraftBukkit start
|
||||
public void loadCallback() {
|
||||
|
@ -2621,7 +2622,7 @@ index 225e8fef6741d9bdbc8ac86cd17e54ddbf04a9e8..4e1e7cb088f1b5d07ace5025c486f2ee
|
|||
if (server != null) {
|
||||
/*
|
||||
* If it's a new world, the first few chunks are generated inside
|
||||
@@ -549,6 +686,22 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -549,6 +687,22 @@ public class Chunk implements IChunkAccess {
|
||||
server.getPluginManager().callEvent(unloadEvent);
|
||||
// note: saving can be prevented, but not forced if no saving is actually required
|
||||
this.mustNotSave = !unloadEvent.isSaveChunk();
|
||||
|
@ -2745,7 +2746,7 @@ index ae61d0a7676bf06c8c9aa5c68ccb8dd4baf326b6..b12e43ed13a1a9d7d418831b8988c30a
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index 84407dfd46138359d42ddf8fd5c462a5f494d46b..6f3a0754ac2c1cbe4a4b8775a2cf9248524a1831 100644
|
||||
index 84407dfd46138359d42ddf8fd5c462a5f494d46b..20f62f6f7704f47f86179d03b4e55a61e0149627 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -17,6 +17,10 @@ import java.util.function.Consumer;
|
||||
|
@ -2768,7 +2769,7 @@ index 84407dfd46138359d42ddf8fd5c462a5f494d46b..6f3a0754ac2c1cbe4a4b8775a2cf9248
|
|||
private final LightEngineThreaded lightEngine;
|
||||
private final ChunkProviderServer.a serverThreadQueue;
|
||||
public final PlayerChunkMap playerChunkMap;
|
||||
@@ -37,6 +41,167 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -37,6 +41,158 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
private final IChunkAccess[] cacheChunk = new IChunkAccess[4];
|
||||
@Nullable
|
||||
private SpawnerCreature.d p;
|
||||
|
@ -2777,13 +2778,8 @@ index 84407dfd46138359d42ddf8fd5c462a5f494d46b..6f3a0754ac2c1cbe4a4b8775a2cf9248
|
|||
+ final Long2ObjectOpenHashMap<Chunk> loadedChunkMap = new Long2ObjectOpenHashMap<>(8192, 0.5f);
|
||||
+
|
||||
+ private final Chunk[] lastLoadedChunks = new Chunk[4 * 4];
|
||||
+ private final long[] lastLoadedChunkKeys = new long[4 * 4];
|
||||
+
|
||||
+ {
|
||||
+ java.util.Arrays.fill(this.lastLoadedChunkKeys, MCUtil.INVALID_CHUNK_KEY);
|
||||
+ }
|
||||
+
|
||||
+ private static int getCacheKey(int x, int z) {
|
||||
+ private static int getChunkCacheKey(int x, int z) {
|
||||
+ return x & 3 | ((z & 3) << 2);
|
||||
+ }
|
||||
+
|
||||
|
@ -2797,12 +2793,9 @@ index 84407dfd46138359d42ddf8fd5c462a5f494d46b..6f3a0754ac2c1cbe4a4b8775a2cf9248
|
|||
+
|
||||
+ // rewrite cache if we have to
|
||||
+ // we do this since we also cache null chunks
|
||||
+ int cacheKey = getCacheKey(chunk.getPos().x, chunk.getPos().z);
|
||||
+ int cacheKey = getChunkCacheKey(chunk.locX, chunk.locZ);
|
||||
+
|
||||
+ long cachedKey = this.lastLoadedChunkKeys[cacheKey];
|
||||
+ if (cachedKey == chunk.coordinateKey) {
|
||||
+ this.lastLoadedChunks[cacheKey] = chunk;
|
||||
+ }
|
||||
+ this.lastLoadedChunks[cacheKey] = chunk;
|
||||
+ }
|
||||
+
|
||||
+ void removeLoadedChunk(Chunk chunk) {
|
||||
|
@ -2815,36 +2808,35 @@ index 84407dfd46138359d42ddf8fd5c462a5f494d46b..6f3a0754ac2c1cbe4a4b8775a2cf9248
|
|||
+
|
||||
+ // rewrite cache if we have to
|
||||
+ // we do this since we also cache null chunks
|
||||
+ int cacheKey = getCacheKey(chunk.getPos().x, chunk.getPos().z);
|
||||
+ int cacheKey = getChunkCacheKey(chunk.locX, chunk.locZ);
|
||||
+
|
||||
+ long cachedKey = this.lastLoadedChunkKeys[cacheKey];
|
||||
+ if (cachedKey == chunk.coordinateKey) {
|
||||
+ Chunk cachedChunk = this.lastLoadedChunks[cacheKey];
|
||||
+ if (cachedChunk != null && cachedChunk.coordinateKey == chunk.coordinateKey) {
|
||||
+ this.lastLoadedChunks[cacheKey] = null;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public Chunk getChunkAtIfLoadedMainThread(int x, int z) {
|
||||
+ int cacheKey = getCacheKey(x, z);
|
||||
+ long chunkKey = MCUtil.getCoordinateKey(x, z);
|
||||
+ public final Chunk getChunkAtIfLoadedMainThread(int x, int z) {
|
||||
+ int cacheKey = getChunkCacheKey(x, z);
|
||||
+
|
||||
+ long cachedKey = this.lastLoadedChunkKeys[cacheKey];
|
||||
+ if (cachedKey == chunkKey) {
|
||||
+ Chunk cachedChunk = this.lastLoadedChunks[cacheKey];
|
||||
+ if (cachedChunk != null && cachedChunk.locX == x & cachedChunk.locZ == z) {
|
||||
+ return this.lastLoadedChunks[cacheKey];
|
||||
+ }
|
||||
+
|
||||
+ Chunk ret = this.loadedChunkMap.get(chunkKey);
|
||||
+ long chunkKey = ChunkCoordIntPair.pair(x, z);
|
||||
+
|
||||
+ this.lastLoadedChunkKeys[cacheKey] = chunkKey;
|
||||
+ this.lastLoadedChunks[cacheKey] = ret;
|
||||
+
|
||||
+ return ret;
|
||||
+ cachedChunk = this.loadedChunkMap.get(chunkKey);
|
||||
+ // Skipping a null check to avoid extra instructions to improve inline capability
|
||||
+ this.lastLoadedChunks[cacheKey] = cachedChunk;
|
||||
+ return cachedChunk;
|
||||
+ }
|
||||
+
|
||||
+ public Chunk getChunkAtIfLoadedMainThreadNoCache(int x, int z) {
|
||||
+ return this.loadedChunkMap.get(MCUtil.getCoordinateKey(x, z));
|
||||
+ public final Chunk getChunkAtIfLoadedMainThreadNoCache(int x, int z) {
|
||||
+ return this.loadedChunkMap.get(ChunkCoordIntPair.pair(x, z));
|
||||
+ }
|
||||
+
|
||||
+ public Chunk getChunkAtMainThread(int x, int z) {
|
||||
+ public final Chunk getChunkAtMainThread(int x, int z) {
|
||||
+ Chunk ret = this.getChunkAtIfLoadedMainThread(x, z);
|
||||
+ if (ret != null) {
|
||||
+ return ret;
|
||||
|
@ -2889,7 +2881,7 @@ index 84407dfd46138359d42ddf8fd5c462a5f494d46b..6f3a0754ac2c1cbe4a4b8775a2cf9248
|
|||
+ throw new IllegalStateException();
|
||||
+ }
|
||||
+ ChunkCoordIntPair chunkPos = new ChunkCoordIntPair(x, z);
|
||||
+ Long identifier = Long.valueOf(this.chunkFutureAwaitCounter++);
|
||||
+ Long identifier = this.chunkFutureAwaitCounter++;
|
||||
+ this.chunkMapDistance.addTicketAtLevel(TicketType.FUTURE_AWAIT, chunkPos, ticketLevel, identifier);
|
||||
+ this.tickDistanceManager();
|
||||
+
|
||||
|
@ -2936,7 +2928,7 @@ index 84407dfd46138359d42ddf8fd5c462a5f494d46b..6f3a0754ac2c1cbe4a4b8775a2cf9248
|
|||
|
||||
public ChunkProviderServer(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, ChunkGenerator chunkgenerator, int i, boolean flag, WorldLoadListener worldloadlistener, Supplier<WorldPersistentData> supplier) {
|
||||
this.world = worldserver;
|
||||
@@ -90,6 +255,49 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -90,6 +246,49 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
this.cacheChunk[0] = ichunkaccess;
|
||||
}
|
||||
|
||||
|
@ -2986,7 +2978,7 @@ index 84407dfd46138359d42ddf8fd5c462a5f494d46b..6f3a0754ac2c1cbe4a4b8775a2cf9248
|
|||
@Nullable
|
||||
@Override
|
||||
public IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag) {
|
||||
@@ -372,10 +580,9 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -372,10 +571,9 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
|
||||
this.p = spawnercreature_d;
|
||||
this.world.getMethodProfiler().exit();
|
||||
|
@ -3109,7 +3101,7 @@ index 1e7f5d77700a1ed98c5f50ea82fb57b5e556496a..09ac187ba8ff52f6fa1f0d5d00a13851
|
|||
// CraftBukkit start - fire event
|
||||
setGoalTarget(entityliving, EntityTargetEvent.TargetReason.UNKNOWN, true);
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index ce8d11eb47c1bf1d73eee69ba0f94d7a63cc5518..c6d3b5c8b14808e10a64d6bf1ef971f8bcdbd48f 100644
|
||||
index 61b06b81ac135734c9fe271ff87ef1d4fcb9d75b..f388ded80048a695e72dde393992d37f99df6ef9 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -138,6 +138,7 @@ public abstract class EntityLiving extends Entity {
|
||||
|
@ -3942,7 +3934,7 @@ index 8bdda63a2807635e8780481244251f6e35c13627..36a7e41cc5036345929ebf4d2fa160a8
|
|||
int j = 0;
|
||||
ChunkSection[] achunksection = chunk.getSections();
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
|
||||
index ce324c1c3ae1b7cddf962a6eb93f91000fa41d50..0f82376ac386ce4dfcf2799fbd92a32ca37095e5 100644
|
||||
index 80118f5a347f5cc21945172b2cc94ad3f640a75e..7b4717ffc31bc406c04d98207a15804502bd3579 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
|
||||
@@ -21,9 +21,9 @@ public class PlayerChunk {
|
||||
|
@ -4400,7 +4392,7 @@ index ff41038ce6d2c1a8093bce3539070fa0ccfd61c2..ed0f9c5d29c4f88b7beee4b0ecdd7a56
|
|||
return VoxelShapes.b;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 2ffa56f3580b524c3593505585410dc347e1780c..cb09b6947080f742b15b166e96e91231fcb5e79e 100644
|
||||
index 2ffa56f3580b524c3593505585410dc347e1780c..9c6b15e70bfb7db853c8e4a8dfd7b24bae27a70c 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -22,6 +22,7 @@ import org.bukkit.craftbukkit.SpigotTimings; // Spigot
|
||||
|
@ -4487,6 +4479,15 @@ index 2ffa56f3580b524c3593505585410dc347e1780c..cb09b6947080f742b15b166e96e91231
|
|||
Fluid fluid = this.getFluid(blockposition);
|
||||
|
||||
return this.setTypeAndData(blockposition, fluid.getBlockData(), 3 | (flag ? 64 : 0));
|
||||
@@ -517,7 +552,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
if (isOutsideWorld(blockposition)) {
|
||||
return Blocks.VOID_AIR.getBlockData();
|
||||
} else {
|
||||
- Chunk chunk = this.getChunkAt(blockposition.getX() >> 4, blockposition.getZ() >> 4);
|
||||
+ Chunk chunk = (Chunk) this.getChunkProvider().getChunkAt(blockposition.getX() >> 4, blockposition.getZ() >> 4, ChunkStatus.FULL, true); // Paper - manually inline to reduce hops and avoid unnecessary null check to reduce total byte code size, this should never return null and if it does we will see it the next line but the real stack trace will matter in the chunk engine
|
||||
|
||||
return chunk.getType(blockposition);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java
|
||||
index 5719ef9714e9680596a08c42c33508c16c0e676a..bb0f30f182856d2701fde9b1a65eeb987462104a 100644
|
||||
--- a/src/main/java/net/minecraft/server/WorldBorder.java
|
||||
|
|
|
@ -8,7 +8,7 @@ This enables us a fast reference to the entities current chunk instead
|
|||
of having to look it up by hashmap lookups.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 157eccc8e45566db527c7d46d3b3d235c802c8f7..e46ed143a52eab4af15cc76606992c3bf68156c3 100644
|
||||
index 8d5598fab64ce3ac58121302dca4b528edd26563..402f6ed90132f48d560a21f56cd50121c42fb34a 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -56,11 +56,36 @@ public class Chunk implements IChunkAccess {
|
||||
|
@ -49,7 +49,7 @@ index 157eccc8e45566db527c7d46d3b3d235c802c8f7..e46ed143a52eab4af15cc76606992c3b
|
|||
this.l = Maps.newHashMap();
|
||||
this.m = Maps.newHashMap();
|
||||
this.n = new ShortList[16];
|
||||
@@ -469,6 +494,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -470,6 +495,7 @@ public class Chunk implements IChunkAccess {
|
||||
}
|
||||
|
||||
entity.inChunk = true;
|
||||
|
@ -57,7 +57,7 @@ index 157eccc8e45566db527c7d46d3b3d235c802c8f7..e46ed143a52eab4af15cc76606992c3b
|
|||
entity.chunkX = this.loc.x;
|
||||
entity.chunkY = k;
|
||||
entity.chunkZ = this.loc.z;
|
||||
@@ -481,6 +507,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -482,6 +508,7 @@ public class Chunk implements IChunkAccess {
|
||||
((HeightMap) this.heightMap.get(heightmap_type)).a(along);
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ index 157eccc8e45566db527c7d46d3b3d235c802c8f7..e46ed143a52eab4af15cc76606992c3b
|
|||
public void b(Entity entity) {
|
||||
this.a(entity, entity.chunkY);
|
||||
}
|
||||
@@ -494,7 +521,12 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -495,7 +522,12 @@ public class Chunk implements IChunkAccess {
|
||||
i = this.entitySlices.length - 1;
|
||||
}
|
||||
|
||||
|
@ -137,7 +137,7 @@ index b8f0653e3e82824a62dfe64348a33ab6432b4e17..b9ffd000c97111678d45fd55dc9c207e
|
|||
|
||||
@Nullable
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index 8c1a66b921c6a63a5446efa24f2e2115010cae41..c20f161eb42159edcfe2c47e3749d88fba9b4747 100644
|
||||
index 2770441b13cb993b222c6bf31c11711f001b74c0..db7c4011c8b90b6daca2b48a6d9ec447d31f7197 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -145,6 +145,7 @@ import net.minecraft.server.EntityZombieVillager;
|
||||
|
|
|
@ -6,7 +6,7 @@ Subject: [PATCH] Store counts for each Entity/Block Entity Type
|
|||
Opens door for future patches to optimize performance
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index e46ed143a52eab4af15cc76606992c3bf68156c3..18e18e6cabe94a23ebfc9f9d8279837105f1d976 100644
|
||||
index 402f6ed90132f48d560a21f56cd50121c42fb34a..9f1db6491dafa8e32395db381466a3447395da7e 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -57,15 +57,19 @@ public class Chunk implements IChunkAccess {
|
||||
|
@ -37,7 +37,7 @@ index e46ed143a52eab4af15cc76606992c3bf68156c3..18e18e6cabe94a23ebfc9f9d82798371
|
|||
}
|
||||
return removed;
|
||||
}
|
||||
@@ -493,6 +498,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -494,6 +499,7 @@ public class Chunk implements IChunkAccess {
|
||||
k = this.entitySlices.length - 1;
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,7 @@ index e46ed143a52eab4af15cc76606992c3bf68156c3..18e18e6cabe94a23ebfc9f9d82798371
|
|||
entity.inChunk = true;
|
||||
entity.setCurrentChunk(this); // Paper
|
||||
entity.chunkX = this.loc.x;
|
||||
@@ -526,6 +532,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -527,6 +533,7 @@ public class Chunk implements IChunkAccess {
|
||||
if (!this.entitySlices[i].remove(entity)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -738,10 +738,10 @@ index 871b79cb2c63525c430c257f00b2cf70157aa476..d847326b0099a0c05a085d5d62de6304
|
|||
private String name;
|
||||
@Nullable
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 23b89ef64deddd3e0db21829aad5a2da1e427be1..0014bf4f47375ebe4ef17110e8f02a315a9dcb43 100644
|
||||
index 9f1db6491dafa8e32395db381466a3447395da7e..19ddcabdc17c23c4ec46f5669ba0fd56d4bbee58 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -696,6 +696,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -697,6 +697,7 @@ public class Chunk implements IChunkAccess {
|
||||
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(this.bukkitChunk, this.needsDecoration));
|
||||
|
||||
if (this.needsDecoration) {
|
||||
|
@ -749,7 +749,7 @@ index 23b89ef64deddd3e0db21829aad5a2da1e427be1..0014bf4f47375ebe4ef17110e8f02a31
|
|||
this.needsDecoration = false;
|
||||
java.util.Random random = new java.util.Random();
|
||||
random.setSeed(world.getSeed());
|
||||
@@ -715,6 +716,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -716,6 +717,7 @@ public class Chunk implements IChunkAccess {
|
||||
}
|
||||
}
|
||||
server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(bukkitChunk));
|
||||
|
@ -758,10 +758,10 @@ index 23b89ef64deddd3e0db21829aad5a2da1e427be1..0014bf4f47375ebe4ef17110e8f02a31
|
|||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index 6f3a0754ac2c1cbe4a4b8775a2cf9248524a1831..1daf3bea2cc488276b33e624e1591a71af1459d9 100644
|
||||
index 20f62f6f7704f47f86179d03b4e55a61e0149627..dd78f093f6ee9822c4a31d87f3c83d2f8fa4fcf8 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -323,11 +323,13 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -314,11 +314,13 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
}
|
||||
|
||||
gameprofilerfiller.c("getChunkCacheMiss");
|
||||
|
@ -777,7 +777,7 @@ index 6f3a0754ac2c1cbe4a4b8775a2cf9248524a1831..1daf3bea2cc488276b33e624e1591a71
|
|||
ichunkaccess = (IChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> {
|
||||
return ichunkaccess1;
|
||||
}, (playerchunk_failure) -> {
|
||||
@@ -514,7 +516,9 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -505,7 +507,9 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
|
||||
public void save(boolean flag) {
|
||||
this.tickDistanceManager();
|
||||
|
@ -787,7 +787,7 @@ index 6f3a0754ac2c1cbe4a4b8775a2cf9248524a1831..1daf3bea2cc488276b33e624e1591a71
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -551,7 +555,9 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -542,7 +546,9 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
this.tickDistanceManager();
|
||||
this.world.timings.doChunkMap.stopTiming(); // Spigot
|
||||
this.world.getMethodProfiler().exitEnter("chunks");
|
||||
|
@ -797,7 +797,7 @@ index 6f3a0754ac2c1cbe4a4b8775a2cf9248524a1831..1daf3bea2cc488276b33e624e1591a71
|
|||
this.world.timings.doChunkUnload.startTiming(); // Spigot
|
||||
this.world.getMethodProfiler().exitEnter("unload");
|
||||
this.playerChunkMap.unloadChunks(booleansupplier);
|
||||
@@ -575,8 +581,10 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -566,8 +572,10 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
boolean flag2 = world.ticksPerAnimalSpawns != 0L && worlddata.getTime() % world.ticksPerAnimalSpawns == 0L; // CraftBukkit
|
||||
|
||||
this.world.getMethodProfiler().enter("naturalSpawnCount");
|
||||
|
@ -808,7 +808,7 @@ index 6f3a0754ac2c1cbe4a4b8775a2cf9248524a1831..1daf3bea2cc488276b33e624e1591a71
|
|||
|
||||
this.p = spawnercreature_d;
|
||||
this.world.getMethodProfiler().exit();
|
||||
@@ -587,7 +595,9 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -578,7 +586,9 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
|
||||
if (optional.isPresent()) {
|
||||
this.world.getMethodProfiler().enter("broadcast");
|
||||
|
@ -818,7 +818,7 @@ index 6f3a0754ac2c1cbe4a4b8775a2cf9248524a1831..1daf3bea2cc488276b33e624e1591a71
|
|||
this.world.getMethodProfiler().exit();
|
||||
Optional<Chunk> optional1 = ((Either) playerchunk.b().getNow(PlayerChunk.UNLOADED_CHUNK)).left();
|
||||
|
||||
@@ -601,25 +611,25 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -592,25 +602,25 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
SpawnerCreature.a(this.world, chunk, spawnercreature_d, this.allowAnimals, this.allowMonsters, flag2);
|
||||
}
|
||||
|
||||
|
@ -1636,7 +1636,7 @@ index b9ffd000c97111678d45fd55dc9c207ebadc140e..f1d0e2faffb3ef27f5a41d06d0ff7d78
|
|||
private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry();
|
||||
public CraftPersistentDataContainer persistentDataContainer;
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index cb09b6947080f742b15b166e96e91231fcb5e79e..e24c5e20f128e787f0a0e58716944dd8748f73c1 100644
|
||||
index 9c6b15e70bfb7db853c8e4a8dfd7b24bae27a70c..b4aeea40ee04fd2ed10484f40d25dbd2a3a01b53 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -18,7 +18,6 @@ import org.apache.logging.log4j.Logger;
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Remove invalid mob spawner tile entities
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 30d760ab30ed70ec2e4c37f2e8dbe80006c51f1b..4c051667028ebed6b6f57d4e7d7acbad850c1052 100644
|
||||
index 19ddcabdc17c23c4ec46f5669ba0fd56d4bbee58..0da51a454b599f54f3bd443040cdcac57b1c7d7c 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -611,6 +611,10 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -612,6 +612,10 @@ public class Chunk implements IChunkAccess {
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
|
|
|
@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..f699ce18ca044f813e194ef2786b7ea8
|
|||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 4c051667028ebed6b6f57d4e7d7acbad850c1052..399641433a874cb6426a6092722036446df32eb6 100644
|
||||
index 0da51a454b599f54f3bd443040cdcac57b1c7d7c..81c6ce3ba87da692675bca8b2831a90fabfa4e37 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -1,5 +1,6 @@
|
||||
|
@ -59,7 +59,7 @@ index 4c051667028ebed6b6f57d4e7d7acbad850c1052..399641433a874cb6426a609272203644
|
|||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import it.unimi.dsi.fastutil.longs.LongOpenHashSet;
|
||||
@@ -616,10 +617,15 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -617,10 +618,15 @@ public class Chunk implements IChunkAccess {
|
||||
this.tileEntities.remove(blockposition);
|
||||
// Paper end
|
||||
} else {
|
||||
|
@ -187,7 +187,7 @@ index 1844a6504acc420bdfaaf8f045c569e970d055db..d6aadbda5c5a17976659f57ee04cf9b9
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 70d6ed9a226ab114b090017cec6998a740b2cb66..db637b5f9ed4180844ddc12dc53050a89a4d163d 100644
|
||||
index 895436e36e6ef6f78dfd42e3ef3a0132506663f2..1c54c081c6ea1f422c19db1aa9e1935ce066d910 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -1,5 +1,10 @@
|
||||
|
|
|
@ -33,10 +33,10 @@ index f6a5ebd4c7ec045c8dd6841831f8fcc0b32d964e..63a9ce32fb8b98695e104f7d820cd9b1
|
|||
this.a = i;
|
||||
this.b = j;
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 399641433a874cb6426a6092722036446df32eb6..560d61183f28b0271739548e8b784fdaf97e8a11 100644
|
||||
index 81c6ce3ba87da692675bca8b2831a90fabfa4e37..b6ff6095543d720382786e159a9f1cdd6eb6f166 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -311,12 +311,27 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -312,12 +312,27 @@ public class Chunk implements IChunkAccess {
|
||||
return this.sections;
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ index 5cfddbfe0bd84c994ed7fa4968bcf4fc13381001..420bf7116def909d3dd7dc9a79972344
|
|||
@Override
|
||||
public Fluid getFluid(BlockPosition blockposition) {
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index bfa9b3482251341947da8e6c4def762bf7d725b7..babf153a3cdf13e7055269adace3948f180925fe 100644
|
||||
index 4aa4a8d10b5126125ae420037c5e1faabdbe147b..096a1d3bf0e9c51244ecd9ad2fbd240f3e01f461 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -187,7 +187,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
|
|
|
@ -30,10 +30,10 @@ index 7ed3bcd7b1ef1a371ad1a4c38f183cef022a5363..4faedee40c731920d6fc0e032df71f81
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 7607b0e195611488f3007e91e63f6e30fb636213..bc8eb90c154a3c95f38e275058b620f4c433ac9b 100644
|
||||
index b6ff6095543d720382786e159a9f1cdd6eb6f166..f9ad646f3061914e55e424602abe27da7f1c0865 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -983,7 +983,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -984,7 +984,7 @@ public class Chunk implements IChunkAccess {
|
||||
|
||||
@Override
|
||||
public long getInhabitedTime() {
|
||||
|
|
|
@ -19,10 +19,10 @@ index 1f02038ac259529b555672978867128761d1bd39..33cb25555401203ff0760872e5b5243d
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index bc8eb90c154a3c95f38e275058b620f4c433ac9b..c00a3bdca49946ab3ca1864da3f27e0f05033ff6 100644
|
||||
index f9ad646f3061914e55e424602abe27da7f1c0865..8dd560c8207f14123ab9c9820d8ce7333775db35 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -640,6 +640,12 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -641,6 +641,12 @@ public class Chunk implements IChunkAccess {
|
||||
"Chunk coordinates: " + (this.loc.x * 16) + "," + (this.loc.z * 16));
|
||||
e.printStackTrace();
|
||||
ServerInternalException.reportInternalException(e);
|
||||
|
|
|
@ -9,10 +9,10 @@ from triggering monster spawns on a server.
|
|||
Also a highly more effecient way to blanket block spawns in a world
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index 1daf3bea2cc488276b33e624e1591a71af1459d9..90812ab056acc39e62a43cb208bfd782e2a0c1b7 100644
|
||||
index dd78f093f6ee9822c4a31d87f3c83d2f8fa4fcf8..b6ec5d0f281bac483f210fd8c45a8965cd97cc02 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -590,6 +590,15 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -581,6 +581,15 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
this.world.getMethodProfiler().exit();
|
||||
//List<PlayerChunk> list = Lists.newArrayList(this.playerChunkMap.f()); // Paper
|
||||
//Collections.shuffle(list); // Paper
|
||||
|
|
|
@ -6,10 +6,10 @@ Subject: [PATCH] Mark chunk dirty anytime entities change to guarantee it
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 45d7a06ea51ccc2264a7c3d1518d0b37d089c531..edacc6da62593c94392f460cb6839ed5f8067dd4 100644
|
||||
index 8dd560c8207f14123ab9c9820d8ce7333775db35..90b2a891c5bfa26ab1ff6738f58719a10d5cbed6 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -522,6 +522,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -523,6 +523,7 @@ public class Chunk implements IChunkAccess {
|
||||
entity.chunkZ = this.loc.z;
|
||||
this.entities.add(entity); // Paper - per chunk entity list
|
||||
this.entitySlices[k].add(entity);
|
||||
|
@ -17,7 +17,7 @@ index 45d7a06ea51ccc2264a7c3d1518d0b37d089c531..edacc6da62593c94392f460cb6839ed5
|
|||
}
|
||||
|
||||
@Override
|
||||
@@ -549,6 +550,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -550,6 +551,7 @@ public class Chunk implements IChunkAccess {
|
||||
return;
|
||||
}
|
||||
entityCounts.decrement(entity.getMinecraftKeyString());
|
||||
|
|
|
@ -9,10 +9,10 @@ This should hopefully avoid duplicate entities ever being created
|
|||
if the entity was to end up in 2 different chunk slices
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index edacc6da62593c94392f460cb6839ed5f8067dd4..18d55cea6258c7b59b79aec1bcdf358944d5b527 100644
|
||||
index 90b2a891c5bfa26ab1ff6738f58719a10d5cbed6..8b9454fd44fe1d14eb6d46f772be56937c99595a 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -513,6 +513,25 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -514,6 +514,25 @@ public class Chunk implements IChunkAccess {
|
||||
if (k >= this.entitySlices.length) {
|
||||
k = this.entitySlices.length - 1;
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ index edacc6da62593c94392f460cb6839ed5f8067dd4..18d55cea6258c7b59b79aec1bcdf3589
|
|||
|
||||
if (!entity.inChunk || entity.getCurrentChunk() != this) entityCounts.increment(entity.getMinecraftKeyString()); // Paper
|
||||
entity.inChunk = true;
|
||||
@@ -522,6 +541,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -523,6 +542,7 @@ public class Chunk implements IChunkAccess {
|
||||
entity.chunkZ = this.loc.z;
|
||||
this.entities.add(entity); // Paper - per chunk entity list
|
||||
this.entitySlices[k].add(entity);
|
||||
|
@ -46,7 +46,7 @@ index edacc6da62593c94392f460cb6839ed5f8067dd4..18d55cea6258c7b59b79aec1bcdf3589
|
|||
this.markDirty(); // Paper
|
||||
}
|
||||
|
||||
@@ -546,6 +566,10 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -547,6 +567,10 @@ public class Chunk implements IChunkAccess {
|
||||
|
||||
// Paper start
|
||||
if (entity.currentChunk != null && entity.currentChunk.get() == this) entity.setCurrentChunk(null);
|
||||
|
|
|
@ -23,10 +23,10 @@ index 9cb2f3b31921870ddba044840e99eb04babe26bb..f0a836db74ad3e20778d3863223bc9a3
|
|||
MutablePair<Integer, Map<ChunkCoordIntPair, Integer>> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap()));
|
||||
ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.chunkX, e.chunkZ);
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index cce7d64efceb9d2336aca1589a7a07379ec3f134..e0f1eb19ea1ceebe00a428c753fec13d317869dd 100644
|
||||
index 8b9454fd44fe1d14eb6d46f772be56937c99595a..a35cd4df85f0043b83f2f70cec6091d6bae89767 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -822,6 +822,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -823,6 +823,7 @@ public class Chunk implements IChunkAccess {
|
||||
|
||||
for (int i1 = 0; i1 < l; ++i1) {
|
||||
Entity entity1 = (Entity) list1.get(i1);
|
||||
|
@ -34,7 +34,7 @@ index cce7d64efceb9d2336aca1589a7a07379ec3f134..e0f1eb19ea1ceebe00a428c753fec13d
|
|||
|
||||
if (entity1.getBoundingBox().c(axisalignedbb) && entity1 != entity) {
|
||||
if (predicate == null || predicate.test(entity1)) {
|
||||
@@ -859,6 +860,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -860,6 +861,7 @@ public class Chunk implements IChunkAccess {
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
T entity = (T) iterator.next(); // CraftBukkit - decompile error
|
||||
|
@ -42,7 +42,7 @@ index cce7d64efceb9d2336aca1589a7a07379ec3f134..e0f1eb19ea1ceebe00a428c753fec13d
|
|||
|
||||
if ((entitytypes == null || entity.getEntityType() == entitytypes) && entity.getBoundingBox().c(axisalignedbb) && predicate.test(entity)) {
|
||||
list.add(entity);
|
||||
@@ -881,6 +883,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -882,6 +884,7 @@ public class Chunk implements IChunkAccess {
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
T t0 = (T) iterator.next(); // CraftBukkit - decompile error
|
||||
|
|
|
@ -81,10 +81,10 @@ index 480f3d69a5b599e822cc7acc171da2b816797f96..160de2b79219f526187ffeb9e49c5656
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index e0f1eb19ea1ceebe00a428c753fec13d317869dd..fdd754a06fc6566b448d9847e210e7cd35fccd89 100644
|
||||
index a35cd4df85f0043b83f2f70cec6091d6bae89767..714ef2a305fe98895ab5eb9190826bafbb157f59 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -502,6 +502,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -503,6 +503,7 @@ public class Chunk implements IChunkAccess {
|
||||
if (i != this.loc.x || j != this.loc.z) {
|
||||
Chunk.LOGGER.warn("Wrong location! ({}, {}) should be ({}, {}), {}", i, j, this.loc.x, this.loc.z, entity);
|
||||
entity.dead = true;
|
||||
|
|
|
@ -8,7 +8,7 @@ This patch also adds a chunk status cache on region files (note that
|
|||
its only purpose is to cache the status on DISK)
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index ac706ac98cdfb1b0c754cd4941cf1d9996f530d7..0c5a14d98f824591c553684191b32ccb507ebe2f 100644
|
||||
index 534bcc215b0efb8561f7489f01fe49d34cba4c4f..c4909536af2af2949a6e7ee8f72f39a6622911f5 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -30,7 +30,7 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
|
@ -20,7 +20,7 @@ index ac706ac98cdfb1b0c754cd4941cf1d9996f530d7..0c5a14d98f824591c553684191b32ccb
|
|||
public final PlayerChunkMap playerChunkMap;
|
||||
private final WorldPersistentData worldPersistentData;
|
||||
private long lastTickTime;
|
||||
@@ -296,6 +296,21 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -287,6 +287,21 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ index 2fde0b6ca8f38a998ac73b68be61fbfea9088cee..fa03834dacacf7ae6a326c88007256a2
|
|||
@Nullable
|
||||
private PersistentStructureLegacy c;
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
|
||||
index f2cd43a449b8a474dcfad735239d54678fce2d13..94a6b5742b3ce2cac0f7567117fadeeb05e888ef 100644
|
||||
index 2c73bc1151d5d87ce6eac3f778ebff9c555b0212..346bf40bbf3026d3bf5585f06f42eec6cae95704 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
|
||||
@@ -113,6 +113,19 @@ public class PlayerChunk {
|
||||
|
@ -277,7 +277,7 @@ index de926992e20da3ec433f9c7b4bc73805fd9d36ab..7a15944926427eb6cad976daabe5e710
|
|||
} catch (Throwable throwable1) {
|
||||
throwable = throwable1;
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 07657d884f45959a69998ec510bf14e940e62056..e741d1f966869b057652a93a1ef1785ad152f303 100644
|
||||
index 7287f595c89e0548252a2c39464d4a06d7f71bb7..dd3c24b4de393f4eaca88484ccf94b620fd28bdc 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -19,6 +19,7 @@ import java.util.Objects;
|
||||
|
|
|
@ -29,7 +29,7 @@ index a4fb3961c69afaefe907860977c0c512301344e3..7313916909c50fe6d97776c236c533a6
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index fdd754a06fc6566b448d9847e210e7cd35fccd89..db8de2a5478cdc1ee9157251c3d3d5e2ffaa7953 100644
|
||||
index 714ef2a305fe98895ab5eb9190826bafbb157f59..6b561332e89476dbecc0b2a044e8556c7fa70626 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -43,7 +43,7 @@ public class Chunk implements IChunkAccess {
|
||||
|
@ -42,10 +42,10 @@ index fdd754a06fc6566b448d9847e210e7cd35fccd89..db8de2a5478cdc1ee9157251c3d3d5e2
|
|||
private long inhabitedTime;
|
||||
@Nullable
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index 0c5a14d98f824591c553684191b32ccb507ebe2f..4140de8bcd1ee93f77574d892d32e7c7821be9e0 100644
|
||||
index c4909536af2af2949a6e7ee8f72f39a6622911f5..bd48c23890c1b28e9838612598a5e4bdcb83e8a0 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -536,6 +536,15 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -527,6 +527,15 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
} // Paper - Timings
|
||||
}
|
||||
|
||||
|
|
|
@ -1007,10 +1007,10 @@ index 0000000000000000000000000000000000000000..333763936897befda5bb6c077944d266
|
|||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index db8de2a5478cdc1ee9157251c3d3d5e2ffaa7953..379291bca1cadbb5d82451d7b2c484bc89386172 100644
|
||||
index 6b561332e89476dbecc0b2a044e8556c7fa70626..68a6e8e3425291eb28f1759ecdd54eb80612f3a4 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -426,7 +426,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -427,7 +427,7 @@ public class Chunk implements IChunkAccess {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -1422,7 +1422,7 @@ index 420bf7116def909d3dd7dc9a799723446ddf8f7f..300cbb8b01d94e7eb0cded0c8e118103
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index f2d2258feadab1a1cb5fffdabc8d90949b980342..8c725507caaa7729e1b6b56b14a111765e9427f7 100644
|
||||
index 9408f47f757183f9a08b948043ce1aa849a14a25..7e183072be368cc03bd280ee5dbe404cd029fce8 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -2,6 +2,8 @@ package net.minecraft.server;
|
||||
|
|
|
@ -14,7 +14,7 @@ And since minecart hoppers are used _very_ rarely near we can avoid alot of sear
|
|||
Combined, this adds up a lot.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 379291bca1cadbb5d82451d7b2c484bc89386172..80ddcb1001324a545a20a53b9deff18ddd305bc4 100644
|
||||
index 68a6e8e3425291eb28f1759ecdd54eb80612f3a4..08d122f7f20e3c2cdfeababb41b0a8910760b80b 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -85,6 +85,10 @@ public class Chunk implements IChunkAccess {
|
||||
|
@ -28,7 +28,7 @@ index 379291bca1cadbb5d82451d7b2c484bc89386172..80ddcb1001324a545a20a53b9deff18d
|
|||
// Paper end
|
||||
|
||||
public Chunk(World world, ChunkCoordIntPair chunkcoordintpair, BiomeStorage biomestorage, ChunkConverter chunkconverter, TickList<Block> ticklist, TickList<FluidType> ticklist1, long i, @Nullable ChunkSection[] achunksection, @Nullable Consumer<Chunk> consumer) {
|
||||
@@ -542,6 +546,13 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -543,6 +547,13 @@ public class Chunk implements IChunkAccess {
|
||||
entity.chunkZ = this.loc.z;
|
||||
this.entities.add(entity); // Paper - per chunk entity list
|
||||
this.entitySlices[k].add(entity);
|
||||
|
@ -42,7 +42,7 @@ index 379291bca1cadbb5d82451d7b2c484bc89386172..80ddcb1001324a545a20a53b9deff18d
|
|||
entity.entitySlice = this.entitySlices[k]; // Paper
|
||||
this.markDirty(); // Paper
|
||||
}
|
||||
@@ -574,6 +585,11 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -575,6 +586,11 @@ public class Chunk implements IChunkAccess {
|
||||
if (!this.entitySlices[i].remove(entity)) {
|
||||
return;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ index 379291bca1cadbb5d82451d7b2c484bc89386172..80ddcb1001324a545a20a53b9deff18d
|
|||
entityCounts.decrement(entity.getMinecraftKeyString());
|
||||
this.markDirty(); // Paper
|
||||
// Paper end
|
||||
@@ -859,6 +875,14 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -860,6 +876,14 @@ public class Chunk implements IChunkAccess {
|
||||
for (int k = i; k <= j; ++k) {
|
||||
Iterator iterator = this.entitySlices[k].iterator(); // Spigot
|
||||
|
||||
|
@ -69,7 +69,7 @@ index 379291bca1cadbb5d82451d7b2c484bc89386172..80ddcb1001324a545a20a53b9deff18d
|
|||
while (iterator.hasNext()) {
|
||||
T entity = (T) iterator.next(); // CraftBukkit - decompile error
|
||||
if (entity.shouldBeRemoved) continue; // Paper
|
||||
@@ -879,9 +903,29 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -880,9 +904,29 @@ public class Chunk implements IChunkAccess {
|
||||
i = MathHelper.clamp(i, 0, this.entitySlices.length - 1);
|
||||
j = MathHelper.clamp(j, 0, this.entitySlices.length - 1);
|
||||
|
||||
|
|
|
@ -199,7 +199,7 @@ index e4719a5e7e5ebd91257a9c9b83fa1adad70fd585..9ad822715c9358e5ac2a0e0a0800786a
|
|||
doChunkInfo(sender, args);
|
||||
break;
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index 346da105776a0ae0cb06ed69f1f8f9160695bb85..38f81c88107cc5c9ac6264d7778b121eb3e7a784 100644
|
||||
index 053ba1023b6d1393c0ade589ae53feb22218f413..dbabff7efb887b78545a12ae6bec42b02a3a39e2 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -1,5 +1,6 @@
|
||||
|
@ -2308,10 +2308,10 @@ index 0000000000000000000000000000000000000000..49a594e5f345096cb3b9913b8ee27607
|
|||
+
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index 4140de8bcd1ee93f77574d892d32e7c7821be9e0..2c47eaf07a46b068c446fc7c71da4b9dfcf39656 100644
|
||||
index bd48c23890c1b28e9838612598a5e4bdcb83e8a0..77e17feb56cc28e763640b2e37f66788241e09b4 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -311,11 +311,138 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -302,11 +302,138 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
return playerChunk.getAvailableChunkNow();
|
||||
|
||||
}
|
||||
|
@ -2450,7 +2450,7 @@ index 4140de8bcd1ee93f77574d892d32e7c7821be9e0..2c47eaf07a46b068c446fc7c71da4b9d
|
|||
if (Thread.currentThread() != this.serverThread) {
|
||||
return (IChunkAccess) CompletableFuture.supplyAsync(() -> {
|
||||
return this.getChunkAt(i, j, chunkstatus, flag);
|
||||
@@ -338,11 +465,16 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -329,11 +456,16 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
}
|
||||
|
||||
gameprofilerfiller.c("getChunkCacheMiss");
|
||||
|
@ -2468,7 +2468,7 @@ index 4140de8bcd1ee93f77574d892d32e7c7821be9e0..2c47eaf07a46b068c446fc7c71da4b9d
|
|||
this.world.timings.syncChunkLoad.stopTiming(); // Paper
|
||||
} // Paper
|
||||
ichunkaccess = (IChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> {
|
||||
@@ -408,6 +540,11 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -399,6 +531,11 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
}
|
||||
|
||||
private CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> getChunkFutureMainThread(int i, int j, ChunkStatus chunkstatus, boolean flag) {
|
||||
|
@ -2480,7 +2480,7 @@ index 4140de8bcd1ee93f77574d892d32e7c7821be9e0..2c47eaf07a46b068c446fc7c71da4b9d
|
|||
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j);
|
||||
long k = chunkcoordintpair.pair();
|
||||
int l = 33 + ChunkStatus.a(chunkstatus);
|
||||
@@ -807,11 +944,12 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -798,11 +935,12 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
protected boolean executeNext() {
|
||||
// CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task
|
||||
try {
|
||||
|
@ -2938,7 +2938,7 @@ index 2507bdf7bfa65f1bc728a46322d2a570e566e32c..c470c6527b214026c230feaae0c0875c
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java
|
||||
index dacb8563bc823c8f6f1e1e10f2b8b9894819374f..80a95441ec2b8394b74818ab74de070ba1ce2754 100644
|
||||
index 85f7cfa1fade8d574e7f85d857ab071c66ec4a95..e79ed0b5702688aaa5a86dc5a511c32685c883d9 100644
|
||||
--- a/src/main/java/net/minecraft/server/Main.java
|
||||
+++ b/src/main/java/net/minecraft/server/Main.java
|
||||
@@ -171,6 +171,7 @@ public class Main {
|
||||
|
@ -3010,7 +3010,7 @@ index 4c52c57c02571353f71772e3650932f314da62ca..71daa0cb08d69c16bded510d1a490534
|
|||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
|
||||
index 10dfdecba53cf16f9fae8a2be1144ef8cda1006d..301836c7d465afe82737b0aa5ad68bf51122ff6b 100644
|
||||
index 5d736e4ca6098d97b6c16d2452066fbd35fe123c..a1341617ba5388d1d1f2c91ad158b0210b4505cb 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
|
||||
@@ -129,6 +129,18 @@ public class PlayerChunk {
|
||||
|
@ -3505,7 +3505,7 @@ index 325532e1585beefe1cb341580e0bb3e95020b6fe..7f72d13bb39182666a741d4376921530
|
|||
return this.m;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index ec20617e3f8982b92d6bcd73bc7b622b04bf2fd5..e4d47589d2368c373f920066309b4c5a757906c5 100644
|
||||
index ee8ea27e0878042d15e81ce02c250a9999723928..412442e197fff0010e06ce2b604450b91e2a984e 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -580,6 +580,13 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
||||
|
|
|
@ -11,7 +11,7 @@ it must be enabled by setting the startup flag -Dpaper.debug-sync-loads=true
|
|||
To get a debug log for sync loads, the command is /paper syncloadinfo
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
index 9b8b49be032d7ceebcea8d7b98f999ed7166d0a1..f7d98a5ba54d041eef10b04f821e0958ad898b0a 100644
|
||||
index 9ad822715c9358e5ac2a0e0a0800786a9cee7be3..c80af89b4ad0223577ed9513dcab0a784cc964e4 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java
|
||||
@@ -1,10 +1,14 @@
|
||||
|
@ -286,10 +286,10 @@ index 0000000000000000000000000000000000000000..1a68a8012f83bab9e814159c76b8c371
|
|||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index 2c47eaf07a46b068c446fc7c71da4b9dfcf39656..7278e39d7fb47737b783c482f4c74a82ded163f8 100644
|
||||
index 77e17feb56cc28e763640b2e37f66788241e09b4..2eb38bfcdc0c232da9dad6921df503e5a11de09f 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -472,6 +472,7 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -463,6 +463,7 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
this.world.asyncChunkTaskManager.raisePriority(x, z, com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGHEST_PRIORITY);
|
||||
com.destroystokyo.paper.io.chunk.ChunkTaskManager.pushChunkWait(this.world, x, z);
|
||||
// Paper end
|
||||
|
@ -298,7 +298,7 @@ index 2c47eaf07a46b068c446fc7c71da4b9dfcf39656..7278e39d7fb47737b783c482f4c74a82
|
|||
this.serverThreadQueue.awaitTasks(completablefuture::isDone);
|
||||
com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index ddf5e3f35a37225f292fb1abba7d9132cd397e32..ea4acb47edb1b22d11e932a1b33f4297a18265f4 100644
|
||||
index e3b4e1cd0384dfda17b5c42577a0f05876e255dc..d4aa3bf40bda5a85cad0b6eaff262581fc25c879 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -1070,7 +1070,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
|
|
|
@ -545,10 +545,10 @@ index 0000000000000000000000000000000000000000..4f13d3ff8391793a99f067189f854078
|
|||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index 7278e39d7fb47737b783c482f4c74a82ded163f8..5b60777c63d54b74b3de5a7373f64ba99fb85d61 100644
|
||||
index 2eb38bfcdc0c232da9dad6921df503e5a11de09f..2fad6a79ee977c2712c55433bde8eca524d09ba7 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -745,7 +745,22 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -736,7 +736,22 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
this.world.getMethodProfiler().enter("naturalSpawnCount");
|
||||
this.world.timings.countNaturalMobs.startTiming(); // Paper - timings
|
||||
int l = this.chunkMapDistance.b();
|
||||
|
|
|
@ -7,10 +7,10 @@ bypass the need to get a player chunk, then get the either,
|
|||
then unwrap it...
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index 5b60777c63d54b74b3de5a7373f64ba99fb85d61..45a91ab94f40ca9d8c469e468c6b66952babcf11 100644
|
||||
index 2fad6a79ee977c2712c55433bde8eca524d09ba7..37ea114deba56efa6692a5e2290c2ef2d4d70ec8 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -448,6 +448,12 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -439,6 +439,12 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
return this.getChunkAt(i, j, chunkstatus, flag);
|
||||
}, this.serverThreadQueue).join();
|
||||
} else {
|
||||
|
@ -23,7 +23,7 @@ index 5b60777c63d54b74b3de5a7373f64ba99fb85d61..45a91ab94f40ca9d8c469e468c6b6695
|
|||
GameProfilerFiller gameprofilerfiller = this.world.getMethodProfiler();
|
||||
|
||||
gameprofilerfiller.c("getChunk");
|
||||
@@ -498,39 +504,7 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -489,39 +495,7 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
if (Thread.currentThread() != this.serverThread) {
|
||||
return null;
|
||||
} else {
|
||||
|
|
|
@ -83,10 +83,10 @@ index f068436960c96b0df427bcdf337a4dcc6a9f66f5..253423acc3c3697a5e47136f34da9261
|
|||
return this.d(baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ());
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 211e4353e88ad703c7f6aa8e416e6a50909bb3d7..98401f36f768f36f98007c52c998252e25b07d47 100644
|
||||
index 08d122f7f20e3c2cdfeababb41b0a8910760b80b..81504bfbbd4a987c95f35d0f25754dbf8b2487e4 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -596,8 +596,8 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -597,8 +597,8 @@ public class Chunk implements IChunkAccess {
|
||||
this.entities.remove(entity); // Paper
|
||||
}
|
||||
|
||||
|
@ -174,7 +174,7 @@ index 90bb2f7ad9f82818d58de9be918f1299c6725070..668942c629732b8d46b7f2646df8e782
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/DataBits.java b/src/main/java/net/minecraft/server/DataBits.java
|
||||
index 2901700dc0ff5dce4fb6f6df9f6686c786293d28..26b48b5ffa4ce3fbe50810dc1a8070d333a2684f 100644
|
||||
index 2a01a48ad347fb123492218a60404b034cfcfbc5..f0c9009fb808ca664a7c3ebaeb8cfa8e2ba7b97e 100644
|
||||
--- a/src/main/java/net/minecraft/server/DataBits.java
|
||||
+++ b/src/main/java/net/minecraft/server/DataBits.java
|
||||
@@ -111,4 +111,32 @@ public class DataBits {
|
||||
|
@ -243,7 +243,7 @@ index fa8eab20bb839c53bf7989d02d2274f835002609..4ad393bc99881d813e2b349fb929fc8e
|
|||
|
||||
public BlockPosition getHomePos() { // Paper - public
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 3b0b86bd33601f741850047e3fe0b6022bc1095b..8c58581417ca3e0336359e7db65568a08e025d6d 100644
|
||||
index 41e84e47cae0012aba023c22e44f3d71c7e86181..ef37b476d26e535bc2b9b970405186090108206d 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -1412,10 +1412,18 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
|
|
|
@ -8,10 +8,10 @@ faster on its own, however removing the try catch makes it
|
|||
easier to inline due to code size
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 98401f36f768f36f98007c52c998252e25b07d47..0bdd463a35d4b45fd6e50ab35046f1783600d3ee 100644
|
||||
index 81504bfbbd4a987c95f35d0f25754dbf8b2487e4..8e91a0270a7a72f09dfc86331a788765de1f9f5e 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -389,17 +389,20 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -390,17 +390,20 @@ public class Chunk implements IChunkAccess {
|
||||
}
|
||||
|
||||
public Fluid a(int i, int j, int k) {
|
||||
|
@ -39,7 +39,7 @@ index 98401f36f768f36f98007c52c998252e25b07d47..0bdd463a35d4b45fd6e50ab35046f178
|
|||
CrashReport crashreport = CrashReport.a(throwable, "Getting fluid state");
|
||||
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Block being got");
|
||||
|
||||
@@ -408,6 +411,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -409,6 +412,7 @@ public class Chunk implements IChunkAccess {
|
||||
});
|
||||
throw new ReportedException(crashreport);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ sets the excessive tick delay to the specified ticks (defaults to
|
|||
60 * 20 ticks, aka 60 seconds)
|
||||
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index 0fcabd12408a8209da5cb3332e217f98983aec02..9b1845024d16a7875ba3406da92efb003f58f8cb 100644
|
||||
index dbabff7efb887b78545a12ae6bec42b02a3a39e2..519b43154993ec01eb13a58336ddcc745362892f 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -349,6 +349,13 @@ public class PaperConfig {
|
||||
|
@ -901,10 +901,10 @@ index 253423acc3c3697a5e47136f34da92617e719753..52ae74571b0d671a294900caedaa400b
|
|||
return this.b(baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ());
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index 45a91ab94f40ca9d8c469e468c6b66952babcf11..ce671ecabc402053b160df0f9d64d22b784d165c 100644
|
||||
index 37ea114deba56efa6692a5e2290c2ef2d4d70ec8..6d1744bbe6af33180fb814a99c041edad9d44aeb 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -203,6 +203,13 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -194,6 +194,13 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
|
@ -990,7 +990,7 @@ index 33cfeabdee03195a294f303f28044a313cb1c4ed..2287e47d1b891135a5f2579ec324c705
|
|||
public String toString() {
|
||||
return this.e + ": " + this.a + ", " + this.b + ", " + this.c + ", " + this.f;
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
|
||||
index 301836c7d465afe82737b0aa5ad68bf51122ff6b..054a3156f7b7b7077422b4951adf7bf45df42bfc 100644
|
||||
index a1341617ba5388d1d1f2c91ad158b0210b4505cb..3cdfb6cddf4b998ee48df64fd884a85237004b63 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
|
||||
@@ -467,7 +467,9 @@ public class PlayerChunk {
|
||||
|
|
|
@ -57,10 +57,10 @@ index 0000000000000000000000000000000000000000..f6ff4d8132a95895680f5bc81f8f873e
|
|||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index ce671ecabc402053b160df0f9d64d22b784d165c..dea7ff47f7a2934708d887c2c40f9328b78fc84e 100644
|
||||
index 6d1744bbe6af33180fb814a99c041edad9d44aeb..44aa6baed64a0d3847cd8df067e0fa32a0739c93 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -757,7 +757,7 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -748,7 +748,7 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
entityPlayer.playerNaturallySpawnedEvent.callEvent();
|
||||
};
|
||||
// Paper end
|
||||
|
@ -83,7 +83,7 @@ index c470c6527b214026c230feaae0c0875c86dea673..df3150072fd36dac28d83309e50342c9
|
|||
List<PlayerChunk> allChunks = new ArrayList<>(visibleChunks.values());
|
||||
List<EntityPlayer> players = world.players;
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
index f839091ae4385e763a19d680585a9363fad6b744..d3a597d878de4cb625484cbf3a9838961d38ada0 100644
|
||||
index 21dfbbdbe72a7562601e23384e2fec8f9393ef29..87de764f74e8174da4c1a28238375caa6fdb4d5e 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
@@ -57,8 +57,33 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
|
@ -243,7 +243,7 @@ index f839091ae4385e763a19d680585a9363fad6b744..d3a597d878de4cb625484cbf3a983896
|
|||
while (objectbidirectionaliterator.hasNext()) {
|
||||
Entry<PlayerChunk> entry = (Entry) objectbidirectionaliterator.next();
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index 20aeec95138a08accc4cb7b1f2d80d63bb9bf920..5ef12e85d7374c137e2d7ff3e0571995070cc222 100644
|
||||
index f826f656efd54672c20cb3240d7ef7acd834b9f5..e800c7cdfa2a9d5ee8e3969ed14e7453e82d9450 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -74,6 +74,7 @@ import net.minecraft.server.GroupDataEntity;
|
||||
|
|
|
@ -42,7 +42,7 @@ index 11fe3524f38f7756ebd0e3807678e8848fd2217d..884b59d478aa7de49906520e77866a79
|
|||
public static final Timing commandFunctionsTimer = Timings.ofSafe("Command Functions");
|
||||
public static final Timing connectionTimer = Timings.ofSafe("Connection Handler");
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
index 9b1845024d16a7875ba3406da92efb003f58f8cb..01d7ad6778d4bbef6e07f7529f40dd9da6cd2ea8 100644
|
||||
index 519b43154993ec01eb13a58336ddcc745362892f..63b3726bfdd22900e7bc577c34db58ddba1084ee 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
||||
@@ -405,4 +405,9 @@ public class PaperConfig {
|
||||
|
@ -56,10 +56,10 @@ index 9b1845024d16a7875ba3406da92efb003f58f8cb..01d7ad6778d4bbef6e07f7529f40dd9d
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index dea7ff47f7a2934708d887c2c40f9328b78fc84e..e31ebda893112b932ee314fc72263fc163ed04ba 100644
|
||||
index 44aa6baed64a0d3847cd8df067e0fa32a0739c93..cc7691a2ed5eaa30071ad5e385bbd76bec3c3d80 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -695,6 +695,7 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -686,6 +686,7 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
this.world.getMethodProfiler().enter("purge");
|
||||
this.world.timings.doChunkMap.startTiming(); // Spigot
|
||||
this.chunkMapDistance.purgeTickets();
|
||||
|
@ -67,7 +67,7 @@ index dea7ff47f7a2934708d887c2c40f9328b78fc84e..e31ebda893112b932ee314fc72263fc1
|
|||
this.tickDistanceManager();
|
||||
this.world.timings.doChunkMap.stopTiming(); // Spigot
|
||||
this.world.getMethodProfiler().exitEnter("chunks");
|
||||
@@ -704,6 +705,7 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -695,6 +696,7 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
this.world.timings.doChunkUnload.startTiming(); // Spigot
|
||||
this.world.getMethodProfiler().exitEnter("unload");
|
||||
this.playerChunkMap.unloadChunks(booleansupplier);
|
||||
|
@ -75,7 +75,7 @@ index dea7ff47f7a2934708d887c2c40f9328b78fc84e..e31ebda893112b932ee314fc72263fc1
|
|||
this.world.timings.doChunkUnload.stopTiming(); // Spigot
|
||||
this.world.getMethodProfiler().exit();
|
||||
this.clearCache();
|
||||
@@ -757,7 +759,7 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -748,7 +750,7 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
entityPlayer.playerNaturallySpawnedEvent.callEvent();
|
||||
};
|
||||
// Paper end
|
||||
|
@ -84,7 +84,7 @@ index dea7ff47f7a2934708d887c2c40f9328b78fc84e..e31ebda893112b932ee314fc72263fc1
|
|||
Optional<Chunk> optional = ((Either) playerchunk.a().getNow(PlayerChunk.UNLOADED_CHUNK)).left();
|
||||
|
||||
if (optional.isPresent()) {
|
||||
@@ -781,6 +783,7 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -772,6 +774,7 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
this.world.timings.chunkTicks.startTiming(); // Spigot // Paper
|
||||
this.world.a(chunk, k);
|
||||
this.world.timings.chunkTicks.stopTiming(); // Spigot // Paper
|
||||
|
@ -92,7 +92,7 @@ index dea7ff47f7a2934708d887c2c40f9328b78fc84e..e31ebda893112b932ee314fc72263fc1
|
|||
}
|
||||
}
|
||||
}
|
||||
@@ -937,6 +940,41 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -928,6 +931,41 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
super.executeTask(runnable);
|
||||
}
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@ so inline where possible, and avoid the abstraction of the
|
|||
Either class.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index e31ebda893112b932ee314fc72263fc163ed04ba..cc91266704043b46653bdd512637d001677ddc76 100644
|
||||
index cc7691a2ed5eaa30071ad5e385bbd76bec3c3d80..106a0e3b7bf3ee563b45a67db25a07114da2cf42 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -619,21 +619,29 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -610,21 +610,29 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
|
||||
public final boolean isInEntityTickingChunk(Entity entity) { return this.a(entity); } // Paper - OBFHELPER
|
||||
@Override public boolean a(Entity entity) {
|
||||
|
|
|
@ -25,10 +25,10 @@ This successfully fixed a reoccurring and highly reproduceable crash
|
|||
for heightmaps.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index cc91266704043b46653bdd512637d001677ddc76..47a02737faa2eddca1b1f9063fe46afc91425169 100644
|
||||
index 106a0e3b7bf3ee563b45a67db25a07114da2cf42..f7355ca6d75c783b663b027efc2ccf6c07e6191d 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -995,6 +995,7 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -986,6 +986,7 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
return super.executeNext() || execChunkTask; // Paper
|
||||
}
|
||||
} finally {
|
||||
|
@ -37,7 +37,7 @@ index cc91266704043b46653bdd512637d001677ddc76..47a02737faa2eddca1b1f9063fe46afc
|
|||
}
|
||||
// CraftBukkit end
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
index 16e4acdb0f834883a480829a864ef7570035bc26..842f5ebad2a4d040b9912ec4841de426667cd91d 100644
|
||||
index 1b5c97c74b7224a8ac4d6e834925c0509a57d308..33e0a93917e67860704e08e639cca1dbdf3b2708 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
@@ -134,6 +134,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
|
|
|
@ -5,10 +5,10 @@ Subject: [PATCH] Load Chunks for Login Asynchronously
|
|||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index 47a02737faa2eddca1b1f9063fe46afc91425169..4e50ef38700918a0efb2c67f5acf98eb66fd8335 100644
|
||||
index f7355ca6d75c783b663b027efc2ccf6c07e6191d..6bcca8f1ddfd4886b6795a1856ec196e8aa61299 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -605,7 +605,7 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -596,7 +596,7 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
return this.serverThreadQueue.executeNext();
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ index 0b1baeab3075a741519c6875f7b4847ce6cad8fc..efb59a7409902aa3c4bf95337683346a
|
|||
if (entityplayer != null) {
|
||||
this.g = LoginListener.EnumProtocolState.DELAY_ACCEPT;
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index 8b464d2c05c636bd1412a9b68c9dcb484620da94..7257c740334478cc30ad57d1d0d4effb6aa63ab5 100644
|
||||
index 46815f388a785009a103e8a726ca85e30a5d55e1..76236c6d0b9decd0b0fa708940443036bfe7af3f 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -74,6 +74,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
||||
|
|
|
@ -77,10 +77,10 @@ index 275c2b23b4d1ff09ee2b1823d0780700f773659e..ef61f8e784b7ebd26293d627e8b8e1ae
|
|||
|
||||
public String c() {
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index 4e50ef38700918a0efb2c67f5acf98eb66fd8335..b4d8657d37b2a6c02e886ec6de243634d1c08d51 100644
|
||||
index 6bcca8f1ddfd4886b6795a1856ec196e8aa61299..dfd85fc1573338e333831e96d3d8845a21d48224 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -729,6 +729,37 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -720,6 +720,37 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
boolean flag1 = this.world.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING) && !world.getPlayers().isEmpty(); // CraftBukkit
|
||||
|
||||
if (!flag) {
|
||||
|
@ -118,7 +118,7 @@ index 4e50ef38700918a0efb2c67f5acf98eb66fd8335..b4d8657d37b2a6c02e886ec6de243634
|
|||
this.world.getMethodProfiler().enter("pollingChunks");
|
||||
int k = this.world.getGameRules().getInt(GameRules.RANDOM_TICK_SPEED);
|
||||
boolean flag2 = world.ticksPerAnimalSpawns != 0L && worlddata.getTime() % world.ticksPerAnimalSpawns == 0L; // CraftBukkit
|
||||
@@ -758,15 +789,7 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -749,15 +780,7 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
this.world.getMethodProfiler().exit();
|
||||
//List<PlayerChunk> list = Lists.newArrayList(this.playerChunkMap.f()); // Paper
|
||||
//Collections.shuffle(list); // Paper
|
||||
|
@ -135,7 +135,7 @@ index 4e50ef38700918a0efb2c67f5acf98eb66fd8335..b4d8657d37b2a6c02e886ec6de243634
|
|||
final int[] chunksTicked = {0}; this.playerChunkMap.forEachVisibleChunk((playerchunk) -> { // Paper - safe iterator incase chunk loads, also no wrapping
|
||||
Optional<Chunk> optional = ((Either) playerchunk.a().getNow(PlayerChunk.UNLOADED_CHUNK)).left();
|
||||
|
||||
@@ -782,9 +805,9 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -773,9 +796,9 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
Chunk chunk = (Chunk) optional1.get();
|
||||
ChunkCoordIntPair chunkcoordintpair = playerchunk.i();
|
||||
|
||||
|
@ -161,7 +161,7 @@ index b307fca8c4b91f0bf260497bc425f2f10540e36d..38b80b72a583b5d99ad9768d41a4ecfb
|
|||
super(worldserver, worldserver.getSpawn(), worldserver.v(), gameprofile);
|
||||
this.spawnDimension = World.OVERWORLD;
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
|
||||
index 054a3156f7b7b7077422b4951adf7bf45df42bfc..69c7bbf6a83b07a3af62b8fabaa851c7f7dc9a98 100644
|
||||
index 3cdfb6cddf4b998ee48df64fd884a85237004b63..6bf27c8baf82cfc98158550f711414d9c8fb476b 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
|
||||
@@ -45,6 +45,18 @@ public class PlayerChunk {
|
||||
|
@ -192,7 +192,7 @@ index 054a3156f7b7b7077422b4951adf7bf45df42bfc..69c7bbf6a83b07a3af62b8fabaa851c7
|
|||
|
||||
// Paper start
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
index 21a9a0364ec6cfd28fcfc0a62d3465993dac1a1c..b4067657eefe6a418b76b599b4c8ffb8359c3f89 100644
|
||||
index 4710e6196362b7a058bc87a263a620237a724168..ebca5620f0bbd4173ca50f023f8333b853ab323a 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
@@ -160,6 +160,17 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
|
|
|
@ -37,10 +37,10 @@ index 670737120d1b2f82a1f73e6ad1b1fda3b121d9a9..d7fcf451e22215f1bfe5cfec456c890e
|
|||
+ }
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index ad96ed28acf7fbacbebc78a6156034887bc300a3..5b033dd3ce11fb8c7579cd41725fc70d8cf97857 100644
|
||||
index 8e91a0270a7a72f09dfc86331a788765de1f9f5e..544f4a473d1453e029111bea45483543e3bcbabb 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -201,7 +201,51 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -202,7 +202,51 @@ public class Chunk implements IChunkAccess {
|
||||
}
|
||||
|
||||
protected void onNeighbourChange(final long bitsetBefore, final long bitsetAfter) {
|
||||
|
@ -92,7 +92,7 @@ index ad96ed28acf7fbacbebc78a6156034887bc300a3..5b033dd3ce11fb8c7579cd41725fc70d
|
|||
}
|
||||
|
||||
public final boolean isAnyNeighborsLoaded() {
|
||||
@@ -1088,7 +1132,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -1089,7 +1133,7 @@ public class Chunk implements IChunkAccess {
|
||||
IBlockData iblockdata = this.getType(blockposition);
|
||||
IBlockData iblockdata1 = Block.b(iblockdata, (GeneratorAccess) this.world, blockposition);
|
||||
|
||||
|
@ -608,7 +608,7 @@ index 0f46aac9d021dc115718b1e36b8fbe28cbc820c6..b8ab8150b7dfe9e34910d35f565083e8
|
|||
|
||||
while (iterator.hasNext()) {
|
||||
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
|
||||
index 0dac8af6680a7dc4ecbedf70707297690fb1e694..b479a25044ecf8c1a791729d643cf8dc90193b2b 100644
|
||||
index bdd1f0873c7b79106d1764eb581b55407d696242..6262db64ae1b615c6742357c32746480eeb69137 100644
|
||||
--- a/src/main/java/net/minecraft/server/World.java
|
||||
+++ b/src/main/java/net/minecraft/server/World.java
|
||||
@@ -464,8 +464,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
|
||||
|
|
|
@ -12,10 +12,10 @@ to the client, so that it doesn't attempt to calculate them.
|
|||
This mitigates the frametime impact to a minimum (but it's still there).
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index b88a0e6a27735e124ff2be2d44c8df4192298606..dcbae1c4512cf267719934785ea60de8ae66052d 100644
|
||||
index 544f4a473d1453e029111bea45483543e3bcbabb..af9d54ef057d5f6977cf77c57cde25b6b0d1f39d 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -233,7 +233,7 @@ public class Chunk implements IChunkAccess {
|
||||
@@ -234,7 +234,7 @@ public class Chunk implements IChunkAccess {
|
||||
|
||||
// broadcast
|
||||
Object[] backingSet = inRange.getBackingSet();
|
||||
|
|
|
@ -483,10 +483,10 @@ index 03b1a67aaf3ed75b7669a3157847affd678f8df4..09fec533d7feebb90e989007dd19c952
|
|||
protected int c(long i) {
|
||||
return this.a.get(i);
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index b4d8657d37b2a6c02e886ec6de243634d1c08d51..4b45a2bf926c26eddc7d81c233ab61870794ecdc 100644
|
||||
index dfd85fc1573338e333831e96d3d8845a21d48224..35ac03c099f525c7cebe0d90ad2c665fc2637194 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -444,6 +444,26 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -435,6 +435,26 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
public <T> void removeTicketAtLevel(TicketType<T> ticketType, ChunkCoordIntPair chunkPos, int ticketLevel, T identifier) {
|
||||
this.chunkMapDistance.removeTicketAtLevel(ticketType, chunkPos, ticketLevel, identifier);
|
||||
}
|
||||
|
@ -513,7 +513,7 @@ index b4d8657d37b2a6c02e886ec6de243634d1c08d51..4b45a2bf926c26eddc7d81c233ab6187
|
|||
// Paper end
|
||||
|
||||
@Nullable
|
||||
@@ -482,6 +502,8 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -473,6 +493,8 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
|
||||
if (!completablefuture.isDone()) { // Paper
|
||||
// Paper start - async chunk io/loading
|
||||
|
@ -522,7 +522,7 @@ index b4d8657d37b2a6c02e886ec6de243634d1c08d51..4b45a2bf926c26eddc7d81c233ab6187
|
|||
this.world.asyncChunkTaskManager.raisePriority(x, z, com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGHEST_PRIORITY);
|
||||
com.destroystokyo.paper.io.chunk.ChunkTaskManager.pushChunkWait(this.world, x, z);
|
||||
// Paper end
|
||||
@@ -490,6 +512,8 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -481,6 +503,8 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
this.serverThreadQueue.awaitTasks(completablefuture::isDone);
|
||||
com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug
|
||||
this.world.timings.syncChunkLoad.stopTiming(); // Paper
|
||||
|
@ -531,7 +531,7 @@ index b4d8657d37b2a6c02e886ec6de243634d1c08d51..4b45a2bf926c26eddc7d81c233ab6187
|
|||
} // Paper
|
||||
ichunkaccess = (IChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> {
|
||||
return ichunkaccess1;
|
||||
@@ -542,10 +566,12 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -533,10 +557,12 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
if (flag && !currentlyUnloading) {
|
||||
// CraftBukkit end
|
||||
this.chunkMapDistance.a(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair);
|
||||
|
@ -544,7 +544,7 @@ index b4d8657d37b2a6c02e886ec6de243634d1c08d51..4b45a2bf926c26eddc7d81c233ab6187
|
|||
this.tickDistanceManager();
|
||||
playerchunk = this.getChunk(k);
|
||||
gameprofilerfiller.exit();
|
||||
@@ -554,8 +580,13 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -545,8 +571,13 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -560,7 +560,7 @@ index b4d8657d37b2a6c02e886ec6de243634d1c08d51..4b45a2bf926c26eddc7d81c233ab6187
|
|||
}
|
||||
|
||||
private boolean a(@Nullable PlayerChunk playerchunk, int i) {
|
||||
@@ -606,6 +637,7 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -597,6 +628,7 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
}
|
||||
|
||||
public boolean tickDistanceManager() { // Paper - private -> public
|
||||
|
@ -628,7 +628,7 @@ index 0b5ddff008d151ad03a1f382a8f24494356e8701..ff74be14512a947e81b62d53e616131c
|
|||
chunkData.addProperty("queued-for-unload", chunkMap.unloadQueue.contains(playerChunk.location.pair()));
|
||||
chunkData.addProperty("status", status == null ? "unloaded" : status.toString());
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
|
||||
index 078cbc9f4dbd387ef1088c76b2f77ee47fff135d..ca9e0208aa35c597a947485f67213ff4b1b1185f 100644
|
||||
index 1536d9661837e76fc23131ecd974f699048cc9ae..371a301f4a295c59ce40fefc6ef07e544414d94b 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
|
||||
@@ -1,6 +1,7 @@
|
||||
|
@ -889,7 +889,7 @@ index 078cbc9f4dbd387ef1088c76b2f77ee47fff135d..ca9e0208aa35c597a947485f67213ff4
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
index fba7c9b5724114eab35a3d24febdee3cd3e30aa0..b6ae589548bdc75052f4986069b3374cb5fd837c 100644
|
||||
index e38c9a8f4bf017db9f296bffcd029f9603ee82f6..19a31536d40289cba25120d4cc4788e93401ce62 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
@@ -14,6 +14,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||
|
@ -1146,7 +1146,7 @@ index fba7c9b5724114eab35a3d24febdee3cd3e30aa0..b6ae589548bdc75052f4986069b3374c
|
|||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index 2978f2e1b136f61e1519ce3aac2f679f650d2258..e76c01a33bfcee1a9d312247b8d08026055204c8 100644
|
||||
index 952aa22b5c35852a8d394cf6814c4ab00c58e599..257c3489f9add056966cdb8eaaa49fa438369bb6 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -1379,6 +1379,7 @@ public class PlayerConnection implements PacketListenerPlayIn {
|
||||
|
|
|
@ -25,10 +25,10 @@ Massive update to light to improve performance and chunk loading/generation.
|
|||
8) Fix NPE risk that crashes server in getting nibble data
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
index 4b45a2bf926c26eddc7d81c233ab61870794ecdc..6acb5f05a05c542f8257e205ef70987be2d29194 100644
|
||||
index 35ac03c099f525c7cebe0d90ad2c665fc2637194..75d25576d68ec95a14372f8530f4916f2bd7c3c5 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
|
||||
@@ -1046,7 +1046,7 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
@@ -1037,7 +1037,7 @@ public class ChunkProviderServer extends IChunkProvider {
|
||||
if (ChunkProviderServer.this.tickDistanceManager()) {
|
||||
return true;
|
||||
} else {
|
||||
|
@ -1329,7 +1329,7 @@ index ff00830b95a17f66d0c913087492dbf4b066df8a..4085426af03f032cf405bdfd1e40a8e5
|
|||
private static final int nibbleBucketSizeMultiplier = Integer.getInteger("Paper.nibbleBucketSize", 3072);
|
||||
private static final int maxPoolSize = Integer.getInteger("Paper.maxNibblePoolSize", (int) Math.min(6, Math.max(1, Runtime.getRuntime().maxMemory() / 1024 / 1024 / 1024)) * (nibbleBucketSizeMultiplier * 8));
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
|
||||
index 7de56172023e49cd8957e3dd45fa8e731809c16a..8146d88a90a758760e383985170d580372577615 100644
|
||||
index 025ab54dddbf4ef80ce2253f9b6cabcb8e46bfd2..acb07a2a7a7606470aa938ffc8f6a54fd7b9f5f9 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
|
||||
@@ -724,6 +724,7 @@ public class PlayerChunk {
|
||||
|
@ -1341,7 +1341,7 @@ index 7de56172023e49cd8957e3dd45fa8e731809c16a..8146d88a90a758760e383985170d5803
|
|||
if (getCurrentPriority() != priority) {
|
||||
this.u.a(this.location, this::getCurrentPriority, priority, this::setPriority); // use preferred priority
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
index c44eeaae0cff03ae5cfa53b3c0f240ef5e982083..6c399bcea03e839bf2f21e92b5d76d46b7088667 100644
|
||||
index bb515e4c08bccff2a737aed924c5cf59800ecf47..49008cdec739b19409fdaf1b0ed806a6c0e93200 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
|
||||
@@ -277,6 +277,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
||||
|
|
Loading…
Reference in a new issue