Package net.minecraft.world.border
Class WorldBorder
java.lang.Object
net.minecraft.world.border.WorldBorder
public class WorldBorder extends Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static interfaceWorldBorder.Area(package private) classWorldBorder.MovingAreastatic classWorldBorder.Properties(package private) classWorldBorder.StaticArea -
Field Summary
Fields Modifier and Type Field Description private WorldBorder.Areaareaprivate doublecenterXprivate doublecenterZprivate doubledamagePerBlockstatic WorldBorder.PropertiesDEFAULT_BORDERprivate List<WorldBorderListener>listenersprivate intmaxRadiusprivate doublesafeZoneprivate intwarningBlocksprivate intwarningTime -
Constructor Summary
Constructors Constructor Description WorldBorder() -
Method Summary
Modifier and Type Method Description voidaddListener(WorldBorderListener listener)VoxelShapeasVoxelShape()booleancontains(BlockPos pos)booleancontains(Box box)booleancontains(ChunkPos pos)doublegetBoundEast()doublegetBoundNorth()doublegetBoundSouth()doublegetBoundWest()doublegetCenterX()doublegetCenterZ()doublegetDamagePerBlock()Returns the damage increase per block beyond this border, in hearts.doublegetDistanceInsideBorder(double x, double z)doublegetDistanceInsideBorder(Entity entity)protected List<WorldBorderListener>getListeners()intgetMaxRadius()Returns the maximum radius of this border, in blocks.doublegetSafeZone()Returns the safe zone of this border.doublegetShrinkingSpeed()doublegetSize()doublegetSizeLerpTarget()longgetSizeLerpTime()WorldBorderStagegetStage()intgetWarningBlocks()Returns the warning distance of this border, in blocks.intgetWarningTime()Returns the warning time of this border, in ticks.voidinterpolateSize(double fromSize, double toSize, long time)voidload(WorldBorder.Properties properties)voidsetCenter(double x, double z)Sets thexandzcoordinates of the center of this border, and notifies its area and all listeners.voidsetDamagePerBlock(double damagePerBlock)Sets the damage per block of this border and notifies all listeners.voidsetMaxRadius(int maxRadius)Sets the maximum radius of this border and notifies its area.voidsetSafeZone(double safeZone)Sets the safe zone of this border and notifies all listeners.voidsetSize(double size)Sets the area of this border to a static area with the givensize, and notifies all listeners.voidsetWarningBlocks(int warningBlocks)Sets the warning blocks of this border and notifies all listeners.voidsetWarningTime(int warningTime)Sets the warning time of this border and notifies all listeners.voidtick()WorldBorder.Propertieswrite()
-
Field Details
-
DEFAULT_BORDER
-
listeners
-
damagePerBlock
private double damagePerBlock -
safeZone
private double safeZone -
warningTime
private int warningTime -
warningBlocks
private int warningBlocks -
centerX
private double centerX -
centerZ
private double centerZ -
maxRadius
private int maxRadius -
area
-
-
Constructor Details
-
WorldBorder
public WorldBorder()
-
-
Method Details
-
contains
-
contains
-
contains
-
getDistanceInsideBorder
-
asVoxelShape
-
getDistanceInsideBorder
public double getDistanceInsideBorder(double x, double z) -
getStage
-
getBoundWest
public double getBoundWest() -
getBoundNorth
public double getBoundNorth() -
getBoundEast
public double getBoundEast() -
getBoundSouth
public double getBoundSouth() -
getCenterX
public double getCenterX() -
getCenterZ
public double getCenterZ() -
setCenter
public void setCenter(double x, double z)Sets thexandzcoordinates of the center of this border, and notifies its area and all listeners. -
getSize
public double getSize() -
getSizeLerpTime
public long getSizeLerpTime() -
getSizeLerpTarget
public double getSizeLerpTarget() -
setSize
public void setSize(double size)Sets the area of this border to a static area with the givensize, and notifies all listeners. -
interpolateSize
public void interpolateSize(double fromSize, double toSize, long time) -
getListeners
-
addListener
-
setMaxRadius
public void setMaxRadius(int maxRadius)Sets the maximum radius of this border and notifies its area. -
getMaxRadius
public int getMaxRadius()Returns the maximum radius of this border, in blocks.The default value is 29999984.
-
getSafeZone
public double getSafeZone()Returns the safe zone of this border.The default value is 5.0.
-
setSafeZone
public void setSafeZone(double safeZone)Sets the safe zone of this border and notifies all listeners. -
getDamagePerBlock
public double getDamagePerBlock()Returns the damage increase per block beyond this border, in hearts.Once an entity goes beyond the border and the safe zone, damage will be applied depending on the distance traveled multiplied by this damage increase.
The default value is 0.2.
- See Also:
LivingEntity.baseTick()
-
setDamagePerBlock
public void setDamagePerBlock(double damagePerBlock)Sets the damage per block of this border and notifies all listeners. -
getShrinkingSpeed
@Environment(CLIENT) public double getShrinkingSpeed() -
getWarningTime
public int getWarningTime()Returns the warning time of this border, in ticks.Once a player goes beyond the border, this is the time before a message is displayed to them.
The default value is 15.
-
setWarningTime
public void setWarningTime(int warningTime)Sets the warning time of this border and notifies all listeners. -
getWarningBlocks
public int getWarningBlocks()Returns the warning distance of this border, in blocks.When an entity approaches the border, this is the distance from which a warning will be displayed.
The default value is 5.
-
setWarningBlocks
public void setWarningBlocks(int warningBlocks)Sets the warning blocks of this border and notifies all listeners. -
tick
public void tick() -
write
-
load
-