diff options
Diffstat (limited to 'src/main/java/gregtech/api/net/GT_Packet.java')
-rw-r--r-- | src/main/java/gregtech/api/net/GT_Packet.java | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/src/main/java/gregtech/api/net/GT_Packet.java b/src/main/java/gregtech/api/net/GT_Packet.java index 6fdd013d8f..48cc171d61 100644 --- a/src/main/java/gregtech/api/net/GT_Packet.java +++ b/src/main/java/gregtech/api/net/GT_Packet.java @@ -1,8 +1,14 @@ package gregtech.api.net; import com.google.common.io.ByteArrayDataInput; +import io.netty.buffer.ByteBuf; +import net.minecraft.network.INetHandler; import net.minecraft.world.IBlockAccess; +/** + * @deprecated Use {@link GT_Packet_New} instead + */ +@Deprecated public abstract class GT_Packet { public GT_Packet(boolean aIsReference) { // @@ -17,13 +23,33 @@ public abstract class GT_Packet { /** * @return encoded byte Stream + * @deprecated Use {@link #encode(ByteBuf)} instead */ + @Deprecated public abstract byte[] encode(); /** + * Encode the data into given byte buffer without creating an intermediate byte array. + * Default implementation just throw {@link UnsupportedOperationException}. + */ + public void encode(ByteBuf aOut) { + throw new UnsupportedOperationException(); + } + + /** * @return encoded byte Stream */ public abstract GT_Packet decode(ByteArrayDataInput aData); + /** + * Process the packet + * + * @param aWorld null if message is received on server side, the client world if message is received on client side + */ public abstract void process(IBlockAccess aWorld); -}
\ No newline at end of file + + /** + * This will be called just before {@link #process(IBlockAccess)} to inform the handler about the source and type of connection + */ + public void setINetHandler(INetHandler aHandler) {} +} |