Package com.minecolonies.core.research
Class LocalResearchTree
java.lang.Object
com.minecolonies.core.research.LocalResearchTree
- All Implemented Interfaces:
ILocalResearchTree
The class which contains all research.
-
Field Summary
Fields -
Constructor Summary
Constructors -
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, 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.
-
Field Details
-
colony
The colony reference.
-
-
Constructor Details
-
LocalResearchTree
-
-
Method Details
-
getResearch
public ILocalResearch getResearch(net.minecraft.resources.ResourceLocation branch, net.minecraft.resources.ResourceLocation id) Description copied from interface:ILocalResearchTreeGet a research by id.- Specified by:
getResearchin interfaceILocalResearchTree- Parameters:
branch- the branch of the research.id- the id of the research.- Returns:
- the IResearch object.
-
hasCompletedResearch
public boolean hasCompletedResearch(net.minecraft.resources.ResourceLocation researchId) Description copied from interface:ILocalResearchTreeChecks if a given research is complete.- Specified by:
hasCompletedResearchin interfaceILocalResearchTree- Returns:
- true if complete or if no such research is loaded, false if not completed.
-
addResearch
Description copied from interface:ILocalResearchTreeAdd a research to the tree.- Specified by:
addResearchin interfaceILocalResearchTree- Parameters:
branch- the branch of the research.research- the research to add.
-
branchFinishedHighestLevel
public boolean branchFinishedHighestLevel(net.minecraft.resources.ResourceLocation branch) Description copied from interface:ILocalResearchTreeCheck if a branch already researched a level 6 research. This is important since only 1 of these can be researched for each branch.- Specified by:
branchFinishedHighestLevelin interfaceILocalResearchTree- Parameters:
branch- the branch to check.- Returns:
- true if so.
-
getResearchInProgress
Description copied from interface:ILocalResearchTreeGet a list of all research in progress.- Specified by:
getResearchInProgressin interfaceILocalResearchTree- Returns:
- the list.
-
finishResearch
public void finishResearch(net.minecraft.resources.ResourceLocation id) Description copied from interface:ILocalResearchTreeFinish a research and remove it from the inProgress list.- Specified by:
finishResearchin interfaceILocalResearchTree- Parameters:
id- the id of the research to finish.
-
attemptBeginResearch
public void attemptBeginResearch(net.minecraft.world.entity.player.Player player, IColony colony, BuildingUniversity building, IGlobalResearch research) Attempt to begin a research.- Specified by:
attemptBeginResearchin interfaceILocalResearchTree- Parameters:
player- the player(s) making the request (and to apply costs toward)colony- the colony doing the researchbuilding- the university building that the player is standing in (or null if not in a university)research- the research.
-
attemptResetResearch
public void attemptResetResearch(net.minecraft.world.entity.player.Player player, IColony colony, ILocalResearch research) Description copied from interface:ILocalResearchTreeReset a research, and optionally undo its effects. If the research is begun but incomplete, cancel it.- Specified by:
attemptResetResearchin interfaceILocalResearchTree- 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
public void writeToNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound) Description copied from interface:ILocalResearchTreeWrite the research tree to NBT.- Specified by:
writeToNBTin interfaceILocalResearchTree- Parameters:
compound- the compound.
-
readFromNBT
public void readFromNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider, net.minecraft.nbt.CompoundTag compound, IResearchEffectManager effects) Description copied from interface:ILocalResearchTreeRead the research tree from NBT.- Specified by:
readFromNBTin interfaceILocalResearchTree- Parameters:
compound- the compound to read it from.effects- the effects.
-
getCompletedList
Description copied from interface:ILocalResearchTreeGet the list of all finished researches- Specified by:
getCompletedListin interfaceILocalResearchTree- Returns:
- a copy of the completed list.
-
isComplete
public boolean isComplete(net.minecraft.resources.ResourceLocation location) Description copied from interface:ILocalResearchTreeCheck if a given research is complete.- Specified by:
isCompletein interfaceILocalResearchTree- Parameters:
location- the unique id.- Returns:
- true if so.
-