use of buildcraft.lib.net.PacketBufferBC in project BuildCraft by BuildCraft.
the class TileBC_Neptune method handleUpdateTag.
@Override
public void handleUpdateTag(NBTTagCompound tag) {
super.readFromNBT(tag);
byte[] bytes = tag.getByteArray("d");
ByteBuf buf = Unpooled.copiedBuffer(bytes);
try {
int id = buf.readUnsignedShort();
PacketBufferBC buffer = new PacketBufferBC(buf);
readPayload(id, buffer, world.isRemote ? Side.CLIENT : Side.SERVER, null);
// Make sure that we actually read the entire message rather than just discarding it
MessageUtil.ensureEmpty(buffer, world.isRemote, getClass() + ", id = " + getIdAllocator().getNameFor(id));
spawnReceiveParticles(id);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
use of buildcraft.lib.net.PacketBufferBC in project BuildCraft by BuildCraft.
the class MessageUtil method writeEnumSet.
public static <E extends Enum<E>> void writeEnumSet(ByteBuf buffer, Set<E> set, Class<E> clazz) {
PacketBufferBC buf = PacketBufferBC.asPacketBufferBc(buffer);
E[] constants = clazz.getEnumConstants();
if (constants == null)
throw new IllegalArgumentException("Not an enum type " + clazz);
for (E e : constants) {
buf.writeBoolean(set.contains(e));
}
}
use of buildcraft.lib.net.PacketBufferBC in project BuildCraft by BuildCraft.
the class PipeBehaviourDirectional method writePayload.
@Override
public void writePayload(PacketBuffer buffer, Side side) {
super.writePayload(buffer, side);
PacketBufferBC bufBc = PacketBufferBC.asPacketBufferBc(buffer);
bufBc.writeEnumValue(currentDir);
}
use of buildcraft.lib.net.PacketBufferBC in project BuildCraft by BuildCraft.
the class PluggableFacade method writeCreationPayload.
@Override
public void writeCreationPayload(PacketBuffer buffer) {
PacketBufferBC buf = PacketBufferBC.asPacketBufferBc(buffer);
states.writeToBuffer(buf);
buf.writeBoolean(isSideSolid);
buf.writeEnumValue(blockFaceShape);
}
use of buildcraft.lib.net.PacketBufferBC in project BuildCraft by BuildCraft.
the class PluggableLens method writeCreationPayload.
@Override
public void writeCreationPayload(PacketBuffer buffer) {
PacketBufferBC buf = PacketBufferBC.asPacketBufferBc(buffer);
MessageUtil.writeEnumOrNull(buf, colour);
buf.writeBoolean(isFilter);
}
Aggregations