From a086e1b7955bd2427983a47ee5532277eeb150c1 Mon Sep 17 00:00:00 2001 From: RTTV Date: Thu, 28 Nov 2024 16:14:43 -0500 Subject: [PATCH] updated to new c2c system --- .../clientcommands/c2c/C2CPacketHandler.java | 2 -- .../c2c/packets/PutConnectFourPieceC2CPacket.java | 10 +++++----- .../c2c/packets/StartTwoPlayerGameC2CPacket.java | 2 ++ 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/net/earthcomputer/clientcommands/c2c/C2CPacketHandler.java b/src/main/java/net/earthcomputer/clientcommands/c2c/C2CPacketHandler.java index 7904832ef..8571e56bb 100644 --- a/src/main/java/net/earthcomputer/clientcommands/c2c/C2CPacketHandler.java +++ b/src/main/java/net/earthcomputer/clientcommands/c2c/C2CPacketHandler.java @@ -13,7 +13,6 @@ import net.earthcomputer.clientcommands.command.ConnectFourCommand; import net.earthcomputer.clientcommands.command.ListenCommand; import net.earthcomputer.clientcommands.features.TwoPlayerGame; -import net.earthcomputer.clientcommands.interfaces.IClientPacketListener_C2C; import net.earthcomputer.clientcommands.command.TicTacToeCommand; import net.fabricmc.fabric.api.networking.v1.PacketByteBufs; import net.minecraft.ChatFormatting; @@ -26,7 +25,6 @@ import net.minecraft.network.DisconnectionDetails; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.ProtocolInfo; -import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.RemoteChatSession; diff --git a/src/main/java/net/earthcomputer/clientcommands/c2c/packets/PutConnectFourPieceC2CPacket.java b/src/main/java/net/earthcomputer/clientcommands/c2c/packets/PutConnectFourPieceC2CPacket.java index b4ec1e203..e83c81fe2 100644 --- a/src/main/java/net/earthcomputer/clientcommands/c2c/packets/PutConnectFourPieceC2CPacket.java +++ b/src/main/java/net/earthcomputer/clientcommands/c2c/packets/PutConnectFourPieceC2CPacket.java @@ -1,5 +1,6 @@ package net.earthcomputer.clientcommands.c2c.packets; +import net.earthcomputer.clientcommands.c2c.C2CFriendlyByteBuf; import net.earthcomputer.clientcommands.c2c.C2CPacket; import net.earthcomputer.clientcommands.c2c.C2CPacketListener; import net.minecraft.network.FriendlyByteBuf; @@ -11,15 +12,14 @@ import net.minecraft.resources.ResourceLocation; public record PutConnectFourPieceC2CPacket(String sender, int x) implements C2CPacket { - public static final StreamCodec CODEC = Packet.codec(PutConnectFourPieceC2CPacket::write, PutConnectFourPieceC2CPacket::new); + public static final StreamCodec CODEC = Packet.codec(PutConnectFourPieceC2CPacket::write, PutConnectFourPieceC2CPacket::new); public static final PacketType ID = new PacketType<>(PacketFlow.CLIENTBOUND, ResourceLocation.fromNamespaceAndPath("clientcommands", "put_connect_four_piece")); - public PutConnectFourPieceC2CPacket(FriendlyByteBuf buf) { - this(buf.readUtf(), buf.readVarInt()); + public PutConnectFourPieceC2CPacket(C2CFriendlyByteBuf buf) { + this(buf.getSender(), buf.readVarInt()); } - public void write(FriendlyByteBuf buf) { - buf.writeUtf(this.sender); + public void write(C2CFriendlyByteBuf buf) { buf.writeVarInt(this.x); } diff --git a/src/main/java/net/earthcomputer/clientcommands/c2c/packets/StartTwoPlayerGameC2CPacket.java b/src/main/java/net/earthcomputer/clientcommands/c2c/packets/StartTwoPlayerGameC2CPacket.java index 25c6adb89..9e199e69e 100644 --- a/src/main/java/net/earthcomputer/clientcommands/c2c/packets/StartTwoPlayerGameC2CPacket.java +++ b/src/main/java/net/earthcomputer/clientcommands/c2c/packets/StartTwoPlayerGameC2CPacket.java @@ -1,7 +1,9 @@ package net.earthcomputer.clientcommands.c2c.packets; +import net.earthcomputer.clientcommands.c2c.C2CFriendlyByteBuf; import net.earthcomputer.clientcommands.c2c.C2CPacket; import net.earthcomputer.clientcommands.c2c.C2CPacketListener; +import net.earthcomputer.clientcommands.features.TwoPlayerGame; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.StreamCodec;