Class CitizenColonyHandler
java.lang.Object
com.minecolonies.core.entity.citizen.citizenhandlers.CitizenColonyHandler
- All Implemented Interfaces:
ICitizenColonyHandler
- Direct Known Subclasses:
VisitorColonyHandler
Handles all colony related methods for the citizen.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AbstractEntityCitizenThe citizen assigned to this manager.protected @Nullable IColonyThe colony reference.protected intIt's colony id.protected booleanWhether the entity is registered to the colony yet. -
Constructor Summary
ConstructorsConstructorDescriptionConstructor for the experience handler. -
Method Summary
Modifier and TypeMethodDescription@Nullable IColonyUnsafe colony getter, doesn't run registration.intGetter for the colony id.@Nullable IColonyGetter for the colony.@Nullable IBuilding@Nullable IBuildingcalculate this worker building.voidActions when the entity is removed.voidonSyncDataUpdate(net.minecraft.network.syncher.EntityDataAccessor<?> data) Entity data update callbackbooleanvoidregisterWithColony(int colonyID, int citizenID) Server-specific update for the EntityCitizen.voidsetColonyId(int colonyId) Setter for the colony id.voidUpdate the client side of the citizen entity.
-
Field Details
-
citizen
The citizen assigned to this manager. -
colonyId
protected int colonyIdIt's colony id. -
colony
The colony reference. -
registered
protected boolean registeredWhether the entity is registered to the colony yet.
-
-
Constructor Details
-
CitizenColonyHandler
Constructor for the experience handler.- Parameters:
citizen- the citizen owning the handler.
-
-
Method Details
-
getWorkBuilding
calculate this worker building.- Specified by:
getWorkBuildingin interfaceICitizenColonyHandler- Returns:
- the building or null if none present.
-
getHomeBuilding
- Specified by:
getHomeBuildingin interfaceICitizenColonyHandler
-
registerWithColony
public void registerWithColony(int colonyID, int citizenID) Server-specific update for the EntityCitizen.- Specified by:
registerWithColonyin interfaceICitizenColonyHandler- Parameters:
colonyID- the id of the colony.citizenID- the id of the citizen.
-
updateColonyClient
public void updateColonyClient()Update the client side of the citizen entity.- Specified by:
updateColonyClientin interfaceICitizenColonyHandler
-
onSyncDataUpdate
public void onSyncDataUpdate(net.minecraft.network.syncher.EntityDataAccessor<?> data) Description copied from interface:ICitizenColonyHandlerEntity data update callback- Specified by:
onSyncDataUpdatein interfaceICitizenColonyHandler
-
registered
public boolean registered()- Specified by:
registeredin interfaceICitizenColonyHandler
-
getColonyOrRegister
Getter for the colony.- Specified by:
getColonyOrRegisterin interfaceICitizenColonyHandler- Returns:
- the colony of the citizen or null.
-
getColony
Description copied from interface:ICitizenColonyHandlerUnsafe colony getter, doesn't run registration.- Specified by:
getColonyin interfaceICitizenColonyHandler- Returns:
- the colony.
-
getColonyId
public int getColonyId()Getter for the colony id.- Specified by:
getColonyIdin interfaceICitizenColonyHandler- Returns:
- the colony id.
-
setColonyId
public void setColonyId(int colonyId) Setter for the colony id.- Specified by:
setColonyIdin interfaceICitizenColonyHandler- Parameters:
colonyId- the new colonyId.
-
onCitizenRemoved
public void onCitizenRemoved()Description copied from interface:ICitizenColonyHandlerActions when the entity is removed.- Specified by:
onCitizenRemovedin interfaceICitizenColonyHandler
-