Package com.minecolonies.core.research
Class GlobalResearchTree
java.lang.Object
com.minecolonies.core.research.GlobalResearchTree
- All Implemented Interfaces:
IGlobalResearchTree
The class which contains all research.
-
Constructor Summary
Constructors -
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 isReloadedWithWorld) 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 id) 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 researchList<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.getResearch(net.minecraft.resources.ResourceLocation branch, net.minecraft.resources.ResourceLocation id) Get a research by id.getResearchForEffect(net.minecraft.resources.ResourceLocation id) Gets all research for a given research effect id, if any are present.Validates and gets the list of research reset costs, if any are set, from their configuration values.handleGlobalResearchTreeMessage(net.minecraft.network.FriendlyByteBuf 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.voidserializeNetworkData(net.minecraft.network.FriendlyByteBuf buf)
-
Constructor Details
-
GlobalResearchTree
public GlobalResearchTree()
-
-
Method Details
-
getResearch
public IGlobalResearch getResearch(net.minecraft.resources.ResourceLocation branch, net.minecraft.resources.ResourceLocation id) Description copied from interface:IGlobalResearchTreeGet a research by id.- Specified by:
getResearchin interfaceIGlobalResearchTree- Parameters:
branch- the branch of the research.id- the id of the research.- Returns:
- the IGlobalResearch object.
-
getResearch
Description copied from interface:IGlobalResearchTreeGet the first research with a given id, on any branch. Avoid using when branch is available.- Specified by:
getResearchin interfaceIGlobalResearchTree- Parameters:
id- the id of the research.- Returns:
- the first matching IGlobalResearch object.
-
hasResearch
public boolean hasResearch(net.minecraft.resources.ResourceLocation branch, net.minecraft.resources.ResourceLocation id) Description copied from interface:IGlobalResearchTreeCheck if a research exists, by id.- Specified by:
hasResearchin interfaceIGlobalResearchTree- 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
public boolean hasResearch(net.minecraft.resources.ResourceLocation id) Description copied from interface:IGlobalResearchTreeCheck if a research exists, by id.- Specified by:
hasResearchin interfaceIGlobalResearchTree- Parameters:
id- the id of the research.- Returns:
- true if the research exists, false if it does not.
-
addResearch
public void addResearch(net.minecraft.resources.ResourceLocation branch, IGlobalResearch research, boolean isReloadedWithWorld) Description copied from interface:IGlobalResearchTreeAdd a research to the tree.- Specified by:
addResearchin interfaceIGlobalResearchTree- Parameters:
branch- the branch of the research.research- the research to add.isReloadedWithWorld- true if reloaded with world events (ie data packs, onWorldLoad), false if assigned statically once.
-
addBranchData
public void addBranchData(net.minecraft.resources.ResourceLocation branchId, IGlobalResearchBranch branchData) Description copied from interface:IGlobalResearchTreeAdd data for a research branch, used to contain translation texts, research speed, and other properties.- Specified by:
addBranchDatain interfaceIGlobalResearchTree- Parameters:
branchId- the branch Id.branchData- the data.
-
getResearchForEffect
Description copied from interface:IGlobalResearchTreeGets all research for a given research effect id, if any are present.- Specified by:
getResearchForEffectin interfaceIGlobalResearchTree- Parameters:
id- the effect's identifier.- Returns:
- The set of researches for the effect, or null if no research has this effect.
-
hasResearchEffect
public boolean hasResearchEffect(net.minecraft.resources.ResourceLocation id) Description copied from interface:IGlobalResearchTreeChecks if a specific research effect has been registered, whether or not it is unlocked.- Specified by:
hasResearchEffectin interfaceIGlobalResearchTree- Parameters:
id- the effect's identifier.- Returns:
- true if present, false if not registered.
-
getBranches
Description copied from interface:IGlobalResearchTreeGet the list of all branch ids.- Specified by:
getBranchesin interfaceIGlobalResearchTree- Returns:
- the list of branches.
-
getBranchData
Description copied from interface:IGlobalResearchTreeGet the specific GlobalResearchBranch data for a specific branch id.- Specified by:
getBranchDatain interfaceIGlobalResearchTree- Parameters:
id- the branch of the research
-
getPrimaryResearch
public List<net.minecraft.resources.ResourceLocation> getPrimaryResearch(net.minecraft.resources.ResourceLocation branch) Description copied from interface:IGlobalResearchTreeGet the primary research of a certain branch.- Specified by:
getPrimaryResearchin interfaceIGlobalResearchTree- Parameters:
branch- the branch it belongs to.- Returns:
- the list of research without parent.
-
reset
public void reset()Description copied from interface:IGlobalResearchTreeResets all dynamically assigned research.- Specified by:
resetin interfaceIGlobalResearchTree
-
isResearchRequirementsFulfilled
public boolean isResearchRequirementsFulfilled(List<IResearchRequirement> requirements, IColony colony) Description copied from interface:IGlobalResearchTreeChecks if the research requirements are completed, for a given colony.- Specified by:
isResearchRequirementsFulfilledin interfaceIGlobalResearchTree- Parameters:
requirements- the research requirements.colony- the colony to test against.- Returns:
- true if complete.
-
sendGlobalResearchTreePackets
public void sendGlobalResearchTreePackets(net.minecraft.server.level.ServerPlayer player) Description copied from interface:IGlobalResearchTreeSends messages to the client from the server describing the Global Research Tree. Only used for dedicated servers.- Specified by:
sendGlobalResearchTreePacketsin interfaceIGlobalResearchTree- Parameters:
player- the player to send the message all players should be updated on a data pack reload.
-
serializeNetworkData
public void serializeNetworkData(net.minecraft.network.FriendlyByteBuf buf) -
handleGlobalResearchTreeMessage
Description copied from interface:IGlobalResearchTreeHandle messages in the client from the server describing the Global Research Tree. Only used for remote clients.- Specified by:
handleGlobalResearchTreeMessagein interfaceIGlobalResearchTree- Parameters:
buf- the buffer of received network data.
-
getEffectsForResearch
public List<IResearchEffect> getEffectsForResearch(@NotNull @NotNull net.minecraft.resources.ResourceLocation id) Description copied from interface:IGlobalResearchTreeGet an effect id for a particular research- Specified by:
getEffectsForResearchin interfaceIGlobalResearchTree- Parameters:
id- the id of the research.- Returns:
- the effect id
-
getAutostartResearches
Description copied from interface:IGlobalResearchTreeGet the list of researches that are intended to start automatically once their requirements are met.- Specified by:
getAutostartResearchesin interfaceIGlobalResearchTree- Returns:
- the list of research.
-
getResearchResetCosts
Description copied from interface:IGlobalResearchTreeValidates and gets the list of research reset costs, if any are set, from their configuration values.- Specified by:
getResearchResetCostsin interfaceIGlobalResearchTree- Returns:
- the list of items in ItemStorage format.
-