Skip to content

Commit

Permalink
updated to new c2c system
Browse files Browse the repository at this point in the history
  • Loading branch information
RealRTTV committed Nov 28, 2024
1 parent 3a4b5e5 commit a086e1b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -11,15 +12,14 @@
import net.minecraft.resources.ResourceLocation;

public record PutConnectFourPieceC2CPacket(String sender, int x) implements C2CPacket {
public static final StreamCodec<RegistryFriendlyByteBuf, PutConnectFourPieceC2CPacket> CODEC = Packet.codec(PutConnectFourPieceC2CPacket::write, PutConnectFourPieceC2CPacket::new);
public static final StreamCodec<C2CFriendlyByteBuf, PutConnectFourPieceC2CPacket> CODEC = Packet.codec(PutConnectFourPieceC2CPacket::write, PutConnectFourPieceC2CPacket::new);
public static final PacketType<PutConnectFourPieceC2CPacket> 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);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit a086e1b

Please sign in to comment.