Package com.minecolonies.api.research
Interface ILocalResearchTree
- All Known Implementing Classes:
LocalResearchTree
public interface ILocalResearchTree
The class which contains all research.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddResearch(net.minecraft.resources.ResourceLocation branch, ILocalResearch research) Add a research to the tree.voidattemptBeginResearch(net.minecraft.world.entity.player.Player player, IColony colony, BuildingUniversity building, IGlobalResearch research) Attempt to begin a research.voidattemptResetResearch(net.minecraft.world.entity.player.Player player, @Nullable IColony colony, ILocalResearch research) Reset a research, and optionally undo its effects.booleanbranchFinishedHighestLevel(net.minecraft.resources.ResourceLocation branch) Check if a branch already researched a level 6 research.voidfinishResearch(net.minecraft.resources.ResourceLocation id) Finish a research and remove it from the inProgress list.List<net.minecraft.resources.ResourceLocation> Get the list of all finished researchesgetResearch(net.minecraft.resources.ResourceLocation branch, net.minecraft.resources.ResourceLocation id) Get a research by id.Get a list of all research in progress.booleanhasCompletedResearch(net.minecraft.resources.ResourceLocation researchId) Checks if a given research is complete.booleanisComplete(net.minecraft.resources.ResourceLocation location) Check if a given research is complete.voidreadFromNBT(net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound, IResearchEffectManager effects) Read the research tree from NBT.voidwriteToNBT(net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound) Write the research tree to NBT.
-
Method Details
-
getResearch
ILocalResearch getResearch(net.minecraft.resources.ResourceLocation branch, net.minecraft.resources.ResourceLocation id) Get a research by id.- Parameters:
branch- the branch of the research.id- the id of the research.- Returns:
- the IResearch object.
-
addResearch
Add a research to the tree.- Parameters:
branch- the branch of the research.research- the research to add.
-
branchFinishedHighestLevel
boolean branchFinishedHighestLevel(net.minecraft.resources.ResourceLocation branch) Check if a branch already researched a level 6 research. This is important since only 1 of these can be researched for each branch.- Parameters:
branch- the branch to check.- Returns:
- true if so.
-
getResearchInProgress
List<ILocalResearch> getResearchInProgress()Get a list of all research in progress.- Returns:
- the list.
-
hasCompletedResearch
boolean hasCompletedResearch(net.minecraft.resources.ResourceLocation researchId) Checks if a given research is complete.- Returns:
- true if complete or if no such research is loaded, false if not completed.
-
finishResearch
void finishResearch(net.minecraft.resources.ResourceLocation id) Finish a research and remove it from the inProgress list.- Parameters:
id- the id of the research to finish.
-
attemptBeginResearch
void attemptBeginResearch(net.minecraft.world.entity.player.Player player, IColony colony, BuildingUniversity building, IGlobalResearch research) Attempt to begin a research.- Parameters:
player- the player(s) making the request (and to apply costs toward)colony- the colony doing the researchresearch- the research.
-
attemptResetResearch
void attemptResetResearch(net.minecraft.world.entity.player.Player player, @Nullable @Nullable IColony colony, ILocalResearch research) Reset a research, and optionally undo its effects. If the research is begun but incomplete, cancel it.- Parameters:
player- the player to notify of research cancellation results.colony- the colony to remove effects from, or null if no effect reset is desired.research- the local research descriptor.
-
writeToNBT
void writeToNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound) Write the research tree to NBT.- Parameters:
compound- the compound.
-
readFromNBT
void readFromNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound, IResearchEffectManager effects) Read the research tree from NBT.- Parameters:
compound- the compound to read it from.effects- the effects.
-
getCompletedList
List<net.minecraft.resources.ResourceLocation> getCompletedList()Get the list of all finished researches- Returns:
- a copy of the completed list.
-
isComplete
boolean isComplete(net.minecraft.resources.ResourceLocation location) Check if a given research is complete.- Parameters:
location- the unique id.- Returns:
- true if so.
-