Class CitizenExperienceHandler
java.lang.Object
com.minecolonies.core.entity.citizen.citizenhandlers.CitizenExperienceHandler
- All Implemented Interfaces:
ICitizenExperienceHandler
Handles all experience related things of the citizen.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intNumber of times to attempt XP pickup before forcing itstatic final intThe percentage share primary skills get.static final intThe percentage share secondary skills get. -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for the experience handler. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddExperience(double xp) Add experience points to citizen.voidDrop some experience share depending on the experience and experienceLevel.voidgatherXp()Collect exp orbs around the entity.voidUpdates the level of the citizen.
-
Field Details
-
PRIMARY_DEPENDENCY_SHARE
public static final int PRIMARY_DEPENDENCY_SHAREThe percentage share primary skills get.- See Also:
-
SECONDARY_DEPENDENCY_SHARE
public static final int SECONDARY_DEPENDENCY_SHAREThe percentage share secondary skills get.- See Also:
-
MAX_XP_PICKUP_ATTEMPTS
public static final int MAX_XP_PICKUP_ATTEMPTSNumber of times to attempt XP pickup before forcing it- See Also:
-
-
Constructor Details
-
CitizenExperienceHandler
Constructor for the experience handler.- Parameters:
citizen- the citizen owning the handler.
-
-
Method Details
-
updateLevel
public void updateLevel()Description copied from interface:ICitizenExperienceHandlerUpdates the level of the citizen.- Specified by:
updateLevelin interfaceICitizenExperienceHandler
-
addExperience
public void addExperience(double xp) Description copied from interface:ICitizenExperienceHandlerAdd experience points to citizen. Increases the citizen level if he has sufficient experience. This will reset the experience.- Specified by:
addExperiencein interfaceICitizenExperienceHandler- Parameters:
xp- the amount of points added.
-
dropExperience
public void dropExperience()Description copied from interface:ICitizenExperienceHandlerDrop some experience share depending on the experience and experienceLevel.- Specified by:
dropExperiencein interfaceICitizenExperienceHandler
-
gatherXp
public void gatherXp()Description copied from interface:ICitizenExperienceHandlerCollect exp orbs around the entity.- Specified by:
gatherXpin interfaceICitizenExperienceHandler
-