blob: 813cc1a07dbbc0f1ee14c136b67e8d6f0bd2ad9f (
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
48
49
50
51
52
53
54
55
56
57
58
59
60
|
package bartworks.common.net;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import com.google.common.io.ByteArrayDataInput;
import bartworks.API.SideReference;
import bartworks.common.tileentities.multis.MTEElectricImplosionCompressor;
import bartworks.util.Coords;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.net.GTPacket;
import io.netty.buffer.ByteBuf;
public class PacketEIC extends GTPacket {
private Coords coords;
private boolean bool;
public PacketEIC() {
super();
}
public PacketEIC(Coords coords, boolean bool) {
super();
this.coords = coords;
this.bool = bool;
}
@Override
public byte getPacketID() {
return 27;
}
@Override
public void encode(ByteBuf aOut) {
aOut.writeInt(this.coords.x);
aOut.writeInt(this.coords.y);
aOut.writeInt(this.coords.z);
aOut.writeBoolean(this.bool);
}
@Override
public GTPacket decode(ByteArrayDataInput aData) {
return new PacketEIC(new Coords(aData.readInt(), aData.readInt(), aData.readInt()), aData.readBoolean());
}
@Override
public void process(IBlockAccess aWorld) {
if (SideReference.Side.Client) {
TileEntity te = aWorld.getTileEntity(this.coords.x, this.coords.y, this.coords.z);
if (!(te instanceof IGregTechTileEntity)) return;
IMetaTileEntity mte = ((IGregTechTileEntity) te).getMetaTileEntity();
if (!(mte instanceof MTEElectricImplosionCompressor)) return;
if (this.bool && !((IGregTechTileEntity) te).hasMufflerUpgrade())
((IGregTechTileEntity) te).addMufflerUpgrade();
}
}
}
|