Class SectionStorage<R,P>

java.lang.Object
net.minecraft.world.level.chunk.storage.SectionStorage<R,P>
All Implemented Interfaces:
AutoCloseable
Direct Known Subclasses:
PoiManager

public class SectionStorage<R,P> extends Object implements AutoCloseable
  • Field Details

    • LOGGER

      static final org.slf4j.Logger LOGGER
    • SECTIONS_TAG

      private static final String SECTIONS_TAG
      See Also:
    • simpleRegionStorage

      private final SimpleRegionStorage simpleRegionStorage
    • storage

      private final it.unimi.dsi.fastutil.longs.Long2ObjectMap<Optional<R>> storage
    • dirtyChunks

      private final it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet dirtyChunks
    • codec

      private final com.mojang.serialization.Codec<P> codec
    • packer

      private final Function<R,P> packer
    • unpacker

      private final BiFunction<P,Runnable,R> unpacker
    • factory

      private final Function<Runnable,R> factory
    • registryAccess

      private final RegistryAccess registryAccess
    • errorReporter

      private final ChunkIOErrorReporter errorReporter
    • levelHeightAccessor

      protected final LevelHeightAccessor 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

      private final Object loadLock
  • Constructor Details

  • Method Details

    • tick

      protected void tick(BooleanSupplier p_63812_)
    • unpackPendingLoads

      private void unpackPendingLoads()
    • flushAll

      public void flushAll()
    • hasWork

      public boolean hasWork()
    • get

      @Nullable protected Optional<R> get(long p_63819_)
    • getOrLoad

      protected Optional<R> getOrLoad(long p_63824_)
    • outsideStoredRange

      protected boolean outsideStoredRange(long p_156631_)
    • getOrCreate

      protected R getOrCreate(long p_63828_)
    • prefetch

      public CompletableFuture<?> prefetch(ChunkPos p_364373_)
    • unpackChunk

      private void unpackChunk(ChunkPos p_365521_)
    • tryRead

    • unpackChunk

      private void unpackChunk(ChunkPos p_365130_, @Nullable SectionStorage.PackedChunk<P> p_361845_)
    • writeChunk

      private void writeChunk(ChunkPos p_361540_)
    • writeChunk

      private <T> com.mojang.serialization.Dynamic<T> writeChunk(ChunkPos p_362535_, com.mojang.serialization.DynamicOps<T> p_360921_)
    • getKey

      private static long getKey(ChunkPos p_156628_, int p_156629_)
    • onSectionLoad

      protected void onSectionLoad(long p_63813_)
    • setDirty

      protected void setDirty(long p_63788_)
    • getVersion

      static int getVersion(com.mojang.serialization.Dynamic<?> p_63806_)
    • flush

      public void flush(ChunkPos p_63797_)
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Throws:
      IOException
    • remove

      public void remove(ChunkPos chunkPos)
      Neo: Removes the data for the given chunk position. See PR #937