public class SerializingRegionBasedStorage<R> extends Object implements AutoCloseable
Modifier and Type | Field and Description |
---|---|
private com.mojang.datafixers.DataFixer |
dataFixer |
private DataFixTypes |
dataFixType |
private BiFunction<Runnable,com.mojang.datafixers.Dynamic<?>,R> |
deserializer |
private Function<Runnable,R> |
factory |
private it.unimi.dsi.fastutil.longs.Long2ObjectMap<Optional<R>> |
loadedElements |
private static Logger |
LOGGER |
private StorageSerializer<R> |
serializer |
private it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet |
unsavedElements |
private StorageIoWorker |
worker |
Constructor and Description |
---|
SerializingRegionBasedStorage(File directory,
StorageSerializer<R> serializer,
BiFunction<Runnable,com.mojang.datafixers.Dynamic<?>,R> deserializer,
Function<Runnable,R> factory,
com.mojang.datafixers.DataFixer dataFixer,
DataFixTypes dataFixType,
boolean bool) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected Optional<R> |
get(long pos) |
private static int |
getDataVersion(com.mojang.datafixers.Dynamic<?> dynamic) |
protected Optional<R> |
getIfLoaded(long pos) |
protected R |
getOrCreate(long pos) |
protected boolean |
isPosInvalid(ChunkSectionPos pos) |
private void |
loadDataAt(ChunkPos chunkPos) |
private CompoundTag |
loadNbt(ChunkPos pos) |
private <T> com.mojang.datafixers.Dynamic<T> |
method_20367(ChunkPos chunkPos,
com.mojang.datafixers.types.DynamicOps<T> dynamicOps) |
void |
method_20436(ChunkPos chunkPos) |
protected void |
onLoad(long pos) |
protected void |
onUpdate(long pos) |
private void |
save(ChunkPos chunkPos) |
protected void |
tick(BooleanSupplier shouldKeepTicking) |
private <T> void |
update(ChunkPos pos,
com.mojang.datafixers.types.DynamicOps<T> ops,
T data) |
private static final Logger LOGGER
private final StorageIoWorker worker
private final it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet unsavedElements
private final StorageSerializer<R> serializer
private final BiFunction<Runnable,com.mojang.datafixers.Dynamic<?>,R> deserializer
private final com.mojang.datafixers.DataFixer dataFixer
private final DataFixTypes dataFixType
public SerializingRegionBasedStorage(File directory, StorageSerializer<R> serializer, BiFunction<Runnable,com.mojang.datafixers.Dynamic<?>,R> deserializer, Function<Runnable,R> factory, com.mojang.datafixers.DataFixer dataFixer, DataFixTypes dataFixType, boolean bool)
protected void tick(BooleanSupplier shouldKeepTicking)
protected boolean isPosInvalid(ChunkSectionPos pos)
protected R getOrCreate(long pos)
private void loadDataAt(ChunkPos chunkPos)
@Nullable private CompoundTag loadNbt(ChunkPos pos)
private <T> void update(ChunkPos pos, com.mojang.datafixers.types.DynamicOps<T> ops, @Nullable T data)
private void save(ChunkPos chunkPos)
private <T> com.mojang.datafixers.Dynamic<T> method_20367(ChunkPos chunkPos, com.mojang.datafixers.types.DynamicOps<T> dynamicOps)
protected void onLoad(long pos)
protected void onUpdate(long pos)
private static int getDataVersion(com.mojang.datafixers.Dynamic<?> dynamic)
public void method_20436(ChunkPos chunkPos)
public void close() throws IOException
close
in interface AutoCloseable
IOException