Update to Minecraft 1.14.2

This commit is contained in:
md_5
2019-05-28 06:30:00 +10:00
parent fcb9f90bf3
commit cb3d14c5a7
57 changed files with 385 additions and 394 deletions

View File

@@ -2,8 +2,8 @@
+++ b/net/minecraft/server/ChunkProviderServer.java
@@ -81,7 +81,7 @@
for (int l = 0; l < 4; ++l) {
if (k == this.n[l] && chunkstatus == this.o[l]) {
ichunkaccess = this.p[l];
if (k == this.cachePos[l] && chunkstatus == this.cacheStatus[l]) {
ichunkaccess = this.cacheChunk[l];
- if (ichunkaccess != null || !flag) {
+ if (ichunkaccess != null) { // CraftBukkit - the chunk can become accessible in the meantime TODO for non-null chunks it might also make sense to check that the chunk's state hasn't changed in the meantime
return ichunkaccess;
@@ -17,16 +17,16 @@
+ // CraftBukkit start - don't add new ticket for currently unloading chunk
+ boolean currentlyUnloading = false;
+ if (playerchunk != null) {
+ PlayerChunk.State oldChunkState = PlayerChunk.c(playerchunk.oldTicketLevel); // PAIL getChunkState
+ PlayerChunk.State currentChunkState = PlayerChunk.c(playerchunk.getTicketLevel()); // PAIL getChunkState
+ currentlyUnloading = (oldChunkState.a(PlayerChunk.State.BORDER) && !currentChunkState.a(PlayerChunk.State.BORDER)); // PAIL isAtLeast
+ PlayerChunk.State oldChunkState = PlayerChunk.getChunkState(playerchunk.oldTicketLevel);
+ PlayerChunk.State currentChunkState = PlayerChunk.getChunkState(playerchunk.getTicketLevel());
+ currentlyUnloading = (oldChunkState.isAtLeast(PlayerChunk.State.BORDER) && !currentChunkState.isAtLeast(PlayerChunk.State.BORDER));
+ }
+ if (flag && !currentlyUnloading) {
+ // CraftBukkit end
this.chunkMapDistance.a(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair);
if (this.a(playerchunk, l)) {
GameProfilerFiller gameprofilerfiller = this.world.getMethodProfiler();
@@ -144,14 +152,14 @@
@@ -144,7 +152,7 @@
}
private boolean a(@Nullable PlayerChunk playerchunk, int i) {
@@ -35,15 +35,7 @@
}
public boolean isLoaded(int i, int j) {
PlayerChunk playerchunk = this.getChunk((new ChunkCoordIntPair(i, j)).pair());
int k = 33 + ChunkStatus.a(ChunkStatus.FULL);
- return playerchunk != null && playerchunk.getTicketLevel() <= k ? ((Either) playerchunk.getStatusFuture(ChunkStatus.FULL).getNow(PlayerChunk.UNLOADED_CHUNK_ACCESS)).left().isPresent() : false;
+ return playerchunk != null && playerchunk.oldTicketLevel <= k ? ((Either) playerchunk.getStatusFuture(ChunkStatus.FULL).getNow(PlayerChunk.UNLOADED_CHUNK_ACCESS)).left().isPresent() : false; // CraftBukkit using oldTicketLevel for isLoaded checks
}
@Override
@@ -241,6 +249,18 @@
@@ -245,6 +253,18 @@
this.playerChunkMap.close();
}
@@ -55,14 +47,14 @@
+ this.world.getMethodProfiler().exitEnter("unload");
+ this.playerChunkMap.unloadChunks(() -> true);
+ this.world.getMethodProfiler().exit();
+ this.l(); // PAIL clearCache
+ this.clearCache();
+ }
+ // CraftBukkit end
+
public void tick(BooleanSupplier booleansupplier) {
this.world.getMethodProfiler().enter("purge");
this.chunkMapDistance.purgeTickets();
@@ -260,13 +280,13 @@
@@ -264,13 +284,13 @@
this.lastTickTime = i;
WorldData worlddata = this.world.getWorldData();
boolean flag = worlddata.getType() == WorldType.DEBUG_ALL_BLOCK_STATES;
@@ -78,7 +70,7 @@
this.world.getMethodProfiler().enter("naturalSpawnCount");
int l = this.chunkMapDistance.b();
@@ -299,8 +319,30 @@
@@ -303,8 +323,30 @@
for (int j1 = 0; j1 < i1; ++j1) {
EnumCreatureType enumcreaturetype = aenumcreaturetype1[j1];