Package com.hypixel.hytale.server.npc
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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AttitudeMapprotected booleanprivate ComponentType<EntityStore, BeaconSupport> protected Lockprivate ResourceType<EntityStore, Blackboard> protected List<BuilderDescriptor> protected final BuilderManagerprivate final Config<NPCPlugin.NPCConfig> static Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringstatic Stringprivate ComponentType<EntityStore, FailedSpawnComponent> private static NPCPluginprivate ItemAttitudeMapprotected booleanprotected intprivate ComponentType<EntityStore, NPCBlockEventSupport> private ResourceType<EntityStore, SpatialResource<Ref<EntityStore>, EntityStore>> private static final Vector3fprotected AtomicIntegerprotected String[]static final shortstatic final shortstatic Stringprotected it.unimi.dsi.fastutil.ints.Int2ObjectMap<SensorSupportBenchmark> protected SensorSupportBenchmarkprotected it.unimi.dsi.fastutil.ints.Int2ObjectMap<TimeDistributionRecorder> protected TimeDistributionRecorderprivate ComponentType<EntityStore, StateEvaluator> private ComponentType<EntityStore, StepComponent> private ComponentType<EntityStore, Timers> protected booleanprivate ComponentType<EntityStore, ValueStore> Fields inherited from class com.hypixel.hytale.server.core.plugin.PluginBase
METRICS_REGISTRY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic RolebuildRole(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) protected voidstatic NPCPluginget()getBuilderInfo(Builder<?> builder) intintgetName(int builderIndex) intString[]getRoleBuilderInfo(int roleIndex) getRoleTemplateNames(boolean spawnableOnly) booleanhasRoleName(String roleName) protected booleanbooleanbooleanbooleanprotected voidonAttitudeGroupsLoaded(LoadedAssetsEvent<String, AttitudeGroup, AssetMap<String, AttitudeGroup>> event) protected voidonAttitudeGroupsRemoved(RemovedAssetsEvent<String, AttitudeGroup, AssetMap<String, AttitudeGroup>> event) protected static voidonBalanceAssetsChanged(LoadedAssetsEvent<String, BalanceAsset, DefaultAssetMap<String, BalanceAsset>> event) protected static voidonBalanceAssetsRemoved(RemovedAssetsEvent<String, BalanceAsset, DefaultAssetMap<String, BalanceAsset>> event) protected voidonItemAttitudeGroupsLoaded(LoadedAssetsEvent<String, ItemAttitudeGroup, AssetMap<String, ItemAttitudeGroup>> event) protected voidonItemAttitudeGroupsRemoved(RemovedAssetsEvent<String, ItemAttitudeGroup, AssetMap<String, ItemAttitudeGroup>> event) protected voidprotected voidprotected voidprotected voidonNPCsLoaded(AllNPCsLoadedEvent event) protected voidvoidprepareRoleBuilderInfo(int roleIndex) private voidprivate voidprivate void<T> NPCPluginregisterCoreComponentType(String name, Supplier<Builder<T>> builder) protected voidstatic voidreloadNPCsWithRole(int roleIndex) protected voidvoidsetBuilderInvalid(int builderIndex) voidsetRoleBuilderNeedsReload(Builder<?> builder) protected voidsetup()voidit.unimi.dsi.fastutil.Pair<Ref<EntityStore>, NPCEntity> spawnEntity(Store<EntityStore> store, int roleIndex, Vector3d position, Vector3f rotation, Model spawnModel, TriConsumer<NPCEntity, Holder<EntityStore>, Store<EntityStore>> preAddToWorld, TriConsumer<NPCEntity, Ref<EntityStore>, Store<EntityStore>> postSpawn) it.unimi.dsi.fastutil.Pair<Ref<EntityStore>, NPCEntity> spawnEntity(Store<EntityStore> store, int roleIndex, Vector3d position, Vector3f rotation, Model spawnModel, TriConsumer<NPCEntity, Ref<EntityStore>, Store<EntityStore>> postSpawn) it.unimi.dsi.fastutil.Pair<Ref<EntityStore>, INonPlayerCharacter> spawnNPC(Store<EntityStore> store, String npcType, String groupType, Vector3d position, Vector3f rotation) protected voidstart()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 com.hypixel.hytale.server.core.plugin.JavaPlugin
getClassLoader, getFile, getType, start0Methods inherited from class com.hypixel.hytale.server.core.plugin.PluginBase
getAssetRegistry, getBasePermission, getBlockStateRegistry, getChunkStoreRegistry, getClientFeatureRegistry, getCodecRegistry, getCodecRegistry, getCodecRegistry, getCommandRegistry, getDataDirectory, getEntityRegistry, getEntityStoreRegistry, getEventRegistry, getIdentifier, getLogger, getManifest, getName, getState, getTaskRegistry, isDisabled, isEnabled, preLoad, setup0, shutdown, shutdown0, withConfig, withConfig
-
Field Details
-
FACTORY_CLASS_ROLE
-
FACTORY_CLASS_BODY_MOTION
-
FACTORY_CLASS_HEAD_MOTION
-
FACTORY_CLASS_ACTION
-
FACTORY_CLASS_SENSOR
-
FACTORY_CLASS_INSTRUCTION
-
FACTORY_CLASS_TRANSIENT_PATH
-
FACTORY_CLASS_ACTION_LIST
-
ROLE_ASSETS_PATH
-
instance
-
builderDescriptors
-
builderManager
-
validateBuilder
protected boolean validateBuilder -
maxBlackboardBlockCountPerType
protected int maxBlackboardBlockCountPerType -
logFailingTestErrors
protected boolean logFailingTestErrors -
presetCoverageTestNPCs
-
pathChangeRevision
-
benchmarkLock
-
roleTickDistribution
@Nullable protected it.unimi.dsi.fastutil.ints.Int2ObjectMap<TimeDistributionRecorder> roleTickDistribution -
roleSensorSupportDistribution
@Nullable protected it.unimi.dsi.fastutil.ints.Int2ObjectMap<SensorSupportBenchmark> roleSensorSupportDistribution -
roleTickDistributionAll
-
roleSensorSupportDistributionAll
-
autoReload
protected boolean autoReload -
attitudeMap
-
itemAttitudeMap
-
NULL_ROTATION
-
PRIORITY_LOAD_NPC
public static final short PRIORITY_LOAD_NPC- See Also:
-
PRIORITY_SPAWN_VALIDATION
public static final short PRIORITY_SPAWN_VALIDATION- See Also:
-
config
-
blackboardResourceType
-
combatDataPoolResourceType
-
roleChangeQueueResourceType
-
newSpawnStartTickingQueueResourceType
private ResourceType<EntityStore,NewSpawnStartTickingSystem.QueueResource> newSpawnStartTickingQueueResourceType -
sortBufferProviderResourceResourceType
-
aStarNodePoolProviderSimpleResourceType
private ResourceType<EntityStore,AStarNodePoolProviderSimple> aStarNodePoolProviderSimpleResourceType -
npcSpatialResource
-
combatDataComponentType
-
npcTestDataComponentType
-
beaconSupportComponentType
-
npcBlockEventSupportComponentType
-
playerBlockEventSupportComponentType
-
npcEntityEventSupportComponentType
-
playerEntityEventSupportComponentType
-
stepComponentType
-
failedSpawnComponentType
-
timersComponentType
-
stateEvaluatorComponentType
-
valueStoreComponentType
-
-
Constructor Details
-
NPCPlugin
-
-
Method Details
-
get
-
setup
protected void setup()- Overrides:
setupin classPluginBase
-
onSchemaGenerate
-
start
protected void start()- Overrides:
startin classPluginBase
-
getBlackboardResourceType
-
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>, getNpcSpatialResource()EntityStore>> -
getCombatDataComponentType
-
getNpcTestDataComponentType
-
getBeaconSupportComponentType
-
getNpcBlockEventSupportComponentType
-
getPlayerBlockEventSupportComponentType
-
getNpcEntityEventSupportComponentType
-
getPlayerEntityEventSupportComponentType
public ComponentType<EntityStore,PlayerEntityEventSupport> getPlayerEntityEventSupportComponentType() -
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 Vector3d position, @Nonnull Vector3f rotation) -
reloadNPCsWithRole
public static void reloadNPCsWithRole(int roleIndex) -
onNPCGroupsLoaded
-
onNPCGroupsRemoved
-
onAttitudeGroupsLoaded
protected void onAttitudeGroupsLoaded(@Nonnull LoadedAssetsEvent<String, AttitudeGroup, AssetMap<String, AttitudeGroup>> event) -
onAttitudeGroupsRemoved
protected void onAttitudeGroupsRemoved(RemovedAssetsEvent<String, AttitudeGroup, AssetMap<String, AttitudeGroup>> event) -
onItemAttitudeGroupsLoaded
protected void onItemAttitudeGroupsLoaded(@Nonnull LoadedAssetsEvent<String, ItemAttitudeGroup, AssetMap<String, ItemAttitudeGroup>> event) -
onItemAttitudeGroupsRemoved
protected void onItemAttitudeGroupsRemoved(RemovedAssetsEvent<String, ItemAttitudeGroup, AssetMap<String, ItemAttitudeGroup>> event) -
putItemAttitudeGroups
private void putItemAttitudeGroups() -
onPathChange
-
getPathChangeRevision
public int getPathChangeRevision() -
onNPCsLoaded
-
putNPCGroups
private void putNPCGroups() -
putAttitudeGroups
private void putAttitudeGroups() -
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 Vector3d position, Vector3f rotation, Model spawnModel, TriConsumer<NPCEntity, Ref<EntityStore>, Store<EntityStore>> postSpawn) -
spawnEntity
@Nullable public it.unimi.dsi.fastutil.Pair<Ref<EntityStore>,NPCEntity> spawnEntity(@Nonnull Store<EntityStore> store, int roleIndex, @Nonnull Vector3d position, @Nullable Vector3f rotation, @Nullable Model spawnModel, @Nullable TriConsumer<NPCEntity, Holder<EntityStore>, Store<EntityStore>> preAddToWorld, @Nullable TriConsumer<NPCEntity, Ref<EntityStore>, Store<EntityStore>> postSpawn) -
prepareRoleBuilderInfo
-
buildRole
@Nonnull public static Role buildRole(@Nonnull Builder<Role> roleBuilder, @Nonnull BuilderInfo builderInfo, @Nonnull BuilderSupport builderSupport, int roleIndex) -
onModelsChanged
protected void onModelsChanged(@Nonnull LoadedAssetsEvent<String, ModelAsset, DefaultAssetMap<String, ModelAsset>> event) -
generateDescriptors
protected void generateDescriptors() -
saveDescriptors
protected 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() -
isBenchmarking
protected boolean isBenchmarking() -
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
-
registerCoreFactories
protected void registerCoreFactories() -
onBalanceAssetsChanged
protected static void onBalanceAssetsChanged(@Nonnull LoadedAssetsEvent<String, BalanceAsset, DefaultAssetMap<String, BalanceAsset>> event) -
onBalanceAssetsRemoved
protected static void onBalanceAssetsRemoved(@Nonnull RemovedAssetsEvent<String, BalanceAsset, DefaultAssetMap<String, BalanceAsset>> event)
-