9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2026-01-06 15:41:52 +00:00

sync paper upstream

This commit is contained in:
NONPLAYT
2025-06-10 20:46:36 +03:00
parent c0ca1f9394
commit 32df32fe22
4 changed files with 205 additions and 1 deletions

View File

@@ -3,7 +3,7 @@ import org.gradle.api.tasks.testing.logging.TestLogEvent
plugins {
java
id("io.papermc.paperweight.patcher") version "2.0.0-SNAPSHOT"
id("io.papermc.paperweight.patcher") version "2.0.0-beta.14"
}
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"

View File

@@ -1,5 +1,14 @@
--- a/purpur-server/build.gradle.kts
+++ b/purpur-server/build.gradle.kts
@@ -11,7 +_,7 @@
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
dependencies {
- mache("io.papermc:mache:1.21.4+build.7")
+ mache("io.papermc:mache:1.21.4+build.8") // DivineMC - sync upstream mache version
paperclip("io.papermc:paperclip:3.0.3")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
@@ -22,6 +_,7 @@
// gitFilePatches = true

View File

@@ -0,0 +1,116 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
Date: Tue, 10 Jun 2025 20:44:38 +0300
Subject: [PATCH] Sync Paper upstream
diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java b/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java
index 34682217252cb98a70511a8cb25f077ec9f872b8..eccd330a332a927354f47acd16295c23d7b5f7dd 100644
--- a/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java
@@ -1143,7 +1143,7 @@ public final class MoonriseRegionFileIO {
LOGGER.error("Failed to decompress chunk data for task: " + this.toString(), thr);
}
- if (compoundTag == null) {
+ if (throwable == null && compoundTag == null) { // DivineMC - Sync Paper upstream
// need to re-try from the start
this.scheduleReadIO();
return;
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index bea62fca118efdd6257188cd53c813dc5fd0c19c..adca106b1100b5c5236f40eb3795ac89c1fa0288 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -1403,7 +1403,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
if (doFull) {
- this.saveLevelData(true);
+ this.saveLevelData(false);
}
// chunk autosave is already called by the ChunkSystem during unload processing (ChunkMap#processUnloads)
// Copied from save()
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index 195d9dc696a9a7da0bb041612b73c0bbacf2919e..5173e1365dd700abb8bf3d38ff00b34dcce41039 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -265,13 +265,6 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
}
// Paper end - Sync offhand slot in menus
- // Paper start - add flag to simplify remote matching logic
- @Override
- public ServerPlayer player() {
- return ServerPlayer.this;
- }
- // Paper end - add flag to simplify remote matching logic
-
@Override
public void sendSlotChange(AbstractContainerMenu container, int slot, ItemStack itemStack) {
ServerPlayer.this.connection.send(new ClientboundContainerSetSlotPacket(container.containerId, container.incrementStateId(), slot, itemStack));
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index c3e8da14d4faf560d24f877ef9eeb4a5dcb2aa8d..86e1ec473d13745e10a371289bee58791228be1f 100644
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -785,6 +785,7 @@ public class ServerGamePacketListenerImpl
@Override
public void handleBundleItemSelectedPacket(ServerboundSelectBundleItemPacket packet) {
+ PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); // Paper
this.player.containerMenu.setSelectedBundleItemIndex(packet.slotId(), packet.selectedItemIndex());
}
diff --git a/net/minecraft/world/inventory/AbstractContainerMenu.java b/net/minecraft/world/inventory/AbstractContainerMenu.java
index b03068bb94c785db51da660361ce28b9f4b45898..f9ae53d04ead53c7de29a3e50da1e257937df44b 100644
--- a/net/minecraft/world/inventory/AbstractContainerMenu.java
+++ b/net/minecraft/world/inventory/AbstractContainerMenu.java
@@ -288,7 +288,7 @@ public abstract class AbstractContainerMenu {
private void synchronizeSlotToRemote(int slotIndex, ItemStack stack, Supplier<ItemStack> supplier) {
if (!this.suppressRemoteUpdates) {
ItemStack itemStack = this.remoteSlots.get(slotIndex);
- if (!this.matchesRemote(itemStack, stack)) { // Paper - add flag to simplify remote matching logic
+ if (!ItemStack.matches(itemStack, stack)) {
ItemStack itemStack1 = supplier.get();
this.remoteSlots.set(slotIndex, itemStack1);
if (this.synchronizer != null) {
@@ -312,7 +312,7 @@ public abstract class AbstractContainerMenu {
private void synchronizeCarriedToRemote() {
if (!this.suppressRemoteUpdates) {
- if (!this.matchesRemote(this.getCarried(), this.remoteCarried)) { // Paper - add flag to simplify remote matching logic
+ if (!ItemStack.matches(this.getCarried(), this.remoteCarried)) {
this.remoteCarried = this.getCarried().copy();
if (this.synchronizer != null) {
this.synchronizer.sendCarriedChange(this, this.remoteCarried);
@@ -321,16 +321,6 @@ public abstract class AbstractContainerMenu {
}
}
- // Paper start - add flag to simplify remote matching logic
- private boolean matchesRemote(final ItemStack stack, final ItemStack other) {
- if (this.synchronizer != null && this.synchronizer.player() != null && this.synchronizer.player().getBukkitEntity().simplifyContainerDesyncCheck()) {
- // Only check the item type and count
- return stack == other || (stack.getCount() == other.getCount() && ItemStack.isSameItem(stack, other));
- }
- return ItemStack.matches(stack, other);
- }
- // Paper end - add flag to simplify remote matching logic
-
public void setRemoteSlot(int slot, ItemStack stack) {
this.remoteSlots.set(slot, stack.copy());
}
diff --git a/net/minecraft/world/inventory/ContainerSynchronizer.java b/net/minecraft/world/inventory/ContainerSynchronizer.java
index 396a8dde4ab85585628e75a60269ebfe9a051423..3200b2ebbdc963385fa6c36975afc062ea248baa 100644
--- a/net/minecraft/world/inventory/ContainerSynchronizer.java
+++ b/net/minecraft/world/inventory/ContainerSynchronizer.java
@@ -13,10 +13,4 @@ public interface ContainerSynchronizer {
void sendDataChange(AbstractContainerMenu container, int id, int value);
default void sendOffHandSlotChange() {} // Paper - Sync offhand slot in menus
-
- // Paper start - add flag to simplify remote matching logic
- default net.minecraft.server.level.@org.jspecify.annotations.Nullable ServerPlayer player() {
- return null;
- }
- // Paper end - add flag to simplify remote matching logic
}

View File

@@ -0,0 +1,79 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com>
Date: Tue, 10 Jun 2025 20:44:52 +0300
Subject: [PATCH] Sync Paper upstream
diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
index af728eec05f67d9c3185bd2ccf7a9088a33be401..9d0835bfae488f6b3f0ac49f1af1b1271a283f1c 100644
--- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
+++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java
@@ -185,8 +185,6 @@ public class GlobalConfiguration extends ConfigurationPart {
public CompressionFormat compressionFormat = CompressionFormat.ZLIB;
@Comment("This setting controls if equipment should be updated when handling certain player actions.")
public boolean updateEquipmentOnPlayerActions = true;
- @Comment("Only checks an item's amount and type instead of its full data during inventory desync checks.")
- public boolean simplifyRemoteItemMatching = false;
public enum CompressionFormat {
GZIP,
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 97c372dca0ec7a8e9f0103676c0baa7a1bb4a855..9c3584f0917bbc482c67ca0fd3429c66cc658a54 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -41,6 +41,7 @@ import java.util.logging.Logger;
import java.util.stream.Collectors;
import javax.imageio.ImageIO;
// import jline.console.ConsoleReader;
+import net.minecraft.Optionull;
import net.minecraft.advancements.AdvancementHolder;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
@@ -2420,7 +2421,11 @@ public final class CraftServer implements Server {
@Override
public GameMode getDefaultGameMode() {
- return GameMode.getByValue(this.console.getLevel(net.minecraft.world.level.Level.OVERWORLD).serverLevelData.getGameType().getId());
+ return GameMode.getByValue(Optionull.mapOrDefault(
+ this.console.getLevel(net.minecraft.world.level.Level.OVERWORLD),
+ l -> l.serverLevelData.getGameType(),
+ this.console.getProperties().gamemode
+ ).getId());
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 3cb2cd294874ece5fbefd0618b4db27701ef118a..c18efc0a7309a749a621b4bc6069cbffcf0bdb6f 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -221,7 +221,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
private BorderChangeListener clientWorldBorderListener = this.createWorldBorderListener();
public org.bukkit.event.player.PlayerResourcePackStatusEvent.Status resourcePackStatus; // Paper - more resource pack API
private static final boolean DISABLE_CHANNEL_LIMIT = System.getProperty("paper.disableChannelLimit") != null; // Paper - add a flag to disable the channel limit
- private boolean simplifyContainerDesyncCheck = GlobalConfiguration.get().unsupportedSettings.simplifyRemoteItemMatching;
private long lastSaveTime; // Paper - getLastPlayed replacement API
public CraftPlayer(CraftServer server, ServerPlayer entity) {
@@ -3639,22 +3638,6 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
getHandle().setScore(score);
}
- /**
- * Returns whether container desync checks should skip the full item comparison of remote carried and changed slots
- * and should instead only check their type and amount.
- * <p>
- * This is useful if the client is not able to produce the same item stack (or as of 1.21.5, its data hashes) as the server.
- *
- * @return whether to simplify container desync checks
- */
- public boolean simplifyContainerDesyncCheck() {
- return simplifyContainerDesyncCheck;
- }
-
- public void setSimplifyContainerDesyncCheck(final boolean simplifyContainerDesyncCheck) {
- this.simplifyContainerDesyncCheck = simplifyContainerDesyncCheck;
- }
-
// Purpur start - Purpur client support
@Override
public boolean usesPurpurClient() {