use of net.minecraft.network.PacketBuffer in project TUMAT by canitzp.
the class PacketSyncEnergyClient method toBytes.
@Override
public void toBytes(ByteBuf buf) {
PacketBuffer buffer = new PacketBuffer(buf);
buffer.writeBlockPos(this.pos);
buffer.writeInt(this.currentEnergy);
buffer.writeInt(this.capEnergy);
buffer.writeInt(this.side.ordinal());
}
use of net.minecraft.network.PacketBuffer in project TUMAT by canitzp.
the class PacketUpdateTileEntity method fromBytes.
@Override
public void fromBytes(ByteBuf buf) {
PacketBuffer buffer = new PacketBuffer(buf);
this.pos = buffer.readBlockPos();
int size = buffer.readInt();
String[] nbtKeys = new String[size];
for (int i = 0; i < size; i++) {
nbtKeys[i] = buffer.readString(Short.MAX_VALUE);
}
this.nbtKeys = nbtKeys;
}
use of net.minecraft.network.PacketBuffer in project TUMAT by canitzp.
the class PacketUpdateTileEntity method toBytes.
@Override
public void toBytes(ByteBuf buf) {
PacketBuffer buffer = new PacketBuffer(buf);
buffer.writeBlockPos(this.pos);
buffer.writeInt(this.nbtKeys.length);
for (String s : this.nbtKeys) {
buffer.writeString(s);
}
}
use of net.minecraft.network.PacketBuffer in project Galacticraft by micdoodle8.
the class ConnectionPacket method createConfigPacket.
public static FMLProxyPacket createConfigPacket(List<Object> data) {
PacketBuffer payload = new PacketBuffer(Unpooled.buffer());
payload.writeByte(103);
try {
NetworkUtil.encodeData(payload, data);
} catch (IOException e) {
e.printStackTrace();
}
// signature
payload.writeInt(3519);
return new FMLProxyPacket(payload, CHANNEL);
}
use of net.minecraft.network.PacketBuffer in project MinecraftForge by MinecraftForge.
the class ByteBufUtils method writeItemStack.
/**
* Write an {@link ItemStack} using minecraft compatible encoding.
*
* @param to The buffer to write to
* @param stack The itemstack to write
*/
public static void writeItemStack(ByteBuf to, ItemStack stack) {
PacketBuffer pb = new PacketBuffer(to);
pb.writeItemStack(stack);
}
Aggregations