Contents
Class PrefabSpawner
java.lang.Object
com.hypixel.hytale.builtin.adventure.worldevents.condition.spawner.PrefabSpawner
- All Implemented Interfaces:
Spawner
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface Spawner
Spawner.Result -
Field Summary
FieldsFields inherited from interface Spawner
EMPTY_ARRAY, INVALID_HEIGHT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanonComplete(org.joml.Vector3ic position, WorldEvent event) Called once when the owning stage completes, with the position that last returnedtruefromSpawner.test(World, Vector3ic, Random).Tests whetherpositionis a valid placement site and records any state needed bySpawner.onComplete(Vector3ic, WorldEvent).
-
Field Details
-
ID
- See Also:
-
-
Constructor Details
-
PrefabSpawner
-
-
Method Details
-
test
public Spawner.Result test(@Nonnull World world, @Nonnull org.joml.Vector3ic position, @Nonnull Random random) Description copied from interface:SpawnerTests whetherpositionis a valid placement site and records any state needed bySpawner.onComplete(Vector3ic, WorldEvent).This may be called up to several times per tick with different positions, so keep it cheap. If the test involves selecting from a random set (e.g. choosing a prefab), store the selection as a field rather than regenerating it in
Spawner.onComplete(Vector3ic, WorldEvent).Check terrain validity using the static helpers on this interface. Reject the position (return
false) if any required chunk is unloaded, i.e. ifSpawner.findSurface(int, int, int, int, int, ChunkStore)returnsSpawner.INVALID_HEIGHT. -
onComplete
Description copied from interface:SpawnerCalled once when the owning stage completes, with the position that last returnedtruefromSpawner.test(World, Vector3ic, Random). Write any context values that downstream actions will need into the event context here.- Specified by:
onCompletein interfaceSpawner- Parameters:
position- the accepted block positionevent- the running world event whose context should be populated- Returns:
falseif the spawner cannot produce a valid result, treating the stage as failed
-