Class RecipeSchema
java.lang.Object
dev.latvian.mods.kubejs.recipe.schema.RecipeSchema
- Direct Known Subclasses:
UnknownRecipeSchema
A recipe schema is a set of keys that defines how a recipe is constructed
from both KubeJS scripts (through the
constructors) and JSON files
(using the deserialize(SourceLine, RecipeTypeFunction, ResourceLocation, JsonObject) method).
The schema also defines a recipeFactory in order to create a KubeRecipe object that
implements serialization logic, post-load validation (KubeRecipe.validate(RecipeValidationContext)),
as well as entirely custom logic such as additional methods a developer may call from scripts.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal Map<String, RecipeFunctionInstance> final Map<RecipeKey<?>, RecipeOptional<?>> net.minecraft.resources.ResourceLocation -
Constructor Summary
ConstructorsConstructorDescriptionRecipeSchema(RecipeKey<?>... keys) RecipeSchema(Map<RecipeKey<?>, RecipeOptional<?>> keyOverrides, List<RecipeKey<?>> keys) Defines a new recipe schema that creates recipes of the givenKubeRecipesubclass. -
Method Summary
Modifier and TypeMethodDescription<T> RecipeSchemaaddToListOpFunction(String name, RecipeKey<List<T>> key) @Nullable Stringconstructor(RecipeKey<?>... keys) Defines an additional constructor to be for this schema.constructor(RecipeConstructor constructor) it.unimi.dsi.fastutil.ints.Int2ObjectMap<RecipeConstructor> booleandeserialize(SourceLine sourceLine, RecipeTypeFunction type, @Nullable net.minecraft.resources.ResourceLocation id, com.google.gson.JsonObject json) factory(KubeRecipeFactory factory) function(RecipeFunctionInstance function) <T> RecipeKey<T> <T> @Nullable RecipeKey<T> getOptionalKey(String id) intbooleanisHidden()intintpostProcessor(RecipePostProcessor processor) <T> RecipeSchemasetOpFunction(String name, RecipeKey<T> key, T value) com.google.gson.JsonObjecttoJson(RecipeSchemaStorage storage, RecipeSchemaType schemaType, net.minecraft.resources.RegistryOps<com.google.gson.JsonElement> ops) typeOverride(net.minecraft.resources.ResourceLocation id) uniqueIds(SequencedCollection<RecipeKey<?>> keys)
-
Field Details
-
recipeFactory
-
typeOverride
public net.minecraft.resources.ResourceLocation typeOverride -
keys
-
includedKeys
-
keyOverrides
-
functions
-
-
Constructor Details
-
RecipeSchema
Defines a new recipe schema that creates recipes of the givenKubeRecipesubclass.Keys are defined in order of their appearance in the autogenerated constructor, where optional keys must be placed after all required keys.
- Parameters:
keys- The keys that define this schema.
-
RecipeSchema
-
-
Method Details
-
factory
-
typeOverride
-
constructor
-
constructor
Defines an additional constructor to be for this schema.- Parameters:
keys- The arguments that this constructor takes in.- Returns:
- This schema.
-
uniqueId
-
uniqueIds
-
buildUniqueId
-
constructors
-
uniqueIds
-
minRequiredArguments
public int minRequiredArguments() -
inputCount
public int inputCount() -
outputCount
public int outputCount() -
isHidden
public boolean isHidden() -
constructorsGenerated
public boolean constructorsGenerated() -
deserialize
public KubeRecipe deserialize(SourceLine sourceLine, RecipeTypeFunction type, @Nullable @Nullable net.minecraft.resources.ResourceLocation id, com.google.gson.JsonObject json) -
function
-
setOpFunction
-
addToListOpFunction
-
postProcessor
-
getOptionalKey
-
getKey
-
postProcessors
-
toJson
public com.google.gson.JsonObject toJson(RecipeSchemaStorage storage, RecipeSchemaType schemaType, net.minecraft.resources.RegistryOps<com.google.gson.JsonElement> ops)
-