Class BuildingResearchRequirement

java.lang.Object
com.minecolonies.api.research.requirements.BuildingResearchRequirement
All Implemented Interfaces:
IResearchRequirement

public class BuildingResearchRequirement extends Object implements IResearchRequirement
Certain building research requirements.
  • Constructor Details

    • BuildingResearchRequirement

      public BuildingResearchRequirement(net.minecraft.nbt.CompoundTag nbt)
      Create a building research requirement.
      Parameters:
      nbt - the nbt containing the relevant data.
    • BuildingResearchRequirement

      public BuildingResearchRequirement(com.google.gson.JsonObject json)
      Create a building research requirement.
      Parameters:
      json - the json containing the relevant data.
  • Method Details

    • parseFallbackBuildingKey

      public static net.minecraft.resources.ResourceLocation parseFallbackBuildingKey(String key)
      Attempts to parse a resource location from a given key. If the key is not already a valid resource location, it is assumed to be a namespaced key within the MineColonies mod, and is converted to a valid resource location accordingly.
      Parameters:
      key - the key to parse.
      Returns:
      the parsed resource location.
    • getBuilding

      public net.minecraft.resources.ResourceLocation getBuilding()
      Returns:
      the building registry resource location
    • getBuildingLevel

      public int getBuildingLevel()
      Returns:
      the building level
    • getRegistryEntry

      Description copied from interface: IResearchRequirement
      Get the ModResearchRequirements.ResearchRequirementEntry for this Research Requirement.
      Specified by:
      getRegistryEntry in interface IResearchRequirement
      Returns:
      a registry entry.
    • getDesc

      public net.minecraft.network.chat.MutableComponent getDesc()
      Description copied from interface: IResearchRequirement
      Get a human-readable description of the requirement, or a translation key.
      Specified by:
      getDesc in interface IResearchRequirement
      Returns:
      translation text component.
    • isFulfilled

      public boolean isFulfilled(IColony colony)
      Description copied from interface: IResearchRequirement
      Check if this requirement is fulfilled for a certain colony.
      Specified by:
      isFulfilled in interface IResearchRequirement
      Parameters:
      colony - the colony to check.
      Returns:
      true if so.
    • writeToNBT

      public net.minecraft.nbt.CompoundTag writeToNBT()
      Description copied from interface: IResearchRequirement
      Write the ResearchRequirement's traits to NBT, to simplify serialization for client-viewable data.
      Specified by:
      writeToNBT in interface IResearchRequirement
      Returns:
      an NBT file which must, at minimum, contain the necessary traits to reassemble the effect.