Class AbstractAssignedCitizenModule
java.lang.Object
com.minecolonies.api.colony.buildings.modules.AbstractBuildingModule
com.minecolonies.core.colony.buildings.modules.AbstractAssignedCitizenModule
- All Implemented Interfaces:
IAssignsCitizen,IBuildingEventsModule,IBuildingModule,IPersistentModule,IHasDirty
- Direct Known Subclasses:
CourierAssignmentModule,LivingBuildingModule,QuarryModule,WorkerBuildingModule
public abstract class AbstractAssignedCitizenModule
extends AbstractBuildingModule
implements IAssignsCitizen, IPersistentModule, IBuildingEventsModule
Abstract assignment module.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final List<ICitizenData> List of worker assosiated to the building.Fields inherited from class com.minecolonies.api.colony.buildings.modules.AbstractBuildingModule
building, isDirty -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanassignCitizen(ICitizenData citizen) Specific citizen assignment hook for modules.voiddeserializeNBT(net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound) Deserialize the module.Get all assigned citizens to this module.@Nullable List<Optional<AbstractEntityCitizen>> Get a list of entities from the assigned citizens.@Nullable ICitizenDataGet the first citizen assigned to this module.Get the hiring mode of the module.protected StringDeprecated.final booleanCheck if there are any assigned citizens in the module.booleanhasAssignedCitizen(ICitizenData citizen) Check if a given citizen is assigned to this module.booleanisFull()Check if we can fit additional citizens into the module.voidOn destruction hook of the building, calling into the modules.booleanremoveCitizen(@NotNull ICitizenData citizen) Specific citizen removal hook for modules.voidserializeNBT(net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound) Serialize the module from a compound.voidserializeToView(@NotNull net.minecraft.network.RegistryFriendlyByteBuf buf) Serialization method to send the module data to the client side.voidsetHiringMode(HiringMode hiringMode) Set the hiring mode (automatic or manual or colony default).Methods inherited from class com.minecolonies.api.colony.buildings.modules.AbstractBuildingModule
checkDirty, clearDirty, getBuilding, getProducer, markDirty, setBuilding, setProducerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.minecolonies.api.colony.buildings.modules.IAssignsCitizen
getModuleMaxMethods inherited from interface com.minecolonies.api.colony.buildings.modules.IBuildingEventsModule
onPlayerEnterBuilding, onUpgradeComplete, onWakeUpMethods inherited from interface com.minecolonies.api.colony.buildings.modules.IBuildingModule
getBuilding, getProducer, serializeToView, setBuilding, setProducerMethods inherited from interface com.minecolonies.api.util.IHasDirty
checkDirty, clearDirty, markDirty
-
Field Details
-
assignedCitizen
List of worker assosiated to the building.
-
-
Constructor Details
-
AbstractAssignedCitizenModule
public AbstractAssignedCitizenModule()
-
-
Method Details
-
removeCitizen
Description copied from interface:IAssignsCitizenSpecific citizen removal hook for modules.- Specified by:
removeCitizenin interfaceIAssignsCitizen- Parameters:
citizen- the removed citizen.- Returns:
- true if one was removed.
-
assignCitizen
Description copied from interface:IAssignsCitizenSpecific citizen assignment hook for modules.- Specified by:
assignCitizenin interfaceIAssignsCitizen- Parameters:
citizen- the added citizen.- Returns:
- true if one was added.
-
onDestroyed
public void onDestroyed()Description copied from interface:IBuildingEventsModuleOn destruction hook of the building, calling into the modules.- Specified by:
onDestroyedin interfaceIBuildingEventsModule
-
getAssignedCitizen
Description copied from interface:IAssignsCitizenGet all assigned citizens to this module.- Specified by:
getAssignedCitizenin interfaceIAssignsCitizen- Returns:
- the list.
-
getFirstCitizen
Get the first citizen assigned to this module.- Returns:
- this citizen or null.
-
isFull
public boolean isFull()Description copied from interface:IAssignsCitizenCheck if we can fit additional citizens into the module.- Specified by:
isFullin interfaceIAssignsCitizen- Returns:
- true if so.
-
hasAssignedCitizen
Description copied from interface:IAssignsCitizenCheck if a given citizen is assigned to this module.- Specified by:
hasAssignedCitizenin interfaceIAssignsCitizen- Parameters:
citizen- the citizen to check.- Returns:
- true if so.
-
getAssignedEntities
Description copied from interface:IAssignsCitizenGet a list of entities from the assigned citizens.- Specified by:
getAssignedEntitiesin interfaceIAssignsCitizen- Returns:
- optional list of entities.
-
hasAssignedCitizen
public final boolean hasAssignedCitizen()Description copied from interface:IAssignsCitizenCheck if there are any assigned citizens in the module.- Specified by:
hasAssignedCitizenin interfaceIAssignsCitizen- Returns:
- true if so.
-
serializeNBT
public void serializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound) Description copied from interface:IPersistentModuleSerialize the module from a compound.- Specified by:
serializeNBTin interfaceIPersistentModule- Parameters:
compound- the compound.
-
deserializeNBT
public void deserializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound) Description copied from interface:IPersistentModuleDeserialize the module.- Specified by:
deserializeNBTin interfaceIPersistentModule- Parameters:
compound- the nbt compound.
-
serializeToView
public void serializeToView(@NotNull @NotNull net.minecraft.network.RegistryFriendlyByteBuf buf) Description copied from interface:IBuildingModuleSerialization method to send the module data to the client side.- Specified by:
serializeToViewin interfaceIBuildingModule- Parameters:
buf- the buffer to write it to.
-
setHiringMode
Description copied from interface:IAssignsCitizenSet the hiring mode (automatic or manual or colony default).- Specified by:
setHiringModein interfaceIAssignsCitizen- Parameters:
hiringMode- the mode to set.
-
getHiringMode
Description copied from interface:IAssignsCitizenGet the hiring mode of the module.- Specified by:
getHiringModein interfaceIAssignsCitizen- Returns:
- the mode.
-
getModuleSerializationIdentifier
Deprecated.Get the identifier for unique serialization. Use for deserialize/serialize only!- Returns:
- a string identifier.
-