记录类 CuboidArea
java.lang.Object
java.lang.Record
io.github.lijinhong11.mittellib.math.CuboidArea
- 记录组件:
pos1- the point 1pos2- the point 2
Represents a cuboid (rectangular) area defined by two block positions.
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明Converts this cuboid area to a list of all block positions it contains.booleanChecks if a block position is contained within this cuboid area.static CuboidAreacreateFromLocation(Location loc1, Location loc2) Creates a CuboidArea from two Bukkit Locations.final boolean指示某个其他对象是否“等于”此对象。expand(int x) Expands this cuboid area by the specified amount in all directions.expand(int x, int y) Expands this cuboid area by the specified amounts in X and Y directions.expand(int x, int y, int z) Expands this cuboid area by the specified amounts in all directions.voidPerforms an action for each block position in this cuboid area.getCenterLocation(World world) Gets the center location of this cuboid area in the specified world.getMax()Gets the maximum corner position of this cuboid area.getMin()Gets the minimum corner position of this cuboid area.final inthashCode()返回此对象的哈希代码值。pos1()返回pos1记录组件的值。pos2()返回pos2记录组件的值。intsizeX()Gets the size of this cuboid area in the X direction.intsizeY()Gets the size of this cuboid area in the Y direction.intsizeZ()Gets the size of this cuboid area in the Z direction.@NotNull StringtoString()返回此记录类的字符串表示形式。intvolume()Gets the total number of blocks in this cuboid area.
-
构造器详细资料
-
方法详细资料
-
createFromLocation
Creates a CuboidArea from two Bukkit Locations.- 参数:
loc1- the first locationloc2- the second location- 返回:
- a new CuboidArea
-
getMin
Gets the minimum corner position of this cuboid area.- 返回:
- the minimum BlockPos
-
getMax
Gets the maximum corner position of this cuboid area.- 返回:
- the maximum BlockPos
-
getCenterLocation
Gets the center location of this cuboid area in the specified world.- 参数:
world- the world for the location- 返回:
- the center location
-
expand
Expands this cuboid area by the specified amount in all directions.- 参数:
x- the amount to expand in X direction- 返回:
- a new expanded CuboidArea
-
expand
Expands this cuboid area by the specified amounts in X and Y directions.- 参数:
x- the amount to expand in X directiony- the amount to expand in Y direction- 返回:
- a new expanded CuboidArea
-
expand
Expands this cuboid area by the specified amounts in all directions.- 参数:
x- the amount to expand in X directiony- the amount to expand in Y directionz- the amount to expand in Z direction- 返回:
- a new expanded CuboidArea
-
contains
Checks if a block position is contained within this cuboid area.- 参数:
pos- the position to check- 返回:
- true if the position is within the area, false otherwise
-
sizeX
public int sizeX()Gets the size of this cuboid area in the X direction.- 返回:
- the X size (in blocks)
-
sizeY
public int sizeY()Gets the size of this cuboid area in the Y direction.- 返回:
- the Y size (in blocks)
-
sizeZ
public int sizeZ()Gets the size of this cuboid area in the Z direction.- 返回:
- the Z size (in blocks)
-
volume
public int volume()Gets the total number of blocks in this cuboid area.- 返回:
- the total number of blocks
-
forEach
Performs an action for each block position in this cuboid area.- 参数:
action- the action to perform for each position
-
asPosList
Converts this cuboid area to a list of all block positions it contains.- 返回:
- a list of all BlockPos in this area
-
toString
返回此记录类的字符串表示形式。此表示形式包含类的名称,后跟每个记录组件的名称和值。 -
hashCode
public final int hashCode()返回此对象的哈希代码值。此值派生自每个记录组件的哈希代码。 -
equals
指示某个其他对象是否“等于”此对象。如果两个对象属于同一个类,而且所有记录组件都相等,则这两个对象相等。 此记录类中的所有组件都使用Objects::equals(Object,Object)进行比较。 -
pos1
返回pos1记录组件的值。- 返回:
pos1记录组件的值
-
pos2
返回pos2记录组件的值。- 返回:
pos2记录组件的值
-