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 privateChunkSectionPos(int x, int y, int z) -
Method Summary
Modifier and Type Method Description longasLong()static longasLong(int x, int y, int z)static ChunkSectionPosfrom(int x, int y, int z)Creates a chunk section position from its x-, y- and z-coordinates.static ChunkSectionPosfrom(long packed)Creates a chunk section position from its packed representation.static ChunkSectionPosfrom(Entity entity)static ChunkSectionPosfrom(BlockPos pos)static ChunkSectionPosfrom(ChunkPos chunkPos, int y)Creates a chunk section position from a chunk position and the y-coordinate of the vertical section.static longfromBlockPos(long blockPos)Gets the packed chunk section coordinate for a given packedBlockPos.static intgetBlockCoord(int sectionCoord)Converts the given chunk section coordinate to the world coordinate system.BlockPosgetCenterPos()static intgetLocalCoord(int coord)Converts a world coordinate to the local coordinate system (0-15) of its corresponding chunk section.intgetMaxX()intgetMaxY()intgetMaxZ()BlockPosgetMinPos()intgetMinX()intgetMinY()intgetMinZ()static intgetSectionCoord(int coord)Converts a world coordinate to the corresponding chunk-section coordinate.intgetSectionX()intgetSectionY()intgetSectionZ()static intmethod_32204(double double2)static intmethod_32205(int int2, int int3)static longoffset(long packed, int x, int y, int z)Offsets a packed chunk section position by the given offsets.static longoffset(long packed, Direction direction)Offsets a packed chunk section position in the given direction.static shortpackLocal(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, int int2, int int3)static Stream<ChunkSectionPos>stream(ChunkSectionPos center, int radius)Stream<BlockPos>streamBlocks()ChunkPostoChunkPos()BlockPosunpackBlockPos(short packedLocalPos)Gets the world position of the given local position within this chunk section.intunpackBlockX(short packedLocalPos)Gets the world x-coordinate of the given local position within this chunk section.intunpackBlockY(short packedLocalPos)Gets the world y-coordinate of the given local position within this chunk section.intunpackBlockZ(short packedLocalPos)Gets the world z-coordinate of the given local position within this chunk section.static intunpackLocalX(short packedLocalPos)Gets the local x-coordinate from the given packed local position.static intunpackLocalY(short packedLocalPos)Gets the local y-coordinate from the given packed local position.static intunpackLocalZ(short packedLocalPos)Gets the local z-coordinate from the given packed local position.static intunpackX(long packed)Gets the chunk section x-coordinate from the given packed chunk section coordinate.static intunpackY(long packed)Gets the chunk section y-coordinate from the given packed chunk section coordinate.static intunpackZ(long packed)Gets the chunk section z-coordinate from the given packed chunk section coordinate.static longwithZeroY(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, 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)
-
method_32204
public static int method_32204(double double2) -
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. -
method_32205
public static int method_32205(int int2, int int3) -
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)
-