Class SectionStorage<R,P>
java.lang.Object
net.minecraft.world.level.chunk.storage.SectionStorage<R,P>
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
PoiManager
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final record -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final com.mojang.serialization.Codec<P> private final it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSetprivate final ChunkIOErrorReporterprotected final LevelHeightAccessorprivate final it.unimi.dsi.fastutil.longs.LongSetprivate final Object(package private) static final org.slf4j.Loggerprivate final it.unimi.dsi.fastutil.longs.Long2ObjectMap<CompletableFuture<Optional<SectionStorage.PackedChunk<P>>>> private final RegistryAccessprivate static final Stringprivate final SimpleRegionStorageprivate final BiFunction<P, Runnable, R> -
Constructor Summary
ConstructorsConstructorDescriptionSectionStorage(SimpleRegionStorage pSimpleRegionStorage, com.mojang.serialization.Codec<P> pCodec, Function<R, P> pPacker, BiFunction<P, Runnable, R> pUnpacker, Function<Runnable, R> pFactory, RegistryAccess pRegistryAccess, ChunkIOErrorReporter pErrorReporter, LevelHeightAccessor pLevelHeightAccessor) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidvoidflushAll()get(long pSectionKey) private static longprotected RgetOrCreate(long pSectionKey) getOrLoad(long pSectionKey) booleanhasWork()protected voidonSectionLoad(long pSectionKey) protected booleanoutsideStoredRange(long pSectionKey) voidNeo: Removes the data for the given chunk position.protected voidsetDirty(long pSectionPos) protected voidtick(BooleanSupplier pAheadOfTime) private CompletableFuture<Optional<SectionStorage.PackedChunk<P>>> private voidunpackChunk(ChunkPos pPos) private voidunpackChunk(ChunkPos pPos, SectionStorage.PackedChunk<P> pPackedChunk) private voidprivate voidwriteChunk(ChunkPos pPos) private <T> com.mojang.serialization.Dynamic<T> writeChunk(ChunkPos pPos, com.mojang.serialization.DynamicOps<T> pOps)
-
Field Details
-
LOGGER
static final org.slf4j.Logger LOGGER -
SECTIONS_TAG
- See Also:
-
simpleRegionStorage
-
storage
-
dirtyChunks
private final it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet dirtyChunks -
codec
-
packer
-
unpacker
-
factory
-
registryAccess
-
errorReporter
-
levelHeightAccessor
-
loadedChunks
private final it.unimi.dsi.fastutil.longs.LongSet loadedChunks -
pendingLoads
private final it.unimi.dsi.fastutil.longs.Long2ObjectMap<CompletableFuture<Optional<SectionStorage.PackedChunk<P>>>> pendingLoads -
loadLock
-
-
Constructor Details
-
SectionStorage
public SectionStorage(SimpleRegionStorage pSimpleRegionStorage, com.mojang.serialization.Codec<P> pCodec, Function<R, P> pPacker, BiFunction<P, Runnable, R> pUnpacker, Function<Runnable, R> pFactory, RegistryAccess pRegistryAccess, ChunkIOErrorReporter pErrorReporter, LevelHeightAccessor pLevelHeightAccessor)
-
-
Method Details
-
tick
-
unpackPendingLoads
private void unpackPendingLoads() -
flushAll
public void flushAll() -
hasWork
public boolean hasWork() -
get
-
getOrLoad
-
outsideStoredRange
protected boolean outsideStoredRange(long pSectionKey) -
getOrCreate
-
prefetch
-
unpackChunk
-
tryRead
-
unpackChunk
-
writeChunk
-
writeChunk
private <T> com.mojang.serialization.Dynamic<T> writeChunk(ChunkPos pPos, com.mojang.serialization.DynamicOps<T> pOps) -
getKey
-
onSectionLoad
protected void onSectionLoad(long pSectionKey) -
setDirty
protected void setDirty(long pSectionPos) -
flush
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
IOException
-
remove
Neo: Removes the data for the given chunk position. See PR #937
-