Interface WorldChunk

All Superinterfaces:
BiomeVolume, BiomeVolume.Modifiable<WorldChunk>, BiomeVolume.Streamable<WorldChunk>, BlockEntityVolume, BlockEntityVolume.Modifiable<WorldChunk>, BlockEntityVolume.Streamable<WorldChunk>, BlockVolume, BlockVolume.Modifiable<WorldChunk>, BlockVolume.Streamable<WorldChunk>, Chunk<WorldChunk>, EntityVolume, EntityVolume.Modifiable<WorldChunk>, EntityVolume.Streamable<WorldChunk>, HeightAwareVolume, LocationBaseDataHolder, LocationBaseDataHolder.Mutable, MutableVolume, PhysicsAwareMutableBlockVolume<WorldChunk>, UpdatableVolume, Volume

A chunk is a specific grid-aligned partition of a World.

In Minecraft, the chunk is 16 by 16 blocks on the X and Z axes. The height of each chunk varies between worlds.

  • Method Details

    • world

      World<?,?> world()
      Gets the world the chunk is in.
      Returns:
      The world
    • neighbor

      default Optional<WorldChunk> neighbor(Direction direction)
      Gets the chunk in the given direction from this chunk, if it exists.
      Parameters:
      direction - The cardinal or ordinal direction to get the chunk from
      Returns:
      The neighbor chunk, if available
    • neighbor

      default Optional<WorldChunk> neighbor(Direction direction, boolean shouldLoad)
      Gets the chunk in the given direction from this chunk.
      Parameters:
      direction - The cardinal or ordinal direction to get the chunk from
      shouldLoad - Whether the server should load or generate the chunk if unavailable
      Returns:
      The neighbor chunk, if available or if shouldLoad is true
    • regionalDifficultyFactor

      double regionalDifficultyFactor()
      Gets the regional difficulty factor for this chunk. In vanilla, it is dependent on the playtime of the world, inhabited time of the chunk, the phase of the moon, and the current difficulty setting. This number ranges from 0.75-1.5 on easy, 1.5-4.0 on normal, and 2.25-6.75 on hard.

      This value is used for display only in vanilla.

      Returns:
      The regional difficulty factor for this chunk
    • regionalDifficultyPercentage

      double regionalDifficultyPercentage()
      Gets the regional difficulty percentage for this chunk. It is calculated by taking the regional difficulty factor and using the following rules: If the factor is less than 2.0, the percentage is 0%. If the factor is greater than 4.0, the percentage is 100%. Otherwise, the percentage is the factor minus 2.0, divided by 2.0.

      This is the value that is used in vanilla to find which effects are caused by the regional difficulty.

      Returns:
      The regional difficulty percentage for this chunk