Interface ICitizenSkillHandler
- All Known Implementing Classes:
CitizenSkillHandler
public interface ICitizenSkillHandler
The interface for the citizen skill handler.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddXpToSkill(Skill skill, double xp, ICitizenData data) Add experience to a skill.intGet the level for a certain skill.Get a copy of the map of skills.doubleGet the total xp that the citizen has.voidincrementLevel(@NotNull Skill skill, int level) Increment the level for a certain skill.voidinit(int levelCap) Initiate a citizen skill handler with a level cap.voidinit(@NotNull IColony colony, @Nullable ICitizenData firstParent, @Nullable ICitizenData secondParent, Random rand) Initiate a citizen with parent citizen data.voidlevelUp(ICitizenData data) Level-up actions for the citizen, increases levels and notifies the Citizen's Jobvoidread(@NotNull net.minecraft.nbt.CompoundTag compoundNBT) Init the handler from NBT.voidremoveXpFromSkill(@NotNull Skill skill, double xp, @NotNull ICitizenData data) Remove xp from a skill.booleantryLevelUpIntelligence(@NotNull Random random, double customChance, @NotNull ICitizenData citizen) Attempt an intelligence level up with a base chance.@NotNull net.minecraft.nbt.CompoundTagwrite()Write the handler to NBT.
-
Method Details
-
init
void init(int levelCap) Initiate a citizen skill handler with a level cap.- Parameters:
levelCap- the max level.
-
init
void init(@NotNull @NotNull IColony colony, @Nullable @Nullable ICitizenData firstParent, @Nullable @Nullable ICitizenData secondParent, Random rand) Initiate a citizen with parent citizen data.- Parameters:
firstParent- the first parent data.secondParent- the second parent data.rand- random var.
-
write
@NotNull @NotNull net.minecraft.nbt.CompoundTag write()Write the handler to NBT.- Returns:
- the handler written to NBT.
-
read
void read(@NotNull @NotNull net.minecraft.nbt.CompoundTag compoundNBT) Init the handler from NBT.- Parameters:
compoundNBT- the input nbt.
-
tryLevelUpIntelligence
boolean tryLevelUpIntelligence(@NotNull @NotNull Random random, double customChance, @NotNull @NotNull ICitizenData citizen) Attempt an intelligence level up with a base chance.- Parameters:
random- the random var.customChance- the custom chance.citizen- the citizen that is trying to level up.- Returns:
- true if leveled up.
-
getLevel
Get the level for a certain skill.- Parameters:
skill- the skill.- Returns:
- the level.
-
incrementLevel
Increment the level for a certain skill.- Parameters:
skill- the skill to increment.level- the quantity.
-
addXpToSkill
Add experience to a skill.- Parameters:
skill- the skill.xp- the xp to add.data- the citizen.
-
removeXpFromSkill
void removeXpFromSkill(@NotNull @NotNull Skill skill, double xp, @NotNull @NotNull ICitizenData data) Remove xp from a skill.- Parameters:
skill- the skill to remove it from.xp- the qty of xp.data- the citizen.
-
levelUp
Level-up actions for the citizen, increases levels and notifies the Citizen's Job- Parameters:
data- the citizen to level up.
-
getTotalXP
double getTotalXP()Get the total xp that the citizen has.- Returns:
- the total xp.
-
getSkills
Map<Skill,CitizenSkillHandler.SkillData> getSkills()Get a copy of the map of skills.- Returns:
- the skills.
-