Class BuildingResearchRequirement
java.lang.Object
com.minecolonies.api.research.requirements.BuildingResearchRequirement
- All Implemented Interfaces:
IResearchRequirement
Certain building research requirements.
-
Constructor Summary
ConstructorsConstructorDescriptionBuildingResearchRequirement(com.google.gson.JsonObject json) Create a building research requirement.BuildingResearchRequirement(net.minecraft.nbt.CompoundTag nbt) Create a building research requirement. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.resources.ResourceLocationintnet.minecraft.network.chat.MutableComponentgetDesc()Get a human-readable description of the requirement, or a translation key.Get theModResearchRequirements.ResearchRequirementEntryfor this Research Requirement.booleanisFulfilled(IColony colony) Check if this requirement is fulfilled for a certain colony.static net.minecraft.resources.ResourceLocationAttempts to parse a resource location from a given key.net.minecraft.nbt.CompoundTagWrite the ResearchRequirement's traits to NBT, to simplify serialization for client-viewable data.
-
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
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:IResearchRequirementGet theModResearchRequirements.ResearchRequirementEntryfor this Research Requirement.- Specified by:
getRegistryEntryin interfaceIResearchRequirement- Returns:
- a registry entry.
-
getDesc
public net.minecraft.network.chat.MutableComponent getDesc()Description copied from interface:IResearchRequirementGet a human-readable description of the requirement, or a translation key.- Specified by:
getDescin interfaceIResearchRequirement- Returns:
- translation text component.
-
isFulfilled
Description copied from interface:IResearchRequirementCheck if this requirement is fulfilled for a certain colony.- Specified by:
isFulfilledin interfaceIResearchRequirement- Parameters:
colony- the colony to check.- Returns:
- true if so.
-
writeToNBT
public net.minecraft.nbt.CompoundTag writeToNBT()Description copied from interface:IResearchRequirementWrite the ResearchRequirement's traits to NBT, to simplify serialization for client-viewable data.- Specified by:
writeToNBTin interfaceIResearchRequirement- Returns:
- an NBT file which must, at minimum, contain the necessary traits to reassemble the effect.
-