2022-11-11 23:10:52 +01:00
|
|
|
package icbm.gangshao.terminal;
|
|
|
|
|
2022-12-20 13:58:52 +01:00
|
|
|
import cpw.mods.fml.common.network.ByteBufUtils;
|
2022-11-11 23:10:52 +01:00
|
|
|
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
|
|
|
import io.netty.buffer.ByteBuf;
|
|
|
|
import universalelectricity.core.vector.Vector3;
|
|
|
|
|
|
|
|
public class TerminalCommandPacket implements IMessage {
|
|
|
|
Vector3 pos;
|
|
|
|
String cmd;
|
|
|
|
|
|
|
|
public TerminalCommandPacket() {}
|
|
|
|
|
|
|
|
public TerminalCommandPacket(Vector3 pos, String cmd) {
|
|
|
|
this.pos = pos;
|
|
|
|
this.cmd = cmd;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void fromBytes(ByteBuf buf) {
|
|
|
|
this.pos = new Vector3(buf.readInt(), buf.readInt(), buf.readInt());
|
2022-12-20 13:58:52 +01:00
|
|
|
this.cmd = ByteBufUtils.readUTF8String(buf);
|
2022-11-11 23:10:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void toBytes(ByteBuf buf) {
|
|
|
|
buf.writeInt(this.pos.intX());
|
|
|
|
buf.writeInt(this.pos.intY());
|
|
|
|
buf.writeInt(this.pos.intZ());
|
|
|
|
|
2022-12-20 13:58:52 +01:00
|
|
|
ByteBufUtils.writeUTF8String(buf, this.cmd);
|
2022-11-11 23:10:52 +01:00
|
|
|
}
|
|
|
|
}
|