Class CitizenSkillHandler
java.lang.Object
com.minecolonies.core.entity.citizen.citizenhandlers.CitizenSkillHandler
- All Implemented Interfaces:
ICitizenSkillHandler
The citizen skill handler of the citizen.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
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.
-
Field Details
-
skillMap
Skill map.
-
-
Constructor Details
-
CitizenSkillHandler
public CitizenSkillHandler()
-
-
Method Details
-
init
public void init(int levelCap) Description copied from interface:ICitizenSkillHandlerInitiate a citizen skill handler with a level cap.- Specified by:
initin interfaceICitizenSkillHandler- 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:ICitizenSkillHandlerInitiate a citizen with parent citizen data.- Specified by:
initin interfaceICitizenSkillHandlerfirstParent- 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:ICitizenSkillHandlerWrite the handler to NBT.- Specified by:
writein interfaceICitizenSkillHandler- Returns:
- the handler written to NBT.
-
read
public void read(@NotNull @NotNull net.minecraft.nbt.CompoundTag compoundNBT) Description copied from interface:ICitizenSkillHandlerInit the handler from NBT.- Specified by:
readin interfaceICitizenSkillHandler- Parameters:
compoundNBT- the input nbt.
-
tryLevelUpIntelligence
public boolean tryLevelUpIntelligence(@NotNull @NotNull Random random, double customChance, @NotNull @NotNull ICitizenData citizen) Description copied from interface:ICitizenSkillHandlerAttempt an intelligence level up with a base chance.- Specified by:
tryLevelUpIntelligencein interfaceICitizenSkillHandler- Parameters:
random- the random var.customChance- the custom chance.citizen- the citizen that is trying to level up.- Returns:
- true if leveled up.
-
getLevel
Description copied from interface:ICitizenSkillHandlerGet the level for a certain skill.- Specified by:
getLevelin interfaceICitizenSkillHandler- Parameters:
skill- the skill.- Returns:
- the level.
-
incrementLevel
Description copied from interface:ICitizenSkillHandlerIncrement the level for a certain skill.- Specified by:
incrementLevelin interfaceICitizenSkillHandler- Parameters:
skill- the skill to increment.level- the quantity.
-
addXpToSkill
Description copied from interface:ICitizenSkillHandlerAdd experience to a skill.- Specified by:
addXpToSkillin interfaceICitizenSkillHandler- 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:ICitizenSkillHandlerRemove xp from a skill.- Specified by:
removeXpFromSkillin interfaceICitizenSkillHandler- Parameters:
skill- the skill to remove it from.xp- the qty of xp.data- the citizen.
-
levelUp
Description copied from interface:ICitizenSkillHandlerLevel-up actions for the citizen, increases levels and notifies the Citizen's Job- Specified by:
levelUpin interfaceICitizenSkillHandler- Parameters:
data- the citizen to level up.
-
getTotalXP
public double getTotalXP()Description copied from interface:ICitizenSkillHandlerGet the total xp that the citizen has.- Specified by:
getTotalXPin interfaceICitizenSkillHandler- Returns:
- the total xp.
-
getSkills
Description copied from interface:ICitizenSkillHandlerGet a copy of the map of skills.- Specified by:
getSkillsin interfaceICitizenSkillHandler- Returns:
- the skills.
-