mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-19 15:09:25 +00:00
85 lines
4.9 KiB
Diff
85 lines
4.9 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 272204ae3f94f6f50454d0b5f5bcdd264971774e..52c4a93d0c1fd40e7a92d9ed6d2d8010569f8f2b 100644
|
|
--- a/net/minecraft/server/MinecraftServer.java
|
|
+++ b/net/minecraft/server/MinecraftServer.java
|
|
@@ -1853,6 +1853,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/ServerEntity.java b/net/minecraft/server/level/ServerEntity.java
|
|
index 5351d373aa0f4450386a6b50f88052c031949f5b..ea4067be7e800b58dd59f7ffec58c1e026f68c6e 100644
|
|
--- a/net/minecraft/server/level/ServerEntity.java
|
|
+++ b/net/minecraft/server/level/ServerEntity.java
|
|
@@ -283,6 +283,7 @@ public class ServerEntity {
|
|
this.entity.hurtMarked = false;
|
|
this.broadcastAndSend(new ClientboundSetEntityMotionPacket(this.entity));
|
|
}
|
|
+ if (entity instanceof ServerPlayer serverPlayer) org.dreeam.leaf.protocol.Protocols.tickTracker(serverPlayer); // Leaf - Protocol core
|
|
}
|
|
|
|
// Purpur start
|
|
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
|
index 09f517059aa47ca67329bc913243d4fdee09abe5..50cf63666071f5d01a85dfc6c6c45c19b05d8ec2 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 842cb6efc8aa7c68b7b9cba144d8540679850f23..857e5823038192931b89a8b638a9a6b1fd0f9b5c 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
|