Package com.minecolonies.api.research
Interface IGlobalResearchTree
- All Known Implementing Classes:
GlobalResearchTree
public interface IGlobalResearchTree
The interface for the object that holds all research globally.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddBranchData(net.minecraft.resources.ResourceLocation branchId, IGlobalResearchBranch branchData) Add data for a research branch, used to contain translation texts, research speed, and other properties.voidaddResearch(net.minecraft.resources.ResourceLocation branch, IGlobalResearch research, boolean isDynamic) Add a research to the tree.Get the list of researches that are intended to start automatically once their requirements are met.getBranchData(net.minecraft.resources.ResourceLocation branchId) Get the specific GlobalResearchBranch data for a specific branch id.List<net.minecraft.resources.ResourceLocation> Get the list of all branch ids.getEffectsForResearch(@NotNull net.minecraft.resources.ResourceLocation id) Get an effect id for a particular researchstatic IGlobalResearchTreeGet an instance of this Tree.List<net.minecraft.resources.ResourceLocation> getPrimaryResearch(net.minecraft.resources.ResourceLocation branch) Get the primary research of a certain branch.@Nullable IGlobalResearchgetResearch(net.minecraft.resources.ResourceLocation id) Get the first research with a given id, on any branch.@Nullable IGlobalResearchgetResearch(net.minecraft.resources.ResourceLocation branch, net.minecraft.resources.ResourceLocation id) Get a research by id.@Nullable Set<IGlobalResearch> getResearchForEffect(net.minecraft.resources.ResourceLocation id) Gets all research for a given research effect id, if any are present.getResearchResetCosts(net.minecraft.core.HolderLookup.Provider provider) Validates and gets the list of research reset costs, if any are set, from their configuration values.voidhandleGlobalResearchTreeMessage(net.minecraft.network.RegistryFriendlyByteBuf buf) Handle messages in the client from the server describing the Global Research Tree.booleanhasResearch(net.minecraft.resources.ResourceLocation id) Check if a research exists, by id.booleanhasResearch(net.minecraft.resources.ResourceLocation branch, net.minecraft.resources.ResourceLocation id) Check if a research exists, by id.booleanhasResearchEffect(net.minecraft.resources.ResourceLocation id) Checks if a specific research effect has been registered, whether or not it is unlocked.booleanisResearchRequirementsFulfilled(List<IResearchRequirement> requirements, IColony colony) Checks if the research requirements are completed, for a given colony.voidreset()Resets all dynamically assigned research.voidsendGlobalResearchTreePackets(net.minecraft.server.level.ServerPlayer player) Sends messages to the client from the server describing the Global Research Tree.
-
Method Details
-
getInstance
Get an instance of this Tree.- Returns:
- the instance.
-
getResearch
@Nullable @Nullable IGlobalResearch 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 IGlobalResearch object.
-
getResearch
Get the first research with a given id, on any branch. Avoid using when branch is available.- Parameters:
id- the id of the research.- Returns:
- the first matching IGlobalResearch object.
-
getEffectsForResearch
List<IResearchEffect> getEffectsForResearch(@NotNull @NotNull net.minecraft.resources.ResourceLocation id) Get an effect id for a particular research- Parameters:
id- the id of the research.- Returns:
- the effect id
-
hasResearch
boolean hasResearch(net.minecraft.resources.ResourceLocation branch, net.minecraft.resources.ResourceLocation id) Check if a research exists, by id.- Parameters:
branch- the branch of the research.id- the id of the research.- Returns:
- true if the research exists, false if it does not.
-
hasResearch
boolean hasResearch(net.minecraft.resources.ResourceLocation id) Check if a research exists, by id.- Parameters:
id- the id of the research.- Returns:
- true if the research exists, false if it does not.
-
addResearch
void addResearch(net.minecraft.resources.ResourceLocation branch, IGlobalResearch research, boolean isDynamic) Add a research to the tree.- Parameters:
branch- the branch of the research.research- the research to add.isDynamic- true if reloaded with world events (ie data packs, onWorldLoad), false if assigned statically once.
-
addBranchData
void addBranchData(net.minecraft.resources.ResourceLocation branchId, IGlobalResearchBranch branchData) Add data for a research branch, used to contain translation texts, research speed, and other properties.- Parameters:
branchId- the branch Id.branchData- the data.
-
getBranches
List<net.minecraft.resources.ResourceLocation> getBranches()Get the list of all branch ids.- Returns:
- the list of branches.
-
getBranchData
Get the specific GlobalResearchBranch data for a specific branch id.- Parameters:
branchId- the branch of the research
-
reset
void reset()Resets all dynamically assigned research. -
getPrimaryResearch
List<net.minecraft.resources.ResourceLocation> getPrimaryResearch(net.minecraft.resources.ResourceLocation branch) Get the primary research of a certain branch.- Parameters:
branch- the branch it belongs to.- Returns:
- the list of research without parent.
-
getAutostartResearches
Set<IGlobalResearch> getAutostartResearches()Get the list of researches that are intended to start automatically once their requirements are met.- Returns:
- the list of research.
-
getResearchResetCosts
Validates and gets the list of research reset costs, if any are set, from their configuration values.- Returns:
- the list of items in ItemStorage format.
-
hasResearchEffect
boolean hasResearchEffect(net.minecraft.resources.ResourceLocation id) Checks if a specific research effect has been registered, whether or not it is unlocked.- Parameters:
id- the effect's identifier.- Returns:
- true if present, false if not registered.
-
getResearchForEffect
@Nullable @Nullable Set<IGlobalResearch> getResearchForEffect(net.minecraft.resources.ResourceLocation id) Gets all research for a given research effect id, if any are present.- Parameters:
id- the effect's identifier.- Returns:
- The set of researches for the effect, or null if no research has this effect.
-
isResearchRequirementsFulfilled
Checks if the research requirements are completed, for a given colony.- Parameters:
requirements- the research requirements.colony- the colony to test against.- Returns:
- true if complete.
-
handleGlobalResearchTreeMessage
void handleGlobalResearchTreeMessage(net.minecraft.network.RegistryFriendlyByteBuf buf) Handle messages in the client from the server describing the Global Research Tree. Only used for remote clients.- Parameters:
buf- the buffer of received network data.
-
sendGlobalResearchTreePackets
void sendGlobalResearchTreePackets(net.minecraft.server.level.ServerPlayer player) Sends messages to the client from the server describing the Global Research Tree. Only used for dedicated servers.- Parameters:
player- the player to send the message all players should be updated on a data pack reload.
-