Role

public class Role implements IAnnotatedComponentCollection

Class Role. Provides role functionality for the Hytale server.

java.lang.Object > Role

Field Summary

roleIndex

protected int roleIndex

Field roleIndex.

roleName

protected String roleName

Field roleName.

appearance

protected String appearance

Field appearance.

isActivated

protected boolean isActivated

Field isActivated.

activeMotionController

protected MotionController activeMotionController

Field activeMotionController.

flockSpawnTypeIndices

protected int[] flockSpawnTypeIndices

Field flockSpawnTypeIndices.

requiresLeashPosition

protected boolean requiresLeashPosition

Field requiresLeashPosition.

hasReachedTerminalAction

protected boolean hasReachedTerminalAction

Field hasReachedTerminalAction.

armor

protected String[] armor

Field armor.

flags

protected boolean[] flags

Field flags.

rootInstruction

protected Instruction rootInstruction

Field rootInstruction.

lastBodyMotionStep

protected Instruction lastBodyMotionStep

Field lastBodyMotionStep.

lastHeadMotionStep

protected Instruction lastHeadMotionStep

Field lastHeadMotionStep.

indexedInstructions

protected Instruction[] indexedInstructions

Field indexedInstructions.

interactionInstruction

protected Instruction interactionInstruction

Field interactionInstruction.

deathInstruction

protected Instruction deathInstruction

Field deathInstruction.

currentTreeModeStep

protected Instruction currentTreeModeStep

Field currentTreeModeStep.

roleChangeRequested

protected boolean roleChangeRequested

Field roleChangeRequested.

backingAway

protected boolean backingAway

Field backingAway.

npcComponent

final NPCEntity npcComponent

Field npcComponent.

instructions

final Instruction[] instructions

Field instructions.

stateTransitions

final StateTransitionController stateTransitions

Field stateTransitions.

motionController

final MotionController motionController

Field motionController.

action

final DeferredAction action

Field action.

isDead

final boolean isDead

Field isDead.

nextBodyMotionStep

final Instruction nextBodyMotionStep

Field nextBodyMotionStep.

nextHeadMotionStep

final Instruction nextHeadMotionStep

Field nextHeadMotionStep.

targetRef

final Ref targetRef

Field targetRef.

targetTransformComponent

final TransformComponent targetTransformComponent

Field targetTransformComponent.

distance

final double distance

Field distance.

s

final double s

Field s.

sumOfDistances

final Vector3d sumOfDistances

Field sumOfDistances.

speed

final double speed

Field speed.

length

final int length

Field length.

index

final int index

Field index.

old

final Instruction old

Field old.

itemModule

final ItemModule itemModule

Field itemModule.

inventorySlots

final int inventorySlots

Field inventorySlots.

inventory

final ItemContainer inventory

Field inventory.

inventory2

final Inventory inventory2

Field inventory2.

hotbar

final ItemContainer hotbar

Field hotbar.

items

final List items

Field items.

Method Detail

Role

public public Role (@Nonnull final BuilderRole builder, @Nonnull final BuilderSupport builderSupport)

Method Role.

Parameters:
@Nonnull final BuilderRole builder
@Nonnull final BuilderSupport builderSupport

getInitialMaxHealth

public int getInitialMaxHealth ()

Method getInitialMaxHealth.

isAvoidingEntities

public boolean isAvoidingEntities ()

Method isAvoidingEntities.

getCollisionProbeDistance

public double getCollisionProbeDistance ()

Method getCollisionProbeDistance.

isApplySeparation

public boolean isApplySeparation ()

Method isApplySeparation.

getSeparationDistance

public double getSeparationDistance ()

Method getSeparationDistance.

getRootInstruction

public Instruction getRootInstruction ()

Method getRootInstruction.

getInteractionInstruction

public Instruction getInteractionInstruction ()

Method getInteractionInstruction.

getDeathInstruction

public Instruction getDeathInstruction ()

Method getDeathInstruction.

getBodySteering

public Steering getBodySteering ()

Method getBodySteering.

getHeadSteering

public Steering getHeadSteering ()

Method getHeadSteering.

getIgnoredEntitiesForAvoidance

public Set> getIgnoredEntitiesForAvoidance ()

Method getIgnoredEntitiesForAvoidance.

getDropListId

public String getDropListId ()

Method getDropListId.

getBalanceAsset

public String getBalanceAsset ()

Method getBalanceAsset.

getInteractionVars

public String> getInteractionVars ()

Method getInteractionVars.

isMemory

public boolean isMemory ()

Method isMemory.

getMemoriesNameOverride

public String getMemoriesNameOverride ()

Method getMemoriesNameOverride.

getNameTranslationKey

public String getNameTranslationKey ()

Method getNameTranslationKey.

isMemoriesNameOverriden

public boolean isMemoriesNameOverriden ()

Method isMemoriesNameOverriden.

getSpawnLockTime

public float getSpawnLockTime ()

Method getSpawnLockTime.

postRoleBuilt

public void postRoleBuilt (@Nonnull final BuilderSupport builderSupport)

Method postRoleBuilt.

Parameters:
@Nonnull final BuilderSupport builderSupport

loaded

public void loaded ()

Method loaded.

spawned

public void spawned (@Nonnull final Holder holder, @Nonnull final NPCEntity npcComponent)

Method spawned.

Parameters:
@Nonnull final Holder holder
@Nonnull final NPCEntity npcComponent

unloaded

public void unloaded ()

Method unloaded.

removed

public void removed ()

Method removed.

teleported

public void teleported (@Nonnull final World from, @Nonnull final World to)

Method teleported.

Parameters:
@Nonnull final World from
@Nonnull final World to

getAppearanceName

public String getAppearanceName ()

Method getAppearanceName.

getActiveMotionController

public MotionController getActiveMotionController ()

Method getActiveMotionController.

getCombatSupport

public CombatSupport getCombatSupport ()

Method getCombatSupport.

getStateSupport

public StateSupport getStateSupport ()

Method getStateSupport.

getWorldSupport

public WorldSupport getWorldSupport ()

Method getWorldSupport.

getMarkedEntitySupport

public MarkedEntitySupport getMarkedEntitySupport ()

Method getMarkedEntitySupport.

getPositionCache

public PositionCache getPositionCache ()

Method getPositionCache.

getEntitySupport

public EntitySupport getEntitySupport ()

Method getEntitySupport.

getDebugSupport

public DebugSupport getDebugSupport ()

Method getDebugSupport.

isRoleChangeRequested

public boolean isRoleChangeRequested ()

Method isRoleChangeRequested.

setRoleChangeRequested

public void setRoleChangeRequested ()

Method setRoleChangeRequested.

setActiveMotionController

public boolean setActiveMotionController (@Nullable final Ref ref, @Nonnull final NPCEntity npcComponent, @Nonnull final String name, @Nullable final ComponentAccessor componentAccessor)

Method setActiveMotionController.

Parameters:
@Nullable final Ref ref
@Nonnull final NPCEntity npcComponent
@Nonnull final String name
@Nullable final ComponentAccessor componentAccessor

motionControllerChanged

protected void motionControllerChanged (@Nullable final Ref ref, @Nonnull final NPCEntity npcComponent, @Nullable final MotionController motionController, @Nullable final ComponentAccessor componentAccessor)

Method motionControllerChanged.

Parameters:
@Nullable final Ref ref
@Nonnull final NPCEntity npcComponent
@Nullable final MotionController motionController
@Nullable final ComponentAccessor componentAccessor

setMotionControllers

public void setMotionControllers (@Nonnull final NPCEntity npcComponent, @Nonnull final Map motionControllers, @Nullable final String initialMotionController)

Method setMotionControllers.

Parameters:
@Nonnull final NPCEntity npcComponent
@Nonnull final Map motionControllers
@Nullable final String initialMotionController

updateMotionControllers

public void updateMotionControllers (@Nullable final Ref ref, @Nullable final Model model, @Nullable final Box boundingBox, @Nullable final ComponentAccessor componentAccessor)

Method updateMotionControllers.

Parameters:
@Nullable final Ref ref
@Nullable final Model model
@Nullable final Box boundingBox
@Nullable final ComponentAccessor componentAccessor

updateMovementState

public void updateMovementState (@Nonnull final Ref ref, @Nonnull final MovementStates movementStates, @Nonnull final Vector3d velocity, @Nonnull final ComponentAccessor componentAccessor)

Method updateMovementState.

Parameters:
@Nonnull final Ref ref
@Nonnull final MovementStates movementStates
@Nonnull final Vector3d velocity
@Nonnull final ComponentAccessor componentAccessor

tick

public void tick (@Nonnull final Ref ref, final float tickTime, @Nonnull final Store store)

Method tick.

Parameters:
@Nonnull final Ref ref
final float tickTime
@Nonnull final Store store

addDeferredAction

public void addDeferredAction (@Nonnull final DeferredAction handler)

Method addDeferredAction.

Parameters:
@Nonnull final DeferredAction handler

computeActionsAndSteering

protected 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 Ref ref
final double tickTime
@Nonnull final Steering bodySteering
@Nonnull final Steering headSteering
@Nonnull final Store store

blendSeparation

public 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 Ref selfRef
@Nonnull final Vector3d position
@Nonnull final Steering steering
@Nonnull final ComponentType transformComponentType
@Nonnull final CommandBuffer commandBuffer

if

public else if (distance < this.separationFarRadiusTarget * this.separationFarRadiusTarget)

Method if.

Parameters:
distance < this.separationFarRadiusTarget * this.separationFarRadiusTarget

getLastSeparationSteering

public Vector3d getLastSeparationSteering ()

Method getLastSeparationSteering.

blendAvoidance

public void blendAvoidance (@Nonnull final Ref ref, @Nonnull final Vector3d position, @Nonnull final Steering steering, @Nonnull final CommandBuffer commandBuffer)

Method blendAvoidance.

Parameters:
@Nonnull final Ref ref
@Nonnull final Vector3d position
@Nonnull final Steering steering
@Nonnull final CommandBuffer commandBuffer

getLastAvoidanceSteering

public Vector3d getLastAvoidanceSteering ()

Method getLastAvoidanceSteering.

resetInstruction

public void resetInstruction (final int instruction)

Method resetInstruction.

Parameters:
final int instruction

getRoleName

public String getRoleName ()

Method getRoleName.

getRoleIndex

public int getRoleIndex ()

Method getRoleIndex.

setRoleIndex

public void setRoleIndex (final int roleIndex, @Nonnull final String roleName)

Method setRoleIndex.

Parameters:
final int roleIndex
@Nonnull final String roleName

isInvulnerable

public boolean isInvulnerable ()

Method isInvulnerable.

isBreathesInAir

public boolean isBreathesInAir ()

Method isBreathesInAir.

isBreathesInWater

public boolean isBreathesInWater ()

Method isBreathesInWater.

getInertia

public double getInertia ()

Method getInertia.

getKnockbackScale

public double getKnockbackScale ()

Method getKnockbackScale.

canBreathe

public boolean canBreathe (@Nonnull final BlockMaterial breathingMaterial, final int fluidId)

Method canBreathe.

Parameters:
@Nonnull final BlockMaterial breathingMaterial
final int fluidId

couldBreathe

public boolean couldBreathe (@Nonnull final BlockMaterial breathingMaterial, final int fluidId)

Method couldBreathe.

Parameters:
@Nonnull final BlockMaterial breathingMaterial
final int fluidId

couldBreatheCached

public boolean couldBreatheCached ()

Method couldBreatheCached.

addForce

public void addForce (@Nonnull final Vector3d velocity, @Nullable final VelocityConfig velocityConfig)

Method addForce.

Parameters:
@Nonnull final Vector3d velocity
@Nullable final VelocityConfig velocityConfig

forceVelocity

public void forceVelocity (@Nonnull final Vector3d velocity, @Nullable final VelocityConfig velocityConfig, final boolean ignoreDamping)

Method forceVelocity.

Parameters:
@Nonnull final Vector3d velocity
@Nullable final VelocityConfig velocityConfig
final boolean ignoreDamping

processAddVelocityInstruction

public void processAddVelocityInstruction (@Nonnull final Vector3d velocity, @Nullable final VelocityConfig velocityConfig)

Method processAddVelocityInstruction.

Parameters:
@Nonnull final Vector3d velocity
@Nullable final VelocityConfig velocityConfig

processSetVelocityInstruction

public void processSetVelocityInstruction (@Nonnull final Vector3d velocity, @Nullable final VelocityConfig velocityConfig)

Method processSetVelocityInstruction.

Parameters:
@Nonnull final Vector3d velocity
@Nullable final VelocityConfig velocityConfig

isOnGround

public boolean isOnGround ()

Method isOnGround.

setArmor

public void setArmor (@Nonnull final NPCEntity npcComponent, @Nullable final String[] armor)

Method setArmor.

Parameters:
@Nonnull final NPCEntity npcComponent
@Nullable final String[] armor

isPickupDropOnDeath

public boolean isPickupDropOnDeath ()

Method isPickupDropOnDeath.

requiresLeashPosition

public boolean requiresLeashPosition ()

Method requiresLeashPosition.

clearOnce

public void clearOnce ()

Method clearOnce.

clearOnceIfNeeded

public void clearOnceIfNeeded ()

Method clearOnceIfNeeded.

setMarkedTarget

public void setMarkedTarget (@Nonnull final String targetSlot, @Nonnull final Ref target)

Method setMarkedTarget.

Parameters:
@Nonnull final String targetSlot
@Nonnull final Ref target

isFriendly

public boolean isFriendly (@Nonnull final Ref ref, @Nonnull final ComponentAccessor componentAccessor)

Method isFriendly.

Parameters:
@Nonnull final Ref ref
@Nonnull final ComponentAccessor componentAccessor

isIgnoredForAvoidance

public boolean isIgnoredForAvoidance (@Nonnull final Ref entityReference)

Method isIgnoredForAvoidance.

Parameters:
@Nonnull final Ref entityReference

getAvoidanceMode

public AvoidanceMode getAvoidanceMode ()

Method getAvoidanceMode.

getCollisionRadius

public double getCollisionRadius ()

Method getCollisionRadius.

getFlockSpawnTypes

public int[] getFlockSpawnTypes ()

Method getFlockSpawnTypes.

IllegalStateException

public 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.roleName this.roleName
this.flockSpawnTypes[i] this.flockSpawnTypes[i]

getFlockAllowedRoles

public String[] getFlockAllowedRoles ()

Method getFlockAllowedRoles.

isFlockSpawnTypesRandom

public boolean isFlockSpawnTypesRandom ()

Method isFlockSpawnTypesRandom.

isCanLeadFlock

public boolean isCanLeadFlock ()

Method isCanLeadFlock.

getFlockInfluenceRange

public double getFlockInfluenceRange ()

Method getFlockInfluenceRange.

getDeathAnimationTime

public double getDeathAnimationTime ()

Method getDeathAnimationTime.

getDeathInteraction

public String getDeathInteraction ()

Method getDeathInteraction.

getDespawnAnimationTime

public float getDespawnAnimationTime ()

Method getDespawnAnimationTime.

setReachedTerminalAction

public void setReachedTerminalAction (final boolean hasReached)

Method setReachedTerminalAction.

Parameters:
final boolean hasReached

hasReachedTerminalAction

public boolean hasReachedTerminalAction ()

Method hasReachedTerminalAction.

setFlag

public void setFlag (final int index, final boolean value)

Method setFlag.

Parameters:
final int index
final boolean value

NullPointerException

public 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 are null"
this.getRoleName( this.getRoleName(

IllegalArgumentException

public 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.length this.flags.length
index index

isFlagSet

public boolean isFlagSet (final int index)

Method isFlagSet.

Parameters:
final int index

isBackingAway

public boolean isBackingAway ()

Method isBackingAway.

setBackingAway

public void setBackingAway (final boolean backingAway)

Method setBackingAway.

Parameters:
final boolean backingAway

swapTreeModeSteps

public Instruction swapTreeModeSteps (final Instruction newStep)

Method swapTreeModeSteps.

Parameters:
final Instruction newStep

notifySensorMatch

public void notifySensorMatch ()

Method notifySensorMatch.

resetAllInstructions

public void resetAllInstructions ()

Method resetAllInstructions.

getSteeringMotionName

public String getSteeringMotionName ()

Method getSteeringMotionName.

componentCount

public int componentCount ()

Method componentCount.

getComponent

public IAnnotatedComponent getComponent (final int index)

Method getComponent.

Parameters:
final int index

getInfo

public void getInfo (final Role role, final ComponentInfo holder)

Method getInfo.

Parameters:
final Role role
final ComponentInfo holder

getIndex

public int getIndex ()

Method getIndex.

setContext

public void setContext (final IAnnotatedComponent parent, final int index)

Method setContext.

Parameters:
final IAnnotatedComponent parent
final int index

getParent

public IAnnotatedComponent getParent ()

Method getParent.

getLabel

public String getLabel ()

Method getLabel.

initialiseInventories

private void initialiseInventories (@Nonnull final NPCEntity npcComponent)

Method initialiseInventories.

Parameters:
@Nonnull final NPCEntity npcComponent

isCorpseStaysInFlock

public boolean isCorpseStaysInFlock ()

Method isCorpseStaysInFlock.

onLoadFromWorldGenOrPrefab

public void onLoadFromWorldGenOrPrefab (@Nonnull final Ref ref, @Nonnull final NPCEntity npcComponent, @Nonnull final ComponentAccessor componentAccessor)

Method onLoadFromWorldGenOrPrefab.

Parameters:
@Nonnull final Ref ref
@Nonnull final NPCEntity npcComponent
@Nonnull final ComponentAccessor componentAccessor

getRoleStats

public RoleStats getRoleStats ()

Method getRoleStats.

AvoidanceMode

public private AvoidanceMode (final String description)

Method AvoidanceMode.

Parameters:
final String description

get

public String get ()

Method get.