Skip to content

Commit

Permalink
Update Paper
Browse files Browse the repository at this point in the history
  • Loading branch information
Spottedleaf committed Nov 29, 2024
1 parent 88f8af4 commit c937c72
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ group=dev.folia
version=1.21.3-R0.1-SNAPSHOT
mcVersion=1.21.3

paperRef=afb5b13056ebbcdd3ae834c039046ecad4fa89eb
paperRef=da9d110d5bf8ffb090d63cd6a443b22ef1ab9d64

org.gradle.caching=true
org.gradle.parallel=true
Expand Down
50 changes: 25 additions & 25 deletions patches/server/0003-Threaded-Regions.patch
Original file line number Diff line number Diff line change
Expand Up @@ -1115,10 +1115,10 @@ index bd68139ae635f2ad7ec8e7a21e0056a139c4c62e..48a43341b17247355a531164019d5cc9
}

diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index 9221ce36355eaf8d4456209c57b68486d587c255..60284e762b7f35fb9e1134542b9fd70b06b762ed 100644
index 17e23ca4dd2bbfba49ea00aa2b719a95feb931be..7e906e8324280ef80222305812527886e7b7ce9e 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -356,4 +356,18 @@ public class GlobalConfiguration extends ConfigurationPart {
@@ -354,4 +354,18 @@ public class GlobalConfiguration extends ConfigurationPart {
public boolean disableChorusPlantUpdates = false;
public boolean disableMushroomBlockUpdates = false;
}
Expand Down Expand Up @@ -10597,7 +10597,7 @@ index 17a158ff6ce6520b69a5a0032ba4c05449dd0cf8..78f33298e809a7f6d079d9f2c64e2caa
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 5b3a886c624b36557cbfaccdc3fb05a46a4ba36a..48fc7676252dbff47f59b65e6b9d9410e25778c5 100644
index 52a6a4badace15a983f0acb431036bd704d9cebd..c6a2d2543a3616e99d253986a113a7cd07b05f0a 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -139,8 +139,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
Expand All @@ -10622,7 +10622,7 @@ index 5b3a886c624b36557cbfaccdc3fb05a46a4ba36a..48fc7676252dbff47f59b65e6b9d9410
this.chunkTypeCache = new Long2ByteOpenHashMap();
// Paper - rewrite chunk system
Path path = session.getDimensionPath(world.dimension());
@@ -802,13 +802,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -796,13 +796,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider

void updatePlayerStatus(ServerPlayer player, boolean added) {
boolean flag1 = this.skipPlayer(player);
Expand All @@ -10639,7 +10639,7 @@ index 5b3a886c624b36557cbfaccdc3fb05a46a4ba36a..48fc7676252dbff47f59b65e6b9d9410
((ca.spottedleaf.moonrise.patches.chunk_tick_iteration.ChunkTickDistanceManager)this.distanceManager).moonrise$addPlayer(player, SectionPos.of(player)); // Paper - chunk tick iteration optimisation
}

@@ -817,9 +817,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -811,9 +811,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
} else {
SectionPos sectionposition = player.getLastSectionPos();

Expand All @@ -10652,7 +10652,7 @@ index 5b3a886c624b36557cbfaccdc3fb05a46a4ba36a..48fc7676252dbff47f59b65e6b9d9410
((ca.spottedleaf.moonrise.patches.chunk_tick_iteration.ChunkTickDistanceManager)this.distanceManager).moonrise$removePlayer(player, SectionPos.of(player)); // Paper - chunk tick iteration optimisation
}

@@ -839,28 +839,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -833,28 +833,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider

SectionPos sectionposition = player.getLastSectionPos();
SectionPos sectionposition1 = SectionPos.of((EntityAccess) player);
Expand Down Expand Up @@ -10686,7 +10686,7 @@ index 5b3a886c624b36557cbfaccdc3fb05a46a4ba36a..48fc7676252dbff47f59b65e6b9d9410

// Paper - rewrite chunk system
}
@@ -891,9 +877,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -885,9 +871,9 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public void addEntity(Entity entity) {
org.spigotmc.AsyncCatcher.catchOp("entity track"); // Spigot
// Paper start - ignore and warn about illegal addEntity calls instead of crashing server
Expand All @@ -10698,7 +10698,7 @@ index 5b3a886c624b36557cbfaccdc3fb05a46a4ba36a..48fc7676252dbff47f59b65e6b9d9410
return;
}
// Paper end - ignore and warn about illegal addEntity calls instead of crashing server
@@ -906,32 +892,30 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -900,32 +886,30 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
if (i != 0) {
int j = entitytypes.updateInterval();

Expand Down Expand Up @@ -10739,7 +10739,7 @@ index 5b3a886c624b36557cbfaccdc3fb05a46a4ba36a..48fc7676252dbff47f59b65e6b9d9410
}

}
@@ -943,16 +927,16 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -937,16 +921,16 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
org.spigotmc.AsyncCatcher.catchOp("entity untrack"); // Spigot
if (entity instanceof ServerPlayer entityplayer) {
this.updatePlayerStatus(entityplayer, false);
Expand All @@ -10763,7 +10763,7 @@ index 5b3a886c624b36557cbfaccdc3fb05a46a4ba36a..48fc7676252dbff47f59b65e6b9d9410

if (playerchunkmap_entitytracker1 != null) {
playerchunkmap_entitytracker1.broadcastRemoved();
@@ -963,9 +947,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -957,9 +941,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider

// Paper start - optimise entity tracker
private void newTrackerTick() {
Expand All @@ -10775,7 +10775,7 @@ index 5b3a886c624b36557cbfaccdc3fb05a46a4ba36a..48fc7676252dbff47f59b65e6b9d9410
final Entity[] trackerEntitiesRaw = trackerEntities.getRawDataUnchecked();
for (int i = 0, len = trackerEntities.size(); i < len; ++i) {
final Entity entity = trackerEntitiesRaw[i];
@@ -991,47 +976,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -985,47 +970,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
// Paper end - optimise entity tracker
// Paper - rewrite chunk system

Expand Down Expand Up @@ -10825,7 +10825,7 @@ index 5b3a886c624b36557cbfaccdc3fb05a46a4ba36a..48fc7676252dbff47f59b65e6b9d9410

if (playerchunkmap_entitytracker != null) {
playerchunkmap_entitytracker.broadcast(packet);
@@ -1040,7 +990,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1034,7 +984,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}

protected void broadcastAndSend(Entity entity, Packet<?> packet) {
Expand All @@ -10834,7 +10834,7 @@ index 5b3a886c624b36557cbfaccdc3fb05a46a4ba36a..48fc7676252dbff47f59b65e6b9d9410

if (playerchunkmap_entitytracker != null) {
playerchunkmap_entitytracker.broadcastAndSend(packet);
@@ -1293,9 +1243,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -1287,9 +1237,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
}
flag = flag && this.entity.broadcastToPlayer(player) && ChunkMap.this.isChunkTracked(player, this.entity.chunkPosition().x, this.entity.chunkPosition().z);
// Paper end - Configurable entity tracking range by Y
Expand Down Expand Up @@ -10906,7 +10906,7 @@ index 7a9e7fc688e48d18a6a884f02f768ae652326aae..7d8f3e295210fcae66309ee9dd40efe1

public String getDebugStatus() {
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index 82110c9af65479a918ba519e197ba880f5fcc24d..f58dadcf5f3822fd18a0d1dfb775b3d7cd7abde9 100644
index d021cd5b6136f0125076513977f430c6d4dd4f9f..16001634fef7573e5363d2903e2b665bc12d3431 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -62,18 +62,14 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
Expand Down Expand Up @@ -11017,7 +11017,7 @@ index 82110c9af65479a918ba519e197ba880f5fcc24d..f58dadcf5f3822fd18a0d1dfb775b3d7
// Paper start - per player mob spawning backoff
for (int ii = 0; ii < ServerPlayer.MOBCATEGORY_TOTAL_ENUMS; ii++) {
player.mobCounts[ii] = 0;
@@ -567,15 +572,15 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -567,28 +572,28 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
}
// Paper end - per player mob spawning backoff
}
Expand All @@ -11037,12 +11037,12 @@ index 82110c9af65479a918ba519e197ba880f5fcc24d..f58dadcf5f3822fd18a0d1dfb775b3d7
int k = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING);
List list1;

@@ -584,12 +589,12 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
int chunkRange = level.spigotConfig.mobSpawnRange;
chunkRange = (chunkRange > level.spigotConfig.viewDistance) ? (byte) level.spigotConfig.viewDistance : chunkRange;
chunkRange = Math.min(chunkRange, 8);
if (flag && (this.spawnEnemies || this.spawnFriendlies)) {
// Paper start - PlayerNaturallySpawnCreaturesEvent
- for (ServerPlayer entityPlayer : this.level.players()) {
+ for (ServerPlayer entityPlayer : this.level.getLocalPlayers()) { // Folia - region threading
int chunkRange = Math.min(level.spigotConfig.mobSpawnRange, entityPlayer.getBukkitEntity().getViewDistance());
chunkRange = Math.min(chunkRange, 8);
entityPlayer.playerNaturallySpawnedEvent = new com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent(entityPlayer.getBukkitEntity(), (byte) chunkRange);
entityPlayer.playerNaturallySpawnedEvent.callEvent();
}
Expand All @@ -11052,7 +11052,7 @@ index 82110c9af65479a918ba519e197ba880f5fcc24d..f58dadcf5f3822fd18a0d1dfb775b3d7

list1 = NaturalSpawner.getFilteredSpawningCategories(spawnercreature_d, this.spawnFriendlies, this.spawnEnemies, flag1, this.level); // CraftBukkit
} else {
@@ -663,21 +668,26 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -662,21 +667,26 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
ChunkHolder playerchunk = this.getVisibleChunkIfPresent(ChunkPos.asLong(i, j));

if (playerchunk != null && playerchunk.blockChanged(pos)) {
Expand Down Expand Up @@ -11083,7 +11083,7 @@ index 82110c9af65479a918ba519e197ba880f5fcc24d..f58dadcf5f3822fd18a0d1dfb775b3d7
}

public <T> void addRegionTicket(TicketType<T> ticketType, ChunkPos pos, int radius, T argument) {
@@ -761,7 +771,8 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -760,7 +770,8 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@Nullable
@VisibleForDebug
public NaturalSpawner.SpawnState getLastSpawnState() {
Expand All @@ -11093,7 +11093,7 @@ index 82110c9af65479a918ba519e197ba880f5fcc24d..f58dadcf5f3822fd18a0d1dfb775b3d7
}

public void removeTicketsOnClosing() {
@@ -770,7 +781,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -769,7 +780,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon

public void onChunkReadyToSend(ChunkHolder chunkHolder) {
if (chunkHolder.hasChangesToBroadcast()) {
Expand All @@ -11102,7 +11102,7 @@ index 82110c9af65479a918ba519e197ba880f5fcc24d..f58dadcf5f3822fd18a0d1dfb775b3d7
}

}
@@ -808,8 +819,59 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -807,8 +818,59 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
return ServerChunkCache.this.mainThread;
}

Expand Down Expand Up @@ -11162,7 +11162,7 @@ index 82110c9af65479a918ba519e197ba880f5fcc24d..f58dadcf5f3822fd18a0d1dfb775b3d7
Profiler.get().incrementCounter("runTask");
super.doRunTask(task);
}
@@ -817,12 +879,17 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -816,12 +878,17 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@Override
// CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task
public boolean pollTask() {
Expand Down Expand Up @@ -13187,7 +13187,7 @@ index 3a9e25b436f366fffe08c3b0c1fce11ed42ee646..ae88c6e2635b1608383f8c74813d723f
Collections.shuffle( this.connections );
}
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index b5d5dbc50a7b8c40739a15f164ffd08fdc534f9c..e2e7369e9439906c6db0720e5a2bc0e9c58d5490 100644
index cd1b6b539a62fa5237d6dab2d1c09a2e631d9941..4d013b3e99a7bf7891dea3b6397de65cc3497250 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -310,7 +310,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
Expand Down
12 changes: 6 additions & 6 deletions patches/server/0017-Region-profiler.patch
Original file line number Diff line number Diff line change
Expand Up @@ -1557,7 +1557,7 @@ index ee55c53d40dbf51f47627a6b56060e32fd215353..b261d166eb09386275ba52372cca56fc
if (false) this.playerList.tick(); // Folia - region threading
if (SharedConstants.IS_RUNNING_IN_IDE && this.tickRateManager.runsNormally()) {
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 48fc7676252dbff47f59b65e6b9d9410e25778c5..dd63a17cdbf758aec2110924ef38ee3c1bc18fd1 100644
index c6a2d2543a3616e99d253986a113a7cd07b05f0a..ad6d635971d0f5d23c923b1dc83c0b18e8f4a94a 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -406,13 +406,18 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
Expand All @@ -1579,7 +1579,7 @@ index 48fc7676252dbff47f59b65e6b9d9410e25778c5..dd63a17cdbf758aec2110924ef38ee3c
}

gameprofilerfiller.pop();
@@ -947,12 +952,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -941,12 +946,17 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider

// Paper start - optimise entity tracker
private void newTrackerTick() {
Expand All @@ -1598,7 +1598,7 @@ index 48fc7676252dbff47f59b65e6b9d9410e25778c5..dd63a17cdbf758aec2110924ef38ee3c
final Entity entity = trackerEntitiesRaw[i];
final ChunkMap.TrackedEntity tracker = ((ca.spottedleaf.moonrise.patches.entity_tracker.EntityTrackerEntity)entity).moonrise$getTrackedEntity();
if (tracker == null) {
@@ -964,6 +974,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -958,6 +968,8 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
tracker.serverEntity.sendChanges();
}
}
Expand All @@ -1608,7 +1608,7 @@ index 48fc7676252dbff47f59b65e6b9d9410e25778c5..dd63a17cdbf758aec2110924ef38ee3c
// Paper end - optimise entity tracker

diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
index f58dadcf5f3822fd18a0d1dfb775b3d7cd7abde9..220db29a8901fbbfbec2b95be994f0ea0144b98d 100644
index 16001634fef7573e5363d2903e2b665bc12d3431..a5fc3187438467d24a3143a01188824bb7120b2a 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -455,18 +455,25 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
Expand Down Expand Up @@ -1687,7 +1687,7 @@ index f58dadcf5f3822fd18a0d1dfb775b3d7cd7abde9..220db29a8901fbbfbec2b95be994f0ea
// Paper end - Optional per player mob spawns

regionizedWorldData.lastSpawnState = spawnercreature_d; // Folia - region threading
@@ -603,6 +618,9 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -602,6 +617,9 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon

Iterator iterator = chunks.iterator();

Expand All @@ -1697,7 +1697,7 @@ index f58dadcf5f3822fd18a0d1dfb775b3d7cd7abde9..220db29a8901fbbfbec2b95be994f0ea
while (iterator.hasNext()) {
LevelChunk chunk = (LevelChunk) iterator.next();
ChunkPos chunkcoordintpair = chunk.getPos();
@@ -616,10 +634,15 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
@@ -615,10 +633,15 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
this.level.tickChunk(chunk, k);
}
}
Expand Down

0 comments on commit c937c72

Please sign in to comment.