Interface IBuildingExtension

All Superinterfaces:
IModuleContainer<IBuildingExtensionModule>
All Known Implementing Classes:
AbstractBuildingExtensionModule, FarmField, PlantationField

public interface IBuildingExtension extends IModuleContainer<IBuildingExtensionModule>
Interface for building extension instances.
  • Method Details

    • getBuildingExtensionType

      @NotNull BuildingExtensionRegistries.BuildingExtensionEntry getBuildingExtensionType()
      Return the building extension type for this building extension.
      Returns:
      the building extension registry entry.
    • getPosition

      @NotNull @NotNull net.minecraft.core.BlockPos getPosition()
      Gets the position of the building extension.
      Returns:
      central location of the building extension.
    • getBuildingId

      @Nullable @Nullable net.minecraft.core.BlockPos getBuildingId()
      Getter for the owning building of the building extension.
      Returns:
      the id or null.
    • setBuilding

      void setBuilding(net.minecraft.core.BlockPos buildingId)
      Sets the owning building of the building extension.
      Parameters:
      buildingId - id of the building.
    • resetOwningBuilding

      void resetOwningBuilding()
      Resets the ownership of the building extension.
    • isTaken

      boolean isTaken()
      Has the building extension been taken.
      Returns:
      true if the building extension is not free to use, false after releasing it.
    • getSqDistance

      int getSqDistance(IBuildingView building)
      Get the distance to a building.
      Parameters:
      building - the building to get the distance to.
      Returns:
      the distance
    • serializeNBT

      @NotNull @NotNull net.minecraft.nbt.CompoundTag serializeNBT()
      Stores the NBT data of the building extension.
    • deserializeNBT

      void deserializeNBT(@NotNull @NotNull net.minecraft.nbt.CompoundTag compound)
      Reconstruct the building extension from the given NBT data.
      Parameters:
      compound - the compound to read from.
    • serialize

      void serialize(@NotNull @NotNull net.minecraft.network.FriendlyByteBuf buf)
      Serialize a building extension to a buffer.
      Parameters:
      buf - the buffer to write the building extension data to.
    • deserialize

      void deserialize(@NotNull @NotNull net.minecraft.network.FriendlyByteBuf buf)
      Deserialize a building extension from a buffer.
      Parameters:
      buf - the buffer to read the building extension data from.
    • isValidPlacement

      boolean isValidPlacement(IColony colony)
      Condition to check whether this building extension instance is currently properly placed down.
      Parameters:
      colony - the colony this building extension is in.
      Returns:
      true if the building extension is correctly placed at the current position.
    • hashCode

      int hashCode()
      Hashcode implementation for this building extension.
      Overrides:
      hashCode in class Object
    • equals

      boolean equals(Object other)
      Equals implementation for this building extension.
      Overrides:
      equals in class Object
    • getId

      Get the unique extension id.
      Returns:
      the unique id.
    • registerModule

      void registerModule(@NotNull @NotNull IBuildingExtensionModule module)
      Register a specific module to the object.
      Parameters:
      module - the module to register.