public class Role implements IAnnotatedComponentCollection
Class Role. Provides role functionality for the Hytale server.
java.lang.Object > Role
Field Summary
roleIndex
Field roleIndex.
roleName
Field roleName.
appearance
Field appearance.
isActivated
Field isActivated.
activeMotionController
Field activeMotionController.
flockSpawnTypeIndices
Field flockSpawnTypeIndices.
requiresLeashPosition
Field requiresLeashPosition.
hasReachedTerminalAction
Field hasReachedTerminalAction.
armor
Field armor.
flags
Field flags.
rootInstruction
Field rootInstruction.
lastBodyMotionStep
Field lastBodyMotionStep.
lastHeadMotionStep
Field lastHeadMotionStep.
indexedInstructions
Field indexedInstructions.
interactionInstruction
Field interactionInstruction.
deathInstruction
Field deathInstruction.
currentTreeModeStep
Field currentTreeModeStep.
roleChangeRequested
Field roleChangeRequested.
backingAway
Field backingAway.
npcComponent
Field npcComponent.
instructions
Field instructions.
stateTransitions
Field stateTransitions.
motionController
Field motionController.
action
Field action.
isDead
Field isDead.
nextBodyMotionStep
Field nextBodyMotionStep.
nextHeadMotionStep
Field nextHeadMotionStep.
targetRef
Field targetRef.
targetTransformComponent
Field targetTransformComponent.
distance
Field distance.
s
Field s.
sumOfDistances
Field sumOfDistances.
speed
Field speed.
length
Field length.
index
Field index.
old
Field old.
itemModule
Field itemModule.
inventorySlots
Field inventorySlots.
inventory
Field inventory.
inventory2
Field inventory2.
hotbar
Field hotbar.
items
Field items.
Method Detail
Role
public
Role
(@Nonnull final BuilderRole builder, @Nonnull final BuilderSupport builderSupport)
Method Role.
- Parameters:
@Nonnull final BuilderRolebuilder@Nonnull final BuilderSupportbuilderSupport
getInitialMaxHealth
int
getInitialMaxHealth
()
Method getInitialMaxHealth.
isAvoidingEntities
boolean
isAvoidingEntities
()
Method isAvoidingEntities.
getCollisionProbeDistance
double
getCollisionProbeDistance
()
Method getCollisionProbeDistance.
isApplySeparation
boolean
isApplySeparation
()
Method isApplySeparation.
getSeparationDistance
double
getSeparationDistance
()
Method getSeparationDistance.
getInteractionInstruction
Method getInteractionInstruction.
getIgnoredEntitiesForAvoidance
Method getIgnoredEntitiesForAvoidance.
getDropListId
String
getDropListId
()
Method getDropListId.
getBalanceAsset
String
getBalanceAsset
()
Method getBalanceAsset.
getInteractionVars
String>
getInteractionVars
()
Method getInteractionVars.
isMemory
boolean
isMemory
()
Method isMemory.
getMemoriesNameOverride
String
getMemoriesNameOverride
()
Method getMemoriesNameOverride.
getNameTranslationKey
String
getNameTranslationKey
()
Method getNameTranslationKey.
isMemoriesNameOverriden
boolean
isMemoriesNameOverriden
()
Method isMemoriesNameOverriden.
getSpawnLockTime
float
getSpawnLockTime
()
Method getSpawnLockTime.
loaded
void
loaded
()
Method loaded.
spawned
Method spawned.
- Parameters:
@Nonnull final Holderholder@Nonnull final NPCEntitynpcComponent
unloaded
void
unloaded
()
Method unloaded.
removed
void
removed
()
Method removed.
teleported
void
teleported
(@Nonnull final World from, @Nonnull final World to)
Method teleported.
- Parameters:
@Nonnull final Worldfrom@Nonnull final Worldto
getAppearanceName
String
getAppearanceName
()
Method getAppearanceName.
getActiveMotionController
Method getActiveMotionController.
getMarkedEntitySupport
Method getMarkedEntitySupport.
isRoleChangeRequested
boolean
isRoleChangeRequested
()
Method isRoleChangeRequested.
setRoleChangeRequested
void
setRoleChangeRequested
()
Method setRoleChangeRequested.
setActiveMotionController
boolean
setActiveMotionController
(@Nullable final Ref ref, @Nonnull final NPCEntity npcComponent, @Nonnull final String name, @Nullable final ComponentAccessor componentAccessor)
Method setActiveMotionController.
- Parameters:
@Nullable final Refref@Nonnull final NPCEntitynpcComponent@Nonnull final Stringname@Nullable final ComponentAccessorcomponentAccessor
motionControllerChanged
void
motionControllerChanged
(@Nullable final Ref ref, @Nonnull final NPCEntity npcComponent, @Nullable final MotionController motionController, @Nullable final ComponentAccessor componentAccessor)
Method motionControllerChanged.
- Parameters:
@Nullable final Refref@Nonnull final NPCEntitynpcComponent@Nullable final MotionControllermotionController@Nullable final ComponentAccessorcomponentAccessor
setMotionControllers
void
setMotionControllers
(@Nonnull final NPCEntity npcComponent, @Nonnull final Map motionControllers, @Nullable final String initialMotionController)
Method setMotionControllers.
- Parameters:
@Nonnull final NPCEntitynpcComponent@Nonnull final MapmotionControllers@Nullable final StringinitialMotionController
updateMotionControllers
void
updateMotionControllers
(@Nullable final Ref ref, @Nullable final Model model, @Nullable final Box boundingBox, @Nullable final ComponentAccessor componentAccessor)
Method updateMotionControllers.
- Parameters:
@Nullable final Refref@Nullable final Modelmodel@Nullable final BoxboundingBox@Nullable final ComponentAccessorcomponentAccessor
updateMovementState
void
updateMovementState
(@Nonnull final Ref ref, @Nonnull final MovementStates movementStates, @Nonnull final Vector3d velocity, @Nonnull final ComponentAccessor componentAccessor)
Method updateMovementState.
- Parameters:
@Nonnull final Refref@Nonnull final MovementStatesmovementStates@Nonnull final Vector3dvelocity@Nonnull final ComponentAccessorcomponentAccessor
tick
Method tick.
- Parameters:
@Nonnull final Refreffinal floattickTime@Nonnull final Storestore
addDeferredAction
void
addDeferredAction
(@Nonnull final DeferredAction handler)
Method addDeferredAction.
- Parameters:
@Nonnull final DeferredActionhandler
computeActionsAndSteering
void
computeActionsAndSteering
(@Nonnull final Ref ref, final double tickTime, @Nonnull final Steering bodySteering, @Nonnull final Steering headSteering, @Nonnull final Store store)
Method computeActionsAndSteering.
- Parameters:
@Nonnull final Refreffinal doubletickTime@Nonnull final SteeringbodySteering@Nonnull final SteeringheadSteering@Nonnull final Storestore
blendSeparation
void
blendSeparation
(@Nonnull final Ref selfRef, @Nonnull final Vector3d position, @Nonnull final Steering steering, @Nonnull final ComponentType transformComponentType, @Nonnull final CommandBuffer commandBuffer)
Method blendSeparation.
- Parameters:
@Nonnull final RefselfRef@Nonnull final Vector3dposition@Nonnull final Steeringsteering@Nonnull final ComponentTypetransformComponentType@Nonnull final CommandBuffercommandBuffer
if
else
if
(distance < this.separationFarRadiusTarget * this.separationFarRadiusTarget)
Method if.
- Parameters:
distance < this.separationFarRadiusTarget *this.separationFarRadiusTarget
getLastSeparationSteering
Method getLastSeparationSteering.
blendAvoidance
void
blendAvoidance
(@Nonnull final Ref ref, @Nonnull final Vector3d position, @Nonnull final Steering steering, @Nonnull final CommandBuffer commandBuffer)
Method blendAvoidance.
- Parameters:
@Nonnull final Refref@Nonnull final Vector3dposition@Nonnull final Steeringsteering@Nonnull final CommandBuffercommandBuffer
getLastAvoidanceSteering
Method getLastAvoidanceSteering.
resetInstruction
void
resetInstruction
(final int instruction)
Method resetInstruction.
- Parameters:
final intinstruction
getRoleName
String
getRoleName
()
Method getRoleName.
getRoleIndex
int
getRoleIndex
()
Method getRoleIndex.
setRoleIndex
void
setRoleIndex
(final int roleIndex, @Nonnull final String roleName)
Method setRoleIndex.
- Parameters:
final introleIndex@Nonnull final StringroleName
isInvulnerable
boolean
isInvulnerable
()
Method isInvulnerable.
isBreathesInAir
boolean
isBreathesInAir
()
Method isBreathesInAir.
isBreathesInWater
boolean
isBreathesInWater
()
Method isBreathesInWater.
getInertia
double
getInertia
()
Method getInertia.
getKnockbackScale
double
getKnockbackScale
()
Method getKnockbackScale.
canBreathe
Method canBreathe.
- Parameters:
@Nonnull final BlockMaterialbreathingMaterialfinal intfluidId
couldBreathe
Method couldBreathe.
- Parameters:
@Nonnull final BlockMaterialbreathingMaterialfinal intfluidId
couldBreatheCached
boolean
couldBreatheCached
()
Method couldBreatheCached.
addForce
void
addForce
(@Nonnull final Vector3d velocity, @Nullable final VelocityConfig velocityConfig)
Method addForce.
- Parameters:
@Nonnull final Vector3dvelocity@Nullable final VelocityConfigvelocityConfig
forceVelocity
void
forceVelocity
(@Nonnull final Vector3d velocity, @Nullable final VelocityConfig velocityConfig, final boolean ignoreDamping)
Method forceVelocity.
- Parameters:
@Nonnull final Vector3dvelocity@Nullable final VelocityConfigvelocityConfigfinal booleanignoreDamping
processAddVelocityInstruction
void
processAddVelocityInstruction
(@Nonnull final Vector3d velocity, @Nullable final VelocityConfig velocityConfig)
Method processAddVelocityInstruction.
- Parameters:
@Nonnull final Vector3dvelocity@Nullable final VelocityConfigvelocityConfig
processSetVelocityInstruction
void
processSetVelocityInstruction
(@Nonnull final Vector3d velocity, @Nullable final VelocityConfig velocityConfig)
Method processSetVelocityInstruction.
- Parameters:
@Nonnull final Vector3dvelocity@Nullable final VelocityConfigvelocityConfig
isOnGround
boolean
isOnGround
()
Method isOnGround.
setArmor
Method setArmor.
- Parameters:
@Nonnull final NPCEntitynpcComponent@Nullable final String[]armor
isPickupDropOnDeath
boolean
isPickupDropOnDeath
()
Method isPickupDropOnDeath.
requiresLeashPosition
boolean
requiresLeashPosition
()
Method requiresLeashPosition.
clearOnce
void
clearOnce
()
Method clearOnce.
clearOnceIfNeeded
void
clearOnceIfNeeded
()
Method clearOnceIfNeeded.
setMarkedTarget
Method setMarkedTarget.
- Parameters:
@Nonnull final StringtargetSlot@Nonnull final Reftarget
isFriendly
boolean
isFriendly
(@Nonnull final Ref ref, @Nonnull final ComponentAccessor componentAccessor)
Method isFriendly.
- Parameters:
@Nonnull final Refref@Nonnull final ComponentAccessorcomponentAccessor
getAvoidanceMode
AvoidanceMode
getAvoidanceMode
()
Method getAvoidanceMode.
getCollisionRadius
double
getCollisionRadius
()
Method getCollisionRadius.
getFlockSpawnTypes
int[]
getFlockSpawnTypes
()
Method getFlockSpawnTypes.
IllegalStateException
new
IllegalStateException
(String.format("Role %s contains unknown FlockSpawnTypes NPC %s", this.roleName, this.flockSpawnTypes[i])
Method IllegalStateException.
- Parameters:
String.format("Role %s contains unknown FlockSpawnTypes NPC%s"this.roleNamethis.roleNamethis.flockSpawnTypes[i]this.flockSpawnTypes[i]
getFlockAllowedRoles
String[]
getFlockAllowedRoles
()
Method getFlockAllowedRoles.
isFlockSpawnTypesRandom
boolean
isFlockSpawnTypesRandom
()
Method isFlockSpawnTypesRandom.
isCanLeadFlock
boolean
isCanLeadFlock
()
Method isCanLeadFlock.
getFlockInfluenceRange
double
getFlockInfluenceRange
()
Method getFlockInfluenceRange.
getDeathAnimationTime
double
getDeathAnimationTime
()
Method getDeathAnimationTime.
getDeathInteraction
String
getDeathInteraction
()
Method getDeathInteraction.
getDespawnAnimationTime
float
getDespawnAnimationTime
()
Method getDespawnAnimationTime.
setReachedTerminalAction
void
setReachedTerminalAction
(final boolean hasReached)
Method setReachedTerminalAction.
- Parameters:
final booleanhasReached
hasReachedTerminalAction
boolean
hasReachedTerminalAction
()
Method hasReachedTerminalAction.
setFlag
void
setFlag
(final int index, final boolean value)
Method setFlag.
- Parameters:
final intindexfinal booleanvalue
NullPointerException
new
NullPointerException
(String.format("Trying to set a flag in role %s but flags are null", this.getRoleName()
Method NullPointerException.
- Parameters:
String.format("Trying to set a flag in role %s but flags arenull"this.getRoleName(this.getRoleName(
IllegalArgumentException
new
IllegalArgumentException
(String.format("Flag value cannot be less than 0 and must be less than array length %s. Value was %s", this.flags.length, index)
Method IllegalArgumentException.
- Parameters:
String.format("Flag value cannot be less than 0 and must be less than array length %s. Value was%s"this.flags.lengththis.flags.lengthindexindex
isFlagSet
boolean
isFlagSet
(final int index)
Method isFlagSet.
- Parameters:
final intindex
isBackingAway
boolean
isBackingAway
()
Method isBackingAway.
setBackingAway
void
setBackingAway
(final boolean backingAway)
Method setBackingAway.
- Parameters:
final booleanbackingAway
notifySensorMatch
void
notifySensorMatch
()
Method notifySensorMatch.
resetAllInstructions
void
resetAllInstructions
()
Method resetAllInstructions.
getSteeringMotionName
String
getSteeringMotionName
()
Method getSteeringMotionName.
componentCount
int
componentCount
()
Method componentCount.
getComponent
Method getComponent.
- Parameters:
final intindex
getIndex
int
getIndex
()
Method getIndex.
getLabel
String
getLabel
()
Method getLabel.
initialiseInventories
Method initialiseInventories.
- Parameters:
@Nonnull final NPCEntitynpcComponent
isCorpseStaysInFlock
boolean
isCorpseStaysInFlock
()
Method isCorpseStaysInFlock.
onLoadFromWorldGenOrPrefab
void
onLoadFromWorldGenOrPrefab
(@Nonnull final Ref ref, @Nonnull final NPCEntity npcComponent, @Nonnull final ComponentAccessor componentAccessor)
Method onLoadFromWorldGenOrPrefab.
- Parameters:
@Nonnull final Refref@Nonnull final NPCEntitynpcComponent@Nonnull final ComponentAccessorcomponentAccessor
AvoidanceMode
private
AvoidanceMode
(final String description)
Method AvoidanceMode.
- Parameters:
final Stringdescription
get
String
get
()
Method get.