mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-19 15:09:25 +00:00
Paper Changes: PaperMC/Paper@c2bb144f Properly save level data async (#12530) PaperMC/Paper@e2ca4773 Remove simplify remote item matching option for now
85 lines
4.8 KiB
Diff
85 lines
4.8 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..d20ffa172227f85b9fd6ac5e2766f6ebd2d07638 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
|
|
+ if (value instanceof org.dreeam.leaf.protocol.LeafCustomPayload payload) {
|
|
+ org.dreeam.leaf.protocol.Protocols.write(buffer, payload);
|
|
+ return;
|
|
+ }
|
|
+ // Leaf end - protocol
|
|
this.writeCap(buffer, value.type(), value);
|
|
}
|
|
|
|
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
|
|
index 98af1ad020a003db66d7319f33d43deec315aec5..e04a6db55d936277f2a852374f11d483d79a90ed 100644
|
|
--- a/net/minecraft/server/MinecraftServer.java
|
|
+++ b/net/minecraft/server/MinecraftServer.java
|
|
@@ -1839,6 +1839,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
|
|
|
|
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 38314fcb660f6cbb36d60434d24df5b579425eb3..f17980536b98f20443556ed294c970bc2d570bbb 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
|
|
}
|
|
|
|
// Purpur start
|
|
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
|
|
index 09f517059aa47ca67329bc913243d4fdee09abe5..43c4b8e54842310e48bcdaa991c68ff9571d7249 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
|
|
}
|
|
|
|
private void updatePlayerAttributes() {
|
|
diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
|
index 96b70c1384834a8e22925c8e2af85ab7606dde20..9570ab0fcf62fef04c039ab0de72e8293fa29950 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
|
|
+
|
|
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..db079ee9a957972a0e7199d885165eead128b81e 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
|
|
// 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
|