summaryrefslogtreecommitdiff
path: root/src/main/java/net/cshift/mc/sparkt/netcode/payload/TransitPayload.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/net/cshift/mc/sparkt/netcode/payload/TransitPayload.java')
-rw-r--r--src/main/java/net/cshift/mc/sparkt/netcode/payload/TransitPayload.java25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/main/java/net/cshift/mc/sparkt/netcode/payload/TransitPayload.java b/src/main/java/net/cshift/mc/sparkt/netcode/payload/TransitPayload.java
new file mode 100644
index 0000000..bc7bb6c
--- /dev/null
+++ b/src/main/java/net/cshift/mc/sparkt/netcode/payload/TransitPayload.java
@@ -0,0 +1,25 @@
+package net.cshift.mc.sparkt.netcode.payload;
+
+import com.mojang.authlib.properties.PropertyMap;
+
+import net.cshift.mc.sparkt.netcode.NetConstants;
+import net.minecraft.network.RegistryByteBuf;
+import net.minecraft.network.codec.PacketCodec;
+import net.minecraft.network.codec.PacketCodecs;
+import net.minecraft.network.packet.CustomPayload;
+
+public record TransitPayload(String uuid, PropertyMap obj) implements CustomPayload {
+ public static final CustomPayload.Id<TransitPayload> ID = new CustomPayload.Id<>(NetConstants.TRANSIT_PACKET_ID);
+
+ public static final PacketCodec<RegistryByteBuf, TransitPayload> CODEC = PacketCodec.tuple(
+ PacketCodecs.STRING, TransitPayload::uuid,
+ PacketCodecs.PROPERTY_MAP, TransitPayload::obj,
+ TransitPayload::new
+ );
+
+ @Override
+ public CustomPayload.Id<? extends CustomPayload> getId ()
+ {
+ return ID;
+ }
+}