Class CitizenDiseaseHandler
java.lang.Object
com.minecolonies.core.entity.citizen.citizenhandlers.CitizenDiseaseHandler
- All Implemented Interfaces:
ICitizenDiseaseHandler
Handler taking care of citizens getting stuck.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleHealth at which citizens seek a doctor. -
Constructor Summary
ConstructorsConstructorDescriptionCitizenDiseaseHandler(ICitizenData citizen) Constructor for the experience handler. -
Method Summary
Modifier and TypeMethodDescriptionvoidcure()Cure the citizen.@Nullable DiseaseGet the current disease, if any.booleanisHurt()True when the citizen needs to go to a hospital because its hurtbooleanisSick()Check if the citizen is sick and must be healed..voidonCollission(ICitizenData citizen) Called when two citizens collide.voidread(net.minecraft.nbt.CompoundTag compound) Read the handler from NBT.booleansetDisease(@Nullable Disease disease) Set a disease on the citizen.voidsetSleepsAtHospital(boolean isAtHospital) Sets a flag that the citizen is now at the hospital.booleanWhether the citizen sleeps at a hospitalvoidupdate(int tickRate) Called in the citizen every few ticks to check for illness.voidwrite(net.minecraft.nbt.CompoundTag compound) Write the handler to NBT.
-
Field Details
-
SEEK_DOCTOR_HEALTH
public static final double SEEK_DOCTOR_HEALTHHealth at which citizens seek a doctor.- See Also:
-
-
Constructor Details
-
CitizenDiseaseHandler
Constructor for the experience handler.- Parameters:
citizen- the citizen owning the handler.
-
-
Method Details
-
update
public void update(int tickRate) Called in the citizen every few ticks to check for illness. Called every 60 ticks- Specified by:
updatein interfaceICitizenDiseaseHandler
-
setDisease
Description copied from interface:ICitizenDiseaseHandlerSet a disease on the citizen.- Specified by:
setDiseasein interfaceICitizenDiseaseHandler- Parameters:
disease- to set.- Returns:
- true if they actually became sick.
-
onCollission
Description copied from interface:ICitizenDiseaseHandlerCalled when two citizens collide.- Specified by:
onCollissionin interfaceICitizenDiseaseHandler
-
isHurt
public boolean isHurt()Description copied from interface:ICitizenDiseaseHandlerTrue when the citizen needs to go to a hospital because its hurt- Specified by:
isHurtin interfaceICitizenDiseaseHandler- Returns:
-
isSick
public boolean isSick()Description copied from interface:ICitizenDiseaseHandlerCheck if the citizen is sick and must be healed..- Specified by:
isSickin interfaceICitizenDiseaseHandler- Returns:
- true if so.
-
write
public void write(net.minecraft.nbt.CompoundTag compound) Description copied from interface:ICitizenDiseaseHandlerWrite the handler to NBT.- Specified by:
writein interfaceICitizenDiseaseHandler- Parameters:
compound- the nbt to write it to.
-
read
public void read(net.minecraft.nbt.CompoundTag compound) Description copied from interface:ICitizenDiseaseHandlerRead the handler from NBT.- Specified by:
readin interfaceICitizenDiseaseHandler- Parameters:
compound- the nbt to read it from.
-
getDisease
Description copied from interface:ICitizenDiseaseHandlerGet the current disease, if any.- Specified by:
getDiseasein interfaceICitizenDiseaseHandler- Returns:
- the disease instance.
-
cure
public void cure()Description copied from interface:ICitizenDiseaseHandlerCure the citizen.- Specified by:
curein interfaceICitizenDiseaseHandler
-
sleepsAtHospital
public boolean sleepsAtHospital()Description copied from interface:ICitizenDiseaseHandlerWhether the citizen sleeps at a hospital- Specified by:
sleepsAtHospitalin interfaceICitizenDiseaseHandler- Returns:
-
setSleepsAtHospital
public void setSleepsAtHospital(boolean isAtHospital) Description copied from interface:ICitizenDiseaseHandlerSets a flag that the citizen is now at the hospital.- Specified by:
setSleepsAtHospitalin interfaceICitizenDiseaseHandler
-