NPCPlugin

public class NPCPlugin extends JavaPlugin

The main plugin class for Npc. This plugin provides gameplay features for the Hytale server. Extend this class to create a plugin.

java.lang.Object > JavaPlugin > NPCPlugin

Field Summary

builderDescriptors

protected List builderDescriptors

Field builderDescriptors.

validateBuilder

protected boolean validateBuilder

Field validateBuilder.

maxBlackboardBlockCountPerType

protected int maxBlackboardBlockCountPerType

Field maxBlackboardBlockCountPerType.

logFailingTestErrors

protected boolean logFailingTestErrors

Field logFailingTestErrors.

presetCoverageTestNPCs

protected String[] presetCoverageTestNPCs

Field presetCoverageTestNPCs.

pathChangeRevision

protected AtomicInteger pathChangeRevision

Field pathChangeRevision.

benchmarkLock

protected Lock benchmarkLock

Field benchmarkLock.

roleTickDistribution

protected Int2ObjectMap roleTickDistribution

Field roleTickDistribution.

roleSensorSupportDistribution

protected Int2ObjectMap roleSensorSupportDistribution

Field roleSensorSupportDistribution.

roleTickDistributionAll

protected TimeDistributionRecorder roleTickDistributionAll

Field roleTickDistributionAll.

roleSensorSupportDistributionAll

protected SensorSupportBenchmark roleSensorSupportDistributionAll

Field roleSensorSupportDistributionAll.

autoReload

protected boolean autoReload

Field autoReload.

attitudeMap

private AttitudeMap attitudeMap

Field attitudeMap.

itemAttitudeMap

private ItemAttitudeMap itemAttitudeMap

Field itemAttitudeMap.

entityStoreRegistry

final ComponentRegistryProxy entityStoreRegistry

Field entityStoreRegistry.

eventRegistry

final EventRegistry eventRegistry

Field eventRegistry.

start

final long start

Field start.

validateAssets

final boolean validateAssets

Field validateAssets.

assetPacks

final List assetPacks

Field assetPacks.

includeTests

final boolean includeTests

Field includeTests.

loadSucceeded

final boolean loadSucceeded

Field loadSucceeded.

postBehaviourDependency

final Set> postBehaviourDependency

Field postBehaviourDependency.

schema

final Schema schema

Field schema.

hytale

final Schema.HytaleMetadata hytale

Field hytale.

config

final NPCConfig config

Field config.

roleIndex

final int roleIndex

Field roleIndex.

flockDefinition

final FlockAsset flockDefinition

Field flockDefinition.

npcRef

final Ref npcRef

Field npcRef.

npcComponent

final NPCEntity npcComponent

Field npcComponent.

npc

final NPCEntity npc

Field npc.

attitudeGroupCount

final int attitudeGroupCount

Field attitudeGroupCount.

iterator

final Iterator iterator

Field iterator.

index

final int index

Field index.

index2

final int index2

Field index2.

builder

final ItemAttitudeMap.Builder builder

Field builder.

tagSetIndexMap

final Object2IntOpenHashMap tagSetIndexMap

Field tagSetIndexMap.

builderInfo

final BuilderInfo builderInfo

Field builderInfo.

worldTimeResource

final WorldTimeResource worldTimeResource

Field worldTimeResource.

roleName

final String roleName

Field roleName.

holder

final Holder holder

Field holder.

displayNameComponent

final DisplayNameComponent displayNameComponent

Field displayNameComponent.

ref

final Ref ref

Field ref.

scope

final StdScope scope

Field scope.

store

final Store store

Field store.

entityModelComponent

final ModelComponent entityModelComponent

Field entityModelComponent.

oldModel

final Model oldModel

Field oldModel.

newModelAsset

final ModelAsset newModelAsset

Field newModelAsset.

entityReference

final Ref entityReference

Field entityReference.

path

final Path path

Field path.

distribution

final Int2ObjectMap distribution

Field distribution.

factory

final BuilderFactory factory

Field factory.

roleFactory

final BuilderFactory roleFactory

Field roleFactory.

motionControllerFactory

final BuilderFactory motionControllerFactory

Field motionControllerFactory.

actionListFactory

final BuilderFactory actionListFactory

Field actionListFactory.

instructionFactory

final BuilderFactory instructionFactory

Field instructionFactory.

transientPathFactory

final BuilderFactory transientPathFactory

Field transientPathFactory.

relativeWaypointFactory

final BuilderFactory relativeWaypointFactory

Field relativeWaypointFactory.

weightedActionFactory

final BuilderFactory weightedActionFactory

Field weightedActionFactory.

valueToParameterMappingFactory

final BuilderFactory valueToParameterMappingFactory

Field valueToParameterMappingFactory.

removedAssets

final Set removedAssets

Field removedAssets.

generateDescriptors

private boolean generateDescriptors

Field generateDescriptors.

generateDescriptorsFile

private boolean generateDescriptorsFile

Field generateDescriptorsFile.

maxBlackboardBlockType

private int maxBlackboardBlockType

Field maxBlackboardBlockType.

Method Detail

get

static NPCPlugin get ()

Method get.

NPCPlugin

public public NPCPlugin (@Nonnull final JavaPluginInit init)

Method NPCPlugin.

Parameters:
@Nonnull final JavaPluginInit init

setup

protected void setup ()

Method setup.

NPCCommand

public new NPCCommand ()

Method NPCCommand.

IndexedLookupTableAssetMap

public new IndexedLookupTableAssetMap (AttitudeGroup[]::new)

Method IndexedLookupTableAssetMap.

Parameters:
AttitudeGroup[]::new AttitudeGroup[]::new

DefaultAssetMap

public new DefaultAssetMap ()

Method DefaultAssetMap.

UseNPCInteraction

public new UseNPCInteraction ("*UseNPC")

Method UseNPCInteraction.

Parameters:
"*UseNPC" "*UseNPC"

KDTree

public new KDTree (Ref::isValid)

Method KDTree.

Parameters:
Ref::isValid Ref::isValid

RoleBuilderSystem

public new RoleBuilderSystem ()

Method RoleBuilderSystem.

BalancingInitialisationSystem

public new BalancingInitialisationSystem ()

Method BalancingInitialisationSystem.

FailedSpawnSystem

public new FailedSpawnSystem ()

Method FailedSpawnSystem.

StateEvaluatorSystem

public new StateEvaluatorSystem (this.stateEvaluatorComponentType, npcComponentType)

Method StateEvaluatorSystem.

Parameters:
this.stateEvaluatorComponentType this.stateEvaluatorComponentType
npcComponentType npcComponentType

NPCPreTickSystem

public new NPCPreTickSystem (npcComponentType)

Method NPCPreTickSystem.

Parameters:
npcComponentType npcComponentType

SystemDependency

public new SystemDependency (Order.AFTER, RoleSystems.PostBehaviourSupportTickSystem.class)

Method SystemDependency.

Parameters:
Order.AFTER Order.AFTER
RoleSystems.PostBehaviourSupportTickSystem.class RoleSystems.PostBehaviourSupportTickSystem.class

AvoidanceSystem

public new AvoidanceSystem (npcComponentType)

Method AvoidanceSystem.

Parameters:
npcComponentType npcComponentType

SteeringSystem

public new SteeringSystem (npcComponentType)

Method SteeringSystem.

Parameters:
npcComponentType npcComponentType

TimerSystem

public new TimerSystem (this.timersComponentType, postBehaviourDependency)

Method TimerSystem.

Parameters:
this.timersComponentType this.timersComponentType
postBehaviourDependency postBehaviourDependency

ComputeVelocitySystem

public new ComputeVelocitySystem (npcComponentType, EntityModule.get()

Method ComputeVelocitySystem.

Parameters:
npcComponentType npcComponentType
EntityModule.get( EntityModule.get(

MovementStatesSystem

public new MovementStatesSystem (npcComponentType, EntityModule.get()

Method MovementStatesSystem.

Parameters:
npcComponentType npcComponentType
EntityModule.get( EntityModule.get(

StepCleanupSystem

public new StepCleanupSystem (this.stepComponentType)

Method StepCleanupSystem.

Parameters:
this.stepComponentType this.stepComponentType

NewSpawnStartTickingSystem

public new NewSpawnStartTickingSystem (this.newSpawnStartTickingQueueResourceType)

Method NewSpawnStartTickingSystem.

Parameters:
this.newSpawnStartTickingQueueResourceType this.newSpawnStartTickingQueueResourceType

RoleChangeSystem

public new RoleChangeSystem (this.roleChangeQueueResourceType, this.beaconSupportComponentType, this.playerBlockEventSupportComponentType, this.npcBlockEventSupportComponentType, this.playerEntityEventSupportComponentType, this.npcEntityEventSupportComponentType, this.timersComponentType, this.stateEvaluatorComponentType, this.valueStoreComponentType)

Method RoleChangeSystem.

Parameters:
this.roleChangeQueueResourceType this.roleChangeQueueResourceType
this.beaconSupportComponentType this.beaconSupportComponentType
this.playerBlockEventSupportComponentType this.playerBlockEventSupportComponentType
this.npcBlockEventSupportComponentType this.npcBlockEventSupportComponentType
this.playerEntityEventSupportComponentType this.playerEntityEventSupportComponentType
this.npcEntityEventSupportComponentType this.npcEntityEventSupportComponentType
this.timersComponentType this.timersComponentType
this.stateEvaluatorComponentType this.stateEvaluatorComponentType
this.valueStoreComponentType this.valueStoreComponentType

NPCSpatialSystem

public new NPCSpatialSystem (this.npcSpatialResource)

Method NPCSpatialSystem.

Parameters:
this.npcSpatialResource this.npcSpatialResource

NPCVelocityInstructionSystem

public new NPCVelocityInstructionSystem ()

Method NPCVelocityInstructionSystem.

NPCEntityRegenerateStatsSystem

public new NPCEntityRegenerateStatsSystem ()

Method NPCEntityRegenerateStatsSystem.

onSchemaGenerate

public void onSchemaGenerate (@Nonnull final GenerateSchemaEvent event)

Method onSchemaGenerate.

Parameters:
@Nonnull final GenerateSchemaEvent event

start

protected void start ()

Method start.

getBlackboardResourceType

public Blackboard> getBlackboardResourceType ()

Method getBlackboardResourceType.

getCombatDataPoolResourceType

public CombatViewSystems.CombatDataPool> getCombatDataPoolResourceType ()

Method getCombatDataPoolResourceType.

getRoleChangeQueueResourceType

public RoleChangeSystem.RoleChangeQueue> getRoleChangeQueueResourceType ()

Method getRoleChangeQueueResourceType.

getNewSpawnStartTickingQueueResourceType

public NewSpawnStartTickingSystem.QueueResource> getNewSpawnStartTickingQueueResourceType ()

Method getNewSpawnStartTickingQueueResourceType.

getSortBufferProviderResourceResourceType

public SortBufferProviderResource> getSortBufferProviderResourceResourceType ()

Method getSortBufferProviderResourceResourceType.

getAStarNodePoolProviderSimpleResourceType

public AStarNodePoolProviderSimple> getAStarNodePoolProviderSimpleResourceType ()

Method getAStarNodePoolProviderSimpleResourceType.

getNpcSpatialResource

public EntityStore>> getNpcSpatialResource ()

Method getNpcSpatialResource.

getCombatDataComponentType

public CombatViewSystems.CombatData> getCombatDataComponentType ()

Method getCombatDataComponentType.

getNpcTestDataComponentType

public NPCRunTestsCommand.NPCTestData> getNpcTestDataComponentType ()

Method getNpcTestDataComponentType.

getBeaconSupportComponentType

public BeaconSupport> getBeaconSupportComponentType ()

Method getBeaconSupportComponentType.

getNpcBlockEventSupportComponentType

public NPCBlockEventSupport> getNpcBlockEventSupportComponentType ()

Method getNpcBlockEventSupportComponentType.

getPlayerBlockEventSupportComponentType

public PlayerBlockEventSupport> getPlayerBlockEventSupportComponentType ()

Method getPlayerBlockEventSupportComponentType.

getNpcEntityEventSupportComponentType

public NPCEntityEventSupport> getNpcEntityEventSupportComponentType ()

Method getNpcEntityEventSupportComponentType.

getPlayerEntityEventSupportComponentType

public PlayerEntityEventSupport> getPlayerEntityEventSupportComponentType ()

Method getPlayerEntityEventSupportComponentType.

getStepComponentType

public StepComponent> getStepComponentType ()

Method getStepComponentType.

getFailedSpawnComponentType

public FailedSpawnComponent> getFailedSpawnComponentType ()

Method getFailedSpawnComponentType.

getTimersComponentType

public Timers> getTimersComponentType ()

Method getTimersComponentType.

getStateEvaluatorComponentType

public StateEvaluator> getStateEvaluatorComponentType ()

Method getStateEvaluatorComponentType.

getValueStoreComponentType

public ValueStore> getValueStoreComponentType ()

Method getValueStoreComponentType.

setupNPCLoading

public void setupNPCLoading ()

Method setupNPCLoading.

getPresetCoverageTestNPCs

public String[] getPresetCoverageTestNPCs ()

Method getPresetCoverageTestNPCs.

spawnNPC

public INonPlayerCharacter> spawnNPC (@Nonnull final Store store, @Nonnull final String npcType, @Nullable final String groupType, @Nonnull final Vector3d position, @Nonnull final Vector3f rotation)

Method spawnNPC.

Parameters:
@Nonnull final Store store
@Nonnull final String npcType
@Nullable final String groupType
@Nonnull final Vector3d position
@Nonnull final Vector3f rotation

reloadNPCsWithRole

static void reloadNPCsWithRole (final int roleIndex)

Method reloadNPCsWithRole.

Parameters:
final int roleIndex

onNPCGroupsLoaded

protected void onNPCGroupsLoaded (final LoadedAssetsEvent> event)

Method onNPCGroupsLoaded.

Parameters:
final LoadedAssetsEvent> event

onNPCGroupsRemoved

protected void onNPCGroupsRemoved (final RemovedAssetsEvent> event)

Method onNPCGroupsRemoved.

Parameters:
final RemovedAssetsEvent> event

onAttitudeGroupsLoaded

protected void onAttitudeGroupsLoaded (@Nonnull final LoadedAssetsEvent> event)

Method onAttitudeGroupsLoaded.

Parameters:
@Nonnull final LoadedAssetsEvent> event

onAttitudeGroupsRemoved

protected void onAttitudeGroupsRemoved (final RemovedAssetsEvent> event)

Method onAttitudeGroupsRemoved.

Parameters:
final RemovedAssetsEvent> event

onItemAttitudeGroupsLoaded

protected void onItemAttitudeGroupsLoaded (@Nonnull final LoadedAssetsEvent> event)

Method onItemAttitudeGroupsLoaded.

Parameters:
@Nonnull final LoadedAssetsEvent> event

onItemAttitudeGroupsRemoved

protected void onItemAttitudeGroupsRemoved (final RemovedAssetsEvent> event)

Method onItemAttitudeGroupsRemoved.

Parameters:
final RemovedAssetsEvent> event

putItemAttitudeGroups

private void putItemAttitudeGroups ()

Method putItemAttitudeGroups.

onPathChange

protected void onPathChange (final WorldPathChangedEvent event)

Method onPathChange.

Parameters:
final WorldPathChangedEvent event

getPathChangeRevision

public int getPathChangeRevision ()

Method getPathChangeRevision.

onNPCsLoaded

protected void onNPCsLoaded (final AllNPCsLoadedEvent event)

Method onNPCsLoaded.

Parameters:
final AllNPCsLoadedEvent event

putNPCGroups

private void putNPCGroups ()

Method putNPCGroups.

putAttitudeGroups

private void putAttitudeGroups ()

Method putAttitudeGroups.

getName

public String getName (final int builderIndex)

Method getName.

Parameters:
final int builderIndex

getIndex

public int getIndex (final String builderName)

Method getIndex.

Parameters:
final String builderName

tryGetCachedValidRole

public Builder tryGetCachedValidRole (final int roleIndex)

Method tryGetCachedValidRole.

Parameters:
final int roleIndex

getBuilderInfo

public BuilderInfo getBuilderInfo (final Builder builder)

Method getBuilderInfo.

Parameters:
final Builder builder

getRoleTemplateNames

public List getRoleTemplateNames (final boolean spawnableOnly)

Method getRoleTemplateNames.

Parameters:
final boolean spawnableOnly

ObjectArrayList

public new ObjectArrayList ()

Method ObjectArrayList.

hasRoleName

public boolean hasRoleName (final String roleName)

Method hasRoleName.

Parameters:
final String roleName

validateSpawnableRole

public void validateSpawnableRole (final String roleName)

Method validateSpawnableRole.

Parameters:
final String roleName

SkipSentryException

public new SkipSentryException (new IllegalArgumentException(roleName + " does not exist as a role!")

Method SkipSentryException.

Parameters:
new IllegalArgumentException(roleName + " does not exist as a role!"

getRoleBuilderInfo

public BuilderInfo getRoleBuilderInfo (final int roleIndex)

Method getRoleBuilderInfo.

Parameters:
final int roleIndex

setBuilderInvalid

public void setBuilderInvalid (final int builderIndex)

Method setBuilderInvalid.

Parameters:
final int builderIndex

getAttitudeMap

public AttitudeMap getAttitudeMap ()

Method getAttitudeMap.

getItemAttitudeMap

public ItemAttitudeMap getItemAttitudeMap ()

Method getItemAttitudeMap.

testAndValidateRole

public boolean testAndValidateRole (@Nullable final BuilderInfo builderInfo)

Method testAndValidateRole.

Parameters:
@Nullable final BuilderInfo builderInfo

forceValidation

public void forceValidation (final int builderIndex)

Method forceValidation.

Parameters:
final int builderIndex

spawnEntity

public NPCEntity> spawnEntity (@Nonnull final Store store, final int roleIndex, @Nonnull final Vector3d position, final Vector3f rotation, final Model spawnModel, final TriConsumer, Store> postSpawn)

Method spawnEntity.

Parameters:
@Nonnull final Store store
final int roleIndex
@Nonnull final Vector3d position
final Vector3f rotation
final Model spawnModel
final TriConsumer, Store> postSpawn

TransformComponent

public new TransformComponent (position, rotation)

Method TransformComponent.

Parameters:
position position
rotation rotation

HeadRotation

public new HeadRotation (rotation)

Method HeadRotation.

Parameters:
rotation rotation

DisplayNameComponent

public new DisplayNameComponent (Message.raw(roleName)

Method DisplayNameComponent.

Parameters:
Message.raw(roleName Message.raw(roleName

ModelComponent

public new ModelComponent (spawnModel)

Method ModelComponent.

Parameters:
spawnModel spawnModel

PersistentModel

public new PersistentModel (spawnModel.toReference()

Method PersistentModel.

Parameters:
spawnModel.toReference( spawnModel.toReference(

prepareRoleBuilderInfo

public BuilderInfo prepareRoleBuilderInfo (final int roleIndex)

Method prepareRoleBuilderInfo.

Parameters:
final int roleIndex

buildRole

static Role buildRole (@Nonnull final Builder roleBuilder, @Nonnull final BuilderInfo builderInfo, @Nonnull final BuilderSupport builderSupport, final int roleIndex)

Method buildRole.

Parameters:
@Nonnull final Builder roleBuilder
@Nonnull final BuilderInfo builderInfo
@Nonnull final BuilderSupport builderSupport
final int roleIndex

onModelsChanged

protected void onModelsChanged (@Nonnull final LoadedAssetsEvent> event)

Method onModelsChanged.

Parameters:
@Nonnull final LoadedAssetsEvent> event

generateDescriptors

protected void generateDescriptors ()

Method generateDescriptors.

saveDescriptors

protected void saveDescriptors ()

Method saveDescriptors.

getBuilderManager

public BuilderManager getBuilderManager ()

Method getBuilderManager.

getMaxBlackboardBlockCountPerType

public int getMaxBlackboardBlockCountPerType ()

Method getMaxBlackboardBlockCountPerType.

isLogFailingTestErrors

public boolean isLogFailingTestErrors ()

Method isLogFailingTestErrors.

startRoleBenchmark

public boolean startRoleBenchmark (final double seconds, @Nonnull final Consumer> onFinished)

Method startRoleBenchmark.

Parameters:
final double seconds
@Nonnull final Consumer> onFinished

collectRoleTick

public void collectRoleTick (final int roleIndex, final long nanos)

Method collectRoleTick.

Parameters:
final int roleIndex
final long nanos

isBenchmarkingRole

public boolean isBenchmarkingRole ()

Method isBenchmarkingRole.

startSensorSupportBenchmark

public boolean startSensorSupportBenchmark (final double seconds, @Nonnull final Consumer> onFinished)

Method startSensorSupportBenchmark.

Parameters:
final double seconds
@Nonnull final Consumer> onFinished

isBenchmarkingSensorSupport

public boolean isBenchmarkingSensorSupport ()

Method isBenchmarkingSensorSupport.

isBenchmarking

protected boolean isBenchmarking ()

Method isBenchmarking.

collectSensorSupportPlayerList

public void collectSensorSupportPlayerList (final int roleIndex, final long getNanos, final double maxPlayerDistanceSorted, final double maxPlayerDistance, final double maxPlayerDistanceAvoidance, final int numPlayers)

Method collectSensorSupportPlayerList.

Parameters:
final int roleIndex
final long getNanos
final double maxPlayerDistanceSorted
final double maxPlayerDistance
final double maxPlayerDistanceAvoidance
final int numPlayers

collectSensorSupportEntityList

public void collectSensorSupportEntityList (final int roleIndex, final long getNanos, final double maxEntityDistanceSorted, final double maxEntityDistance, final double maxEntityDistanceAvoidance, final int numEntities)

Method collectSensorSupportEntityList.

Parameters:
final int roleIndex
final long getNanos
final double maxEntityDistanceSorted
final double maxEntityDistance
final double maxEntityDistanceAvoidance
final int numEntities

collectSensorSupportLosTest

public void collectSensorSupportLosTest (final int roleIndex, final boolean cacheHit, final long time)

Method collectSensorSupportLosTest.

Parameters:
final int roleIndex
final boolean cacheHit
final long time

collectSensorSupportInverseLosTest

public void collectSensorSupportInverseLosTest (final int roleIndex, final boolean cacheHit)

Method collectSensorSupportInverseLosTest.

Parameters:
final int roleIndex
final boolean cacheHit

collectSensorSupportFriendlyBlockingTest

public void collectSensorSupportFriendlyBlockingTest (final int roleIndex, final boolean cacheHit)

Method collectSensorSupportFriendlyBlockingTest.

Parameters:
final int roleIndex
final boolean cacheHit

collectSensorSupportTickDone

public void collectSensorSupportTickDone (final int roleIndex)

Method collectSensorSupportTickDone.

Parameters:
final int roleIndex

registerCoreComponentType

public NPCPlugin registerCoreComponentType (final String name, @Nonnull final Supplier> builder)

Method registerCoreComponentType.

Parameters:
final String name
@Nonnull final Supplier> builder

setRoleBuilderNeedsReload

public void setRoleBuilderNeedsReload (final Builder builder)

Method setRoleBuilderNeedsReload.

Parameters:
final Builder builder

registerCoreFactories

protected void registerCoreFactories ()

Method registerCoreFactories.

onBalanceAssetsChanged

static void onBalanceAssetsChanged (@Nonnull final LoadedAssetsEvent> event)

Method onBalanceAssetsChanged.

Parameters:
@Nonnull final LoadedAssetsEvent> event

onBalanceAssetsRemoved

static void onBalanceAssetsRemoved (@Nonnull final RemovedAssetsEvent> event)

Method onBalanceAssetsRemoved.

Parameters:
@Nonnull final RemovedAssetsEvent> event

NPCConfig

public public NPCConfig ()

Method NPCConfig.

isGenerateDescriptors

public boolean isGenerateDescriptors ()

Method isGenerateDescriptors.

isGenerateDescriptorsFile

public boolean isGenerateDescriptorsFile ()

Method isGenerateDescriptorsFile.

isAutoReload

public boolean isAutoReload ()

Method isAutoReload.

isValidateBuilder

public boolean isValidateBuilder ()

Method isValidateBuilder.

getMaxBlackboardBlockType

public int getMaxBlackboardBlockType ()

Method getMaxBlackboardBlockType.