blob: 68e08ab30404213900af34845709daf813cb2801 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
package gregtech.api.net;
import net.minecraft.network.INetHandler;
import net.minecraft.world.IBlockAccess;
import com.google.common.io.ByteArrayDataInput;
import io.netty.buffer.ByteBuf;
public abstract class GTPacket {
public GTPacket() {}
/**
* Unique ID of this packet.
*/
public abstract byte getPacketID();
/**
* Encode the data into given byte buffer.
*/
public abstract void encode(ByteBuf buffer);
/**
* Decode byte buffer into packet object.
*/
public abstract GTPacket decode(ByteArrayDataInput buffer);
/**
* Process the received packet.
*
* @param world null if message is received on server side, the client world if message is received on client side
*/
public abstract void process(IBlockAccess world);
/**
* This will be called just before {@link #process(IBlockAccess)} to inform the handler about the source and type of
* connection.
*/
public void setINetHandler(INetHandler handler) {}
}
|