Contents
- Description
- Field Summary
- Constructor Summary
- Method Summary
- Field Details
- Constructor Details
- Method Details
- getComponentType()
- getCachedMarker()
- setCachedMarker(SpawnMarker)
- getSpawnCount()
- setSpawnCount(int)
- setRespawnCounter(double)
- setSpawnAfter(Instant)
- getSpawnAfter()
- setGameTimeRespawn(Duration)
- pollGameTimeRespawn()
- tickRespawnTimer(float)
- getSuppressedBy()
- setStoredFlock(StoredFlock)
- getStoredFlock()
- getTimeToDeactivation()
- setTimeToDeactivation(double)
- tickTimeToDeactivation(float)
- tickSpawnLostTimeout(float)
- getSpawnPosition()
- getNpcReferences()
- setNpcReferences(InvalidatablePersistentRef[])
- completeSpawnedNpcRemoval(Instant)
- getTempStorageList()
- setTempStorageList(List)
- isDespawnStarted()
- setDespawnStarted(boolean)
- refreshTimeout()
- spawnNPC(Ref, SpawnMarker, List, Store)
- validate(Ref, Store, TransformComponent, SpawnMarkerValidation)
- setSpawnMarker(SpawnMarker)
- decrementAndGetSpawnCount()
- getSpawnMarkerId()
- isManualTrigger()
- trigger(Ref, List, Store)
- isSuppressedBy(SpawnSuppression)
- suppress(UUID)
- releaseSuppression(UUID)
- clearAllSuppressions()
- clone()
- cloneSerializable()
- toString()
- getModel(SpawnMarker)
Class SpawnMarkerEntity
java.lang.Object
com.hypixel.hytale.server.spawning.spawnmarkers.SpawnMarkerEntity
- All Implemented Interfaces:
Component<EntityStore>, Cloneable
A component that represents a spawn marker entity in the world.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BuilderCodec<SpawnMarkerEntity> The codec used to parseSpawnMarkerEntityinstances.static final ArrayCodec<InvalidatablePersistentRef> An array codec used to parse and serialize arrays ofInvalidatablePersistentRefinstances.Fields inherited from interface Component
EMPTY_ARRAY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled to clear all suppressions of this spawn marker.clone()voidcompleteSpawnedNpcRemoval(Instant gameTime) intCalled to decrement the spawn count and get the new value.static ComponentType<EntityStore, SpawnMarkerEntity> static ModelgetModel(SpawnMarker marker) Called to fetch the model for a given spawn marker.intorg.joml.Vector3dList<it.unimi.dsi.fastutil.Pair<Ref<EntityStore>, NPCEntity>> doublebooleanbooleanbooleanisSuppressedBy(SpawnSuppression suppression) Whether the given suppression applies to this marker.voidCalled to refresh the spawn lost timeout counter.voidreleaseSuppression(UUID suppressor) Called to release suppression of this spawn marker.voidsetCachedMarker(SpawnMarker marker) Called to set the cached spawn marker asset.voidsetDespawnStarted(boolean despawnStarted) Called to set whether the despawn process has started for this spawn marker.voidsetGameTimeRespawn(Duration gameTimeRespawn) Called to set the game time duration until respawn.voidsetNpcReferences(InvalidatablePersistentRef[] npcReferences) Called to set the array of references to the NPCs spawned by this marker.voidsetRespawnCounter(double respawnCounter) Called to get the current respawn counter.voidsetSpawnAfter(Instant spawnAfter) Called to set the instant after which the NPC can be respawned.voidsetSpawnCount(int spawnCount) Called to set the current spawn count.voidsetSpawnMarker(SpawnMarker marker) Called to set the spawn marker for this entity.voidsetStoredFlock(StoredFlock storedFlock) Called to set the stored flock information for this spawn marker.voidsetTempStorageList(List<it.unimi.dsi.fastutil.Pair<Ref<EntityStore>, NPCEntity>> tempStorageList) Called to set the temporary storage list for flock members during despawn/spawn operations.voidsetTimeToDeactivation(double timeToDeactivation) Called to set the time, in seconds, until this spawn marker is deactivated.booleanspawnNPC(Ref<EntityStore> ref, SpawnMarker marker, List<Ref<EntityStore>> outSpawnedList, Store<EntityStore> store) Called to spawn an NPC at this spawn marker.voidCalled to suppress this spawn marker.booleantickRespawnTimer(float dt) Called to tick the respawn timer.booleantickSpawnLostTimeout(float dt) Called to tick the spawn lost timeout counter.booleantickTimeToDeactivation(float dt) Called to tick the time to deactivation.toString()booleantrigger(Ref<EntityStore> markerRef, List<Ref<EntityStore>> outSpawnedList, Store<EntityStore> store) Manually trigger this spawn marker (only valid for spawn markers that have been explicitly set as manually triggered.)voidvalidate(Ref<EntityStore> ref, Store<EntityStore> store, TransformComponent transform, SpawnMarkerValidation validation) Validates the spawn marker's current position and stores the result.
-
Field Details
-
NPC_REFERENCES_CODEC
An array codec used to parse and serialize arrays ofInvalidatablePersistentRefinstances. -
CODEC
The codec used to parseSpawnMarkerEntityinstances.
-
-
Constructor Details
-
SpawnMarkerEntity
public SpawnMarkerEntity()Default Constructor for aSpawnMarkerEntityinstance.
-
-
Method Details
-
getComponentType
- Returns:
- the component type for the
SpawnMarkerEntitycomponent.
-
getCachedMarker
- Returns:
- the cached spawn marker asset.
-
setCachedMarker
Called to set the cached spawn marker asset.- Parameters:
marker- The spawn marker asset to cache.
-
getSpawnCount
public int getSpawnCount()- Returns:
- the current spawn count.
-
setSpawnCount
public void setSpawnCount(int spawnCount) Called to set the current spawn count.- Parameters:
spawnCount- The spawn count to set.
-
setRespawnCounter
public void setRespawnCounter(double respawnCounter) Called to get the current respawn counter.- Parameters:
respawnCounter- The respawn counter to set.
-
setSpawnAfter
Called to set the instant after which the NPC can be respawned.- Parameters:
spawnAfter- The instant to set.
-
getSpawnAfter
- Returns:
- the instant after which the NPC can be respawned.
-
setGameTimeRespawn
Called to set the game time duration until respawn.- Parameters:
gameTimeRespawn- The game time duration to set.
-
pollGameTimeRespawn
- Returns:
- the game time duration until respawn, null if not set. This also clears the stored value.
-
tickRespawnTimer
public boolean tickRespawnTimer(float dt) Called to tick the respawn timer.- Parameters:
dt- The delta time to tick.- Returns:
trueif the respawn timer has reached zero,falseotherwise.
-
getSuppressedBy
-
setStoredFlock
Called to set the stored flock information for this spawn marker.- Parameters:
storedFlock- The stored flock information to set.
-
getStoredFlock
- Returns:
- the stored flock information for this spawn marker.
-
getTimeToDeactivation
public double getTimeToDeactivation()- Returns:
- the time, in seconds, until this spawn marker is deactivated.
-
setTimeToDeactivation
public void setTimeToDeactivation(double timeToDeactivation) Called to set the time, in seconds, until this spawn marker is deactivated.- Parameters:
timeToDeactivation- The time to deactivation to set.
-
tickTimeToDeactivation
public boolean tickTimeToDeactivation(float dt) Called to tick the time to deactivation.- Parameters:
dt- The delta time to tick.- Returns:
trueif the time to deactivation has reached zero,falseotherwise.
-
tickSpawnLostTimeout
public boolean tickSpawnLostTimeout(float dt) Called to tick the spawn lost timeout counter.- Parameters:
dt- The delta time to tick.- Returns:
trueif the spawn lost timeout has reached zero,falseotherwise.
-
getSpawnPosition
@Nonnull public org.joml.Vector3d getSpawnPosition()- Returns:
- the last known spawn position of the NPCs spawned by this marker.
-
getNpcReferences
- Returns:
- the array of references to the NPCs spawned by this marker.
-
setNpcReferences
Called to set the array of references to the NPCs spawned by this marker.- Parameters:
npcReferences- The array of NPC references to set.
-
completeSpawnedNpcRemoval
-
getTempStorageList
- Returns:
- the temporary storage list for flock members during despawn/spawn operations.
-
setTempStorageList
public void setTempStorageList(@Nonnull List<it.unimi.dsi.fastutil.Pair<Ref<EntityStore>, NPCEntity>> tempStorageList) Called to set the temporary storage list for flock members during despawn/spawn operations.- Parameters:
tempStorageList- The temporary storage list to set.
-
isDespawnStarted
public boolean isDespawnStarted()- Returns:
trueif the despawn process has started for this spawn marker,falseotherwise.
-
setDespawnStarted
public void setDespawnStarted(boolean despawnStarted) Called to set whether the despawn process has started for this spawn marker.- Parameters:
despawnStarted- The despawn started flag to set.
-
refreshTimeout
public void refreshTimeout()Called to refresh the spawn lost timeout counter. -
spawnNPC
public boolean spawnNPC(@Nonnull Ref<EntityStore> ref, @Nonnull SpawnMarker marker, @Nullable List<Ref<EntityStore>> outSpawnedList, @Nonnull Store<EntityStore> store) Called to spawn an NPC at this spawn marker.- Parameters:
ref- The entity reference of the spawn marker entity.marker- The associatedSpawnMarkerasset.outSpawnedList- An optional list to collect spawned entity references.store- TheStore<EntityStore>for component access.- Returns:
trueif the NPC was successfully spawned or a noop spawn was performed,falseif the spawn failed.
-
validate
public void validate(@Nonnull Ref<EntityStore> ref, @Nonnull Store<EntityStore> store, @Nonnull TransformComponent transform, @Nonnull SpawnMarkerValidation validation) Validates the spawn marker's current position and stores the result.- Parameters:
ref- The spawn marker entity reference.store- The store that contains the spawn marker.transform- The current spawn marker transform.validation- The component that receives the validation result.
-
setSpawnMarker
Called to set the spawn marker for this entity.- Parameters:
marker- The spawn marker to set.
-
decrementAndGetSpawnCount
public int decrementAndGetSpawnCount()Called to decrement the spawn count and get the new value.- Returns:
- the new spawn count after decrementing.
-
getSpawnMarkerId
- Returns:
- the ID of the associated spawn marker asset.
-
isManualTrigger
public boolean isManualTrigger()- Returns:
trueif this spawn marker is manually triggered,falseotherwise.
-
trigger
public boolean trigger(@Nonnull Ref<EntityStore> markerRef, @Nullable List<Ref<EntityStore>> outSpawnedList, @Nonnull Store<EntityStore> store) Manually trigger this spawn marker (only valid for spawn markers that have been explicitly set as manually triggered.) Allows passing an optional list to collect spawned references.Returns true if the NPC was successfully spawned (or if a noop spawn was performed as this is still part of the config) Returns false if the spawn fails for any reason that cannot be affected by the marker. This includes:
- No room to spawn the NPC
- Role of spawned NPC being invalid
- Player being within the exclusion radius
- Being offset too far from the ground
- An NPC has already been spawned and is still alive
- Returns:
- true if the trigger was run successfully, false if not
-
isSuppressedBy
Whether the given suppression applies to this marker.A suppressor that lists no
SuppressedGroupsblanket-suppresses every marker in range (legacy behaviour). A suppressor that does list groups only suppresses markers whose payload - the NPC role(s) this marker would spawn - belongs to one of those groups, mirroring howSuppressedGroupsalready gates ambient world-spawns. This lets a marker that spawns an out-of-group NPC (e.g. a player-built companion spawner) keep working inside a camp that only suppresses hostiles/neutrals. -
suppress
Called to suppress this spawn marker.- Parameters:
suppressor- The UUID of the entity suppressing this spawn marker.
-
releaseSuppression
Called to release suppression of this spawn marker.- Parameters:
suppressor- The UUID of the entity releasing suppression of this spawn marker.
-
clearAllSuppressions
public void clearAllSuppressions()Called to clear all suppressions of this spawn marker. -
clone
- Specified by:
clonein interfaceComponent<EntityStore>- Returns:
- a clone instance of the original component instance.
-
cloneSerializable
- Specified by:
cloneSerializablein interfaceComponent<EntityStore>- Returns:
- a clone instance of the original component instance.
-
toString
-
getModel
Called to fetch the model for a given spawn marker.- Parameters:
marker- The spawn marker to fetch the model for.- Returns:
- the model for the given spawn marker.
-