Contents
- Description
- Nested Class Summary
- Field Summary
- Constructor Summary
- Method Summary
- Field Details
- Constructor Details
- Method Details
- get()
- getBlackboardResourceType()
- getBlackboardSubscriptionComponentType()
- getCombatDataPoolResourceType()
- getRoleChangeQueueResourceType()
- getNewSpawnStartTickingQueueResourceType()
- getSortBufferProviderResourceResourceType()
- getAStarNodePoolProviderSimpleResourceType()
- getNpcSpatialResource()
- registerBeaconReceiverProvider(BeaconReceiverProvider)
- getBeaconReceiverProviders()
- getSpawnNPCInteractionFailureTrackerResourceType()
- getCombatDataComponentType()
- getNpcTestDataComponentType()
- getBeaconSupportComponentType()
- getNpcBlockEventSupportComponentType()
- getPlayerBlockEventSupportComponentType()
- getNpcEntityEventSupportComponentType()
- getPlayerEntityEventSupportComponentType()
- getCombatSupportComponentType()
- getStateSupportComponentType()
- getMarkedEntitySupportComponentType()
- getWorldSupportComponentType()
- getEntitySupportComponentType()
- getMotionContextSupportComponentType()
- getDisplayNameSupportComponentType()
- getPlayerTaskSupportComponentType()
- getPositionCacheComponentType()
- getDebugSupportComponentType()
- getAlarmStoreComponentType()
- getSpawnLineageComponentType()
- getFlagsComponentType()
- getStepComponentType()
- getFailedSpawnComponentType()
- getTimersComponentType()
- getStateEvaluatorComponentType()
- getValueStoreComponentType()
- setupNPCLoading()
- getPresetCoverageTestNPCs()
- spawnNPC(Store, String, String, Vector3dc, Rotation3fc)
- spawnNPCWithSpaceValidation(Store, String, String, Vector3dc, Rotation3fc)
- spawnNPCWithSpaceValidation(Store, String, String, Vector3dc, Rotation3fc, TriConsumer)
- spawnNPCWithSpaceValidation(Store, String, String, Vector3dc, Rotation3fc, TriConsumer, boolean, boolean)
- spawnNPCWithColumnProbe(Store, String, String, World, int, int, double, Rotation3fc)
- spawnNPCWithColumnProbe(Store, String, String, World, int, int, double, Rotation3fc, TriConsumer)
- reloadNPCsWithRole(int)
- getPathChangeRevision()
- getName(int)
- getIndex(String)
- tryGetCachedValidRole(int)
- getBuilderInfo(Builder)
- getRoleTemplateNames(boolean)
- hasRoleName(String)
- validateSpawnableRole(String)
- getRoleBuilderInfo(int)
- setBuilderInvalid(int)
- getAttitudeMap()
- getItemAttitudeMap()
- testAndValidateRole(BuilderInfo)
- forceValidation(int)
- spawnEntity(Store, int, Vector3dc, Rotation3fc, Model, TriConsumer)
- spawnEntity(Store, int, Vector3dc, Rotation3fc, Model, TriConsumer, TriConsumer)
- prepareRoleBuilderInfo(int)
- buildRole(Holder, Builder, BuilderInfo, BuilderSupport, int)
- generateDescriptors()
- saveDescriptors()
- getBuilderManager()
- getMaxBlackboardBlockCountPerType()
- isLogFailingTestErrors()
- startRoleBenchmark(double, Consumer)
- collectRoleTick(int, long)
- isBenchmarkingRole()
- startSensorSupportBenchmark(double, Consumer)
- isBenchmarkingSensorSupport()
- collectSensorSupportPlayerList(int, long, double, double, double, int)
- collectSensorSupportEntityList(int, long, double, double, double, int)
- collectSensorSupportLosTest(int, boolean, long)
- collectSensorSupportInverseLosTest(int, boolean)
- collectSensorSupportFriendlyBlockingTest(int, boolean)
- collectSensorSupportTickDone(int)
- registerCoreComponentType(String, Supplier)
- setRoleBuilderNeedsReload(Builder)
Class NPCPlugin
java.lang.Object
com.hypixel.hytale.server.core.plugin.PluginBase
com.hypixel.hytale.server.core.plugin.JavaPlugin
com.hypixel.hytale.server.npc.NPCPlugin
- All Implemented Interfaces:
CommandOwner
- Since:
- 15/3/18
- Version:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final EnumCodec<MovementMode> static final SetCodec<MovementMode, EnumSet<MovementMode>> static final shortstatic final shortstatic final StringFields inherited from class PluginBase
METRICS_REGISTRY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic RolebuildRole(Holder<EntityStore> holder, Builder<Role> roleBuilder, BuilderInfo builderInfo, BuilderSupport builderSupport, int roleIndex) voidcollectRoleTick(int roleIndex, long nanos) voidcollectSensorSupportEntityList(int roleIndex, long getNanos, double maxEntityDistanceSorted, double maxEntityDistance, double maxEntityDistanceAvoidance, int numEntities) voidcollectSensorSupportFriendlyBlockingTest(int roleIndex, boolean cacheHit) voidcollectSensorSupportInverseLosTest(int roleIndex, boolean cacheHit) voidcollectSensorSupportLosTest(int roleIndex, boolean cacheHit, long time) voidcollectSensorSupportPlayerList(int roleIndex, long getNanos, double maxPlayerDistanceSorted, double maxPlayerDistance, double maxPlayerDistanceAvoidance, int numPlayers) voidcollectSensorSupportTickDone(int roleIndex) voidforceValidation(int builderIndex) voidstatic NPCPluginget()getBuilderInfo(Builder<?> builder) intintgetName(int builderIndex) intString[]getRoleBuilderInfo(int roleIndex) getRoleTemplateNames(boolean spawnableOnly) booleanhasRoleName(String roleName) booleanbooleanbooleanprepareRoleBuilderInfo(int roleIndex) voidRegisters a provider of additional, non-NPC beacon receivers.<T> NPCPluginregisterCoreComponentType(String name, Supplier<Builder<T>> builder) static voidreloadNPCsWithRole(int roleIndex) voidvoidsetBuilderInvalid(int builderIndex) voidsetRoleBuilderNeedsReload(Builder<?> builder) voidit.unimi.dsi.fastutil.Pair<Ref<EntityStore>, NPCEntity> spawnEntity(Store<EntityStore> store, int roleIndex, org.joml.Vector3dc position, Rotation3fc rotation, Model spawnModel, TriConsumer<NPCEntity, Holder<EntityStore>, Store<EntityStore>> preAddToWorld, TriConsumer<NPCEntity, Ref<EntityStore>, Store<EntityStore>> postSpawn) Called to spawn and return an NPC entity in the given world.it.unimi.dsi.fastutil.Pair<Ref<EntityStore>, NPCEntity> spawnEntity(Store<EntityStore> store, int roleIndex, org.joml.Vector3dc position, Rotation3fc rotation, Model spawnModel, TriConsumer<NPCEntity, Ref<EntityStore>, Store<EntityStore>> postSpawn) Called to spawn and return an NPC entity in the given world.it.unimi.dsi.fastutil.Pair<Ref<EntityStore>, INonPlayerCharacter> spawnNPC(Store<EntityStore> store, String npcType, String groupType, org.joml.Vector3dc position, Rotation3fc rotation) Called to spawn and returns an NPC in the given world.spawnNPCWithColumnProbe(Store<EntityStore> store, String npcType, String groupType, World world, int worldBlockX, int worldBlockZ, double yHint, Rotation3fc rotation) Spawns an NPC using column probing (SpawningContext.set(World, double, double, double)thenSpawningContext.canSpawn()), for cases where an exact pose is blocked but a nearby column may fit (including ground placement for walkers).spawnNPCWithColumnProbe(Store<EntityStore> store, String npcType, String groupType, World world, int worldBlockX, int worldBlockZ, double yHint, Rotation3fc rotation, TriConsumer<NPCEntity, Ref<EntityStore>, Store<EntityStore>> postSpawn) Spawns an NPC using column probing, with an optional post-spawn callback.spawnNPCWithSpaceValidation(Store<EntityStore> store, String npcType, String groupType, org.joml.Vector3dc position, Rotation3fc rotation) Called to spawn and return an NPC entity in the given world if the NPC can fit at the supplied exact position.spawnNPCWithSpaceValidation(Store<EntityStore> store, String npcType, String groupType, org.joml.Vector3dc position, Rotation3fc rotation, TriConsumer<NPCEntity, Ref<EntityStore>, Store<EntityStore>> postSpawn) Called to spawn and return an NPC entity in the given world if the NPC can fit at the supplied exact position, with an optional post-spawn callback.spawnNPCWithSpaceValidation(Store<EntityStore> store, String npcType, String groupType, org.joml.Vector3dc position, Rotation3fc rotation, TriConsumer<NPCEntity, Ref<EntityStore>, Store<EntityStore>> postSpawn, boolean cubeBlockersOnly, boolean centerHitbox) booleanstartRoleBenchmark(double seconds, Consumer<it.unimi.dsi.fastutil.ints.Int2ObjectMap<TimeDistributionRecorder>> onFinished) booleanstartSensorSupportBenchmark(double seconds, Consumer<it.unimi.dsi.fastutil.ints.Int2ObjectMap<SensorSupportBenchmark>> onFinished) booleantestAndValidateRole(BuilderInfo builderInfo) tryGetCachedValidRole(int roleIndex) voidvalidateSpawnableRole(String roleName) Methods inherited from class JavaPlugin
getClassLoader, getFile, getTypeMethods inherited from class PluginBase
getAssetRegistry, getBasePermission, getChunkStoreRegistry, getClientFeatureRegistry, getCodecRegistry, getCodecRegistry, getCodecRegistry, getCommandRegistry, getDataDirectory, getEntityRegistry, getEntityStoreRegistry, getEventRegistry, getIdentifier, getLogger, getManifest, getName, getState, getTaskRegistry, isDisabled, isEnabled, preLoad
-
Field Details
-
FACTORY_CLASS_ROLE
- See Also:
-
FACTORY_CLASS_BODY_MOTION
- See Also:
-
FACTORY_CLASS_HEAD_MOTION
- See Also:
-
FACTORY_CLASS_ACTION
- See Also:
-
FACTORY_CLASS_SENSOR
- See Also:
-
FACTORY_CLASS_INSTRUCTION
- See Also:
-
FACTORY_CLASS_TRANSIENT_PATH
- See Also:
-
FACTORY_CLASS_ACTION_LIST
- See Also:
-
ROLE_ASSETS_PATH
- See Also:
-
MOVEMENT_MODE_CODEC
-
MOVEMENT_MODE_SET_CODEC
-
PRIORITY_LOAD_NPC
public static final short PRIORITY_LOAD_NPC- See Also:
-
PRIORITY_SPAWN_VALIDATION
public static final short PRIORITY_SPAWN_VALIDATION- See Also:
-
-
Constructor Details
-
NPCPlugin
-
-
Method Details
-
get
-
getBlackboardResourceType
-
getBlackboardSubscriptionComponentType
@Nonnull public ComponentType<EntityStore, BlackboardSubscription> getBlackboardSubscriptionComponentType() -
getCombatDataPoolResourceType
-
getRoleChangeQueueResourceType
-
getNewSpawnStartTickingQueueResourceType
public ResourceType<EntityStore, NewSpawnStartTickingSystem.QueueResource> getNewSpawnStartTickingQueueResourceType() -
getSortBufferProviderResourceResourceType
public ResourceType<EntityStore, SortBufferProviderResource> getSortBufferProviderResourceResourceType() -
getAStarNodePoolProviderSimpleResourceType
public ResourceType<EntityStore, AStarNodePoolProviderSimple> getAStarNodePoolProviderSimpleResourceType() -
getNpcSpatialResource
public ResourceType<EntityStore, SpatialResource<Ref<EntityStore>, EntityStore>> getNpcSpatialResource() -
registerBeaconReceiverProvider
Registers a provider of additional, non-NPC beacon receivers. -
getBeaconReceiverProviders
-
getSpawnNPCInteractionFailureTrackerResourceType
public ResourceType<EntityStore, SpawnNPCInteractionFailureTracker> getSpawnNPCInteractionFailureTrackerResourceType() -
getCombatDataComponentType
-
getNpcTestDataComponentType
-
getBeaconSupportComponentType
-
getNpcBlockEventSupportComponentType
-
getPlayerBlockEventSupportComponentType
public ComponentType<EntityStore, PlayerBlockEventSupport> getPlayerBlockEventSupportComponentType() -
getNpcEntityEventSupportComponentType
-
getPlayerEntityEventSupportComponentType
public ComponentType<EntityStore, PlayerEntityEventSupport> getPlayerEntityEventSupportComponentType() -
getCombatSupportComponentType
-
getStateSupportComponentType
-
getMarkedEntitySupportComponentType
-
getWorldSupportComponentType
-
getEntitySupportComponentType
-
getMotionContextSupportComponentType
-
getDisplayNameSupportComponentType
-
getPlayerTaskSupportComponentType
-
getPositionCacheComponentType
-
getDebugSupportComponentType
-
getAlarmStoreComponentType
-
getSpawnLineageComponentType
-
getFlagsComponentType
-
getStepComponentType
-
getFailedSpawnComponentType
-
getTimersComponentType
-
getStateEvaluatorComponentType
-
getValueStoreComponentType
-
setupNPCLoading
public void setupNPCLoading() -
getPresetCoverageTestNPCs
-
spawnNPC
@Nullable public it.unimi.dsi.fastutil.Pair<Ref<EntityStore>, INonPlayerCharacter> spawnNPC(@Nonnull Store<EntityStore> store, @Nonnull String npcType, @Nullable String groupType, @Nonnull org.joml.Vector3dc position, @Nonnull Rotation3fc rotation) Called to spawn and returns an NPC in the given world.- Parameters:
store- TheStore<EntityStore>for component access.npcType- The type of NPC to spawn.groupType- A reference to the group definition to spawn.position- The position to spawn at.rotation- The rotation to spawn with.- Returns:
- the spawned NPC, or
nullif the NPC type is invalid.
-
spawnNPCWithSpaceValidation
@Nonnull public SpawnTestResult spawnNPCWithSpaceValidation(@Nonnull Store<EntityStore> store, @Nonnull String npcType, @Nullable String groupType, @Nonnull org.joml.Vector3dc position, @Nonnull Rotation3fc rotation) Called to spawn and return an NPC entity in the given world if the NPC can fit at the supplied exact position.- Parameters:
store- TheStore<EntityStore>for component access.npcType- The type of NPC to spawn.groupType- A reference to the group definition to spawn.position- The exact position to validate and spawn at.rotation- The rotation to spawn with.- Returns:
- A
SpawnTestResult:SpawnTestResult.TEST_OKfor success,SpawnTestResult.FAIL_INVALID_POSITIONif not enough space or chunk unloaded,SpawnTestResult.FAIL_NOT_SPAWNABLEif the NPC type is invalid or not spawnable, orSpawnTestResult.FAIL_SPAWNif an error occurred during entity spawning.
-
spawnNPCWithSpaceValidation
@Nonnull public SpawnTestResult spawnNPCWithSpaceValidation(@Nonnull Store<EntityStore> store, @Nonnull String npcType, @Nullable String groupType, @Nonnull org.joml.Vector3dc position, @Nonnull Rotation3fc rotation, @Nullable TriConsumer<NPCEntity, Ref<EntityStore>, Store<EntityStore>> postSpawn) Called to spawn and return an NPC entity in the given world if the NPC can fit at the supplied exact position, with an optional post-spawn callback.- Parameters:
store- TheStore<EntityStore>for component access.npcType- The type of NPC to spawn.groupType- A reference to the group definition to spawn.position- The exact position to validate and spawn at.rotation- The rotation to spawn with.postSpawn- Optional callback invoked after the NPC has been spawned.- Returns:
- A
SpawnTestResult:SpawnTestResult.TEST_OKfor success,SpawnTestResult.FAIL_INVALID_POSITIONif not enough space or chunk unloaded,SpawnTestResult.FAIL_NOT_SPAWNABLEif the NPC type is invalid or not spawnable, orSpawnTestResult.FAIL_SPAWNif an error occurred during entity spawning.
-
spawnNPCWithSpaceValidation
@Nonnull public SpawnTestResult spawnNPCWithSpaceValidation(@Nonnull Store<EntityStore> store, @Nonnull String npcType, @Nullable String groupType, @Nonnull org.joml.Vector3dc position, @Nonnull Rotation3fc rotation, @Nullable TriConsumer<NPCEntity, Ref<EntityStore>, Store<EntityStore>> postSpawn, boolean cubeBlockersOnly, boolean centerHitbox) - Parameters:
cubeBlockersOnly- Whentrue, only full-cube blocks invalidate the exact position; partial models (ropes, plants, cocoons, etc.) are ignored. Used for mid-air spawns that emerge from decorative non-cube blocks.centerHitbox- Whentrue, the supplied position is treated as the desired center of the NPC's collision box rather than its origin; the origin is shifted so the box centers on that point.
-
spawnNPCWithColumnProbe
@Nonnull public SpawnTestResult spawnNPCWithColumnProbe(@Nonnull Store<EntityStore> store, @Nonnull String npcType, @Nullable String groupType, @Nonnull World world, int worldBlockX, int worldBlockZ, double yHint, @Nonnull Rotation3fc rotation) Spawns an NPC using column probing (SpawningContext.set(World, double, double, double)thenSpawningContext.canSpawn()), for cases where an exact pose is blocked but a nearby column may fit (including ground placement for walkers).- Parameters:
store- entity storenpcType- role idgroupType- optional flock groupworld- worldworldBlockX- world block X of the column to probeworldBlockZ- world block Z of the column to probeyHint- vertical hint for span selection (typically primary spawn Y)rotation- NPC rotation- Returns:
SpawnTestResult.TEST_OKif spawned;SpawnTestResult.FAIL_INVALID_POSITIONif column/set/canSpawn unsuitable;SpawnTestResult.FAIL_NOT_SPAWNABLEif role invalid;SpawnTestResult.FAIL_SPAWNif entity add failed
-
spawnNPCWithColumnProbe
@Nonnull public SpawnTestResult spawnNPCWithColumnProbe(@Nonnull Store<EntityStore> store, @Nonnull String npcType, @Nullable String groupType, @Nonnull World world, int worldBlockX, int worldBlockZ, double yHint, @Nonnull Rotation3fc rotation, @Nullable TriConsumer<NPCEntity, Ref<EntityStore>, Store<EntityStore>> postSpawn) Spawns an NPC using column probing, with an optional post-spawn callback.- Parameters:
store- entity storenpcType- role idgroupType- optional flock groupworld- worldworldBlockX- world block X of the column to probeworldBlockZ- world block Z of the column to probeyHint- vertical hint for span selection (typically primary spawn Y)rotation- NPC rotationpostSpawn- optional callback invoked after the NPC has been spawned- Returns:
SpawnTestResult.TEST_OKif spawned;SpawnTestResult.FAIL_INVALID_POSITIONif column/set/canSpawn unsuitable;SpawnTestResult.FAIL_NOT_SPAWNABLEif role invalid;SpawnTestResult.FAIL_SPAWNif entity add failed
-
reloadNPCsWithRole
public static void reloadNPCsWithRole(int roleIndex) -
getPathChangeRevision
public int getPathChangeRevision() -
getName
-
getIndex
-
tryGetCachedValidRole
-
getBuilderInfo
-
getRoleTemplateNames
-
hasRoleName
-
validateSpawnableRole
-
getRoleBuilderInfo
-
setBuilderInvalid
public void setBuilderInvalid(int builderIndex) -
getAttitudeMap
-
getItemAttitudeMap
-
testAndValidateRole
-
forceValidation
public void forceValidation(int builderIndex) -
spawnEntity
@Nullable public it.unimi.dsi.fastutil.Pair<Ref<EntityStore>, NPCEntity> spawnEntity(@Nonnull Store<EntityStore> store, int roleIndex, @Nonnull org.joml.Vector3dc position, @Nullable Rotation3fc rotation, @Nullable Model spawnModel, @Nullable TriConsumer<NPCEntity, Ref<EntityStore>, Store<EntityStore>> postSpawn) Called to spawn and return an NPC entity in the given world.- Parameters:
store- TheStore<EntityStore>for component access.roleIndex- The index of the role to spawn.position- The position at which to spawn the NPC.rotation- The rotation to apply to the NPC.spawnModel- The model to use when spawning the NPC.postSpawn- A consumer that is called after the NPC has been spawned.- Returns:
- a pair containing the reference to the spawned entity and the
NPCEntitycomponent, ornullif the role index is invalid.
-
spawnEntity
@Nullable public it.unimi.dsi.fastutil.Pair<Ref<EntityStore>, NPCEntity> spawnEntity(@Nonnull Store<EntityStore> store, int roleIndex, @Nonnull org.joml.Vector3dc position, @Nullable Rotation3fc rotation, @Nullable Model spawnModel, @Nullable TriConsumer<NPCEntity, Holder<EntityStore>, Store<EntityStore>> preAddToWorld, @Nullable TriConsumer<NPCEntity, Ref<EntityStore>, Store<EntityStore>> postSpawn) Called to spawn and return an NPC entity in the given world.- Parameters:
store- TheStore<EntityStore>for component access.roleIndex- The index of the role to spawn.position- The position at which to spawn the NPC.rotation- The rotation to apply to the NPC.spawnModel- The model to use when spawning the NPC.preAddToWorld- A consumer that is called before the NPC is added to the world.postSpawn- A consumer that is called after the NPC has been spawned.- Returns:
- a pair containing the reference to the spawned entity and the
NPCEntitycomponent, ornullif the role index is invalid.
-
prepareRoleBuilderInfo
-
buildRole
@Nonnull public static Role buildRole(@Nonnull Holder<EntityStore> holder, @Nonnull Builder<Role> roleBuilder, @Nonnull BuilderInfo builderInfo, @Nonnull BuilderSupport builderSupport, int roleIndex) -
generateDescriptors
public void generateDescriptors() -
saveDescriptors
public void saveDescriptors() -
getBuilderManager
-
getMaxBlackboardBlockCountPerType
public int getMaxBlackboardBlockCountPerType() -
isLogFailingTestErrors
public boolean isLogFailingTestErrors() -
startRoleBenchmark
public boolean startRoleBenchmark(double seconds, @Nonnull Consumer<it.unimi.dsi.fastutil.ints.Int2ObjectMap<TimeDistributionRecorder>> onFinished) -
collectRoleTick
public void collectRoleTick(int roleIndex, long nanos) -
isBenchmarkingRole
public boolean isBenchmarkingRole() -
startSensorSupportBenchmark
public boolean startSensorSupportBenchmark(double seconds, @Nonnull Consumer<it.unimi.dsi.fastutil.ints.Int2ObjectMap<SensorSupportBenchmark>> onFinished) -
isBenchmarkingSensorSupport
public boolean isBenchmarkingSensorSupport() -
collectSensorSupportPlayerList
public void collectSensorSupportPlayerList(int roleIndex, long getNanos, double maxPlayerDistanceSorted, double maxPlayerDistance, double maxPlayerDistanceAvoidance, int numPlayers) -
collectSensorSupportEntityList
public void collectSensorSupportEntityList(int roleIndex, long getNanos, double maxEntityDistanceSorted, double maxEntityDistance, double maxEntityDistanceAvoidance, int numEntities) -
collectSensorSupportLosTest
public void collectSensorSupportLosTest(int roleIndex, boolean cacheHit, long time) -
collectSensorSupportInverseLosTest
public void collectSensorSupportInverseLosTest(int roleIndex, boolean cacheHit) -
collectSensorSupportFriendlyBlockingTest
public void collectSensorSupportFriendlyBlockingTest(int roleIndex, boolean cacheHit) -
collectSensorSupportTickDone
public void collectSensorSupportTickDone(int roleIndex) -
registerCoreComponentType
-
setRoleBuilderNeedsReload
-