Class GraveManager

java.lang.Object
com.minecolonies.core.colony.managers.GraveManager
All Implemented Interfaces:
IGraveManager

public class GraveManager extends Object implements IGraveManager
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates the GraveManager for a colony.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    addNewGrave(@NotNull net.minecraft.core.BlockPos pos)
    Add a grave from the Colony.
    net.minecraft.core.BlockPos
    createCitizenGrave(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, ICitizenData citizenData)
    Attempt to create a TileEntityGrave at @pos containing the specific @citizenData
    @NotNull Map<net.minecraft.core.BlockPos,Boolean>
    Returns a map with all graves within the colony.
    void
    Ticks all grave when this building manager receives a tick.
    void
    read(@NotNull net.minecraft.nbt.CompoundTag compound)
    Read the graves from NBT.
    void
    removeGrave(@NotNull net.minecraft.core.BlockPos pos)
    Remove a TileEntityGrave from the Colony (when it is destroyed).
    boolean
    reserveGrave(@NotNull net.minecraft.core.BlockPos pos)
    Reserve a grave
    net.minecraft.core.BlockPos
    Reserve the next free grave
    void
    unReserveGrave(@NotNull net.minecraft.core.BlockPos pos)
    Un-Reserve a grave
    void
    write(@NotNull net.minecraft.nbt.CompoundTag compound)
    Write the graves to NBT.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GraveManager

      public GraveManager(Colony colony)
      Creates the GraveManager for a colony.
      Parameters:
      colony - the colony.
  • Method Details

    • read

      public void read(@NotNull @NotNull net.minecraft.nbt.CompoundTag compound)
      Read the graves from NBT.
      Specified by:
      read in interface IGraveManager
      Parameters:
      compound - the compound.
    • write

      public void write(@NotNull @NotNull net.minecraft.nbt.CompoundTag compound)
      Write the graves to NBT.
      Specified by:
      write in interface IGraveManager
      Parameters:
      compound - the compound.
    • onColonyTick

      public void onColonyTick(IColony colony)
      Ticks all grave when this building manager receives a tick.
      Specified by:
      onColonyTick in interface IGraveManager
      Parameters:
      colony - the colony which is being ticked.
    • getGraves

      @NotNull public @NotNull Map<net.minecraft.core.BlockPos,Boolean> getGraves()
      Returns a map with all graves within the colony. Key is ID (Coordinates), value is isReserved boolean.
      Specified by:
      getGraves in interface IGraveManager
      Returns:
      Map with ID (coordinates) as key, value is isReserved boolean.
    • addNewGrave

      public boolean addNewGrave(@NotNull @NotNull net.minecraft.core.BlockPos pos)
      Add a grave from the Colony.
      Specified by:
      addNewGrave in interface IGraveManager
      Parameters:
      pos - position of the TileEntityGrave to add.
      Returns:
      the grave that was created and added.
    • removeGrave

      public void removeGrave(@NotNull @NotNull net.minecraft.core.BlockPos pos)
      Remove a TileEntityGrave from the Colony (when it is destroyed).
      Specified by:
      removeGrave in interface IGraveManager
      Parameters:
      pos - position of the TileEntityGrave to remove.
    • reserveGrave

      public boolean reserveGrave(@NotNull @NotNull net.minecraft.core.BlockPos pos)
      Reserve a grave
      Specified by:
      reserveGrave in interface IGraveManager
      Parameters:
      pos - the id of the grave.
      Returns:
      is the grave successfully reserved.
    • unReserveGrave

      public void unReserveGrave(@NotNull @NotNull net.minecraft.core.BlockPos pos)
      Description copied from interface: IGraveManager
      Un-Reserve a grave
      Specified by:
      unReserveGrave in interface IGraveManager
      Parameters:
      pos - the id of the grave.
    • reserveNextFreeGrave

      public net.minecraft.core.BlockPos reserveNextFreeGrave()
      Reserve the next free grave
      Specified by:
      reserveNextFreeGrave in interface IGraveManager
      Returns:
      the grave successfully reserved or null if none available
    • createCitizenGrave

      public net.minecraft.core.BlockPos createCitizenGrave(net.minecraft.world.level.Level world, net.minecraft.core.BlockPos pos, ICitizenData citizenData)
      Attempt to create a TileEntityGrave at @pos containing the specific @citizenData

      On failure: drop all the citizen inventory on the ground.

      Specified by:
      createCitizenGrave in interface IGraveManager
      Parameters:
      world - The world.
      pos - The position where to spawn a grave
      citizenData - The citizenData
      Returns:
      position if a grave was created.