def crafting_shaped(self,
                     name_parts: ResourceIdentifier,
                     pattern: Sequence[str],
                     ingredients: Json,
                     result: Json,
                     group: str = None,
                     conditions: Optional[Json] = None) -> RecipeContext:
     """
     Creates a shaped crafting recipe.
     :param name_parts: The resource location, including path elements.
     :param pattern: The pattern for the recipe.
     :param ingredients: The ingredients, indexed by key in pattern.
     :param result: The result of crafting the recipe.
     :param group: The group.
     :param conditions: Any conditions for the recipe to be enabled.
     """
     res = utils.resource_location(self.domain, name_parts)
     self.write(
         (*self.resource_dir, 'data', res.domain, 'recipes', res.path), {
             'type': 'minecraft:crafting_shaped',
             'group': group,
             'pattern': pattern,
             'key': utils.item_stack_dict(ingredients, ''.join(pattern)[0]),
             'result': utils.item_stack(result),
             'conditions': utils.recipe_condition(conditions)
         })
     return RecipeContext(self, res)
Пример #2
0
 def damage_shapeless(name_parts: utils.ResourceIdentifier, ingredients: utils.Json, result: utils.Json, group: str = None, conditions: utils.Json = None) -> RecipeContext:
     res = utils.resource_location(rm.domain, name_parts)
     rm.write((*rm.resource_dir, 'data', res.domain, 'recipes', res.path), {
         'type': 'tfc:damage_inputs_crafting',
         'recipe': {
             'type': 'minecraft:crafting_shapeless',
             'group': group,
             'ingredients': utils.item_stack_list(ingredients),
             'result': utils.item_stack(result),
             'conditions': utils.recipe_condition(conditions)
         }
     })
     return RecipeContext(rm, res)
 def recipe(self,
            name_parts: ResourceIdentifier,
            type_in: str,
            data_in: Dict[str, Any],
            group: str = None,
            conditions: Json = None) -> RecipeContext:
     """
     Creates a non-crafting recipe file, used for custom mod recipes using vanilla's data pack system
     :param name_parts: The resource location, including path elements.
     :param type_in: The type of the recipe.
     :param data_in: Data required by the recipe, as present in json
     :param group: The group.
     :param conditions: Any conditions for the recipe to be enabled.
     """
     res = utils.resource_location(self.domain, name_parts)
     self.write(
         (*self.resource_dir, 'data', res.domain, 'recipes', res.path), {
             'type': type_in,
             'group': group,
             **data_in, 'conditions': utils.recipe_condition(conditions)
         })
     return RecipeContext(self, res)
 def crafting_shapeless(self,
                        name_parts: ResourceIdentifier,
                        ingredients: Json,
                        result: Json,
                        group: str = None,
                        conditions: Optional[Json] = None) -> RecipeContext:
     """
     Creates a shapeless crafting recipe.
     :param name_parts: The resource location, including path elements.
     :param ingredients: The ingredients.
     :param result: The result of crafting the recipe.
     :param group: The group.
     :param conditions: Any conditions for the recipe to be enabled.
     """
     res = utils.resource_location(self.domain, name_parts)
     self.write(
         (*self.resource_dir, 'data', res.domain, 'recipes', res.path), {
             'type': 'minecraft:crafting_shapeless',
             'group': group,
             'ingredients': utils.item_stack_list(ingredients),
             'result': utils.item_stack(result),
             'conditions': utils.recipe_condition(conditions)
         })
     return RecipeContext(self, res)