Hello rune-server, I have built a custom Object Spawn definitions and have attempted to cache pack them (using Toms Suite) so I can spawn objects client sided (I did this because I could not find a program that edits map objects).

I would like your thoughts on how I am spawning the objects and help on fixing a problem with cache packing the regions.dat and regions.idx.

When you enter a region it will get the region id and stream through all the objects and spawn them.

This system I built is similar to how the items are unpacked and loaded.

Code:
public static RegionObjectsDef forID(int regionId) {
        for (int j = 0; j < cache.length; j++) {
            if (cache[j].getId() == regionId)
                return cache[j];
        }
        cacheIndex = (cacheIndex + 1) % 10;
        RegionObjectsDef region = cache[cacheIndex];
        try {
            stream.skipBytes(streamIndices[regionId]);
            region.setId(regionId);
            region.setDefaults();
            region.readValues(stream);
            /*switch (regionId) {
                case 12592:
                    GameObject magicTree = new GameObject(1306, 3185, 3099);
                    GameObject b1 = new GameObject(26972, 3181, 3091, 0);
                    GameObject b2 = new GameObject(26972, 3181, 3093, 2);
                    GameObject b3 = new GameObject(26972, 3180, 3092, 1);
                    GameObject b4 = new GameObject(26972, 3182, 3092, 3);
                    region.spawnObject(magicTree);
                    region.spawnObject(b1);
                    region.spawnObject(b2); spawnObject now named addObject
                    region.spawnObject(b3);
                    region.spawnObject(b4);
                    break;
            }*/
        } catch (IOException e) {
            //e.printStackTrace();
        }
        return region;
    }
Code:
public void loadObjects() {
        int x = baseX + (myPlayer.x - 6 >> 7);
        int y = baseY + (myPlayer.y - 6 >> 7);
        int rx = x>>6;
        int ry = y>>6;
        int regionId = rx * 256 + ry;
        RegionObjectsDef.forID(regionId).getObjectList().stream().forEach(this::spawnObject);
    }
Everything works fine I can load and it spawns objects but it will only read the files outside of the cache

I run into a decompression problem (I think) class13 (Which I renamed BZIP2Decompressor)

I get no exception but get "PANIC RANDOMIZED BLOCK".

My old system loaded all the objects no matter the region the player was in, which loading system do you think would be more effective/Efficient?