Interface IGlobalResearchTree

All Known Implementing Classes:
GlobalResearchTree

public interface IGlobalResearchTree
The interface for the object that holds all research globally.
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    void
    addResearch(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 research
    Get 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 IGlobalResearch
    getResearch(net.minecraft.resources.ResourceLocation id)
    Get the first research with a given id, on any branch.
    @Nullable IGlobalResearch
    getResearch(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.
    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.
    boolean
    hasResearch(net.minecraft.resources.ResourceLocation id)
    Check if a research exists, by id.
    boolean
    hasResearch(net.minecraft.resources.ResourceLocation branch, net.minecraft.resources.ResourceLocation id)
    Check if a research exists, by id.
    boolean
    hasResearchEffect(net.minecraft.resources.ResourceLocation id)
    Checks if a specific research effect has been registered, whether or not it is unlocked.
    boolean
    Checks if the research requirements are completed, for a given colony.
    void
    Resets all dynamically assigned research.
    void
    sendGlobalResearchTreePackets(net.minecraft.server.level.ServerPlayer player)
    Sends messages to the client from the server describing the Global Research Tree.
  • Method Details

    • getInstance

      static IGlobalResearchTree 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:
      id - the id of the research.
      branch - the branch of the research.
      Returns:
      the IGlobalResearch object.
    • getResearch

      @Nullable @Nullable IGlobalResearch getResearch(net.minecraft.resources.ResourceLocation id)
      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:
      id - the id of the research.
      branch - the branch 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:
      research - the research to add.
      branch - the branch of the research.
      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

      IGlobalResearchBranch getBranchData(net.minecraft.resources.ResourceLocation branchId)
      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

      List<ItemStorage> 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

      boolean isResearchRequirementsFulfilled(List<IResearchRequirement> requirements, IColony colony)
      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

      IMessage handleGlobalResearchTreeMessage(net.minecraft.network.FriendlyByteBuf 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.