Region slice fixes

This commit is contained in:
Daniel Mills 2020-10-31 08:30:20 -04:00
parent 3292dc47ab
commit 6c8db56474

View File

@ -1,6 +1,7 @@
package com.volmit.iris.v2.scaffold.hunk.io; package com.volmit.iris.v2.scaffold.hunk.io;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.atomic.AtomicIntegerArray;
import com.volmit.iris.util.*; import com.volmit.iris.util.*;
import org.bukkit.block.data.BlockData; import org.bukkit.block.data.BlockData;
@ -10,9 +11,9 @@ import com.volmit.iris.v2.scaffold.hunk.Hunk;
public class HunkRegionSlice<T> public class HunkRegionSlice<T>
{ {
public static final Function2<Integer, CompoundTag, HunkRegionSlice<BlockData>> BLOCKDATA = (h, c) -> new HunkRegionSlice<>(h, Hunk::newMappedHunk, new BlockDataHunkIOAdapter(), c, "blockdata"); public static final Function2<Integer, CompoundTag, HunkRegionSlice<BlockData>> BLOCKDATA = (h, c) -> new HunkRegionSlice<>(h, Hunk::newAtomicHunk, new BlockDataHunkIOAdapter(), c, "blockdata");
public static final Function3<Integer, CompoundTag, String, HunkRegionSlice<String>> STRING = (h, c, t) -> new HunkRegionSlice<>(h, Hunk::newMappedHunk, new StringHunkIOAdapter(), c, t); public static final Function3<Integer, CompoundTag, String, HunkRegionSlice<String>> STRING = (h, c, t) -> new HunkRegionSlice<>(h, Hunk::newAtomicHunk, new StringHunkIOAdapter(), c, t);
public static final Function3<Integer, CompoundTag, String, HunkRegionSlice<Boolean>> BOOLEAN = (h, c, t) -> new HunkRegionSlice<>(h, Hunk::newMappedHunk, new BooleanHunkIOAdapter(), c, t); public static final Function3<Integer, CompoundTag, String, HunkRegionSlice<Boolean>> BOOLEAN = (h, c, t) -> new HunkRegionSlice<>(h, Hunk::newAtomicHunk, new BooleanHunkIOAdapter(), c, t);
private final Function3<Integer, Integer, Integer, Hunk<T>> factory; private final Function3<Integer, Integer, Integer, Hunk<T>> factory;
private final HunkIOAdapter<T> adapter; private final HunkIOAdapter<T> adapter;
private final CompoundTag compound; private final CompoundTag compound;
@ -229,4 +230,8 @@ public class HunkRegionSlice<T>
return key + "." + Integer.toString(((short) (((x & 0xFF) << 8) | (z & 0xFF))), 36); return key + "." + Integer.toString(((short) (((x & 0xFF) << 8) | (z & 0xFF))), 36);
} }
public int getLoadCount() {
return loadedChunks.size();
}
} }