Class LocalResearchTree

java.lang.Object
com.minecolonies.core.research.LocalResearchTree
All Implemented Interfaces:
ILocalResearchTree

public class LocalResearchTree extends Object implements ILocalResearchTree
The class which contains all research.
  • Field Details

    • colony

      public final IColony colony
      The colony reference.
  • Constructor Details

    • LocalResearchTree

      public LocalResearchTree(IColony colony)
  • Method Details

    • getResearch

      public ILocalResearch getResearch(net.minecraft.resources.ResourceLocation branch, net.minecraft.resources.ResourceLocation id)
      Description copied from interface: ILocalResearchTree
      Get a research by id.
      Specified by:
      getResearch in interface ILocalResearchTree
      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: ILocalResearchTree
      Checks if a given research is complete.
      Specified by:
      hasCompletedResearch in interface ILocalResearchTree
      Returns:
      true if complete or if no such research is loaded, false if not completed.
    • addResearch

      public void addResearch(net.minecraft.resources.ResourceLocation branch, ILocalResearch research)
      Description copied from interface: ILocalResearchTree
      Add a research to the tree.
      Specified by:
      addResearch in interface ILocalResearchTree
      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: ILocalResearchTree
      Check 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:
      branchFinishedHighestLevel in interface ILocalResearchTree
      Parameters:
      branch - the branch to check.
      Returns:
      true if so.
    • getResearchInProgress

      public List<ILocalResearch> getResearchInProgress()
      Description copied from interface: ILocalResearchTree
      Get a list of all research in progress.
      Specified by:
      getResearchInProgress in interface ILocalResearchTree
      Returns:
      the list.
    • finishResearch

      public void finishResearch(net.minecraft.resources.ResourceLocation id)
      Description copied from interface: ILocalResearchTree
      Finish a research and remove it from the inProgress list.
      Specified by:
      finishResearch in interface ILocalResearchTree
      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:
      attemptBeginResearch in interface ILocalResearchTree
      Parameters:
      player - the player(s) making the request (and to apply costs toward)
      colony - the colony doing the research
      building - 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: ILocalResearchTree
      Reset a research, and optionally undo its effects. If the research is begun but incomplete, cancel it.
      Specified by:
      attemptResetResearch in interface ILocalResearchTree
      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(net.minecraft.nbt.CompoundTag compound)
      Description copied from interface: ILocalResearchTree
      Write the research tree to NBT.
      Specified by:
      writeToNBT in interface ILocalResearchTree
      Parameters:
      compound - the compound.
    • readFromNBT

      public void readFromNBT(net.minecraft.nbt.CompoundTag compound, IResearchEffectManager effects)
      Description copied from interface: ILocalResearchTree
      Read the research tree from NBT.
      Specified by:
      readFromNBT in interface ILocalResearchTree
      Parameters:
      compound - the compound to read it from.
      effects - the effects.
    • getCompletedList

      public List<net.minecraft.resources.ResourceLocation> getCompletedList()
      Description copied from interface: ILocalResearchTree
      Get the list of all finished researches
      Specified by:
      getCompletedList in interface ILocalResearchTree
      Returns:
      a copy of the completed list.
    • isComplete

      public boolean isComplete(net.minecraft.resources.ResourceLocation location)
      Description copied from interface: ILocalResearchTree
      Check if a given research is complete.
      Specified by:
      isComplete in interface ILocalResearchTree
      Parameters:
      location - the unique id.
      Returns:
      true if so.