Class AbstractResearchProvider

java.lang.Object
com.minecolonies.api.research.AbstractResearchProvider
All Implemented Interfaces:
net.minecraft.data.DataProvider
Direct Known Subclasses:
DefaultResearchProvider

public abstract class AbstractResearchProvider extends Object implements net.minecraft.data.DataProvider
A class for creating the Research-related JSONs, including Research, ResearchEffects, and (optional) Branches. Note that this does not validate that the resulting research tree is coherent: programmers should make sure that research parents and effects exist, that depth is 1 or one level greater than the parent depth, and that cost and requirement identifiers match real items.

Avoid changing research identifiers here unless necessary. If required, update ResearchCompatMap.

  • Field Details

    • packOutput

      protected final net.minecraft.data.PackOutput packOutput
  • Constructor Details

    • AbstractResearchProvider

      public AbstractResearchProvider(@NotNull @NotNull net.minecraft.data.PackOutput packOutput)
      The abstract variant of a ResearchProvider, to register to fires during runData.
      Parameters:
      packOutput - the pack output.
  • Method Details

    • getResearchBranchCollection

      protected abstract Collection<AbstractResearchProvider.ResearchBranch> getResearchBranchCollection()
      Creates a collection of Research Branches, holding the human-readable name and time multiplier. Research Branches are optional: if no matching json is present, or no values set, the branch will default to its ResourceLocation.getPath(), at 1.0 research time.
      Returns:
      A collection of Research Branches, or Collection.EMPTY_LIST.
    • getResearchEffectCollection

      protected abstract Collection<AbstractResearchProvider.ResearchEffect> getResearchEffectCollection()
      Creates a collection of ResearchEffects, holding effect levels and (optionally) name and subtitles. ResearchEffects are not strictly mandatory: if no matching effect or effect level is present, the Research will default to a strength of 10 or true when complete. For non-boolean-like effects, they're strongly encouraged.
      Returns:
      A collection of ResearchEffects, or Collection.EMPTY_LIST.
    • getResearchCollection

      protected abstract Collection<AbstractResearchProvider.Research> getResearchCollection()
      Create a collection of Researches, holding the majority of relevant data for the individual research targets. Researches must consist of at least an identifier and a branch. If the research has no parent, it must be research level 1; if it does have a parent, it must be exactly one level higher than its parent.
      Returns:
      A collection of Researches.
    • run

      @NotNull public @NotNull CompletableFuture<?> run(@NotNull @NotNull net.minecraft.data.CachedOutput cache)
      Specified by:
      run in interface net.minecraft.data.DataProvider
    • generateAll

      protected CompletableFuture<?> generateAll(net.minecraft.data.CachedOutput cache, com.google.gson.JsonObject langJson)
    • getName

      @NotNull public @NotNull String getName()
      Specified by:
      getName in interface net.minecraft.data.DataProvider