Class TavernBuildingModule
java.lang.Object
com.minecolonies.api.colony.buildings.modules.AbstractBuildingModule
com.minecolonies.core.colony.buildings.modules.TavernBuildingModule
- All Implemented Interfaces:
IBuildingEventsModule,IBuildingModule,IDefinesCoreBuildingStatsModule,IPersistentModule,ITickingModule,IHasDirty
public class TavernBuildingModule
extends AbstractBuildingModule
implements IDefinesCoreBuildingStatsModule, IBuildingEventsModule, IPersistentModule, ITickingModule
Tavern building for the colony. Houses 4 citizens Plays a tavern theme on entering Spawns/allows citizen recruitment Spawns trader/quest npcs
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classClientSide representation of the building. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ISettingKey<BoolSetting> static final StringSchematic nameFields inherited from class com.minecolonies.api.colony.buildings.modules.AbstractBuildingModule
building, isDirty -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeserializeNBT(net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag nbt) Deserialize the module.Gets the assigned visitor idsnet.minecraft.core.BlockPosGets a free sitting positionGet the max number of inhabitants this module allows.net.minecraft.core.BlockPosGet a random work positionvoidInitializes the sitting and work position listsvoidonColonyTick(@NotNull IColony colony) Colony tick hook.voidOn destruction hook of the building, calling into the modules.voidonPlayerEnterBuilding(net.minecraft.world.entity.player.Player player) On player entering hook.voidonUpgradeComplete(int newlevel) Upgrade complete module hook.booleanremoveCitizen(Integer id) Removes the given citizen idvoidserializeNBT(net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag nbt) Serialize the module from a compound.voidsetNoVisitorTime(int noVisitorTime) Sets the delay time before a new visitor spawns@Nullable IVisitorDataSpawns a visitor citizen that can be recruited.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.IBuildingEventsModule
onWakeUpMethods inherited from interface com.minecolonies.api.colony.buildings.modules.IBuildingModule
getBuilding, getProducer, serializeToView, serializeToView, setBuilding, setProducerMethods inherited from interface com.minecolonies.api.util.IHasDirty
checkDirty, clearDirty, markDirty
-
Field Details
-
PLAYMUSIC
-
TAG_VISITOR_ID
Schematic name- See Also:
-
-
Constructor Details
-
TavernBuildingModule
public TavernBuildingModule()
-
-
Method Details
-
getMaxInhabitants
Description copied from interface:IDefinesCoreBuildingStatsModuleGet the max number of inhabitants this module allows.- Specified by:
getMaxInhabitantsin interfaceIDefinesCoreBuildingStatsModule- Returns:
- the modules max number of assigned citizens.
-
onPlayerEnterBuilding
public void onPlayerEnterBuilding(net.minecraft.world.entity.player.Player player) Description copied from interface:IBuildingEventsModuleOn player entering hook.- Specified by:
onPlayerEnterBuildingin interfaceIBuildingEventsModule- Parameters:
player- the player that entered the building.
-
onColonyTick
Description copied from interface:ITickingModuleColony tick hook.- Specified by:
onColonyTickin interfaceITickingModule- Parameters:
colony- the colony the tick is invoked from.
-
onUpgradeComplete
public void onUpgradeComplete(int newlevel) Description copied from interface:IBuildingEventsModuleUpgrade complete module hook.- Specified by:
onUpgradeCompletein interfaceIBuildingEventsModule- Parameters:
newlevel- the new level.
-
spawnVisitor
Spawns a visitor citizen that can be recruited. -
serializeNBT
public void serializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag nbt) Description copied from interface:IPersistentModuleSerialize the module from a compound.- Specified by:
serializeNBTin interfaceIPersistentModule- Parameters:
nbt- the compound.
-
deserializeNBT
public void deserializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag nbt) Description copied from interface:IPersistentModuleDeserialize the module.- Specified by:
deserializeNBTin interfaceIPersistentModule- Parameters:
nbt- the nbt compound.
-
getFreeSitPosition
public net.minecraft.core.BlockPos getFreeSitPosition()Gets a free sitting position- Returns:
- a blockpos to sit at
-
onDestroyed
public void onDestroyed()Description copied from interface:IBuildingEventsModuleOn destruction hook of the building, calling into the modules.- Specified by:
onDestroyedin interfaceIBuildingEventsModule
-
getExternalCitizens
Gets the assigned visitor ids- Returns:
- list of ids
-
getWorkPos
public net.minecraft.core.BlockPos getWorkPos()Get a random work position- Returns:
- a random work pos
-
initTagPositions
public void initTagPositions()Initializes the sitting and work position lists -
removeCitizen
Removes the given citizen id- Parameters:
id- to remove
-
setNoVisitorTime
public void setNoVisitorTime(int noVisitorTime) Sets the delay time before a new visitor spawns- Parameters:
noVisitorTime- time in ticks
-