blob: 2f4805aad8b40890d399a962d9322057a0ceba2a (
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
42
43
44
45
46
47
|
package gregtech.api.net;
import net.minecraft.world.ChunkCoordIntPair;
import net.minecraft.world.IBlockAccess;
import com.google.common.io.ByteArrayDataInput;
import gregtech.common.GTClient;
import io.netty.buffer.ByteBuf;
public class GTPacketPollution extends GTPacketNew {
private ChunkCoordIntPair chunk;
private int pollution;
public GTPacketPollution() {
super(true);
}
public GTPacketPollution(ChunkCoordIntPair chunk, int pollution) {
super(false);
this.chunk = chunk;
this.pollution = pollution;
}
@Override
public void encode(ByteBuf aOut) {
aOut.writeInt(chunk.chunkXPos)
.writeInt(chunk.chunkZPos)
.writeInt(pollution);
}
@Override
public GTPacketNew decode(ByteArrayDataInput aData) {
return new GTPacketPollution(new ChunkCoordIntPair(aData.readInt(), aData.readInt()), aData.readInt());
}
@Override
public void process(IBlockAccess aWorld) {
GTClient.recieveChunkPollutionPacket(chunk, pollution);
}
@Override
public byte getPacketID() {
return GTPacketTypes.POLLUTION.id;
}
}
|