BlockPos

Represents a position of a block in the world

Questa classe è stata aggiunta da una mod con ID crafttweaker. Perciò, è necessario avere questa mod installata per poter utilizzare questa funzione.

Importing the class

Potrebbe essere necessario importare il pacchetto, se si incontrano dei problemi (come castare un vettore), quindi meglio essere sicuri e aggiungere la direttiva di importazione.

crafttweaker.api.util.BlockPos

Constructors

new crafttweaker.api.util.BlockPos(x as int, y as int, z as int);
ParameterTypeDescription
xintNessuna descrizione fornita
yintNessuna descrizione fornita
zintNessuna descrizione fornita

Methods

add

Adds two positions together and returns the result.

Returns crafttweaker.api.util.BlockPos

new BlockPos(0, 1, 2).add(pos as crafttweaker.api.util.BlockPos);
new BlockPos(0, 1, 2).add(new BlockPos(3, 2, 1));
ParameterTypeDescription
poscrafttweaker.api.util.BlockPosother position to add

Adds the given values to this position, and returns a new position with the new values.

Returns crafttweaker.api.util.BlockPos

new BlockPos(0, 1, 2).add(x as double, y as double, z as double);
new BlockPos(0, 1, 2).add(50.21, -20.8, -25.2);
ParameterTypeDescription
xdoublex value to add
ydoubley value to add
zdoublez value to add

crossProduct

Creates a new BlockPos based on the cross product of this position, and the given position

Returns crafttweaker.api.util.BlockPos

new BlockPos(0, 1, 2).crossProduct(pos as crafttweaker.api.util.BlockPos);
new BlockPos(0, 1, 2).crossProduct(new BlockPos(5, 8, 2););
ParameterTypeDescription
poscrafttweaker.api.util.BlockPosBlockPos to cross product

distanceSq

Gets the squared distance of this position to the specified BlockPos, using the center of the BlockPos

Returns double

new BlockPos(0, 1, 2).distanceSq(to as crafttweaker.api.util.BlockPos);
new BlockPos(0, 1, 2).distanceSq(new BlockPos(256, 128, 10););
ParameterTypeDescription
tocrafttweaker.api.util.BlockPosBlockPos to check against

Gets the squared distance of this position to the specified BlockPos

Returns double

new BlockPos(0, 1, 2).distanceSq(to as crafttweaker.api.util.BlockPos, useCenter as boolean);
new BlockPos(0, 1, 2).distanceSq(new BlockPos(256, 128, 10);, true);
ParameterTypeDescription
tocrafttweaker.api.util.BlockPosBlockPos to check against
useCenterbooleanshould 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 double

new BlockPos(0, 1, 2).distanceSq(x as double, y as double, z as double, useCenter as boolean);
new BlockPos(0, 1, 2).distanceSq(500.25, 250.75, 100.20, false);
ParameterTypeDescription
xdoublex position to check against
ydoubley position to check against
zdoublez position to check against
useCenterbooleanshould the center of the coordinate be used? (adds 0.5 to each value)

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

Returns net.minecraft.util.math.BlockPos

new BlockPos(0, 1, 2).down();

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

Returns net.minecraft.util.math.BlockPos

new BlockPos(0, 1, 2).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

Returns net.minecraft.util.math.BlockPos

new BlockPos(0, 1, 2).east(n as int);
new BlockPos(0, 1, 2).east(2);
ParameterTypeDescription
nintNessuna descrizione fornita

manhattanDistance

Gets the Manhattan Distance of this pos compared to a different position

Restituisce un intero

new BlockPos(0, 1, 2).manhattanDistance(other as crafttweaker.api.util.BlockPos);
new BlockPos(0, 1, 2).manhattanDistance(new BlockPos(4, 5, 6));
ParameterTypeDescription
othercrafttweaker.api.util.BlockPosother position to get the distance to

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

Returns net.minecraft.util.math.BlockPos

new BlockPos(0, 1, 2).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

Returns net.minecraft.util.math.BlockPos

new BlockPos(0, 1, 2).north(n as int);
new BlockPos(0, 1, 2).north(10);
ParameterTypeDescription
nintNessuna descrizione fornita

offset

Creates a new BlockPos based on this BlockPos that is one block offset of this BlockPos based on the given crafttweaker.api.util.Direction

Returns: a new BlockPos that is 1 block offset of this BlockPos

Returns crafttweaker.api.util.BlockPos

new BlockPos(0, 1, 2).offset(direction as crafttweaker.api.util.Direction);
new BlockPos(0, 1, 2).offset(<direction:east>);
ParameterTypeDescription
directioncrafttweaker.api.util.DirectionNessuna descrizione fornita

Creates a new BlockPos based on this BlockPos that is n block(s) offset of this BlockPos based on the given crafttweaker.api.util.Direction

Returns: a new BlockPos that is n block(s) offset of this BlockPos

Returns crafttweaker.api.util.BlockPos

new BlockPos(0, 1, 2).offset(direction as crafttweaker.api.util.Direction, n as int);
new BlockPos(0, 1, 2).offset(<direction:south>, 3);
ParameterTypeDescription
directioncrafttweaker.api.util.DirectionNessuna descrizione fornita
nintNessuna descrizione fornita

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

Returns net.minecraft.util.math.BlockPos

new BlockPos(0, 1, 2).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

Returns net.minecraft.util.math.BlockPos

new BlockPos(0, 1, 2).south(n as int);
new BlockPos(0, 1, 2).south(12);
ParameterTypeDescription
nintNessuna descrizione fornita

subtract

Subtracts two positions together and returns the result.

Returns crafttweaker.api.util.BlockPos

new BlockPos(0, 1, 2).subtract(pos as crafttweaker.api.util.BlockPos);
new BlockPos(0, 1, 2).subtract(new BlockPos(2, 1, 3));
ParameterTypeDescription
poscrafttweaker.api.util.BlockPosother position to remove

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

Returns net.minecraft.util.math.BlockPos

new BlockPos(0, 1, 2).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

Returns net.minecraft.util.math.BlockPos

new BlockPos(0, 1, 2).up(n as int);
new BlockPos(0, 1, 2).up(45);
ParameterTypeDescription
nintNessuna descrizione fornita

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

Returns net.minecraft.util.math.BlockPos

new BlockPos(0, 1, 2).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

Returns net.minecraft.util.math.BlockPos

new BlockPos(0, 1, 2).west(n as int);
new BlockPos(0, 1, 2).west(120);
ParameterTypeDescription
nintNessuna descrizione fornita

withinDistance

Checks if the given BlockPos is within the specified distance of this BlockPos (this uses the middle of the BlockPos)

Restituisce un booleano

new BlockPos(0, 1, 2).withinDistance(pos as crafttweaker.api.util.BlockPos, distance as double);
new BlockPos(0, 1, 2).withinDistance(new BlockPos(80, 75, 54);, 10);
ParameterTypeDescription
poscrafttweaker.api.util.BlockPosBlockPos to check if it is within the distance
distancedoubledistance to check within

Properties

NameTypeHa GetterHa Setter
xinttruefalse
yinttruefalse
zinttruefalse

Operators

ADD

Adds two positions together and returns the result.

new BlockPos(0, 1, 2) + pos as crafttweaker.api.util.BlockPos
new BlockPos(0, 1, 2) + new BlockPos(3, 2, 1)
ParameterTypeDescription
poscrafttweaker.api.util.BlockPosother position to add

SUB

Subtracts two positions together and returns the result.

new BlockPos(0, 1, 2) - pos as crafttweaker.api.util.BlockPos
new BlockPos(0, 1, 2) - new BlockPos(2, 1, 3)
ParameterTypeDescription
poscrafttweaker.api.util.BlockPosother position to remove

Caster

Tipo RisultatoImplicito
longfalse