Class BuilderRole

All Implemented Interfaces:
NamedSchema, SchemaConvertable<Void>, Builder<Role>, BuilderContext, RoleBuilder, SpawnEffect, ISpawnable, ISpawnableWithModel
Direct Known Subclasses:
BuilderRoleAbstract

public class BuilderRole extends SupportConfigBuilder<Role> implements ISpawnableWithModel, SpawnEffect, RoleBuilder
  • Constructor Details

    • BuilderRole

      public BuilderRole()
  • Method Details

    • isSpawnable

      public boolean isSpawnable()
      Specified by:
      isSpawnable in interface Builder<Role>
    • getShortDescription

      @Nonnull public String getShortDescription()
      Specified by:
      getShortDescription in class BuilderBase<Role>
    • getLongDescription

      @Nonnull public String getLongDescription()
      Specified by:
      getLongDescription in class BuilderBase<Role>
    • getBuilderDescriptorState

      @Nonnull public BuilderDescriptorState getBuilderDescriptorState()
      Specified by:
      getBuilderDescriptorState in interface Builder<Role>
      Specified by:
      getBuilderDescriptorState in class BuilderBase<Role>
    • build

      @Nonnull public Role build(@Nonnull BuilderSupport builderSupport)
      Specified by:
      build in interface Builder<Role>
    • createAndAttach

      @Nonnull public Role createAndAttach(@Nonnull Holder<EntityStore> holder, @Nonnull BuilderSupport builderSupport)
      Specified by:
      createAndAttach in interface RoleBuilder
    • validate

      public boolean validate(String configName, @Nonnull NPCLoadTimeValidationHelper validationHelper, @Nonnull ExecutionContext context, Scope globalScope, @Nonnull List<String> errors)
      Description copied from interface: Builder
      Iterates the builder tree and validates all present dynamic value holders based on the execution context and scope provided. Will also run an optional ILoadTimeValidationHelper
      Specified by:
      validate in interface Builder<Role>
      Overrides:
      validate in class BuilderBase<Role>
      Parameters:
      configName - the name of the parent file from which the execution context and scope are derived
      validationHelper - an optional validation helper that will be run in certain contexts depending on implementations
      context - the execution context for resolving value holders
      globalScope - the scope for resolving value holders
      errors - a list for storing any errors encountered
      Returns:
      false if any errors were encountered during validation, true otherwise
    • readConfig

      @Nonnull public BuilderRole readConfig(@Nonnull com.google.gson.JsonElement data)
      Overrides:
      readConfig in class SupportConfigBuilder<Role>
    • getIdentifier

      @Nonnull public String getIdentifier()
      Specified by:
      getIdentifier in interface ISpawnable
      Returns:
      the unique identifier of the spawnable class type
    • canSpawn

      @Nonnull public SpawnTestResult canSpawn(@Nonnull SpawningContext context)
      Description copied from interface: ISpawnable
      Called to test whether this spawnable class type is spawnable regarding the given context
      Specified by:
      canSpawn in interface ISpawnable
      Parameters:
      context - The SpawningContext to test against
      Returns:
      true if this spawnable can spawn, false if otherwise
    • requiresSpawnDropHeightCheck

      public boolean requiresSpawnDropHeightCheck(@Nonnull SpawningContext context)
      Description copied from interface: ISpawnable
      Called to test whether a spawn drop height check applies to this spawnable for the given context.

      The motion controller that supports the movement mode in the context resolves the answer. An implementation that cannot resolve it returns true, so the caller keeps the check.

      Specified by:
      requiresSpawnDropHeightCheck in interface ISpawnable
      Parameters:
      context - The SpawningContext to test against
      Returns:
      true if the caller must check the spawn drop height, false if otherwise
    • getSpawnPlacement

      @Nonnull public SpawnPositionPlacement getSpawnPlacement(@Nonnull SpawningContext context)
      Description copied from interface: ISpawnable
      Query where a spawn position for this spawnable must sit for the movement mode in the context.

      The motion controller that supports the movement mode in the context resolves the answer. An implementation that cannot resolve it returns SpawnPositionPlacement.ON_GROUND.

      A position search uses the answer to place its candidates. The spawnable still judges the finished candidate in ISpawnable.canSpawn(SpawningContext).

      Specified by:
      getSpawnPlacement in interface ISpawnable
      Parameters:
      context - The SpawningContext to test against
      Returns:
      the placement a spawn position must have
    • getMovementModes

      public void getMovementModes(@Nonnull SpawningContext context, @Nonnull Set<MovementMode> outSupportedMovementModes, @Nonnull Set<MovementMode> outDefaultMovementModes, @Nonnull Set<MovementMode> outSafeMovementModes)
      Description copied from interface: ISpawnable
      Query all movement mode sets for this spawnable.
      Specified by:
      getMovementModes in interface ISpawnable
      Parameters:
      context - The SpawningContext to test against
      outSupportedMovementModes - Populated with every movement mode the NPC's motion controller is capable of. Must be cleared before population.
      outDefaultMovementModes - Populated with the movement modes used when no user configuration is present. Must be cleared before population.
      outSafeMovementModes - Populated with movement modes the NPC can use safely given its breathing configuration (e.g. air-breathing walkers exclude UNDERWATER_WALK). Must be cleared before population.
    • category

      @Nonnull public Class<Role> category()
      Specified by:
      category in interface Builder<Role>
    • getSpawnModelName

      public String getSpawnModelName(ExecutionContext context, Scope modifierScope)
      Specified by:
      getSpawnModelName in interface ISpawnableWithModel
    • createModifierScope

      @Nullable public Scope createModifierScope(ExecutionContext executionContext)
      Specified by:
      createModifierScope in interface ISpawnableWithModel
    • createExecutionScope

      @Nonnull public Scope createExecutionScope()
      Specified by:
      createExecutionScope in interface ISpawnableWithModel
    • markNeedsReload

      public void markNeedsReload()
      Specified by:
      markNeedsReload in interface ISpawnableWithModel
    • getSpawnParticles

      public String getSpawnParticles(@Nonnull BuilderSupport support)
      Specified by:
      getSpawnParticles in interface SpawnEffect
    • getSpawnParticleOffset

      public org.joml.Vector3d getSpawnParticleOffset(@Nonnull BuilderSupport support)
      Specified by:
      getSpawnParticleOffset in interface SpawnEffect
    • getSpawnParticleTargetNode

      public String getSpawnParticleTargetNode(@Nonnull BuilderSupport support)
      Specified by:
      getSpawnParticleTargetNode in interface SpawnEffect
    • isSpawnParticleDetached

      public boolean isSpawnParticleDetached(@Nonnull BuilderSupport support)
      Specified by:
      isSpawnParticleDetached in interface SpawnEffect
    • getSpawnViewDistance

      public double getSpawnViewDistance()
      Specified by:
      getSpawnViewDistance in interface SpawnEffect
    • isEnabled

      public final boolean isEnabled(ExecutionContext context)
      Specified by:
      isEnabled in interface Builder<Role>
    • getMaxHealth

      public int getMaxHealth(@Nonnull BuilderSupport builderSupport)
    • getDisplayNames

      @Nullable public String[] getDisplayNames()
    • getHiddenUIComponents

      @Nullable public String[] getHiddenUIComponents(@Nonnull BuilderSupport builderSupport)
    • getNameTranslationKey

      public String getNameTranslationKey(BuilderSupport support)
    • getAppearance

      public String getAppearance(@Nonnull BuilderSupport builderSupport)
    • breathesInAir

      public boolean breathesInAir(@Nonnull ExecutionContext context, @Nullable Scope modifierScope)
      Description copied from interface: ISpawnableWithModel
      Return whether this spawnable can breathe in air. Defaults to true matching the standard role default.
      Specified by:
      breathesInAir in interface ISpawnableWithModel
    • breathesInWater

      public boolean breathesInWater(@Nonnull ExecutionContext context, @Nullable Scope modifierScope)
      Description copied from interface: ISpawnableWithModel
      Return whether this spawnable can breathe in water. Defaults to false matching the standard role default.
      Specified by:
      breathesInWater in interface ISpawnableWithModel
    • getOpaqueBlockSet

      public int getOpaqueBlockSet()
    • getInertia

      public double getInertia()
    • getKnockbackScale

      public double getKnockbackScale(@Nonnull BuilderSupport support)
    • useFixedKnockback

      public boolean useFixedKnockback(@Nonnull BuilderSupport support)
    • getHotbarItems

      @Nullable public String[] getHotbarItems(@Nonnull BuilderSupport support)
    • getOffHandItems

      @Nullable public String[] getOffHandItems(@Nonnull BuilderSupport support)
    • getInventoryItemsDropList

      public String getInventoryItemsDropList(@Nonnull BuilderSupport support)
    • getArmor

      public String[] getArmor()
    • isPickupDropOnDeath

      public boolean isPickupDropOnDeath()
    • getDropListId

      public String getDropListId(@Nonnull BuilderSupport builderSupport)
    • getCollisionDistance

      public double getCollisionDistance()
    • getCollisionForceFalloff

      public double getCollisionForceFalloff()
    • isAvoidingEntities

      public boolean isAvoidingEntities()
    • getAvoidanceMode

      public Role.AvoidanceMode getAvoidanceMode(BuilderSupport builderSupport)
    • getSeparationMode

      public Role.SeparationMode getSeparationMode(BuilderSupport builderSupport)
    • getSeparationSafeDistanceMultiplier

      public double getSeparationSafeDistanceMultiplier(BuilderSupport builderSupport)
    • getSeparationLegacySteeringStrength

      public double getSeparationLegacySteeringStrength(BuilderSupport builderSupport)
    • getSeparationPushSteeringStrength

      public double getSeparationPushSteeringStrength(BuilderSupport builderSupport)
    • getSeparationPushDistanceWeightDefault

      public double getSeparationPushDistanceWeightDefault(BuilderSupport builderSupport)
    • getSeparationPushDistanceWeightTarget

      public double getSeparationPushDistanceWeightTarget(BuilderSupport builderSupport)
    • getSeparationPushDistanceWeightAttacker

      public double getSeparationPushDistanceWeightAttacker(BuilderSupport builderSupport)
    • getSeparationPushSpeedScale

      public double getSeparationPushSpeedScale(BuilderSupport builderSupport)
    • getOverrideUseOrientationHint

      public FeatureOverride getOverrideUseOrientationHint(BuilderSupport builderSupport)
    • getOverrideAlwaysSeparate

      public FeatureOverride getOverrideAlwaysSeparate(BuilderSupport builderSupport)
    • getOverrideNormalizeDistances

      public FeatureOverride getOverrideNormalizeDistances(BuilderSupport builderSupport)
    • getCollisionRadius

      public double getCollisionRadius()
    • getSeparationDistance

      public double getSeparationDistance(BuilderSupport support)
    • getSeparationWeight

      public double getSeparationWeight(BuilderSupport support)
    • getSeparationDistanceTarget

      public double getSeparationDistanceTarget(BuilderSupport support)
    • getSeparationNearRadiusTarget

      public double getSeparationNearRadiusTarget(BuilderSupport support)
    • getSeparationFarRadiusTarget

      public double getSeparationFarRadiusTarget(BuilderSupport support)
    • isApplySeparation

      public boolean isApplySeparation(BuilderSupport support)
    • isAvoidanceFallCheck

      public boolean isAvoidanceFallCheck(BuilderSupport builderSupport)
    • isStayingInEnvironment

      public boolean isStayingInEnvironment()
    • getAllowedEnvironments

      public String getAllowedEnvironments()
    • getEntityAvoidanceStrength

      public double getEntityAvoidanceStrength()
    • isOverridingHeadPitchAngle

      public boolean isOverridingHeadPitchAngle(@Nonnull BuilderSupport support)
    • getHeadPitchAngleRange

      public float[] getHeadPitchAngleRange(@Nonnull BuilderSupport support)
    • getFlockSpawnTypes

      @Nullable public String[] getFlockSpawnTypes(@Nonnull BuilderSupport support)
    • isFlockSpawnTypeRandom

      public boolean isFlockSpawnTypeRandom(@Nonnull BuilderSupport support)
    • getFlockAllowedRoles

      @Nonnull public String[] getFlockAllowedRoles(@Nonnull BuilderSupport support)
    • isCanLeadFlock

      public boolean isCanLeadFlock(@Nonnull BuilderSupport support)
    • getFlockWeightAlignment

      public double getFlockWeightAlignment()
    • getFlockWeightSeparation

      public double getFlockWeightSeparation()
    • getFlockWeightCohesion

      public double getFlockWeightCohesion()
    • getFlockInfluenceRange

      public double getFlockInfluenceRange()
    • getCollisionViewAngle

      public float getCollisionViewAngle()
    • getBalanceAsset

      @Nullable public String getBalanceAsset(@Nonnull BuilderSupport support)
    • getDeathAnimationTime

      public double getDeathAnimationTime(@Nonnull BuilderSupport support)
    • getDeathParticles

      public String getDeathParticles(@Nonnull BuilderSupport support)
    • isDropDeathItemsInstantly

      public boolean isDropDeathItemsInstantly(@Nonnull BuilderSupport support)
    • getDeathInteraction

      @Nullable public String getDeathInteraction(@Nonnull BuilderSupport builderSupport)
    • getDespawnAnimationTime

      public float getDespawnAnimationTime()
    • isInvulnerable

      public boolean isInvulnerable(BuilderSupport support)
    • isIgnoreDisableNPCIncomingDamage

      public boolean isIgnoreDisableNPCIncomingDamage(BuilderSupport support)
    • getInventorySlots

      public int getInventorySlots()
    • getHotbarSlots

      public int getHotbarSlots()
    • getOffHandSlots

      public int getOffHandSlots()
    • getDefaultOffHandSlot

      public byte getDefaultOffHandSlot(@Nonnull BuilderSupport support)
    • isCorpseStaysInFlock

      public boolean isCorpseStaysInFlock()
    • getMotionControllerMap

      @Nullable public Map<String, MotionController> getMotionControllerMap(@Nonnull BuilderSupport support)
    • getInitialMotionController

      public String getInitialMotionController(@Nonnull BuilderSupport support)
    • getInstructionList

      @Nullable public List<Instruction> getInstructionList(@Nonnull BuilderSupport support)
    • getInteractionInstruction

      @Nullable public Instruction getInteractionInstruction(@Nonnull BuilderSupport support)
    • getDeathInstruction

      @Nullable public Instruction getDeathInstruction(@Nonnull BuilderSupport support)
    • registerStateEvaluator

      public void registerStateEvaluator(@Nonnull BuilderSupport support)
    • getInteractionVars

      @Nullable public Map<String,String> getInteractionVars(@Nonnull BuilderSupport support)
    • isMemory

      public boolean isMemory(ExecutionContext context)
    • isMemory

      public boolean isMemory(ExecutionContext context, Scope modifierScope)
      Specified by:
      isMemory in interface ISpawnableWithModel
    • getMemoriesCategory

      public String getMemoriesCategory(ExecutionContext context, Scope modifierScope)
      Specified by:
      getMemoriesCategory in interface ISpawnableWithModel
    • getMemoriesNameOverride

      public String getMemoriesNameOverride(ExecutionContext context)
    • getMemoriesNameOverride

      public String getMemoriesNameOverride(ExecutionContext context, @Nullable Scope modifierScope)
      Specified by:
      getMemoriesNameOverride in interface ISpawnableWithModel
    • getMemoriesUnlockedBy

      public Role.MemoriesUnlockMethod getMemoriesUnlockedBy(ExecutionContext context)
    • getMemoriesUnlockedBy

      public Role.MemoriesUnlockMethod getMemoriesUnlockedBy(ExecutionContext context, @Nullable Scope modifierScope)
      Specified by:
      getMemoriesUnlockedBy in interface ISpawnableWithModel
    • getMemoriesKillRange

      public double getMemoriesKillRange(ExecutionContext context)
    • getMemoriesKillRange

      public double getMemoriesKillRange(ExecutionContext context, @Nullable Scope modifierScope)
      Specified by:
      getMemoriesKillRange in interface ISpawnableWithModel
    • getNameTranslationKey

      @Nonnull public String getNameTranslationKey(ExecutionContext context, @Nullable Scope modifierScope)
      Specified by:
      getNameTranslationKey in interface ISpawnableWithModel
    • getSpawnLockTime

      public float getSpawnLockTime(BuilderSupport support)