public class SerializingRegionBasedStorage<R> extends Object implements AutoCloseable
Modifier and Type | Field and Description |
---|---|
private Function<Runnable,com.mojang.serialization.Codec<R>> |
codecFactory |
private com.mojang.datafixers.DataFixer |
dataFixer |
private DataFixTypes |
dataFixType |
private Function<Runnable,R> |
factory |
private it.unimi.dsi.fastutil.longs.Long2ObjectMap<Optional<R>> |
loadedElements |
private static Logger |
LOGGER |
private it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet |
unsavedElements |
private StorageIoWorker |
worker |
Constructor and Description |
---|
SerializingRegionBasedStorage(File directory,
Function<Runnable,com.mojang.serialization.Codec<R>> codecFactory,
Function<Runnable,R> factory,
com.mojang.datafixers.DataFixer dataFixer,
DataFixTypes dataFixTypes,
boolean bool) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected Optional<R> |
get(long pos) |
private static int |
getDataVersion(com.mojang.serialization.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.serialization.Dynamic<T> |
method_20367(ChunkPos chunkPos,
com.mojang.serialization.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.serialization.DynamicOps<T> dynamicOps,
T data) |
private static final Logger LOGGER
private final StorageIoWorker worker
private final it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet unsavedElements
private final com.mojang.datafixers.DataFixer dataFixer
private final DataFixTypes dataFixType
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.serialization.DynamicOps<T> dynamicOps, @Nullable T data)
private void save(ChunkPos chunkPos)
private <T> com.mojang.serialization.Dynamic<T> method_20367(ChunkPos chunkPos, com.mojang.serialization.DynamicOps<T> dynamicOps)
protected void onLoad(long pos)
protected void onUpdate(long pos)
private static int getDataVersion(com.mojang.serialization.Dynamic<?> dynamic)
public void method_20436(ChunkPos chunkPos)
public void close() throws IOException
close
in interface AutoCloseable
IOException