BlockPos
Link to blockpos
Represents a position of a block in the world
Importare la Classe
Link to importare-la-classe
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.
ZenScript Copyimport crafttweaker.api.util.BlockPos;
Extending MCVector3i
Link to extending-mcvector3i
BlockPos extends MCVector3i. That means all methods available in MCVector3i are also available in BlockPos
Static Methods
Link to static-methods
Name: getAllInBox
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>
ZenScript Copy// BlockPos.getAllInBox(first as BlockPos, second as BlockPos) as stdlib.List<BlockPos>
BlockPos.getAllInBox(new BlockPos(0, 0, 0), new BlockPos(5, 5, 5));
Parametro | Tipo | Descrizione |
---|---|---|
Parametro first | Tipo BlockPos | Descrizione The first position. |
Parametro second | Tipo BlockPos | Descrizione The second position. |
Constructors
Link to constructors
ZenScript Copynew BlockPos(x as int, y as int, z as int) as BlockPos
Parametro | Tipo | Descrizione |
---|---|---|
Parametro x | Tipo int | Descrizione Nessuna descrizione fornita |
Parametro y | Tipo int | Descrizione Nessuna descrizione fornita |
Parametro z | Tipo int | Descrizione Nessuna descrizione fornita |
Caster
Link to caster
Tipo Risultato | Implicito |
---|---|
Tipo Risultato long | Implicito no |
Tipo Risultato string | Implicito sì |
Metodi
Link to metodi
Name: add
Adds two positions together and returns the result.
Returns: new BlockPos with the added values.
Return Type: BlockPos
ZenScript Copy// BlockPos.add(pos as BlockPos) as BlockPos
new BlockPos(0, 1, 2).add(new BlockPos(3, 2, 1));
Parametro | Tipo | Descrizione |
---|---|---|
Parametro pos | Tipo BlockPos | Descrizione other position to add |
Name: 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
ZenScript Copy// BlockPos.add(x as double, y as double, z as double) as BlockPos
new BlockPos(0, 1, 2).add(50.21, -20.8, -25.2);
Parametro | Tipo | Descrizione |
---|---|---|
Parametro x | Tipo double | Descrizione x value to add |
Parametro y | Tipo double | Descrizione y value to add |
Parametro z | Tipo double | Descrizione z value to add |
Name: 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
ZenScript Copy// BlockPos.add(x as int, y as int, z as int) as BlockPos
new BlockPos(0, 1, 2).add(50, -20, -25);
Parametro | Tipo | Descrizione |
---|---|---|
Parametro x | Tipo int | Descrizione x value to add |
Parametro y | Tipo int | Descrizione y value to add |
Parametro z | Tipo int | Descrizione z value to add |
Name: crossProduct
Creates a new BlockPos based on the cross product of this position, and the given position
Returns: a new BlockPos based on the cross product of this BlockPos and the given BlockPos
Return Type: BlockPos
ZenScript Copy// BlockPos.crossProduct(pos as BlockPos) as BlockPos
new BlockPos(0, 1, 2).crossProduct(new BlockPos(5, 8, 2););
Parametro | Tipo | Descrizione |
---|---|---|
Parametro pos | Tipo BlockPos | Descrizione BlockPos to cross product |
Name: distanceSq
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
ZenScript Copy// BlockPos.distanceSq(to as BlockPos) as double
new BlockPos(0, 1, 2).distanceSq(new BlockPos(256, 128, 10););
Parametro | Tipo | Descrizione |
---|---|---|
Parametro to | Tipo BlockPos | Descrizione BlockPos to check against |
Name: distanceSq
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
ZenScript Copy// BlockPos.distanceSq(to as BlockPos, useCenter as boolean) as double
new BlockPos(0, 1, 2).distanceSq(new BlockPos(256, 128, 10);, true);
Parametro | Tipo | Descrizione |
---|---|---|
Parametro to | Tipo BlockPos | Descrizione BlockPos to check against |
Parametro useCenter | Tipo boolean | Descrizione should the center of the coordinate be used? (adds 0.5 to each value) |
Name: distanceSq
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
ZenScript Copy// BlockPos.distanceSq(x as double, y as double, z as double, useCenter as boolean) as double
new BlockPos(0, 1, 2).distanceSq(500.25, 250.75, 100.20, false);
Parametro | Tipo | Descrizione |
---|---|---|
Parametro x | Tipo double | Descrizione x position to check against |
Parametro y | Tipo double | Descrizione y position to check against |
Parametro z | Tipo double | Descrizione z position to check against |
Parametro useCenter | Tipo boolean | Descrizione should the center of the coordinate be used? (adds 0.5 to each value) |
Name: down
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
ZenScript Copy// BlockPos.down() as BlockPos
new BlockPos(0, 1, 2).down();
Name: down
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
ZenScript CopyBlockPos.down(n as int) as BlockPos
Parametro | Tipo | Descrizione |
---|---|---|
Parametro n | Tipo int | Descrizione No Description Provided |
Name: east
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
ZenScript Copy// BlockPos.east() as BlockPos
new BlockPos(0, 1, 2).east();
Name: east
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
ZenScript Copy// BlockPos.east(n as int) as BlockPos
new BlockPos(0, 1, 2).east(2);
Parametro | Tipo | Descrizione |
---|---|---|
Parametro n | Tipo int | Descrizione No Description Provided |
Name: manhattanDistance
Gets the Manhattan Distance of this pos compared to a different position
Returns: The manhattan distance of the positions
Return Type: int
ZenScript Copy// BlockPos.manhattanDistance(other as BlockPos) as int
new BlockPos(0, 1, 2).manhattanDistance(new BlockPos(4, 5, 6));
Parametro | Tipo | Descrizione |
---|---|---|
Parametro other | Tipo BlockPos | Descrizione other position to get the distance to |
Name: north
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
ZenScript Copy// BlockPos.north() as BlockPos
new BlockPos(0, 1, 2).north();
Name: north
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
ZenScript Copy// BlockPos.north(n as int) as BlockPos
new BlockPos(0, 1, 2).north(10);
Parametro | Tipo | Descrizione |
---|---|---|
Parametro n | Tipo int | Descrizione No Description Provided |
Name: offset
Creates a new BlockPos based on this BlockPos that is one block offset of this BlockPos based on the given Direction
Returns: a new BlockPos that is 1 block offset of this BlockPos
Return Type: BlockPos
ZenScript Copy// BlockPos.offset(direction as Direction) as BlockPos
new BlockPos(0, 1, 2).offset(<direction:east>);
Parametro | Tipo | Descrizione |
---|---|---|
Parametro direction | Tipo Direction | Descrizione No Description Provided |
Name: offset
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
ZenScript Copy// BlockPos.offset(direction as Direction, n as int) as BlockPos
new BlockPos(0, 1, 2).offset(<direction:south>, 3);
Parametro | Tipo | Descrizione |
---|---|---|
Parametro direction | Tipo Direction | Descrizione No Description Provided |
Parametro n | Tipo int | Descrizione No Description Provided |
Name: south
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
ZenScript Copy// BlockPos.south() as BlockPos
new BlockPos(0, 1, 2).south();
Name: south
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
ZenScript Copy// BlockPos.south(n as int) as BlockPos
new BlockPos(0, 1, 2).south(12);
Parametro | Tipo | Descrizione |
---|---|---|
Parametro n | Tipo int | Descrizione No Description Provided |
Name: subtract
Subtracts two positions together and returns the result.
Returns: new BlockPos with the removed values.
Return Type: BlockPos
ZenScript Copy// BlockPos.subtract(pos as BlockPos) as BlockPos
new BlockPos(0, 1, 2).subtract(new BlockPos(2, 1, 3));
Parametro | Tipo | Descrizione |
---|---|---|
Parametro pos | Tipo BlockPos | Descrizione other position to remove |
Name: up
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
ZenScript Copy// BlockPos.up() as BlockPos
new BlockPos(0, 1, 2).up();
Name: up
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
ZenScript Copy// BlockPos.up(n as int) as BlockPos
new BlockPos(0, 1, 2).up(45);
Parametro | Tipo | Descrizione |
---|---|---|
Parametro n | Tipo int | Descrizione No Description Provided |
Name: west
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
ZenScript Copy// BlockPos.west() as BlockPos
new BlockPos(0, 1, 2).west();
Name: west
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
ZenScript Copy// BlockPos.west(n as int) as BlockPos
new BlockPos(0, 1, 2).west(120);
Parametro | Tipo | Descrizione |
---|---|---|
Parametro n | Tipo int | Descrizione No Description Provided |
Name: withinDistance
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
ZenScript Copy// BlockPos.withinDistance(pos as BlockPos, distance as double) as boolean
new BlockPos(0, 1, 2).withinDistance(new BlockPos(80, 75, 54);, 10);
Parametro | Tipo | Descrizione |
---|---|---|
Parametro pos | Tipo BlockPos | Descrizione BlockPos to check if it is within the distance |
Parametro distance | Tipo double | Descrizione distance to check within |
Proprietà
Link to proprietà
Nome | Tipo | Ha Getter | Ha Setter | Descrizione |
---|---|---|---|---|
Nome x | Tipo int | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome y | Tipo int | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome z | Tipo int | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |