Package net.minecraft.util.math
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
-
Field Summary
-
Constructor Summary
Constructors Modifier Constructor Description private
ChunkSectionPos(int x, int y, int z)
-
Method Summary
Modifier and Type Method Description long
asLong()
static long
asLong(int x, int y, int z)
static ChunkSectionPos
from(int x, int y, int z)
Creates a chunk section position from its x-, y- and z-coordinates.static ChunkSectionPos
from(long packed)
Creates a chunk section position from its packed representation.static ChunkSectionPos
from(Entity entity)
static ChunkSectionPos
from(BlockPos pos)
static ChunkSectionPos
from(ChunkPos chunkPos, int y)
Creates a chunk section position from a chunk position and the y-coordinate of the vertical section.static long
fromBlockPos(long blockPos)
Gets the packed chunk section coordinate for a given packedBlockPos
.static int
getBlockCoord(int sectionCoord)
Converts the given chunk section coordinate to the world coordinate system.BlockPos
getCenterPos()
static int
getLocalCoord(int coord)
Converts a world coordinate to the local coordinate system (0-15) of its corresponding chunk section.int
getMaxX()
int
getMaxY()
int
getMaxZ()
BlockPos
getMinPos()
int
getMinX()
int
getMinY()
int
getMinZ()
static int
getSectionCoord(int coord)
Converts a world coordinate to the corresponding chunk-section coordinate.int
getSectionX()
int
getSectionY()
int
getSectionZ()
static long
offset(long packed, int x, int y, int z)
Offsets a packed chunk section position by the given offsets.static long
offset(long packed, Direction direction)
Offsets a packed chunk section position in the given direction.static short
packLocal(BlockPos pos)
Returns the local position of the given block position relative to its respective chunk section, packed into a short.static Stream<ChunkSectionPos>
stream(int minX, int minY, int minZ, int maxX, int maxY, int maxZ)
static Stream<ChunkSectionPos>
stream(ChunkPos center, int radius)
static Stream<ChunkSectionPos>
stream(ChunkSectionPos center, int radius)
Stream<BlockPos>
streamBlocks()
ChunkPos
toChunkPos()
BlockPos
unpackBlockPos(short packedLocalPos)
Gets the world position of the given local position within this chunk section.int
unpackBlockX(short packedLocalPos)
Gets the world x-coordinate of the given local position within this chunk section.int
unpackBlockY(short packedLocalPos)
Gets the world y-coordinate of the given local position within this chunk section.int
unpackBlockZ(short packedLocalPos)
Gets the world z-coordinate of the given local position within this chunk section.static int
unpackLocalX(short packedLocalPos)
Gets the local x-coordinate from the given packed local position.static int
unpackLocalY(short packedLocalPos)
Gets the local y-coordinate from the given packed local position.static int
unpackLocalZ(short packedLocalPos)
Gets the local z-coordinate from the given packed local position.static int
unpackX(long packed)
Gets the chunk section x-coordinate from the given packed chunk section coordinate.static int
unpackY(long packed)
Gets the chunk section y-coordinate from the given packed chunk section coordinate.static int
unpackZ(long packed)
Gets the chunk section z-coordinate from the given packed chunk section coordinate.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.Methods inherited from class net.minecraft.util.math.Vec3i
compareTo, crossProduct, down, down, equals, getComponentAlongAxis, getManhattanDistance, getSquaredDistance, getSquaredDistance, getSquaredDistance, getX, getY, getZ, hashCode, isWithinDistance, isWithinDistance, offset, setX, setY, setZ, toShortString, toString, up, up
-
Constructor Details
-
ChunkSectionPos
private ChunkSectionPos(int x, int y, int z)
-
-
Method Details
-
from
Creates a chunk section position from its x-, y- and z-coordinates. -
from
-
from
Creates a chunk section position from a chunk position and the y-coordinate of the vertical section. -
from
-
from
Creates a chunk section position from its packed representation.- See Also:
asLong(int, int, int)
-
offset
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
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. -
unpackLocalY
public static int unpackLocalY(short packedLocalPos)Gets the local y-coordinate from the given packed local position. -
unpackLocalZ
public static int unpackLocalZ(short packedLocalPos)Gets the local z-coordinate from the given packed local position. -
unpackBlockX
public int unpackBlockX(short packedLocalPos)Gets the world x-coordinate of the given local position within this chunk section. -
unpackBlockY
public int unpackBlockY(short packedLocalPos)Gets the world y-coordinate of the given local position within this chunk section. -
unpackBlockZ
public int unpackBlockZ(short packedLocalPos)Gets the world z-coordinate of the given local position within this chunk section. -
unpackBlockPos
Gets the world position of the given local position within this chunk section. -
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 packedBlockPos
.- 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
-
getCenterPos
-
toChunkPos
-
asLong
public static long asLong(int x, int y, int z) -
asLong
public long asLong() -
streamBlocks
-
stream
-
stream
-
stream
public static Stream<ChunkSectionPos> stream(int minX, int minY, int minZ, int maxX, int maxY, int maxZ)
-