public abstract class AbstractTCGPacket extends java.lang.Object implements TCGPacket
TCGPacket
interface.
It abstracts the process of checking if the method should be run on the main Minecraft server Thread
.
It also abstracts the process of performing safety checks depending on the enviroment it's being executed in (i.e.
DistExecutor.unsafeRunWhenOn(Dist, Supplier)
Constructor and Description |
---|
AbstractTCGPacket(boolean sync) |
AbstractTCGPacket(PacketDirection direction) |
AbstractTCGPacket(PacketDirection direction,
boolean sync) |
Modifier and Type | Method and Description |
---|---|
void |
decode(net.minecraft.network.PacketBuffer buffer)
Decodes the information from the buffer to the packet instance
|
void |
encode(net.minecraft.network.PacketBuffer buffer)
Encodes the buffer with the packet information
|
void |
handle(net.minecraftforge.fml.network.NetworkEvent.Context context)
Handles the packet being executed on the server or the client
|
protected abstract void |
handlePacket(net.minecraftforge.fml.network.NetworkEvent.Context context) |
protected void |
reply(net.minecraftforge.fml.network.NetworkEvent.Context context,
java.lang.Object packet)
Abstracted method for replying to the received packet
|
public AbstractTCGPacket(PacketDirection direction)
public AbstractTCGPacket(PacketDirection direction, boolean sync)
public AbstractTCGPacket(boolean sync)
public void encode(net.minecraft.network.PacketBuffer buffer)
TCGPacket
public void decode(net.minecraft.network.PacketBuffer buffer)
TCGPacket
public void handle(net.minecraftforge.fml.network.NetworkEvent.Context context)
TCGPacket
protected abstract void handlePacket(net.minecraftforge.fml.network.NetworkEvent.Context context)
protected void reply(net.minecraftforge.fml.network.NetworkEvent.Context context, java.lang.Object packet)
context
- The context of the packetpacket
- The packet to reply with