@Override public void setTrue(int x, int y, int z, World world) { int cx = x / 16; int cz = z / 16; int cy = y / 64; int ix = Math.abs(x) % 16; int iz = Math.abs(z) % 16; int iy = Math.abs(y) % 64; String key = world.getName() + "," + cx + "," + cz + "," + cy; if (!store.containsKey(key)) { loadChunklet(cx, cy, cz, world); } ChunkletStore cStore = store.get(key); if (cStore == null) { cStore = ChunkletStoreFactory.getChunkletStore(); store.put(world.getName() + "," + cx + "," + cz + "," + cy, cStore); } cStore.setTrue(ix, iy, iz); }
@Override public boolean isTrue(int x, int y, int z, World world) { int cx = x / 16; int cz = z / 16; int cy = y / 64; String key = world.getName() + "," + cx + "," + cz + "," + cy; if (!store.containsKey(key)) { loadChunklet(cx, cy, cz, world); } if (!store.containsKey(key)) { return false; } ChunkletStore check = store.get(world.getName() + "," + cx + "," + cz + "," + cy); int ix = Math.abs(x) % 16; int iz = Math.abs(z) % 16; int iy = Math.abs(y) % 64; return check.isTrue(ix, iy, iz); }
@Override public void setFalse(int x, int y, int z, World world) { int cx = x / 16; int cz = z / 16; int cy = y / 64; int ix = Math.abs(x) % 16; int iz = Math.abs(z) % 16; int iy = Math.abs(y) % 64; String key = world.getName() + "," + cx + "," + cz + "," + cy; if (!store.containsKey(key)) { loadChunklet(cx, cy, cz, world); } ChunkletStore cStore = store.get(key); if (cStore == null) { return; // No need to make a store for something we will be setting to false } cStore.setFalse(ix, iy, iz); }