9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00
Files
Leaf/leaf-server/minecraft-patches/features/0160-Protocol-Core.patch
2025-06-11 03:59:45 +08:00

73 lines
4.2 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 7e19dfe90a63ff26f03b95891dacb7360bba5a3c..5d0961f06c23121883c4f0b889ccdf32f06e8a35 100644
--- a/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java
+++ b/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java
@@ -47,6 +47,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 f5f0e4f5d7a4b34514e102020d2a7be313292f7f..0baa48054beead8f187b56ea8d71916600ccea9f 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1832,6 +1832,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
}
org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handleTick(); // 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 941a73f32661dfa50dd381dc888bd3c04f3fad60..0ba7cf69eda2d952ac2ffecf9167f3f5d43c4c63 100644
--- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java
@@ -859,6 +859,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 96b70c1384834a8e22925c8e2af85ab7606dde20..9eb14bb38416330878959c4b095d057ce0e4fe92 100644
--- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -167,6 +167,8 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
+ org.dreeam.leaf.protocol.Protocols.handle(this.player, discardedPayload); // Leaf - 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 afa25f6adb7e3c50f4a71af10818b50d4f1be393..6da7f7213130f19c7d95a173498e7375bfacc9a5 100644
--- a/net/minecraft/server/players/PlayerList.java
+++ b/net/minecraft/server/players/PlayerList.java
@@ -682,6 +682,7 @@ public abstract class PlayerList {
}
public 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