mirror of
https://github.com/LeavesMC/Leaves.git
synced 2026-01-04 15:41:31 +00:00
PCA sync protocol
This commit is contained in:
@@ -246,3 +246,28 @@ index 0000000000000000000000000000000000000000..b684d8f576acbc5de8d06b0ff779c257
|
||||
+ return backingMap.size();
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/top/leavesmc/leaves/util/ProtocolUtils.java b/src/main/java/top/leavesmc/leaves/util/ProtocolUtils.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..a29da205e542edb0400b8c5db76dc97cff015b8c
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/top/leavesmc/leaves/util/ProtocolUtils.java
|
||||
@@ -0,0 +1,19 @@
|
||||
+package top.leavesmc.leaves.util;
|
||||
+
|
||||
+import net.minecraft.network.FriendlyByteBuf;
|
||||
+import net.minecraft.network.protocol.game.ClientboundCustomPayloadPacket;
|
||||
+import net.minecraft.network.protocol.game.ServerboundCustomPayloadPacket;
|
||||
+import net.minecraft.resources.ResourceLocation;
|
||||
+import net.minecraft.server.level.ServerPlayer;
|
||||
+import org.jetbrains.annotations.NotNull;
|
||||
+
|
||||
+public class ProtocolUtils {
|
||||
+
|
||||
+ public static void sendPayloadPacket(@NotNull ServerPlayer player, ResourceLocation channel, FriendlyByteBuf data) {
|
||||
+ player.connection.send(new ClientboundCustomPayloadPacket(channel, data));
|
||||
+ }
|
||||
+
|
||||
+ public static boolean isNamespacePacket(@NotNull ServerboundCustomPayloadPacket packet, String namespace) {
|
||||
+ return packet.identifier.getNamespace().equals(namespace);
|
||||
+ }
|
||||
+}
|
||||
|
||||
Reference in New Issue
Block a user