Contents
Interface ISpawnProvider
- All Known Implementing Classes:
FitToHeightMapSpawnProvider, GlobalSpawnProvider, IndividualSpawnProvider
public interface ISpawnProvider
An interface for providing spawn points within a world.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BuilderCodecMapCodec<ISpawnProvider> The codec used to parseISpawnProviderimplementations. -
Method Summary
Modifier and TypeMethodDescriptiondefault CompletableFuture<Transform> getSpawnPointAsync(Ref<EntityStore> ref, ComponentAccessor<EntityStore> componentAccessor) Resolves the spawn point for the given entity reference, loading any chunk data the provider needs.getSpawnPointAsync(World world, UUID uuid) Resolves the spawn point for the given world and UUID, loading any chunk data the provider needs.Deprecated.This is limiting for spawn providers that may be able to generate new spawn points dynamicallybooleanisWithinSpawnDistance(org.joml.Vector3d position, double distance) Determines whether the given position is within the specified distance from the spawn point.
-
Field Details
-
CODEC
The codec used to parseISpawnProviderimplementations.
-
-
Method Details
-
getSpawnPointAsync
@Nonnull default CompletableFuture<Transform> getSpawnPointAsync(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor) Resolves the spawn point for the given entity reference, loading any chunk data the provider needs.- Parameters:
ref- The entity reference of the entity to fetch a spawn point for.componentAccessor- TheComponentAccessorto use for fetching components.- Returns:
- a future completing with the spawn point
Transform.
-
getSpawnPointAsync
Resolves the spawn point for the given world and UUID, loading any chunk data the provider needs.- Parameters:
world- The world to fetch the spawn point from.uuid- The UUID of the entity to fetch the spawn point for.- Returns:
- a future completing with the spawn point
Transform.
-
getSpawnPoints
Deprecated.This is limiting for spawn providers that may be able to generate new spawn points dynamically -
isWithinSpawnDistance
boolean isWithinSpawnDistance(@Nonnull org.joml.Vector3d position, double distance) Determines whether the given position is within the specified distance from the spawn point.- Parameters:
position- The position to check.distance- The distance from the spawn point.- Returns:
trueif the position is within the specified distance from the spawn point,falseotherwise.
-