Package: com.hypixel.hytale.server.npc.role
public class Role implements IAnnotatedComponentCollection
The central runtime object for an NPC. Constructed from a BuilderRole and BuilderSupport, it owns all support subsystems (CombatSupport, StateSupport, MarkedEntitySupport, WorldSupport, EntitySupport, PositionCache, DebugSupport), the behavior instruction tree, motion controller map, steering accumulators, avoidance/separation configuration, flock parameters, inventory configuration, and lifecycle methods. The tick method drives the NPC’s per-frame behavior: deferred actions, instruction tree evaluation, motion step selection, and steering computation.
Modifier Type Name Value public static finaldoubleINTERACTION_PLAYER_DISTANCE10.0public static finalbooleanDEBUG_APPLIED_FORCESfalse
Modifier Return Type Signature @Nonnull publicCombatSupportgetCombatSupport()@Nonnull publicStateSupportgetStateSupport()@Nonnull publicWorldSupportgetWorldSupport()@Nonnull publicMarkedEntitySupportgetMarkedEntitySupport()@Nonnull publicPositionCachegetPositionCache()@Nonnull publicEntitySupportgetEntitySupport()@Nonnull publicDebugSupportgetDebugSupport()
Modifier Return Type Signature publicvoidpostRoleBuilt(@Nonnull BuilderSupport builderSupport)publicvoidloaded()publicvoidspawned(@Nonnull Holder<EntityStore> holder, @Nonnull NPCEntity npcComponent)publicvoidunloaded()publicvoidremoved()publicvoidteleported(@Nonnull World from, @Nonnull World to)publicvoidtick(@Nonnull Ref<EntityStore> ref, float tickTime, @Nonnull Store<EntityStore> store)
Modifier Return Type Signature publicMotionControllergetActiveMotionController()publicbooleansetActiveMotionController(@Nullable Ref<EntityStore> ref, @Nonnull NPCEntity npcComponent, @Nonnull String name, @Nullable ComponentAccessor<EntityStore> componentAccessor)publicvoidsetMotionControllers(@Nonnull NPCEntity npcComponent, @Nonnull Map<String, MotionController> motionControllers, @Nullable String initialMotionController)publicvoidupdateMotionControllers(@Nullable Ref<EntityStore> ref, @Nullable Model model, @Nullable Box boundingBox, @Nullable ComponentAccessor<EntityStore> componentAccessor)
Modifier Return Type Signature @Nonnull publicSteeringgetBodySteering()@Nonnull publicSteeringgetHeadSteering()publicvoidblendSeparation(@Nonnull Ref<EntityStore> selfRef, @Nonnull Vector3d position, @Nonnull Steering steering, ...)publicvoidblendAvoidance(@Nonnull Ref<EntityStore> ref, @Nonnull Vector3d position, @Nonnull Steering steering, @Nonnull CommandBuffer<EntityStore> commandBuffer)@Nonnull publicVector3dgetLastSeparationSteering()@Nonnull publicVector3dgetLastAvoidanceSteering()publicAvoidanceModegetAvoidanceMode()
Modifier Return Type Signature publicStringgetRoleName()publicintgetRoleIndex()publicintgetInitialMaxHealth()publicbooleanisInvulnerable()publicbooleanisBreathesInAir()publicbooleanisBreathesInWater()publicbooleancanBreathe(@Nonnull BlockMaterial breathingMaterial, int fluidId)publicbooleanisOnGround()publicbooleanisFriendly(@Nonnull Ref<EntityStore> ref, @Nonnull ComponentAccessor<EntityStore> componentAccessor)publicInstructiongetRootInstruction()@Nullable publicInstructiongetInteractionInstruction()@Nullable publicInstructiongetDeathInstruction()publicStringgetDropListId()@Nullable publicStringgetBalanceAsset()publicbooleanisMemory()
public static enum AvoidanceMode implements Supplier < String > {
Slowdown ( " Only slow down NPC " ),
Any ( " Any avoidance allowed " );
public interface DeferredAction {
boolean tick ( @ Nonnull Ref < EntityStore > ref , @ Nonnull Role role , double dt , @ Nonnull Store < EntityStore > store ) ;
Returns true when the action is complete and should be removed.
Hydex is an independent community resource. Hytale is a trademark of Hypixel Studios. Hydex is not affiliated with or endorsed by Hypixel Studios.