Contents
Class Wilderness
java.lang.Object
com.hypixel.hytale.builtin.adventure.wilderness.component.Wilderness
- All Implemented Interfaces:
Component<EntityStore>, Cloneable
Tracks which chunks around a given entity are wilderness or not.
-
Field Summary
Fields inherited from interface Component
EMPTY_ARRAY -
Constructor Summary
ConstructorsConstructorDescriptionWilderness(int horizontalRadius, int verticalRadius) Wilderness(Wilderness other) -
Method Summary
Modifier and TypeMethodDescriptionintbegin()Find the first wilderness chunk index in the component.clone()booleanempty()Indicates whether there are any wilderness chunks within range of the entity or not.intintintstatic ComponentType<EntityStore, Wilderness> Retrieves theComponentTypefor the Wilderness component.intgetX()intgetY()intgetZ()booleanisValid()voidmove(int x, int y, int z, WildernessTracker tracker) Move the wilderness tracker to the given world-coords.intnext(int index) Find the next wilderness chunk index in the component from the given index.intsize()booleantest(int index) Test whether the chunk at the given index is wilderness or not.booleantest(int x, int y, int z) Test whether the given world-coords are wilderness or not.intxFromIndex(int index) Convert the given wilderness index into a chunk x-coordinate.intyFromIndex(int index) Convert the given wilderness index into a chunk y-coordinate.intzFromIndex(int index) Convert the given wilderness index into a chunk z-coordinate.Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Component
cloneSerializable
-
Constructor Details
-
Wilderness
public Wilderness() -
Wilderness
public Wilderness(int horizontalRadius, int verticalRadius) -
Wilderness
-
-
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 withnext(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), andzFromIndex(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 withbegin()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), andzFromIndex(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
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- TheWildernessTrackerfor the world the entity is moving in.
-
clone
- Specified by:
clonein interfaceComponent<EntityStore>- Returns:
- a clone instance of the original component instance.
-
getComponentType
Retrieves theComponentTypefor the Wilderness component.- Returns:
- the ComponentType for the Wilderness component.
-