Skip to content

Commit

Permalink
Updated Upstream (CraftBukkit)
Browse files Browse the repository at this point in the history
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

CraftBukkit Changes:
cc7edd6 SPIGOT-7051: Worldgen API does not run vanilla noise generation when shouldGenerateNoise is true
  • Loading branch information
kennytv committed Jun 10, 2022
1 parent 9a75a79 commit 0754819
Show file tree
Hide file tree
Showing 36 changed files with 180 additions and 180 deletions.
22 changes: 11 additions & 11 deletions patches/server/0007-MC-Utils.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5304,7 +5304,7 @@ index f902b1f7062fc2c81e0ce43e8b8599192469e57c..90fcb4dc89643b1c706ea4554595a842
+ // Paper end
}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 775e34f6abd2fd703a284a85d975d48cd1930ad9..ef23f9f81a909348ee4ae3d7eb51dbcc430530ca 100644
index 3e49e739238096442e89b7ab23d2af8aff55912e..91fd4243416c41b1c2b0f0f1abc154064c164a25 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -62,6 +62,7 @@ import net.minecraft.network.protocol.game.ClientboundSetChunkCacheCenterPacket;
Expand All @@ -5315,7 +5315,7 @@ index 775e34f6abd2fd703a284a85d975d48cd1930ad9..ef23f9f81a909348ee4ae3d7eb51dbcc
import net.minecraft.server.level.progress.ChunkProgressListener;
import net.minecraft.server.network.ServerPlayerConnection;
import net.minecraft.util.CsvOutput;
@@ -167,6 +168,56 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -168,6 +169,56 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
};
// CraftBukkit end

Expand Down Expand Up @@ -5372,7 +5372,7 @@ index 775e34f6abd2fd703a284a85d975d48cd1930ad9..ef23f9f81a909348ee4ae3d7eb51dbcc
public ChunkMap(ServerLevel world, LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, StructureTemplateManager structureTemplateManager, Executor executor, BlockableEventLoop<Runnable> mainThreadExecutor, LightChunkGetter chunkProvider, ChunkGenerator chunkGenerator, ChunkProgressListener worldGenerationProgressListener, ChunkStatusUpdateListener chunkStatusChangeListener, Supplier<DimensionDataStorage> persistentStateManagerFactory, int viewDistance, boolean dsync) {
super(session.getDimensionPath(world.dimension()).resolve("region"), dataFixer, dsync);
this.visibleChunkMap = this.updatingChunkMap.clone();
@@ -211,6 +262,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -217,6 +268,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.overworldDataStorage = persistentStateManagerFactory;
this.poiManager = new PoiManager(path.resolve("poi"), dataFixer, dsync, world.registryAccess(), world);
this.setViewDistance(viewDistance);
Expand All @@ -5383,7 +5383,7 @@ index 775e34f6abd2fd703a284a85d975d48cd1930ad9..ef23f9f81a909348ee4ae3d7eb51dbcc
}

protected ChunkGenerator generator() {
@@ -304,6 +359,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -310,6 +365,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
}

Expand All @@ -5398,7 +5398,7 @@ index 775e34f6abd2fd703a284a85d975d48cd1930ad9..ef23f9f81a909348ee4ae3d7eb51dbcc
private CompletableFuture<Either<List<ChunkAccess>, ChunkHolder.ChunkLoadingFailure>> getChunkRangeFuture(ChunkPos centerChunk, int margin, IntFunction<ChunkStatus> distanceToStatus) {
List<CompletableFuture<Either<ChunkAccess, ChunkHolder.ChunkLoadingFailure>>> list = new ArrayList();
List<ChunkHolder> list1 = new ArrayList();
@@ -435,6 +498,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -441,6 +504,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
holder.setTicketLevel(level);
} else {
holder = new ChunkHolder(new ChunkPos(pos), level, this.level, this.lightEngine, this.queueSorter, this);
Expand All @@ -5410,7 +5410,7 @@ index 775e34f6abd2fd703a284a85d975d48cd1930ad9..ef23f9f81a909348ee4ae3d7eb51dbcc
}

this.updatingChunkMap.put(pos, holder);
@@ -552,7 +620,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -558,7 +626,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (completablefuture1 != completablefuture) {
this.scheduleUnload(pos, holder);
} else {
Expand All @@ -5425,7 +5425,7 @@ index 775e34f6abd2fd703a284a85d975d48cd1930ad9..ef23f9f81a909348ee4ae3d7eb51dbcc
if (ichunkaccess instanceof LevelChunk) {
((LevelChunk) ichunkaccess).setLoaded(false);
}
@@ -568,7 +642,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -574,7 +648,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.lightEngine.tryScheduleUpdate();
this.progressListener.onStatusChange(ichunkaccess.getPos(), (ChunkStatus) null);
this.chunkSaveCooldowns.remove(ichunkaccess.getPos().toLong());
Expand All @@ -5437,23 +5437,23 @@ index 775e34f6abd2fd703a284a85d975d48cd1930ad9..ef23f9f81a909348ee4ae3d7eb51dbcc

}
};
@@ -1138,6 +1216,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1144,6 +1222,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (!flag1) {
this.distanceManager.addPlayer(SectionPos.of((EntityAccess) player), player);
}
+ this.addPlayerToDistanceMaps(player); // Paper - distance maps
} else {
SectionPos sectionposition = player.getLastSectionPos();

@@ -1145,6 +1224,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1151,6 +1230,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (!flag2) {
this.distanceManager.removePlayer(sectionposition, player);
}
+ this.removePlayerFromDistanceMaps(player); // Paper - distance maps
}

for (int k = i - this.viewDistance - 1; k <= i + this.viewDistance + 1; ++k) {
@@ -1257,6 +1337,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1263,6 +1343,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
}

Expand All @@ -5462,7 +5462,7 @@ index 775e34f6abd2fd703a284a85d975d48cd1930ad9..ef23f9f81a909348ee4ae3d7eb51dbcc
}

@Override
@@ -1460,7 +1542,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1466,7 +1548,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public class ChunkDistanceManager extends DistanceManager {

protected ChunkDistanceManager(Executor workerExecutor, Executor mainThreadExecutor) {
Expand Down
10 changes: 5 additions & 5 deletions patches/server/0012-Timings-v2.patch
Original file line number Diff line number Diff line change
Expand Up @@ -997,7 +997,7 @@ index 408eff59b081ace53bf435947df17e2fe75bfd5e..cd0365249dffc1704a349a5e419364bb
}

diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index ef23f9f81a909348ee4ae3d7eb51dbcc430530ca..e9a2a71b1f2bf6c701d4eba8dc31a10015cf7904 100644
index 91fd4243416c41b1c2b0f0f1abc154064c164a25..e01d86c50e0227cfae91ba8022b763e51a10c5f5 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1,8 +1,10 @@
Expand All @@ -1011,31 +1011,31 @@ index ef23f9f81a909348ee4ae3d7eb51dbcc430530ca..e9a2a71b1f2bf6c701d4eba8dc31a100
import com.google.common.collect.Lists;
import com.google.common.collect.Queues;
import com.google.common.collect.Sets;
@@ -847,6 +849,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -853,6 +855,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
ChunkStatus chunkstatus = ChunkHolder.getStatus(chunkHolder.getTicketLevel());

return !chunkstatus.isOrAfter(ChunkStatus.FULL) ? ChunkHolder.UNLOADED_CHUNK : either.mapLeft((ichunkaccess) -> {
+ try (Timing ignored = level.timings.chunkPostLoad.startTimingIfSync()) { // Paper
ChunkPos chunkcoordintpair = chunkHolder.getPos();
ProtoChunk protochunk = (ProtoChunk) ichunkaccess;
LevelChunk chunk;
@@ -871,6 +874,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -877,6 +880,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}

return chunk;
+ } // Paper
});
}, (runnable) -> {
ProcessorHandle mailbox = this.mainThreadMailbox;
@@ -1423,6 +1427,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1429,6 +1433,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
List<ServerPlayer> list = Lists.newArrayList();
List<ServerPlayer> list1 = this.level.players();
ObjectIterator objectiterator = this.entityMap.values().iterator();
+ level.timings.tracker1.startTiming(); // Paper

ChunkMap.TrackedEntity playerchunkmap_entitytracker;

@@ -1447,14 +1452,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1453,14 +1458,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
playerchunkmap_entitytracker.serverEntity.sendChanges();
}
}
Expand Down
6 changes: 3 additions & 3 deletions patches/server/0056-Add-exception-reporting-event.patch
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ index 0000000000000000000000000000000000000000..f699ce18ca044f813e194ef2786b7ea8
+ }
+}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index e9a2a71b1f2bf6c701d4eba8dc31a10015cf7904..8b11fbfe2805ad7e8ba84e6b7fdfafc054a248bd 100644
index e01d86c50e0227cfae91ba8022b763e51a10c5f5..e1200e903e39c3e5cb023e1bd4fe104907c0c6eb 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -992,6 +992,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -998,6 +998,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
return true;
} catch (Exception exception) {
ChunkMap.LOGGER.error("Failed to save chunk {},{}", new Object[]{chunkcoordintpair.x, chunkcoordintpair.z, exception});
Expand Down Expand Up @@ -100,7 +100,7 @@ index c6fb4c33d7ea52b88d8fc0d90748cbab7387c565..fed09b886f4fa0006d160e5f2abb00df
}

diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 17da97bfece600438f6e872e8a1a2bee1d60c804..447ce111786a53fca6b0f6c8803b47f9cadd7df7 100644
index 7b3a81876f04c6aff370ac9cc97b0c9270f34a2e..ee71a6cc552bd2bb82beda1bd44905ea4cc14604 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1,5 +1,10 @@
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Make targetSize more aggressive in the chunk unload queue


diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 8b11fbfe2805ad7e8ba84e6b7fdfafc054a248bd..943cad9a08d72b90b92f92ef90588501bbf158d5 100644
index e1200e903e39c3e5cb023e1bd4fe104907c0c6eb..702d885b6a5caf8cabc40934893a081b01906781 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -231,7 +231,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -232,7 +232,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
this.entityMap = new Int2ObjectOpenHashMap();
this.chunkTypeCache = new Long2ByteOpenHashMap();
this.chunkSaveCooldowns = new Long2LongOpenHashMap();
Expand All @@ -17,15 +17,15 @@ index 8b11fbfe2805ad7e8ba84e6b7fdfafc054a248bd..943cad9a08d72b90b92f92ef90588501
this.structureTemplateManager = structureTemplateManager;
Path path = session.getDimensionPath(world.dimension());

@@ -581,7 +581,6 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -587,7 +587,6 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider

private void processUnloads(BooleanSupplier shouldKeepTicking) {
LongIterator longiterator = this.toDrop.iterator();
-
for (int i = 0; longiterator.hasNext() && (shouldKeepTicking.getAsBoolean() || i < 200 || this.toDrop.size() > 2000); longiterator.remove()) {
long j = longiterator.nextLong();
ChunkHolder playerchunk = (ChunkHolder) this.updatingChunkMap.remove(j);
@@ -594,7 +593,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -600,7 +599,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
}

Expand Down
6 changes: 3 additions & 3 deletions patches/server/0168-PlayerNaturallySpawnCreaturesEvent.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 943cad9a08d72b90b92f92ef90588501bbf158d5..f9ef45635b731cafc9b6879603cac34c146833b0 100644
index 702d885b6a5caf8cabc40934893a081b01906781..4f2dfe5d2b646a1a2f19414388af13b26d28d504 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1150,7 +1150,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1156,7 +1156,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
chunkRange = (chunkRange > level.spigotConfig.viewDistance) ? (byte) level.spigotConfig.viewDistance : chunkRange;
chunkRange = (chunkRange > 8) ? 8 : chunkRange;

Expand All @@ -23,7 +23,7 @@ index 943cad9a08d72b90b92f92ef90588501bbf158d5..f9ef45635b731cafc9b6879603cac34c
// Spigot end
long i = chunkcoordintpair.toLong();

@@ -1167,6 +1169,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1173,6 +1175,15 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}

entityplayer = (ServerPlayer) iterator.next();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ Add -Ddebug.entities=true to your JVM flags to gain more information
1.17: Needs to be reworked for new entity storage system

diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index f9ef45635b731cafc9b6879603cac34c146833b0..29482bebf5b878c698283720d1452ef237da5516 100644
index 4f2dfe5d2b646a1a2f19414388af13b26d28d504..213c94cecc1103056ce83625f1e78cd62b6476a6 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -1389,6 +1389,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1395,6 +1395,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} else {
ChunkMap.TrackedEntity playerchunkmap_entitytracker = new ChunkMap.TrackedEntity(entity, i, j, entitytypes.trackDeltas());

+ entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker
this.entityMap.put(entity.getId(), playerchunkmap_entitytracker);
playerchunkmap_entitytracker.updatePlayers(this.level.players());
if (entity instanceof ServerPlayer) {
@@ -1431,7 +1432,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1437,7 +1438,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (playerchunkmap_entitytracker1 != null) {
playerchunkmap_entitytracker1.broadcastRemoved();
}
Expand Down
Loading

0 comments on commit 0754819

Please sign in to comment.