Package net.minestom.server.instance
Class WorldBorder
java.lang.Object
net.minestom.server.instance.WorldBorder
Represents the world border of an
Instance,
can be retrieved with Instance.getWorldBorder().-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloatGets the center X of the world border.floatGets the center Z of the world border.@NotNull WorldBorder.CollisionAxisgetCollisionAxis(@NotNull Point point) Used to check at which axis does the position collides with the world border.doubleGets the diameter of the world border.@NotNull InstanceGets theInstancelinked to this world border.intintvoidSends the world border init packet to a player.booleanUsed to know if a position is located inside the world border or not.booleanUsed to know if an entity is located inside the world border or not.voidsetCenter(float centerX, float centerZ) Changes the X and Z position of the center.voidsetCenterX(float centerX) Changes the center X of the world border.voidsetCenterZ(float centerZ) Changes the center Z of the world border.voidsetDiameter(double diameter) Changes the diameter of the world border.voidsetDiameter(double diameter, long speed) Changes the diameter todiameterinspeedmilliseconds (interpolation).voidsetWarningBlocks(int warningBlocks) voidsetWarningTime(int warningTime) protected voidupdate()Used to update in real-time the current diameter time.
-
Constructor Details
-
WorldBorder
-
-
Method Details
-
setCenter
public void setCenter(float centerX, float centerZ) Changes the X and Z position of the center.- Parameters:
centerX- the X centercenterZ- the Z center
-
getCenterX
public float getCenterX()Gets the center X of the world border.- Returns:
- the X center
-
setCenterX
public void setCenterX(float centerX) Changes the center X of the world border.- Parameters:
centerX- the new center X
-
getCenterZ
public float getCenterZ()Gets the center Z of the world border.- Returns:
- the Z center
-
setCenterZ
public void setCenterZ(float centerZ) Changes the center Z of the world border.- Parameters:
centerZ- the new center Z
-
getWarningTime
public int getWarningTime() -
setWarningTime
public void setWarningTime(int warningTime) - Parameters:
warningTime- In seconds as /worldborder warning time
-
getWarningBlocks
public int getWarningBlocks() -
setWarningBlocks
public void setWarningBlocks(int warningBlocks) - Parameters:
warningBlocks- In meters
-
setDiameter
public void setDiameter(double diameter, long speed) Changes the diameter todiameterinspeedmilliseconds (interpolation).- Parameters:
diameter- the diameter targetspeed- the time it will take to reachdiameterin milliseconds
-
getDiameter
public double getDiameter()Gets the diameter of the world border. It takes lerp in consideration.- Returns:
- the current world border diameter
-
setDiameter
public void setDiameter(double diameter) Changes the diameter of the world border.- Parameters:
diameter- the new diameter of the world border
-
getCollisionAxis
Used to check at which axis does the position collides with the world border.- Parameters:
point- the point to check- Returns:
- the axis where the position collides with the world border
-
isInside
Used to know if a position is located inside the world border or not.- Parameters:
point- the point to check- Returns:
- true if
positionis inside the world border, false otherwise
-
isInside
Used to know if an entity is located inside the world border or not.- Parameters:
entity- the entity to check- Returns:
- true if
entityis inside the world border, false otherwise
-
update
protected void update()Used to update in real-time the current diameter time. Called in the instance tick update. -
init
Sends the world border init packet to a player.- Parameters:
player- the player to send the packet to
-
getInstance
Gets theInstancelinked to this world border.- Returns:
- the
Instanceof this world border
-