Code:
public static void init(Archive archive) {
data_buffer = new Buffer(
ClientConstants.LOAD_OSRS_DATA_FROM_CACHE_DIR ?
FileUtils.read(ClientConstants.DATA_DIR+"items/obj.dat")
: archive.get("obj.dat"));
Buffer index_buffer = new Buffer(
ClientConstants.LOAD_OSRS_DATA_FROM_CACHE_DIR ?
FileUtils.read(ClientConstants.DATA_DIR+"items/obj.idx")
: archive.get("obj.idx"));
length = index_buffer.readUShort();
pos = new int[length + 7000];
int offset = 2;
for (int index = 0; index < length; index++) {
pos[index] = offset;
offset += index_buffer.readUShort();
}
cache = new ItemDefinition[10];
for (int index = 0; index < 10; index++)
cache[index] = new ItemDefinition();
System.out.println(String.format("Loaded %d items loading OSRS version %d and SUB version %d", length, ClientConstants.OSRS_DATA_VERSION, ClientConstants.OSRS_DATA_SUB_VERSION));
}