Class JobCavalry

All Implemented Interfaces:
IJob<AbstractEntityAIGuard<JobCavalry,? extends AbstractBuildingGuards>>, net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>

public class JobCavalry extends AbstractJobGuard<JobCavalry>
The Cavalry job class.
  • Field Details

    • MOUNT_DAMAGE_SPLIT

      public static final float MOUNT_DAMAGE_SPLIT
      See Also:
    • DININGHALL_HORSE_PARKING_RANGE

      public static final int DININGHALL_HORSE_PARKING_RANGE
      See Also:
    • myMount

      protected UUID myMount
      The UUID of the mount.
  • Constructor Details

    • JobCavalry

      public JobCavalry(ICitizenData entity)
      Initialize citizen data.
      Parameters:
      entity - the citizen data.
  • Method Details

    • generateGuardAI

      public EntityAICavalry generateGuardAI()
      Specified by:
      generateGuardAI in class AbstractJobGuard<JobCavalry>
    • onLevelUp

      public void onLevelUp()
      Fired when level increases.
    • getModel

      public net.minecraft.resources.ResourceLocation getModel()
      Description copied from interface: IJob
      Get the RenderBipedCitizen.Model to use when the Citizen performs this job role.
      Specified by:
      getModel in interface IJob<AbstractEntityAIGuard<JobCavalry,? extends AbstractBuildingGuards>>
      Overrides:
      getModel in class AbstractJob<AbstractEntityAIGuard<JobCavalry,? extends AbstractBuildingGuards>,JobCavalry>
      Returns:
      Model of the citizen.
    • serializeNBT

      public net.minecraft.nbt.CompoundTag serializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider)
      Specified by:
      serializeNBT in interface net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
      Overrides:
      serializeNBT in class AbstractJob<AbstractEntityAIGuard<JobCavalry,? extends AbstractBuildingGuards>,JobCavalry>
    • deserializeNBT

      public void deserializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound)
      Specified by:
      deserializeNBT in interface net.neoforged.neoforge.common.util.INBTSerializable<net.minecraft.nbt.CompoundTag>
      Overrides:
      deserializeNBT in class AbstractJob<AbstractEntityAIGuard<JobCavalry,? extends AbstractBuildingGuards>,JobCavalry>
    • ignoresDamage

      public boolean ignoresDamage(@NotNull @NotNull net.minecraft.world.damagesource.DamageSource damageSource)
      Whether the citizen will ignore damage from the given source. Units will ignore explosion and projectile damage if they have a shield in their offhand and the SHIELD_USAGE research is enabled.
      Specified by:
      ignoresDamage in interface IJob<AbstractEntityAIGuard<JobCavalry,? extends AbstractBuildingGuards>>
      Overrides:
      ignoresDamage in class AbstractJob<AbstractEntityAIGuard<JobCavalry,? extends AbstractBuildingGuards>,JobCavalry>
      Parameters:
      damageSource - the source of the damage
      Returns:
      true if the citizen will ignore the damage, false otherwise
    • isMissingMount

      public boolean isMissingMount()
      If the cavalry unity is missing a mount.
      Returns:
      true if so.
    • setMount

      public void setMount(UUID mountUUID)
      Sets the mount UUID.
      Parameters:
      mountUUID - the mount UUID.
    • getMount

      public UUID getMount()
      Return the current mount for the cavalry job.
      Returns:
    • getMountDamageSplit

      public float getMountDamageSplit()
      The fraction of damage that is applied to the mount instead of the rider. This is used to calculate the damage to apply to the mount when the rider is attacked.
      Returns:
      the fraction of damage to apply to the mount.
    • getWeaponType

      public static EquipmentTypeEntry getWeaponType()
      Gets the weapon type that the AI will look for when checking if it can attack.
      Returns:
      the weapon type.