Class GraveyardManagementModule
java.lang.Object
com.minecolonies.api.colony.buildings.modules.AbstractBuildingModule
com.minecolonies.core.colony.buildings.modules.GraveyardManagementModule
- All Implemented Interfaces:
IBuildingEventsModule,IBuildingModule,IPersistentModule,IHasDirty
public class GraveyardManagementModule
extends AbstractBuildingModule
implements IBuildingModule, IPersistentModule, IBuildingEventsModule
The graveyard list module.
-
Field Summary
Fields inherited from class com.minecolonies.api.colony.buildings.modules.AbstractBuildingModule
building, isDirty -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanburyCitizenHere(Tuple<net.minecraft.core.BlockPos, net.minecraft.core.Direction> positionAndDirection, AbstractEntityCitizen worker) Add a citizen to the list of resting citizens in this graveyard.voiddeserializeNBT(net.minecraft.nbt.CompoundTag compound) Deserialize the module.Get the burial plot positions and their directions.Get for the last grave.@Nullable Tuple<net.minecraft.core.BlockPos,net.minecraft.core.Direction> Return a random free visual grave position.booleanhasRestingCitizen(Set<String> citizens) Check if one of the citizens in the list is resting.voidmigrateLegacyGravePositions(net.minecraft.nbt.CompoundTag compound) Migrates burial plot positions stored on the graveyard building before ownership moved to this module.voidregisterGravePosition(net.minecraft.world.level.block.state.BlockState state, net.minecraft.core.BlockPos pos) Register a named grave block as a burial plot.voidserializeNBT(net.minecraft.nbt.CompoundTag compound) Serialize the module from a compound.voidserializeToView(@NotNull net.minecraft.network.FriendlyByteBuf buf) Serialization method to send the module data to the client side.voidsetLastGraveData(GraveData graveData) Setter for the last grave data.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
onDestroyed, 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
-
Constructor Details
-
GraveyardManagementModule
public GraveyardManagementModule()
-
-
Method Details
-
deserializeNBT
public void deserializeNBT(net.minecraft.nbt.CompoundTag compound) Description copied from interface:IPersistentModuleDeserialize the module.- Specified by:
deserializeNBTin interfaceIPersistentModule- Parameters:
compound- the nbt compound.
-
serializeNBT
public void serializeNBT(net.minecraft.nbt.CompoundTag compound) Description copied from interface:IPersistentModuleSerialize the module from a compound.- Specified by:
serializeNBTin interfaceIPersistentModule- Parameters:
compound- the compound.
-
serializeToView
public void serializeToView(@NotNull @NotNull net.minecraft.network.FriendlyByteBuf 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.
-
migrateLegacyGravePositions
public void migrateLegacyGravePositions(net.minecraft.nbt.CompoundTag compound) Migrates burial plot positions stored on the graveyard building before ownership moved to this module.- Parameters:
compound- the legacy building data.
-
getGravePositions
Get the burial plot positions and their directions.- Returns:
- the burial plot positions.
-
registerGravePosition
public void registerGravePosition(net.minecraft.world.level.block.state.BlockState state, net.minecraft.core.BlockPos pos) Register a named grave block as a burial plot.- Parameters:
state- the block state.pos- the block position.
-
getRandomFreeVisualGravePos
@Nullable public @Nullable Tuple<net.minecraft.core.BlockPos,net.minecraft.core.Direction> getRandomFreeVisualGravePos()Return a random free visual grave position.- Returns:
- a free burial plot, or
nullwhen none are available.
-
setLastGraveData
Setter for the last grave data.- Parameters:
graveData- the last grave the worker has dug.
-
getLastGraveData
Get for the last grave.- Returns:
- the last grave the worker has dug.
-
hasRestingCitizen
Check if one of the citizens in the list is resting.- Parameters:
citizens- the citizens to check.- Returns:
- true if so.
-
buryCitizenHere
public boolean buryCitizenHere(Tuple<net.minecraft.core.BlockPos, net.minecraft.core.Direction> positionAndDirection, AbstractEntityCitizen worker) Add a citizen to the list of resting citizens in this graveyard.- Parameters:
positionAndDirection- the burial plot position and grave direction.worker- the undertaker performing the burial.- Returns:
trueif the named grave was placed and the burial was recorded; otherwisefalse.
-