Class ChunkCache

java.lang.Object
com.zenith.cache.data.chunk.ChunkCache
All Implemented Interfaces:
CachedData

public class ChunkCache extends Object implements CachedData
  • Field Details

    • cache

      protected final it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<Chunk> cache
    • tickableBlockEntities

      protected final it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<TickableBlockEntity> tickableBlockEntities
    • currentDimension

      protected @Nullable DimensionData currentDimension
    • worldNames

      protected List<net.kyori.adventure.key.Key> worldNames
    • serverViewDistance

      protected int serverViewDistance
    • serverSimulationDistance

      protected int serverSimulationDistance
    • centerX

      protected int centerX
    • centerZ

      protected int centerZ
    • dimensionType

      protected int dimensionType
    • worldName

      protected net.kyori.adventure.key.Key worldName
    • hashedSeed

      protected long hashedSeed
    • debug

      protected boolean debug
    • flat

      protected boolean flat
    • seaLevel

      protected int seaLevel
    • blockStatePredictionHandler

      protected BlockStatePredictionHandler blockStatePredictionHandler
    • worldBorderData

      protected WorldBorderData worldBorderData
    • worldTimeData

      protected WorldTimeData worldTimeData
    • serverBrand

      protected byte[] serverBrand
    • BLOCK_ENTITY_TICK_PRIORITY

      public static final int BLOCK_ENTITY_TICK_PRIORITY
      See Also:
    • CLOCK_TICK_PRIORITY

      public static final int CLOCK_TICK_PRIORITY
      See Also:
  • Constructor Details

    • ChunkCache

      public ChunkCache()
  • Method Details

    • subscribeEvents

      public void subscribeEvents()
    • setCurrentWorld

      public void setCurrentWorld(int dimensionId, net.kyori.adventure.key.Key worldName, long hashedSeed, boolean debug, boolean flat)
    • sync

      public static void sync()
    • isChunkLoaded

      public boolean isChunkLoaded(int x, int z)
    • updateBlock

      public boolean updateBlock(int x, int y, int z, int blockStateId)
    • updateBlock

      public boolean updateBlock(@NonNull BlockChangeEntry record)
    • handleChunkBiomes

      public boolean handleChunkBiomes(ClientboundChunksBiomesPacket packet)
    • handleLightUpdate

      public boolean handleLightUpdate(ClientboundLightUpdatePacket packet)
    • multiBlockUpdate

      public boolean multiBlockUpdate(ClientboundSectionBlocksUpdatePacket packet)
    • updateBlock

      public boolean updateBlock(@NonNull ClientboundBlockUpdatePacket packet)
    • updateBlockEntity

      public boolean updateBlockEntity(ClientboundBlockEntityDataPacket packet)
    • getServerBrandRaw

      public byte @Nullable [] getServerBrandRaw()
    • getServerBrand

      public byte[] getServerBrand()
    • createFullBrightLightData

      public LightUpdateData createFullBrightLightData(LightUpdateData lightData, int sectionCount)
    • isRaining

      public boolean isRaining()
    • getPackets

      public void getPackets(@NonNull Consumer<Packet> consumer, @NonNull TcpSession session)
      Specified by:
      getPackets in interface CachedData
    • reset

      public void reset(CacheResetType type)
      Specified by:
      reset in interface CachedData
    • getSendingMessage

      public String getSendingMessage()
      Specified by:
      getSendingMessage in interface CachedData
    • add

    • getSectionsCount

      public int getSectionsCount()
    • getMaxSection

      public int getMaxSection()
    • getMinSection

      public int getMinSection()
    • getMaxBuildHeight

      public int getMaxBuildHeight()
    • get

      public Chunk get(int x, int z)
    • getChunkSection

      public ChunkSection getChunkSection(int x, int y, int z)
    • remove

      public void remove(int x, int z)
    • getTickableBlockEntity

      public @Nullable TickableBlockEntity getTickableBlockEntity(int x, int y, int z)
    • setTickableBlockEntity

      public void setTickableBlockEntity(TickableBlockEntity blockEntity)
    • removeTickableBlockEntity

      public void removeTickableBlockEntity(int x, int y, int z)
    • updateCurrentDimension

      public void updateCurrentDimension(ClientboundRespawnPacket packet)
    • updateWorldTime

      public void updateWorldTime(ClientboundSetTimePacket packet)
    • getRainStrength

      public float getRainStrength()
    • getThunderStrength

      public float getThunderStrength()
    • getCache

      public it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<Chunk> getCache()
    • getTickableBlockEntities

      public it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<TickableBlockEntity> getTickableBlockEntities()
    • getCurrentDimension

      public @Nullable DimensionData getCurrentDimension()
    • getWorldNames

      public List<net.kyori.adventure.key.Key> getWorldNames()
    • getServerViewDistance

      public int getServerViewDistance()
    • getServerSimulationDistance

      public int getServerSimulationDistance()
    • getCenterX

      public int getCenterX()
    • getCenterZ

      public int getCenterZ()
    • getDimensionType

      public int getDimensionType()
    • getWorldName

      public net.kyori.adventure.key.Key getWorldName()
    • getHashedSeed

      public long getHashedSeed()
    • isDebug

      public boolean isDebug()
    • isFlat

      public boolean isFlat()
    • getSeaLevel

      public int getSeaLevel()
    • getBlockStatePredictionHandler

      public BlockStatePredictionHandler getBlockStatePredictionHandler()
    • getWorldBorderData

      public WorldBorderData getWorldBorderData()
    • getWorldTimeData

      public WorldTimeData getWorldTimeData()
    • setRainStrength

      public ChunkCache setRainStrength(float rainStrength)
      Returns:
      this.
    • setThunderStrength

      public ChunkCache setThunderStrength(float thunderStrength)
      Returns:
      this.
    • setCurrentDimension

      public ChunkCache setCurrentDimension(@Nullable DimensionData currentDimension)
      Returns:
      this.
    • setWorldNames

      public ChunkCache setWorldNames(List<net.kyori.adventure.key.Key> worldNames)
      Returns:
      this.
    • setServerViewDistance

      public ChunkCache setServerViewDistance(int serverViewDistance)
      Returns:
      this.
    • setServerSimulationDistance

      public ChunkCache setServerSimulationDistance(int serverSimulationDistance)
      Returns:
      this.
    • setCenterX

      public ChunkCache setCenterX(int centerX)
      Returns:
      this.
    • setCenterZ

      public ChunkCache setCenterZ(int centerZ)
      Returns:
      this.
    • setDimensionType

      public ChunkCache setDimensionType(int dimensionType)
      Returns:
      this.
    • setWorldName

      public ChunkCache setWorldName(net.kyori.adventure.key.Key worldName)
      Returns:
      this.
    • setHashedSeed

      public ChunkCache setHashedSeed(long hashedSeed)
      Returns:
      this.
    • setDebug

      public ChunkCache setDebug(boolean debug)
      Returns:
      this.
    • setFlat

      public ChunkCache setFlat(boolean flat)
      Returns:
      this.
    • setSeaLevel

      public ChunkCache setSeaLevel(int seaLevel)
      Returns:
      this.
    • setBlockStatePredictionHandler

      public ChunkCache setBlockStatePredictionHandler(BlockStatePredictionHandler blockStatePredictionHandler)
      Returns:
      this.
    • setWorldBorderData

      public ChunkCache setWorldBorderData(WorldBorderData worldBorderData)
      Returns:
      this.
    • setWorldTimeData

      public ChunkCache setWorldTimeData(WorldTimeData worldTimeData)
      Returns:
      this.
    • setServerBrand

      public ChunkCache setServerBrand(byte[] serverBrand)
      Returns:
      this.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object