9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-26 10:29:13 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0229-Protocol-Core.patch
Dreeam f5b95a6716 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@b0da38c2 Repository details in RuntimeException for MavenLibraryResolver#addRepository (#12939)
PaperMC/Paper@1922be90 Update custom tags (#12183)
PaperMC/Paper@79cf1353 Ignore HopperInventorySearchEvent when it has no listeners (#13009)
PaperMC/Paper@ea014f7a feat: add stuckEntityPoiRetryDelay config (#12949)
PaperMC/Paper@a9e76749 Support for showNotification in PlayerRecipeDiscoverEvent (#12992)
PaperMC/Paper@5622c9dd Expose attribute sentiment (#12974)
PaperMC/Paper@42b653b1 Expose more argument types (#12665)
PaperMC/Paper@52d9a221 [ci/skip] Fix typo in Display javadoc (#13010)
PaperMC/Paper@614e9acf Improve APIs around riptide tridents (#12996)
PaperMC/Paper@51706e5a Fixed DyeItem sheep dye hunk
2025-08-25 15:52:00 -04:00

77 lines
4.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: hayanesuru <hayanesuru@outlook.jp>
Date: Tue, 6 May 2025 17:44:16 +0900
Subject: [PATCH] Protocol Core
diff --git a/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java b/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java
index 56fd1ed7ccaf96e7eedea60fbdbf7f934939d563..d2f522ea6d0a209496848af073c9af1c45d6b6ce 100644
--- a/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java
+++ b/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java
@@ -46,6 +46,12 @@ public interface CustomPacketPayload {
return;
}
// Leaves end - protocol core
+ // Leaf start - Protocol core
+ if (value instanceof org.dreeam.leaf.protocol.LeafCustomPayload payload) {
+ org.dreeam.leaf.protocol.Protocols.write(buffer, payload);
+ return;
+ }
+ // Leaf end - Protocol core
this.writeCap(buffer, value.type(), value);
}
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 462328b74bfa081033edb54491985162c39fe208..39898c9429612b0cc690361be971c1fb3e71b278 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1803,6 +1803,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handleTick(tickCount); // Leaves - protocol
+ org.dreeam.leaf.protocol.Protocols.tickServer(this); // Leaf - Protocol core
for (int i = 0; i < this.tickables.size(); i++) {
this.tickables.get(i).run();
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index 6c2b7818ff6535f73fcbb87ef25b2992656ce348..be9d5c760e192df17a6513b819f956ad526e6d67 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -810,6 +810,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
}
}
// Purpur end - Ridables
+ org.dreeam.leaf.protocol.Protocols.tickPlayer(this); // Leaf - Protocol core
}
private void updatePlayerAttributes() {
diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 3479ed772125b619dea7aed2a6695b8f7f08e1e8..0777dfca620c5c6c45696d73f1ab7341e813537c 100644
--- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -190,6 +190,12 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
net.minecraft.network.protocol.PacketUtils.ensureRunningOnSameThread(packet, this, this.server);
+ // Leaf start - Protocol core
+ if (this instanceof ServerGamePacketListenerImpl gamePacketListener) {
+ org.dreeam.leaf.protocol.Protocols.handle(gamePacketListener.player, discardedPayload);
+ }
+ // Leaf end - Protocol core
+
final net.minecraft.resources.ResourceLocation identifier = packet.payload().type().id();
final byte[] data = discardedPayload.data();
try {
diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java
index 504ba8622d87c73e9a640de9b96285474685c77e..f0bdc2bbf358d4c5f113b395c6409ff9fa759e2f 100644
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -690,6 +690,7 @@ public abstract class PlayerList {
}
public @Nullable net.kyori.adventure.text.Component remove(ServerPlayer player, net.kyori.adventure.text.Component leaveMessage) {
org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handlePlayerLeave(player); // Leaves - protocol
+ org.dreeam.leaf.protocol.Protocols.disconnected(player); // Leaf - Protocol core
// Paper end - Fix kick event leave message not being sent
org.purpurmc.purpur.task.BossBarTask.removeFromAll(player.getBukkitEntity()); // Purpur - Implement TPSBar
net.minecraft.server.network.ServerGamePacketListenerImpl.afkCooldown.remove(player.getBukkitEntity().getUniqueId()); // Leaf - Improve Purpur AFK system