Class Wilderness

java.lang.Object
com.hypixel.hytale.builtin.adventure.wilderness.component.Wilderness
All Implemented Interfaces:
Component<EntityStore>, Cloneable

public class Wilderness extends Object implements Component<EntityStore>
Tracks which chunks around a given entity are wilderness or not.
  • Constructor Details

    • Wilderness

      public Wilderness()
    • Wilderness

      public Wilderness(int horizontalRadius, int verticalRadius)
    • Wilderness

      public Wilderness(@Nonnull Wilderness other)
  • Method Details

    • getX

      public int getX()
      Returns:
      the world x-coordinate tracked by the component.
    • getY

      public int getY()
      Returns:
      the world y-coordinate tracked by the component.
    • getZ

      public int getZ()
      Returns:
      the world z-coordinate tracked by the component.
    • getChunkX

      public int getChunkX()
      Returns:
      the center chunk x-coordinate tracked by the component.
    • getChunkY

      public int getChunkY()
      Returns:
      the center chunk y-coordinate tracked by the component.
    • getChunkZ

      public int getChunkZ()
      Returns:
      the center chunk z-coordinate tracked by the component.
    • size

      public int size()
      Returns:
      the size of the tracked region in chunks.
    • isValid

      public boolean isValid()
      Returns:
      whether the tracker is positioned at valid coordinates or not.
    • begin

      public int begin()
      Find the first wilderness chunk index in the component. This can be used in conjunction with next(int) to iterate all wilderness chunk indices held by the component.

      Wilderness chunk indices can be converted into chunk coordinates via the corresponding methods xFromIndex(int), yFromIndex(int), and zFromIndex(int).

      Returns:
      The first wilderness chunk index or -1 with there are none.
    • next

      public int next(int index)
      Find the next wilderness chunk index in the component from the given index. This can be used in conjunction with begin() to iterate all wilderness chunk indices held by the component.

      Wilderness chunk indices can be converted into chunk coordinates via the corresponding methods xFromIndex(int), yFromIndex(int), and zFromIndex(int).

      Parameters:
      index - The wilderness chunk index to find the next index from.
      Returns:
      The next wilderness chunk index or -1 if there are none.
    • empty

      public boolean empty()
      Indicates whether there are any wilderness chunks within range of the entity or not.
      Returns:
      true if there are no wilderness chunks within range.
    • xFromIndex

      public int xFromIndex(int index)
      Convert the given wilderness index into a chunk x-coordinate.
      Parameters:
      index - The wilderness index to convert.
      Returns:
      The chunk x-coordinate.
    • yFromIndex

      public int yFromIndex(int index)
      Convert the given wilderness index into a chunk y-coordinate.
      Parameters:
      index - The wilderness index to convert.
      Returns:
      The chunk y-coordinate.
    • zFromIndex

      public int zFromIndex(int index)
      Convert the given wilderness index into a chunk z-coordinate.
      Parameters:
      index - The wilderness index to convert.
      Returns:
      The chunk z-coordinate.
    • test

      public boolean test(int x, int y, int z)
      Test whether the given world-coords are wilderness or not.
      Parameters:
      x - The world x-coordinate to test.
      y - The world y-coordinate to test.
      z - The world z-coordinate to test.
      Returns:
      true if the chunk at the given coordinate is within range of the tracker and is wilderness.
    • test

      public boolean test(int index)
      Test whether the chunk at the given index is wilderness or not.
      Parameters:
      index - The index to test.
      Returns:
      true if the chunk at the given index is within range of the tracker and is wilderness.
    • move

      public void move(int x, int y, int z, @Nonnull WildernessTracker tracker)
      Move the wilderness tracker to the given world-coords.
      Parameters:
      x - The world x-coordinate to move the tracker to.
      y - The world y-coordinate to move the tracker to.
      z - The world z-coordinate to move the tracker to.
      tracker - The WildernessTracker for the world the entity is moving in.
    • clone

      @Nullable public Wilderness clone()
      Specified by:
      clone in interface Component<EntityStore>
      Returns:
      a clone instance of the original component instance.

    • getComponentType

      public static ComponentType<EntityStore, Wilderness> getComponentType()
      Retrieves the ComponentType for the Wilderness component.
      Returns:
      the ComponentType for the Wilderness component.