- private byte[][][] cache = new byte[24][][];
- public /*synchronized*/ byte mode4(int z, int y, int x) {
- if (cache[x]==null) return 0;
- if (cache[x][y]==null) return 0;
- return cache[x][y][z];
- }
-
- int lastz = 0;
- int lastx = 0;
- int lasty = 0;
- public static int save = 0;
- public static int saveof = 0;
- public /*synchronized*/ void mode4(int z, int y, int x, int d) {
- try {
- out.writeByte(1);
- out.writeByte(z);
- out.writeByte(y);
- out.writeByte(x);
- saveof++;
- lastz = z;
- lastx = x;
- lasty = y;
- out.writeByte(d);
-
- if (cache[x & 0xff]==null) cache[x & 0xff] = new byte[24][];
- if (cache[x & 0xff][y & 0xff]==null) cache[x & 0xff][y & 0xff] = new byte[256];
- cache[x & 0xff][y & 0xff][z & 0xff] = (byte)(d & 0xff);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- public /*synchronized*/ void flush() {
- try {
- out.flush();
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }