Package com.minecolonies.api.research
Interface IGlobalResearch
- All Known Implementing Classes:
GlobalResearch
public interface IGlobalResearch
Interface defining how a research globally is defined.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddChild(IGlobalResearch child) Add a child to a research.voidaddChild(net.minecraft.resources.ResourceLocation child) Add a child to a research, without setting parentage.voidaddCost(IResearchCost cost) Add an individual cost.voidaddEffect(IResearchEffect effect) Add an individual effect.voidaddRequirement(IResearchRequirement requirement) Add an individual requirementbooleancanDisplay(int uni_level) Check if this research can be displayed in the GUI.booleancanResearch(@NotNull IBuilding building, @NotNull ILocalResearchTree localTree) Check if this research can be executed at this moment.net.minecraft.resources.ResourceLocationGet the id of the branch.List<net.minecraft.resources.ResourceLocation>Get the list of children of the research.Get the cost list from the research.intgetDepth()Get the depth in the research tree.Get the effect of the research.net.minecraft.resources.ResourceLocationgetId()Getter of the id of the research.net.minecraft.network.chat.contents.TranslatableContentsgetName()Human-readable description of research, in human-readable text or as a translation key.@Nullable net.minecraft.resources.ResourceLocationGet the id of the parent IResearch.Getter for the research requirement.intGet the sort order for relative display position.net.minecraft.network.chat.contents.TranslatableContentsSubtitle description of research, in human-readable text or as a translation key.booleanhasEnoughResources(@NotNull net.minecraft.world.entity.player.Player player, @NotNull net.minecraft.core.BlockPos universityPos) Check whether all resources are available to execute the research.booleanCheck if this research is an only child research.booleanhasResearchedChild(@NotNull ILocalResearchTree localTree) Check if this research has other children and if one of these children has been research already.booleanCheck if this research should automatically start when requirements are complete.booleanisHidden()Check if this research is a hidden research.booleanCheck if this research is an immutable research.booleanCheck if this research is an instant research.static booleanisPlayerResearchMatch(net.minecraft.world.item.ItemStack stack, net.minecraft.world.item.Item cost) A stack "matches" a research ingredient if: - It has the same Item - It does NOT carry enchantments, custom names, etc.static booleanisUniversityResearchMatch(net.minecraft.world.item.ItemStack stack, net.minecraft.world.item.Item cost) A stack "matches" a research ingredient if: - It has the same Item (even if they are enchanted or have a custom name)voidstartResearch(@NotNull ILocalResearchTree localResearchTree) Start the research.
-
Method Details
-
canResearch
boolean canResearch(@NotNull @NotNull IBuilding building, @NotNull @NotNull ILocalResearchTree localTree) Check if this research can be executed at this moment.- Parameters:
building- the university building trying to do the research.localTree- the local tree of the colony.- Returns:
- true if so.
-
canDisplay
boolean canDisplay(int uni_level) Check if this research can be displayed in the GUI.- Parameters:
uni_level- the level of the university.- Returns:
- true if so.
-
hasEnoughResources
boolean hasEnoughResources(@NotNull @NotNull net.minecraft.world.entity.player.Player player, @NotNull @NotNull net.minecraft.core.BlockPos universityPos) Check whether all resources are available to execute the research.- Parameters:
inventory- the inventory to check in.- Returns:
- true if so
-
getCostList
List<IResearchCost> getCostList()Get the cost list from the research.- Returns:
- the list.
-
startResearch
Start the research.- Parameters:
localResearchTree- the local research tree to store in the colony.
-
getName
net.minecraft.network.chat.contents.TranslatableContents getName()Human-readable description of research, in human-readable text or as a translation key.- Returns:
- the description.
-
getSubtitle
net.minecraft.network.chat.contents.TranslatableContents getSubtitle()Subtitle description of research, in human-readable text or as a translation key.- Returns:
- the optional subtitle name.
-
getId
net.minecraft.resources.ResourceLocation getId()Getter of the id of the research.- Returns:
- the research id, as a ResourceLocation
-
getParent
@Nullable @Nullable net.minecraft.resources.ResourceLocation getParent()Get the id of the parent IResearch.- Returns:
- the parent id, as a ResourceLocation
-
getBranch
net.minecraft.resources.ResourceLocation getBranch()Get the id of the branch.- Returns:
- the branch id, as a ResourceLocation
-
getDepth
int getDepth()Get the depth in the research tree.- Returns:
- the depth.
-
getSortOrder
int getSortOrder()Get the sort order for relative display position.- Returns:
- the depth.
-
isInstant
boolean isInstant()Check if this research is an instant research. If so, it will attempt to start when its requirements are complete, and prompt the player.- Returns:
- true if so.
-
isAutostart
boolean isAutostart()Check if this research should automatically start when requirements are complete. This can temporarily exceed normal limits of the max number of concurrent researches.- Returns:
- true if so.
-
isHidden
boolean isHidden()Check if this research is a hidden research. If so, it (and its children) should only be visible if all requirements are met.- Returns:
- true if so.
-
isImmutable
boolean isImmutable()Check if this research is an immutable research. If so, it (and ancestor research unlocking it) can not be reset once completed.- Returns:
- true if so.
-
hasOnlyChild
boolean hasOnlyChild()Check if this research is an only child research. This means, after researching one child no other children can be researched.- Returns:
- true if so.
-
hasResearchedChild
Check if this research has other children and if one of these children has been research already.- Parameters:
localTree- the local tree of the colony.- Returns:
- true if so.
-
addChild
Add a child to a research.- Parameters:
child- the child to add.
-
addChild
void addChild(net.minecraft.resources.ResourceLocation child) Add a child to a research, without setting parentage.- Parameters:
child- the child to add
-
addCost
Add an individual cost.- Parameters:
cost- the individual item to add to the cost list, as a reseach cost instance.
-
addEffect
Add an individual effect.- Parameters:
effect- the individual effect to add to the research, as a IResearchEffect.
-
addRequirement
Add an individual requirement- Parameters:
requirement- the individual requirement to add to the research, as an IResearchRequirement.
-
getChildren
List<net.minecraft.resources.ResourceLocation> getChildren()Get the list of children of the research.- Returns:
- a copy of the list of child identifiers.
-
getResearchRequirements
List<IResearchRequirement> getResearchRequirements()Getter for the research requirement.- Returns:
- the requirement.
-
getEffects
List<IResearchEffect> getEffects()Get the effect of the research.- Returns:
- the effect.
-
isPlayerResearchMatch
static boolean isPlayerResearchMatch(net.minecraft.world.item.ItemStack stack, net.minecraft.world.item.Item cost) A stack "matches" a research ingredient if: - It has the same Item - It does NOT carry enchantments, custom names, etc. -
isUniversityResearchMatch
static boolean isUniversityResearchMatch(net.minecraft.world.item.ItemStack stack, net.minecraft.world.item.Item cost) A stack "matches" a research ingredient if: - It has the same Item (even if they are enchanted or have a custom name)
-