Contents
- Description
- Field Summary
- Constructor Summary
- Method Summary
- Constructor Details
- Method Details
- clone()
- generation()
- isEnabled()
- isDisabled()
- isHome(Vector3i)
- isHome(Vector3d)
- isHome(int, int, int)
- isWilderness(Vector3i)
- isWilderness(Vector3d)
- isWilderness(int, int, int)
- isWildernessChunk(int, int, int)
- isWildernessChunk(Vector3i)
- collectHomeChunks(Vector3i, int, int, int, Collection)
- collectHomeChunks(Vector3d, int, int, int, Collection)
- collectWildernessChunks(Vector3i, int, int, int, Collection)
- collectWildernessChunks(Vector3d, int, int, int, Collection)
- collectHomeChunks(int, int, int, int, int, int, Collection)
- collectWildernessChunks(int, int, int, int, int, int, Collection)
- addHomeChunk(int, int, int, boolean)
- removeHomeChunk(int, int, int, boolean)
- getResourceType()
- getTracker(World)
Class WildernessTracker
java.lang.Object
com.hypixel.hytale.builtin.adventure.wilderness.resource.WildernessTracker
- All Implemented Interfaces:
Resource<ChunkStore>, Cloneable
Tracks wilderness and home chunk regions within a world.
Provides functionality to determine whether a position or chunk is in a "wilderness" region or a "home" region, as well as tools for managing and querying these regions. Gameplay systems can use this information to specify certain game events occur specifically in parts of the world that match either of these categories.
The current implementation defines a "home" chunk as one being within a given elliptic radius of a player bed, and "wilderness" chunks being those outside that radius. This may be expanded upon in the future to consider more factors when determining a home chunk vs wilderness chunk.
-
Field Summary
Fields inherited from interface Resource
EMPTY_ARRAY -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new WildernessTracker with default radius settings.WildernessTracker(WildernessTracker tracker) Copy constructor for WildernessTracker.WildernessTracker(WildernessConfig config) Constructs a new WildernessTracker with settings from the provided configuration. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddHomeChunk(int chunkX, int chunkY, int chunkZ, boolean owned) Marks a chunk (and its surrounding radius) as being near a "home".clone()Creates a clone of this tracker.voidcollectHomeChunks(int x, int y, int z, int radiusX, int radiusY, int radiusZ, Collection<org.joml.Vector3i> collector) Collects all chunks within the specified radius from world coordinates that are considered home.voidcollectHomeChunks(org.joml.Vector3d position, int radiusX, int radiusY, int radiusZ, Collection<org.joml.Vector3i> collector) Collects all chunks within the specified radius from a world position that are considered home chunks.voidcollectHomeChunks(org.joml.Vector3i position, int radiusX, int radiusY, int radiusZ, Collection<org.joml.Vector3i> collector) Collects all chunks within the specified radius from a position that are considered home chunks.voidcollectWildernessChunks(int x, int y, int z, int radiusX, int radiusY, int radiusZ, Collection<org.joml.Vector3i> collector) Collects all chunks within the specified radius from world coordinates that are considered wilderness.voidcollectWildernessChunks(org.joml.Vector3d position, int radiusX, int radiusY, int radiusZ, Collection<org.joml.Vector3i> collector) Collects all chunks within the specified radius from a world position that are considered wilderness.voidcollectWildernessChunks(org.joml.Vector3i position, int radiusX, int radiusY, int radiusZ, Collection<org.joml.Vector3i> collector) Collects all chunks within the specified radius from a position that are considered wilderness.longGet the generation count of the WildernessTracker.static ResourceType<ChunkStore, WildernessTracker> Gets the resource type for the wilderness tracker.static WildernessTrackergetTracker(World world) Retrieves theWildernessTrackerassociated with the givenWorld.booleanChecks if the wilderness tracking is disabled.booleanChecks if the wilderness tracking is enabled.booleanisHome(int x, int y, int z) Checks if the specified world coordinates are in a home chunk.booleanisHome(org.joml.Vector3d position) Checks if the specified world position is in a home chunk.booleanisHome(org.joml.Vector3i position) Checks if the specified chunk position is considered a home chunk.booleanisWilderness(int x, int y, int z) Checks if the specified world coordinates are in wilderness.booleanisWilderness(org.joml.Vector3d position) Checks if the specified world position is in wilderness.booleanisWilderness(org.joml.Vector3i position) Checks if the specified chunk position is considered wilderness.booleanisWildernessChunk(int chunkX, int chunkY, int chunkZ) booleanisWildernessChunk(org.joml.Vector3i coords) voidremoveHomeChunk(int chunkX, int chunkY, int chunkZ, boolean owned) Unmarks a chunk (and its surrounding radius) from being near a "home".
-
Constructor Details
-
WildernessTracker
public WildernessTracker()Constructs a new WildernessTracker with default radius settings. -
WildernessTracker
Constructs a new WildernessTracker with settings from the provided configuration.- Parameters:
config- the wilderness configuration.
-
WildernessTracker
Copy constructor for WildernessTracker.- Parameters:
tracker- the tracker to copy from.
-
-
Method Details
-
clone
Creates a clone of this tracker.- Specified by:
clonein interfaceResource<ChunkStore>- Returns:
- a new instance of WildernessTracker with the same state.
-
generation
public long generation()Get the generation count of the WildernessTracker. The generation count is incremented whenever the WildernessTracker is updated, so can be used by third-party systems to determine whether they to refresh their own state.- Returns:
- The current generation count of the WildernessTracker.
-
isEnabled
public boolean isEnabled()Checks if the wilderness tracking is enabled.- Returns:
- true if enabled, false otherwise.
-
isDisabled
public boolean isDisabled()Checks if the wilderness tracking is disabled.- Returns:
- true if disabled, false otherwise.
-
isHome
public boolean isHome(@Nonnull org.joml.Vector3i position) Checks if the specified chunk position is considered a home chunk.- Parameters:
position- the chunk position to check.- Returns:
- true if it is a home chunk, false if it is wilderness.
-
isHome
public boolean isHome(@Nonnull org.joml.Vector3d position) Checks if the specified world position is in a home chunk.- Parameters:
position- the world position to check.- Returns:
- true if it is in a home chunk, false if it is in wilderness.
-
isHome
public boolean isHome(int x, int y, int z) Checks if the specified world coordinates are in a home chunk.- Parameters:
x- world x-coordinate.y- world y-coordinate.z- world z-coordinate.- Returns:
- true if it is in a home chunk, false if it is in wilderness.
-
isWilderness
public boolean isWilderness(@Nonnull org.joml.Vector3i position) Checks if the specified chunk position is considered wilderness.- Parameters:
position- the chunk position to check.- Returns:
- true if it is wilderness, false if it is a home chunk.
-
isWilderness
public boolean isWilderness(@Nonnull org.joml.Vector3d position) Checks if the specified world position is in wilderness.- Parameters:
position- the world position to check.- Returns:
- true if it is wilderness, false if it is in a home chunk.
-
isWilderness
public boolean isWilderness(int x, int y, int z) Checks if the specified world coordinates are in wilderness.- Parameters:
x- world x-coordinate.y- world y-coordinate.z- world z-coordinate.- Returns:
- true if it is wilderness, false if it is in a home chunk.
-
isWildernessChunk
public boolean isWildernessChunk(int chunkX, int chunkY, int chunkZ) -
isWildernessChunk
public boolean isWildernessChunk(@Nonnull org.joml.Vector3i coords) -
collectHomeChunks
public void collectHomeChunks(@Nonnull org.joml.Vector3i position, int radiusX, int radiusY, int radiusZ, @Nonnull Collection<org.joml.Vector3i> collector) Collects all chunks within the specified radius from a position that are considered home chunks.- Parameters:
position- the center chunk position.radiusX- x-radius in blocks.radiusY- y-radius in blocks.radiusZ- z-radius in blocks.collector- the collection to add the home chunks to.
-
collectHomeChunks
public void collectHomeChunks(@Nonnull org.joml.Vector3d position, int radiusX, int radiusY, int radiusZ, @Nonnull Collection<org.joml.Vector3i> collector) Collects all chunks within the specified radius from a world position that are considered home chunks.- Parameters:
position- the center world position.radiusX- x-radius in blocks.radiusY- y-radius in blocks.radiusZ- z-radius in blocks.collector- the collection to add the home chunks to.
-
collectWildernessChunks
public void collectWildernessChunks(@Nonnull org.joml.Vector3i position, int radiusX, int radiusY, int radiusZ, @Nonnull Collection<org.joml.Vector3i> collector) Collects all chunks within the specified radius from a position that are considered wilderness.- Parameters:
position- the center chunk position.radiusX- x-radius in blocks.radiusY- y-radius in blocks.radiusZ- z-radius in blocks.collector- the collection to add the wilderness chunks to.
-
collectWildernessChunks
public void collectWildernessChunks(@Nonnull org.joml.Vector3d position, int radiusX, int radiusY, int radiusZ, @Nonnull Collection<org.joml.Vector3i> collector) Collects all chunks within the specified radius from a world position that are considered wilderness.- Parameters:
position- the center world position.radiusX- x-radius in blocks.radiusY- y-radius in blocks.radiusZ- z-radius in blocks.collector- the collection to add the wilderness chunks to.
-
collectHomeChunks
public void collectHomeChunks(int x, int y, int z, int radiusX, int radiusY, int radiusZ, @Nonnull Collection<org.joml.Vector3i> collector) Collects all chunks within the specified radius from world coordinates that are considered home.- Parameters:
x- world x-coordinate.y- world y-coordinate.z- world z-coordinate.radiusX- x-radius in blocks.radiusY- y-radius in blocks.radiusZ- z-radius in blocks.collector- the collection to add the home chunks to.
-
collectWildernessChunks
public void collectWildernessChunks(int x, int y, int z, int radiusX, int radiusY, int radiusZ, @Nonnull Collection<org.joml.Vector3i> collector) Collects all chunks within the specified radius from world coordinates that are considered wilderness.- Parameters:
x- world x-coordinate.y- world y-coordinate.z- world z-coordinate.radiusX- x-radius in blocks.radiusY- y-radius in blocks.radiusZ- z-radius in blocks.collector- the collection to add the wilderness chunks to.
-
addHomeChunk
public void addHomeChunk(int chunkX, int chunkY, int chunkZ, boolean owned) Marks a chunk (and its surrounding radius) as being near a "home".- Parameters:
chunkX- chunk x-coordinate.chunkY- chunk y-coordinate.chunkZ- chunk z-coordinate.
-
removeHomeChunk
public void removeHomeChunk(int chunkX, int chunkY, int chunkZ, boolean owned) Unmarks a chunk (and its surrounding radius) from being near a "home".- Parameters:
chunkX- chunk x-coordinate.chunkY- chunk y-coordinate.chunkZ- chunk z-coordinate.
-
getResourceType
Gets the resource type for the wilderness tracker.- Returns:
- the resource type.
-
getTracker
Retrieves theWildernessTrackerassociated with the givenWorld.- Parameters:
world- theWorldinstance for which theWildernessTrackeris to be retrieved. Must not be null.- Returns:
- the
WildernessTrackerassociated with the provided world. Never null.
-