diff options
author | GlodBlock <60341015+GlodBlock@users.noreply.github.com> | 2021-09-27 15:39:31 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-27 15:39:31 +0800 |
commit | 097438be70486735a8940dd5ce4e9484b6d951af (patch) | |
tree | 90f26b34d5059eb9858d9c82aabbd5373638acfa /src/main/java/gregtech/api/net/GT_Packet.java | |
parent | a0a77f0b9868a4ca8a3df8ae8d50b4dcfb4030db (diff) | |
parent | 92433a5b85bb2fcca541ac25ca4033fac24f841e (diff) | |
download | GT5-Unofficial-097438be70486735a8940dd5ce4e9484b6d951af.tar.gz GT5-Unofficial-097438be70486735a8940dd5ce4e9484b6d951af.tar.bz2 GT5-Unofficial-097438be70486735a8940dd5ce4e9484b6d951af.zip |
Merge pull request #1 from GlodBlock/fix-crack-recipe-check
Fix crack recipe check
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) {} +} |