public abstract class AbstractPixelmonPacket extends java.lang.Object implements PixelmonPacket
PixelmonPacket
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 |
---|
AbstractPixelmonPacket(boolean sync) |
AbstractPixelmonPacket(PacketDirection direction) |
AbstractPixelmonPacket(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 AbstractPixelmonPacket(PacketDirection direction)
public AbstractPixelmonPacket(PacketDirection direction, boolean sync)
public AbstractPixelmonPacket(boolean sync)
public void encode(net.minecraft.network.PacketBuffer buffer)
PixelmonPacket
encode
in interface PixelmonPacket
buffer
- The buffer being encodedpublic void decode(net.minecraft.network.PacketBuffer buffer)
PixelmonPacket
decode
in interface PixelmonPacket
buffer
- The buffer being decodedpublic void handle(net.minecraftforge.fml.network.NetworkEvent.Context context)
PixelmonPacket
handle
in interface PixelmonPacket
context
- The network event context being supplied by Forgeprotected 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