Class WorldBorder

java.lang.Object
net.minecraft.world.border.WorldBorder

public class WorldBorder
extends Object
  • Field Details

    • DEFAULT_BORDER

      public static final WorldBorder.Properties DEFAULT_BORDER
    • listeners

      private final List<WorldBorderListener> 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

      private WorldBorder.Area area
  • Constructor Details

    • WorldBorder

      public WorldBorder()
  • Method Details

    • contains

      public boolean contains​(BlockPos pos)
    • contains

      public boolean contains​(ChunkPos pos)
    • contains

      public boolean contains​(Box box)
    • getDistanceInsideBorder

      public double getDistanceInsideBorder​(Entity entity)
    • asVoxelShape

      public VoxelShape asVoxelShape()
    • getDistanceInsideBorder

      public double getDistanceInsideBorder​(double x, double z)
    • getStage

      @Environment(CLIENT) public WorldBorderStage 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 the x and z coordinates 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 given size, and notifies all listeners.
    • interpolateSize

      public void interpolateSize​(double fromSize, double toSize, long time)
    • getListeners

      protected List<WorldBorderListener> getListeners()
    • addListener

      public void addListener​(WorldBorderListener listener)
    • 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

      public WorldBorder.Properties write()
    • load

      public void load​(WorldBorder.Properties properties)