mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-19 14:59:25 +00:00
* start 1.21.6 update * change workflow * apply some patches * set experimental to true * some compile fixes * Updated Upstream (Purpur) Upstream has released updates that appear to apply and compile correctly Purpur Changes: PurpurMC/Purpur@5d3463aa Updated Upstream (Paper) * Updated Upstream (Purpur) Upstream has released updates that appear to apply and compile correctly Purpur Changes: PurpurMC/Purpur@5d3463aa Updated Upstream (Paper) * remove data converter for 1.21.6; move clumps to unapplied * Updated Upstream (Purpur) Upstream has released updates that appear to apply and compile correctly * Updated Upstream (Purpur) Upstream has released updates that appear to apply and compile correctly * Update upstream * Update upstream * update to 1.21.6-pre4 * update patches * fix compile * set readme version to 1.21.6 * Updated Upstream (Purpur) Upstream has released updates that appear to apply and compile correctly Purpur Changes: PurpurMC/Purpur@439f15db Updated Upstream (Paper) PurpurMC/Purpur@46a28b93 [ci/skip] update version in README
47 lines
3.9 KiB
Diff
47 lines
3.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
|
|
Date: Fri, 13 Sep 2024 14:32:32 -0700
|
|
Subject: [PATCH] Paper PR: Add ticket on player join to avoid chunk
|
|
load-unload-load cycle
|
|
|
|
Original license: GPLv3
|
|
Original project: https://github.com/PaperMC/Paper
|
|
Paper pull request: https://github.com/PaperMC/Paper/pull/11398
|
|
|
|
Adding the entity will add and then immediately remove an entity load ticket, which would result in the chunk loading and then unloading before being loaded again once the player chunk loader reacts (delay can vary based on rate limit configs)
|
|
By adding a ticket with a short removal delay we attempt to keep the chunk loaded until the player chunk loader reacts, but this is not a guarantee due to the aforementioned rate limit configs. Plugins should still handle load/unload events as normal, however this will reduce redundant calls.
|
|
The delay is currently set to 2 seconds, however, we may want to adjust this before merging (for example the player chunk unload delay is 5 seconds)
|
|
|
|
This patch fixes PaperMC/Paper#9581
|
|
|
|
diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java b/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java
|
|
index 70cf5f90b278814b7b594dd79f592696c28a69d7..75a3b7ea3c212bce63041ebfc4c7be9f55127cc4 100644
|
|
--- a/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java
|
|
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java
|
|
@@ -48,6 +48,7 @@ public final class RegionizedPlayerChunkLoader {
|
|
|
|
public static final TicketType PLAYER_TICKET = ChunkSystemTicketType.create("chunk_system:player_ticket", Long::compareTo);
|
|
public static final TicketType PLAYER_TICKET_DELAYED = ChunkSystemTicketType.create("chunk_system:player_ticket_delayed", Long::compareTo, 5L * 20L);
|
|
+ public static final TicketType PLAYER_JOIN = ChunkSystemTicketType.create("chunk_system:player_join", (a, b) -> 0, 5 * 20); // Paper - Add ticket on player join to avoid chunk load-unload-load cycle
|
|
|
|
public static final int GENERATED_TICKET_LEVEL = ChunkHolderManager.FULL_LOADED_TICKET_LEVEL;
|
|
public static final int LOADED_TICKET_LEVEL = ChunkTaskScheduler.getTicketLevel(ChunkStatus.EMPTY);
|
|
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
|
|
index a534b3e6835b9e998ae25210812ddf55685473ea..ce68dd77963e2bcb6119c682a700f540109d4877 100644
|
|
--- a/net/minecraft/server/players/PlayerList.java
|
|
+++ b/net/minecraft/server/players/PlayerList.java
|
|
@@ -316,6 +316,13 @@ public abstract class PlayerList {
|
|
// this.broadcastAll(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(player))); // CraftBukkit - replaced with loop below
|
|
// Paper start - Fire PlayerJoinEvent when Player is actually ready; correctly register player BEFORE PlayerJoinEvent, so the entity is valid and doesn't require tick delay hacks
|
|
player.supressTrackerForLogin = true;
|
|
+ // Paper start - Add ticket on player join to avoid chunk load-unload-load cycle
|
|
+ serverLevel.moonrise$getChunkTaskScheduler().chunkHolderManager.addTicketAtLevel(
|
|
+ ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.PLAYER_JOIN,
|
|
+ player.chunkPosition(),
|
|
+ ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.TICK_TICKET_LEVEL,
|
|
+ net.minecraft.util.Unit.INSTANCE);
|
|
+ // Paper end - Add ticket on player join to avoid chunk load-unload-load cycle
|
|
serverLevel.addNewPlayer(player);
|
|
this.server.getCustomBossEvents().onPlayerConnect(player); // see commented out section below serverLevel.addPlayerJoin(player);
|
|
// Paper end - Fire PlayerJoinEvent when Player is actually ready
|