Class CitizenSkillHandler

java.lang.Object
com.minecolonies.core.entity.citizen.citizenhandlers.CitizenSkillHandler
All Implemented Interfaces:
ICitizenSkillHandler

public class CitizenSkillHandler extends Object implements ICitizenSkillHandler
The citizen skill handler of the citizen.
  • Field Details

  • Constructor Details

    • CitizenSkillHandler

      public CitizenSkillHandler()
  • Method Details

    • init

      public void init(int levelCap)
      Description copied from interface: ICitizenSkillHandler
      Initiate a citizen skill handler with a level cap.
      Specified by:
      init in interface ICitizenSkillHandler
      Parameters:
      levelCap - the max level.
    • init

      public void init(@NotNull @NotNull IColony colony, @Nullable @Nullable ICitizenData firstParent, @Nullable @Nullable ICitizenData secondParent, Random rand)
      Description copied from interface: ICitizenSkillHandler
      Initiate a citizen with parent citizen data.
      Specified by:
      init in interface ICitizenSkillHandler
      Parameters:
      firstParent - the first parent data.
      secondParent - the second parent data.
      rand - random var.
    • write

      @NotNull public @NotNull net.minecraft.nbt.CompoundTag write()
      Description copied from interface: ICitizenSkillHandler
      Write the handler to NBT.
      Specified by:
      write in interface ICitizenSkillHandler
      Returns:
      the handler written to NBT.
    • read

      public void read(@NotNull @NotNull net.minecraft.nbt.CompoundTag compoundNBT)
      Description copied from interface: ICitizenSkillHandler
      Init the handler from NBT.
      Specified by:
      read in interface ICitizenSkillHandler
      Parameters:
      compoundNBT - the input nbt.
    • tryLevelUpIntelligence

      public boolean tryLevelUpIntelligence(@NotNull @NotNull Random random, double chance, @NotNull @NotNull ICitizenData citizen)
      Description copied from interface: ICitizenSkillHandler
      Attempt an intelligence level up with a percentage chance.
      Specified by:
      tryLevelUpIntelligence in interface ICitizenSkillHandler
      Parameters:
      random - the random var.
      chance - the chance to succeed, as a percentage in the range [0, 100].
      citizen - the citizen that is trying to level up.
      Returns:
      true if the roll succeeded.
    • getLevel

      public int getLevel(@NotNull @NotNull Skill skill)
      Description copied from interface: ICitizenSkillHandler
      Get the level for a certain skill.
      Specified by:
      getLevel in interface ICitizenSkillHandler
      Parameters:
      skill - the skill.
      Returns:
      the level.
    • incrementLevel

      public void incrementLevel(@NotNull @NotNull Skill skill, int level)
      Description copied from interface: ICitizenSkillHandler
      Increment the level for a certain skill.
      Specified by:
      incrementLevel in interface ICitizenSkillHandler
      Parameters:
      skill - the skill to increment.
      level - the quantity.
    • addXpToSkill

      public void addXpToSkill(Skill skill, double xp, ICitizenData data)
      Description copied from interface: ICitizenSkillHandler
      Add experience to a skill.
      Specified by:
      addXpToSkill in interface ICitizenSkillHandler
      Parameters:
      skill - the skill.
      xp - the xp to add.
      data - the citizen.
    • removeXpFromSkill

      public void removeXpFromSkill(@NotNull @NotNull Skill skill, double xp, @NotNull @NotNull ICitizenData data)
      Description copied from interface: ICitizenSkillHandler
      Remove xp from a skill.
      Specified by:
      removeXpFromSkill in interface ICitizenSkillHandler
      Parameters:
      skill - the skill to remove it from.
      xp - the qty of xp.
      data - the citizen.
    • levelUp

      public void levelUp(ICitizenData data)
      Description copied from interface: ICitizenSkillHandler
      Level-up actions for the citizen, increases levels and notifies the Citizen's Job
      Specified by:
      levelUp in interface ICitizenSkillHandler
      Parameters:
      data - the citizen to level up.
    • getTotalXP

      public double getTotalXP()
      Description copied from interface: ICitizenSkillHandler
      Get the total xp that the citizen has.
      Specified by:
      getTotalXP in interface ICitizenSkillHandler
      Returns:
      the total xp.
    • getSkills

      Description copied from interface: ICitizenSkillHandler
      Get a copy of the map of skills.
      Specified by:
      getSkills in interface ICitizenSkillHandler
      Returns:
      the skills.