Interface IRegisteredStructureManager

All Superinterfaces:
ICommonRegisteredStructureManager<IBuilding,ITownHall>
All Known Implementing Classes:
RegisteredStructureManager

public interface IRegisteredStructureManager extends ICommonRegisteredStructureManager<IBuilding,ITownHall>
Interface for the managers for registered structures. Buildings + Extensions, Decorations, etc.
  • Method Details

    • read

      void read(@NotNull net.minecraft.core.HolderLookup.Provider provider, @NotNull @NotNull net.minecraft.nbt.CompoundTag compound)
      Read the buildings from NBT.
      Parameters:
      compound - the compound.
    • write

      void write(@NotNull net.minecraft.core.HolderLookup.Provider provider, @NotNull @NotNull net.minecraft.nbt.CompoundTag compound)
      Write the buildings to NBT.
      Parameters:
      compound - the compound.
    • clearDirty

      void clearDirty()
      Clear the isDirty of the buildings.
    • sendPackets

      void sendPackets(Set<net.minecraft.server.level.ServerPlayer> closeSubscribers, Set<net.minecraft.server.level.ServerPlayer> newSubscribers)
      Send packets of the buildings to the subscribers.
      Parameters:
      closeSubscribers - the old subs.
      newSubscribers - new subs.
    • onColonyTick

      void onColonyTick(IColony colony)
      Tick the buildings on colony tick.
      Parameters:
      colony - the event.
    • cleanUpBuildings

      void cleanUpBuildings(IColony colony)
      Clean up the buildings.
      Parameters:
      colony - at the worldTick event.
    • getLeisureSites

      List<net.minecraft.core.BlockPos> getLeisureSites()
      Get the leisure site positions.
      Returns:
      the list.
    • addLeisureSite

      void addLeisureSite(net.minecraft.core.BlockPos pos)
      Register a new leisure site.
      Parameters:
      pos - the position of it.
    • removeLeisureSite

      void removeLeisureSite(net.minecraft.core.BlockPos pos)
      Remove a leisure site.
      Parameters:
      pos - the position of it.
    • getClosestWarehouseInColony

      @Nullable @Nullable IWareHouse getClosestWarehouseInColony(net.minecraft.core.BlockPos pos)
      Get the closest warehouse relative to a position.
      Parameters:
      pos - the position,.
      Returns:
      the closest warehouse.
    • getMysticalSiteMaxBuildingLevel

      int getMysticalSiteMaxBuildingLevel()
      Get the maximum level among built mystical sites
      Returns:
      the max level among all mystical sites or zero if no mystical site built
    • hasMysticalSite

      boolean hasMysticalSite()
      Check if the colony has a placed mystical site.
      Returns:
      true if so.
    • removeBuilding

      void removeBuilding(@NotNull @NotNull IBuilding building, Set<net.minecraft.server.level.ServerPlayer> subscribers)
      Remove a IBuilding from the Colony (when it is destroyed).
      Parameters:
      building - IBuilding to remove.
      subscribers - the subscribers of the colony to message.
    • markBuildingsDirty

      void markBuildingsDirty()
      Marks building data dirty.
    • markBuildingExtensionsDirty

      void markBuildingExtensionsDirty()
      Marks building extensions data dirty.
    • addNewBuilding

      @Nullable @Nullable IBuilding addNewBuilding(@NotNull @NotNull AbstractTileEntityColonyBuilding tileEntity, net.minecraft.world.level.Level world)
      Creates a building from a tile entity and adds it to the colony.
      Parameters:
      tileEntity - Tile entity to build a building from.
      world - the world to add it to.
      Returns:
      IBuilding that was created and added.
    • hasGuardBuildingNear

      boolean hasGuardBuildingNear(IBuilding building)
      Finds whether there is a guard building close to the given building
      Parameters:
      building - the building to check for.
      Returns:
      false if no guard tower close, true in other cases
    • guardBuildingChangedAt

      void guardBuildingChangedAt(IBuilding guardBuilding, int newLevel)
      Event once a guard building changed at a certain level.
      Parameters:
      guardBuilding - the guard building.
      newLevel - the level of it.
    • setTownHall

      void setTownHall(@Nullable @Nullable ITownHall building)
      Set the townhall building.
      Parameters:
      building - the building to set.
    • removeWareHouse

      void removeWareHouse(IWareHouse wareHouse)
      Removes a warehouse from the BuildingManager
      Parameters:
      wareHouse - the warehouse to remove.
    • getWareHouses

      List<IWareHouse> getWareHouses()
      Get a list of the warehouses in this colony.
      Returns:
      the warehouse.
    • removeMysticalSite

      void removeMysticalSite(IMysticalSite mysticalSite)
      Removes a warehouse from the BuildingManager
      Parameters:
      mysticalSite - the warehouse to remove.
    • getMysticalSites

      List<IMysticalSite> getMysticalSites()
      Get a list of the mystical sites in this colony.
      Returns:
      the list of mistical sites.
    • canPlaceAt

      boolean canPlaceAt(net.minecraft.world.level.block.Block block, net.minecraft.core.BlockPos pos, net.minecraft.world.entity.player.Player player)
      Checks whether we're allowed to place the block for a new building
      Parameters:
      block - Block to check
      pos - position
      player - the player trying to place
      Returns:
      true if placement allowed
    • keepChunkColonyLoaded

      boolean keepChunkColonyLoaded(net.minecraft.world.level.chunk.LevelChunk chunk)
      Is this chunk claimed by enough buildings to keep it loaded.
      Parameters:
      chunk - the chunk to check
      Returns:
      true if within.
    • getHouseWithSpareBed

      IBuilding getHouseWithSpareBed()
      Get a house with a spare bed.
      Returns:
      the house or null.
    • onBuildingUpgradeComplete

      void onBuildingUpgradeComplete(@Nullable @Nullable IBuilding building, int level)
      Performed when a building of this colony finished his upgrade state.
      Parameters:
      building - The upgraded building.
      level - The new level.
    • getRandomLeisureSite

      net.minecraft.core.BlockPos getRandomLeisureSite()
      Get a random leisure site to go to.
      Returns:
      the position of it.
    • getMatchingBuildingExtension

      Optional<IBuildingExtension> getMatchingBuildingExtension(Predicate<IBuildingExtension> matcher)
      Get a specific building extension on the given location.
      Parameters:
      matcher - the building extension matcher predicate.
      Returns:
      the building extension, if any.
    • addBuildingExtension

      boolean addBuildingExtension(IBuildingExtension extension)
      Add a new building extension to the building manager. If an identical building extension already exists, this building extension won't be added.
      Parameters:
      extension - the new building extension to add.
      Returns:
      true if the building extension was added.
    • removeBuildingExtension

      void removeBuildingExtension(Predicate<IBuildingExtension> matcher)
      Remove a building extension from the building extension collection.
      Parameters:
      matcher - the building extension matcher predicate.
    • getMatchingBuildingExtension

      @Nullable @Nullable IBuildingExtension getMatchingBuildingExtension(IBuildingExtension.ExtensionId extensionId)
      Get a building extension by id.
      Parameters:
      extensionId - the id of the extension.
      Returns:
      the building extension or null.
    • addBuildingExtensionIfMissing

      void addBuildingExtensionIfMissing(BuildingExtensionRegistries.BuildingExtensionEntry buildingExtensionEntry, net.minecraft.core.BlockPos pos, net.minecraft.world.entity.player.Player player)
      Add a building extension if it's missing.
      Parameters:
      buildingExtensionEntry - the entry to create the extension from.
      pos - the pos it's at.
    • clearPendingPrestigeCalc

      void clearPendingPrestigeCalc(IBuilding building)
      Indicate to building manager that prestige just has been calculated.
      Parameters:
      building - the building it happened for.
    • getColonyPrestige

      int getColonyPrestige()
      Get the colony prestige.
      Returns:
      the prestige.