Package com.minecolonies.api.research
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA Builder-like class for producing Researches.static classA Builder-like class for producing Research Branchesstatic classA Builder-like class for producing Research Effects.Nested classes/interfaces inherited from interface net.minecraft.data.DataProvider
net.minecraft.data.DataProvider.Factory<T extends net.minecraft.data.DataProvider> -
Field Summary
FieldsFields inherited from interface net.minecraft.data.DataProvider
FIXED_ORDER_FIELDS, KEY_COMPARATOR, LOGGER -
Constructor Summary
ConstructorsConstructorDescriptionAbstractResearchProvider(@NotNull net.minecraft.data.PackOutput packOutput) The abstract variant of a ResearchProvider, to register to fires during runData. -
Method Summary
Modifier and TypeMethodDescriptionprotected CompletableFuture<?>generateAll(net.minecraft.data.CachedOutput cache, com.google.gson.JsonObject langJson) @NotNull StringgetName()protected abstract Collection<AbstractResearchProvider.ResearchBranch>Creates a collection of Research Branches, holding the human-readable name and time multiplier.protected abstract Collection<AbstractResearchProvider.Research>Create a collection of Researches, holding the majority of relevant data for the individual research targets.protected abstract Collection<AbstractResearchProvider.ResearchEffect>Creates a collection of ResearchEffects, holding effect levels and (optionally) name and subtitles.@NotNull CompletableFuture<?>run(@NotNull net.minecraft.data.CachedOutput cache)
-
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 itsResourceLocation.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
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:
runin interfacenet.minecraft.data.DataProvider
-
generateAll
protected CompletableFuture<?> generateAll(net.minecraft.data.CachedOutput cache, com.google.gson.JsonObject langJson) -
getName
- Specified by:
getNamein interfacenet.minecraft.data.DataProvider
-