Class ChunkSectionPos

java.lang.Object
net.minecraft.util.math.Vec3i
net.minecraft.util.math.ChunkSectionPos
All Implemented Interfaces:
Comparable<Vec3i>

public class ChunkSectionPos
extends Vec3i
  • Constructor Details

    • ChunkSectionPos

      private ChunkSectionPos​(int x, int y, int z)
  • Method Details

    • from

      public static ChunkSectionPos from​(int x, int y, int z)
      Creates a chunk section position from its x-, y- and z-coordinates.
    • from

      public static ChunkSectionPos from​(BlockPos pos)
    • from

      public static ChunkSectionPos from​(ChunkPos chunkPos, int y)
      Creates a chunk section position from a chunk position and the y-coordinate of the vertical section.
    • from

      public static ChunkSectionPos from​(Entity entity)
    • from

      public static ChunkSectionPos from​(long packed)
      Creates a chunk section position from its packed representation.
      See Also:
      asLong(int, int, int)
    • offset

      public static long offset​(long packed, Direction direction)
      Offsets a packed chunk section position in the given direction.
      See Also:
      asLong(int, int, int)
    • offset

      public static long offset​(long packed, int x, int y, int z)
      Offsets a packed chunk section position by the given offsets.
      See Also:
      asLong(int, int, int)
    • getSectionCoord

      public static int getSectionCoord​(int coord)
      Converts a world coordinate to the corresponding chunk-section coordinate.
    • getLocalCoord

      public static int getLocalCoord​(int coord)
      Converts a world coordinate to the local coordinate system (0-15) of its corresponding chunk section.
    • packLocal

      public static short packLocal​(BlockPos pos)
      Returns the local position of the given block position relative to its respective chunk section, packed into a short.
    • unpackLocalX

      public static int unpackLocalX​(short packedLocalPos)
      Gets the local x-coordinate from the given packed local position.
      See Also:
      packLocal(net.minecraft.util.math.BlockPos)
    • unpackLocalY

      public static int unpackLocalY​(short packedLocalPos)
      Gets the local y-coordinate from the given packed local position.
      See Also:
      packLocal(net.minecraft.util.math.BlockPos)
    • unpackLocalZ

      public static int unpackLocalZ​(short packedLocalPos)
      Gets the local z-coordinate from the given packed local position.
      See Also:
      packLocal(net.minecraft.util.math.BlockPos)
    • unpackBlockX

      public int unpackBlockX​(short packedLocalPos)
      Gets the world x-coordinate of the given local position within this chunk section.
      See Also:
      packLocal(net.minecraft.util.math.BlockPos)
    • unpackBlockY

      public int unpackBlockY​(short packedLocalPos)
      Gets the world y-coordinate of the given local position within this chunk section.
      See Also:
      packLocal(net.minecraft.util.math.BlockPos)
    • unpackBlockZ

      public int unpackBlockZ​(short packedLocalPos)
      Gets the world z-coordinate of the given local position within this chunk section.
      See Also:
      packLocal(net.minecraft.util.math.BlockPos)
    • unpackBlockPos

      public BlockPos unpackBlockPos​(short packedLocalPos)
      Gets the world position of the given local position within this chunk section.
      See Also:
      packLocal(net.minecraft.util.math.BlockPos)
    • getBlockCoord

      public static int getBlockCoord​(int sectionCoord)
      Converts the given chunk section coordinate to the world coordinate system. The returned coordinate will always be at the origin of the chunk section in world space.
    • unpackX

      public static int unpackX​(long packed)
      Gets the chunk section x-coordinate from the given packed chunk section coordinate.
      See Also:
      asLong(int, int, int)
    • unpackY

      public static int unpackY​(long packed)
      Gets the chunk section y-coordinate from the given packed chunk section coordinate.
      See Also:
      asLong(int, int, int)
    • unpackZ

      public static int unpackZ​(long packed)
      Gets the chunk section z-coordinate from the given packed chunk section coordinate.
      See Also:
      asLong(int, int, int)
    • getSectionX

      public int getSectionX()
    • getSectionY

      public int getSectionY()
    • getSectionZ

      public int getSectionZ()
    • getMinX

      public int getMinX()
    • getMinY

      public int getMinY()
    • getMinZ

      public int getMinZ()
    • getMaxX

      public int getMaxX()
    • getMaxY

      public int getMaxY()
    • getMaxZ

      public int getMaxZ()
    • fromBlockPos

      public static long fromBlockPos​(long blockPos)
      Gets the packed chunk section coordinate for a given packed BlockPos.
      See Also:
      asLong(int, int, int), BlockPos.asLong()
    • withZeroY

      public static long withZeroY​(long pos)
      Gets the packed chunk section coordinate at y=0 for the same chunk as the given packed chunk section coordinate.
      See Also:
      asLong(int, int, int)
    • getMinPos

      public BlockPos getMinPos()
    • getCenterPos

      public BlockPos getCenterPos()
    • toChunkPos

      public ChunkPos toChunkPos()
    • asLong

      public static long asLong​(int x, int y, int z)
    • asLong

      public long asLong()
    • streamBlocks

      public Stream<BlockPos> streamBlocks()
    • stream

      public static Stream<ChunkSectionPos> stream​(ChunkSectionPos center, int radius)
    • stream

      public static Stream<ChunkSectionPos> stream​(ChunkPos center, int radius)
    • stream

      public static Stream<ChunkSectionPos> stream​(int minX, int minY, int minZ, int maxX, int maxY, int maxZ)