BlockPos
Link to blockpos
Represents a position of a block in the world
Этот класс был добавлен модом с mod-id crafttweaker
. Так что если вы хотите использовать эту функцию, вам нужно установить этот мод.
Импорт класса
Link to импорт-класса
Вам может потребоваться импортировать пакет, если вы столкнетесь с какими-либо проблемами (например, с заливкой массива), так что лучше быть в безопасности, чем извиняться и добавлять импорт.
ZenScript Copycrafttweaker.api.util.BlockPos
Constructors
Link to constructors
ZenScript Copynew crafttweaker.api.util.BlockPos(x as int, y as int, z as int);
Параметр | Тип | Описание |
---|---|---|
Параметр x | Тип int | Описание Описание отсутствует |
Параметр y | Тип int | Описание Описание отсутствует |
Параметр z | Тип int | Описание Описание отсутствует |
Методы
Link to методы
add
Link to add
Adds two positions together and returns the result.
Returns crafttweaker.api.util.BlockPos
ZenScript Copynew BlockPos(0, 1, 2).add(pos as crafttweaker.api.util.BlockPos);
new BlockPos(0, 1, 2).add(new BlockPos(3, 2, 1));
Параметр | Тип | Описание |
---|---|---|
Параметр pos | Тип crafttweaker.api.util.BlockPos | Описание other position to add |
Adds the given values to this position, and returns a new position with the new values.
Returns crafttweaker.api.util.BlockPos
ZenScript Copynew 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);
Параметр | Тип | Описание |
---|---|---|
Параметр x | Тип double | Описание x value to add |
Параметр y | Тип double | Описание y value to add |
Параметр z | Тип double | Описание z value to add |
crossProduct
Link to crossproduct
Creates a new BlockPos based on the cross product of this position, and the given position
Returns crafttweaker.api.util.BlockPos
ZenScript Copynew BlockPos(0, 1, 2).crossProduct(pos as crafttweaker.api.util.BlockPos);
new BlockPos(0, 1, 2).crossProduct(new BlockPos(5, 8, 2););
Параметр | Тип | Описание |
---|---|---|
Параметр pos | Тип crafttweaker.api.util.BlockPos | Описание BlockPos to cross product |
distanceSq
Link to distancesq
Gets the squared distance of this position to the specified BlockPos, using the center of the BlockPos
Returns double
ZenScript Copynew BlockPos(0, 1, 2).distanceSq(to as crafttweaker.api.util.BlockPos);
new BlockPos(0, 1, 2).distanceSq(new BlockPos(256, 128, 10););
Параметр | Тип | Описание |
---|---|---|
Параметр to | Тип crafttweaker.api.util.BlockPos | Описание BlockPos to check against |
Gets the squared distance of this position to the specified BlockPos
Returns double
ZenScript Copynew 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);
Параметр | Тип | Описание |
---|---|---|
Параметр to | Тип crafttweaker.api.util.BlockPos | Описание BlockPos to check against |
Параметр useCenter | Тип boolean | Описание 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 double
ZenScript Copynew 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);
Параметр | Тип | Описание |
---|---|---|
Параметр x | Тип double | Описание x position to check against |
Параметр y | Тип double | Описание y position to check against |
Параметр z | Тип double | Описание z position to check against |
Параметр useCenter | Тип boolean | Описание should the center of the coordinate be used? (adds 0.5 to each value) |
down
Link to 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
ZenScript Copynew BlockPos(0, 1, 2).down();
east
Link to 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
ZenScript Copynew 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
ZenScript Copynew BlockPos(0, 1, 2).east(n as int);
new BlockPos(0, 1, 2).east(2);
Параметр | Тип | Описание |
---|---|---|
Параметр n | Тип int | Описание Описание отсутствует |
manhattanDistance
Link to manhattandistance
Gets the Manhattan Distance of this pos compared to a different position
Возвращает int
ZenScript Copynew BlockPos(0, 1, 2).manhattanDistance(other as crafttweaker.api.util.BlockPos);
new BlockPos(0, 1, 2).manhattanDistance(new BlockPos(4, 5, 6));
Параметр | Тип | Описание |
---|---|---|
Параметр other | Тип crafttweaker.api.util.BlockPos | Описание other position to get the distance to |
north
Link 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
ZenScript Copynew 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
ZenScript Copynew BlockPos(0, 1, 2).north(n as int);
new BlockPos(0, 1, 2).north(10);
Параметр | Тип | Описание |
---|---|---|
Параметр n | Тип int | Описание Описание отсутствует |
offset
Link to 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
ZenScript Copynew BlockPos(0, 1, 2).offset(direction as crafttweaker.api.util.Direction);
new BlockPos(0, 1, 2).offset(<direction:east>);
Параметр | Тип | Описание |
---|---|---|
Параметр direction | Тип crafttweaker.api.util.Direction | Описание Описание отсутствует |
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
ZenScript Copynew BlockPos(0, 1, 2).offset(direction as crafttweaker.api.util.Direction, n as int);
new BlockPos(0, 1, 2).offset(<direction:south>, 3);
Параметр | Тип | Описание |
---|---|---|
Параметр direction | Тип crafttweaker.api.util.Direction | Описание Описание отсутствует |
Параметр n | Тип int | Описание Описание отсутствует |
south
Link to 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
ZenScript Copynew 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
ZenScript Copynew BlockPos(0, 1, 2).south(n as int);
new BlockPos(0, 1, 2).south(12);
Параметр | Тип | Описание |
---|---|---|
Параметр n | Тип int | Описание Описание отсутствует |
subtract
Link to subtract
Subtracts two positions together and returns the result.
Returns crafttweaker.api.util.BlockPos
ZenScript Copynew BlockPos(0, 1, 2).subtract(pos as crafttweaker.api.util.BlockPos);
new BlockPos(0, 1, 2).subtract(new BlockPos(2, 1, 3));
Параметр | Тип | Описание |
---|---|---|
Параметр pos | Тип crafttweaker.api.util.BlockPos | Описание other position to remove |
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
ZenScript Copynew 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
ZenScript Copynew BlockPos(0, 1, 2).up(n as int);
new BlockPos(0, 1, 2).up(45);
Параметр | Тип | Описание |
---|---|---|
Параметр n | Тип int | Описание Описание отсутствует |
west
Link to 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
ZenScript Copynew 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
ZenScript Copynew BlockPos(0, 1, 2).west(n as int);
new BlockPos(0, 1, 2).west(120);
Параметр | Тип | Описание |
---|---|---|
Параметр n | Тип int | Описание Описание отсутствует |
withinDistance
Link to withindistance
Checks if the given BlockPos is within the specified distance of this BlockPos (this uses the middle of the BlockPos)
Возвращает boolean
ZenScript Copynew 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);
Параметр | Тип | Описание |
---|---|---|
Параметр pos | Тип crafttweaker.api.util.BlockPos | Описание BlockPos to check if it is within the distance |
Параметр distance | Тип double | Описание distance to check within |
Свойства
Link to свойства
Название | Тип | Имеет Getter | Имеет Setter |
---|---|---|---|
Название x | Тип int | Имеет Getter true | Имеет Setter false |
Название y | Тип int | Имеет Getter true | Имеет Setter false |
Название z | Тип int | Имеет Getter true | Имеет Setter false |
Операторы
Link to операторы
Adds two positions together and returns the result.
ZenScript Copynew BlockPos(0, 1, 2) + pos as crafttweaker.api.util.BlockPos
new BlockPos(0, 1, 2) + new BlockPos(3, 2, 1)
Параметр | Тип | Описание |
---|---|---|
Параметр pos | Тип crafttweaker.api.util.BlockPos | Описание other position to add |
Параметр ### SUB |
Subtracts two positions together and returns the result.
ZenScript Copynew BlockPos(0, 1, 2) - pos as crafttweaker.api.util.BlockPos
new BlockPos(0, 1, 2) - new BlockPos(2, 1, 3)
Параметр | Тип | Описание |
---|---|---|
Параметр pos | Тип crafttweaker.api.util.BlockPos | Описание other position to remove |
Утилиты
Link to утилиты
Тип результата | Является неявным |
---|---|
Тип результата long | Является неявным false |