use of mcjty.rftools.items.dimlets.DimletKey in project RFTools by McJty.
the class PacketCheckDimletConfig method fromBytes.
@Override
public void fromBytes(ByteBuf buf) {
int size = buf.readInt();
dimlets = new HashMap<Integer, DimletKey>();
for (int i = 0; i < size; i++) {
int id = buf.readInt();
String name = NetworkTools.readString(buf);
int typeOrdinal = buf.readInt();
try {
dimlets.put(id, new DimletKey(DimletType.values()[typeOrdinal], name));
} catch (Exception e) {
Logging.logError("INTERNAL ERROR: name=" + name + ", i=" + i + ", size=" + size + "!");
throw new RuntimeException(e);
}
}
}
use of mcjty.rftools.items.dimlets.DimletKey in project RFTools by McJty.
the class PacketCheckDimletConfig method toBytes.
@Override
public void toBytes(ByteBuf buf) {
buf.writeInt(dimlets.size());
for (Map.Entry<Integer, DimletKey> me : dimlets.entrySet()) {
DimletKey key = me.getValue();
buf.writeInt(me.getKey());
NetworkTools.writeString(buf, key.getName());
buf.writeInt(key.getType().ordinal());
}
}
Aggregations