use of net.minecraft.network.PacketBuffer in project BuildCraft by BuildCraft.
the class MessageUpdateTile method toBytes.
@Override
public void toBytes(ByteBuf buf) {
MessageUtil.writeBlockPos(new PacketBuffer(buf), pos);
int length = payload.readableBytes();
buf.writeMedium(length);
buf.writeBytes(payload, 0, length);
}
use of net.minecraft.network.PacketBuffer in project BuildCraft by BuildCraft.
the class Lock method toBytes.
public void toBytes(PacketBuffer buf) {
new PacketBufferBC(buf).writeEnumValue(Cause.EnumCause.getForClass(cause.getClass()));
cause.toBytes(buf);
buf.writeInt(targets.size());
targets.forEach(target -> {
new PacketBuffer(buf).writeEnumValue(Target.EnumTarget.getForClass(target.getClass()));
target.toBytes(buf);
});
}
use of net.minecraft.network.PacketBuffer in project BuildCraft by BuildCraft.
the class Lock method fromBytes.
public void fromBytes(PacketBuffer buf) {
cause = new PacketBufferBC(buf).readEnumValue(Cause.EnumCause.class).supplier.get();
cause.fromBytes(buf);
targets.clear();
IntStream.range(0, buf.readInt()).mapToObj(i -> {
Target target;
target = new PacketBufferBC(buf).readEnumValue(Target.EnumTarget.class).supplier.get();
target.fromBytes(buf);
return target;
}).forEach(targets::add);
}
use of net.minecraft.network.PacketBuffer in project BuildCraft by BuildCraft.
the class MessageZoneMapResponse method toBytes.
@Override
public void toBytes(ByteBuf buf) {
key.toBytes(buf);
data.write(new PacketBuffer(buf));
}
use of net.minecraft.network.PacketBuffer in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.
the class MessagePlayerStoppedPiloting method fromBytes.
@Override
public void fromBytes(ByteBuf buf) {
PacketBuffer packetBuf = new PacketBuffer(buf);
final boolean isBlockPos = packetBuf.readBoolean();
final boolean isUUID = packetBuf.readBoolean();
if (isBlockPos) {
posToStopPiloting = new BlockPos(packetBuf.readInt(), packetBuf.readInt(), packetBuf.readInt());
}
if (isUUID) {
shipIDToStopPiloting = packetBuf.readUniqueId();
}
}
Aggregations