BlockPos
Represents a position of a block in the world
Importing the class
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
Extending MCVector3i
BlockPos extends MCVector3i. That means all methods available in MCVector3i are also available in BlockPos
Static Methods
Gets all the BlockPos inside the given positions.
For example, doing
getAllInBox(new BlockPos(0,0,0), new BlockPos(2,2,0
Would return a list of the following positions:
[(0,0,0), (1,0,0), (1,1,0), (0,1,0)]
Returns: A list of all the BlockPos within the given position.
Return Type: stdlib.List<BlockPos>
Parameter | Type | Description |
---|---|---|
Parameter first | Type BlockPos | Description The first position. |
Parameter second | Type BlockPos | Description The second position. |
Constructors
Parameter | Type | Description |
---|---|---|
Parameter x | Type int | Description No description provided |
Parameter y | Type int | Description No description provided |
Parameter z | Type int | Description No description provided |
Casters
Result type | Is Implicit |
---|---|
Result type long | Is Implicit false |
Result type string | Is Implicit true |
Methods
Adds the given values to this position, and returns a new position with the new values.
Returns: a new position based on values of provided values and this position
Return Type: BlockPos
Parameter | Type | Description |
---|---|---|
Parameter x | Type double | Description x value to add |
Parameter y | Type double | Description y value to add |
Parameter z | Type double | Description z value to add |
Adds the given values to this position, and returns a new position with the new values.
Returns: a new position based on values of provided values and this position
Return Type: BlockPos
Parameter | Type | Description |
---|---|---|
Parameter x | Type int | Description x value to add |
Parameter y | Type int | Description y value to add |
Parameter z | Type int | Description z value to add |
Gets the squared distance of this position to the specified BlockPos, using the center of the BlockPos
Returns: the squared distance of this current position and the given BlockPos.
Return Type: double
Parameter | Type | Description |
---|---|---|
Parameter to | Type BlockPos | Description BlockPos to check against |
Gets the squared distance of this position to the specified BlockPos
Returns: the squared distance of this current position and the given BlockPos.
Return Type: double
Parameter | Type | Description |
---|---|---|
Parameter to | Type BlockPos | Description BlockPos to check against |
Parameter useCenter | Type boolean | Description should the center of the coordinate be used? (adds 0.5 to each value) |
Gets the squared distance of this position to the specified coordinates
Returns: the squared distance of this current position and the given coordinates.
Return Type: double
Parameter | Type | Description |
---|---|---|
Parameter x | Type double | Description x position to check against |
Parameter y | Type double | Description y position to check against |
Parameter z | Type double | Description z position to check against |
Parameter useCenter | Type boolean | Description should the center of the coordinate be used? (adds 0.5 to each value) |
Creates a new BlockPos based on this BlockPos that is one block lower than this BlockPos
Returns: a new BlockPos that is one block lower than this BlockPos
Return Type: BlockPos
Creates a new BlockPos based on this BlockPos that is n block(s) lower than this BlockPos
Returns: a new BlockPos that is n block(s) lower than this BlockPos
Return Type: BlockPos
Parameter | Type | Description |
---|---|---|
Parameter n | Type int | Description No Description Provided |
Creates a new BlockPos based on this BlockPos that is one block east of this BlockPos
Returns: a new BlockPos that is one block east of this BlockPos
Return Type: BlockPos
Creates a new BlockPos based on this BlockPos that is n block(s) east of this BlockPos
Returns: a new BlockPos that is n block(s) east of this BlockPos
Return Type: BlockPos
Parameter | Type | Description |
---|---|---|
Parameter n | Type int | Description No Description Provided |
Gets the Manhattan Distance of this pos compared to a different position
Returns: The manhattan distance of the positions
Return Type: int
Parameter | Type | Description |
---|---|---|
Parameter other | Type BlockPos | Description other position to get the distance to |
Creates a new BlockPos based on this BlockPos that is one block north of this BlockPos
Returns: a new BlockPos that is one block north of this BlockPos
Return Type: BlockPos
Creates a new BlockPos based on this BlockPos that is n block(s) north of this BlockPos
Returns: a new BlockPos that is n block(s) north of this BlockPos
Return Type: BlockPos
Parameter | Type | Description |
---|---|---|
Parameter n | Type int | Description No Description Provided |
Creates a new BlockPos based on this BlockPos that is n block(s) offset of this BlockPos based on the given Direction
Returns: a new BlockPos that is n block(s) offset of this BlockPos
Return Type: BlockPos
Parameter | Type | Description |
---|---|---|
Parameter direction | Type Direction | Description No Description Provided |
Parameter n | Type int | Description No Description Provided |
Creates a new BlockPos based on this BlockPos that is one block south of this BlockPos
Returns: a new BlockPos that is one block south of this BlockPos
Return Type: BlockPos
Creates a new BlockPos based on this BlockPos that is n block(s) south of this BlockPos
Returns: a new BlockPos that is n block(s) south of this BlockPos
Return Type: BlockPos
Parameter | Type | Description |
---|---|---|
Parameter n | Type int | Description No Description Provided |
Creates a new BlockPos based on this BlockPos that is one block higher than this BlockPos
Returns: a new BlockPos that is one block higher than this BlockPos
Return Type: BlockPos
Creates a new BlockPos based on this BlockPos that is n block(s) higher than this BlockPos
Returns: a new BlockPos that is n block(s) higher than this BlockPos
Return Type: BlockPos
Parameter | Type | Description |
---|---|---|
Parameter n | Type int | Description No Description Provided |
Creates a new BlockPos based on this BlockPos that is one block west of this BlockPos
Returns: a new BlockPos that is one block west of this BlockPos
Return Type: BlockPos
Creates a new BlockPos based on this BlockPos that is n block(s) west of this BlockPos
Returns: a new BlockPos that is n block(s) west of this BlockPos
Return Type: BlockPos
Parameter | Type | Description |
---|---|---|
Parameter n | Type int | Description No Description Provided |
Checks if the given BlockPos is within the specified distance of this BlockPos (this uses the middle of the BlockPos)
Returns: true if the given BlockPos is within the given distance of this BlockPos
Return Type: boolean
Parameter | Type | Description |
---|---|---|
Parameter pos | Type BlockPos | Description BlockPos to check if it is within the distance |
Parameter distance | Type double | Description distance to check within |
Properties
Name | Type | Has Getter | Has Setter | Description |
---|---|---|---|---|
Name x | Type int | Has Getter true | Has Setter false | Description No Description Provided |
Name y | Type int | Has Getter true | Has Setter false | Description No Description Provided |
Name z | Type int | Has Getter true | Has Setter false | Description No Description Provided |