SmithingTransformRecipeBuilder.java

net.minecraft.data.recipes.SmithingTransformRecipeBuilder

信息

  • 全限定名:net.minecraft.data.recipes.SmithingTransformRecipeBuilder
  • 类型:public class
  • 包:net.minecraft.data.recipes
  • 源码路径:src/main/java/net/minecraft/data/recipes/SmithingTransformRecipeBuilder.java
  • 起始行号:L14
  • 职责:

    TODO

字段/常量

  • template

    • 类型: Ingredient
    • 修饰符: private final
    • 源码定位: L15
    • 说明:

      TODO

  • base

    • 类型: Ingredient
    • 修饰符: private final
    • 源码定位: L16
    • 说明:

      TODO

  • addition

    • 类型: Ingredient
    • 修饰符: private final
    • 源码定位: L17
    • 说明:

      TODO

  • category

    • 类型: RecipeCategory
    • 修饰符: private final
    • 源码定位: L18
    • 说明:

      TODO

  • result

    • 类型: ItemStackTemplate
    • 修饰符: private final
    • 源码定位: L19
    • 说明:

      TODO

  • advancementBuilder

    • 类型: RecipeUnlockAdvancementBuilder
    • 修饰符: private final
    • 源码定位: L20
    • 说明:

      TODO

内部类/嵌套类型

构造器

public SmithingTransformRecipeBuilder(Ingredient template, Ingredient base, Ingredient addition, RecipeCategory category, ItemStackTemplate result) @ L22

  • 构造器名:SmithingTransformRecipeBuilder
  • 源码定位:L22
  • 修饰符:public

参数:

  • template: Ingredient
  • base: Ingredient
  • addition: Ingredient
  • category: RecipeCategory
  • result: ItemStackTemplate

说明:

TODO

方法

下面的方法块按源码顺序生成。

public static SmithingTransformRecipeBuilder smithing(Ingredient template, Ingredient base, Ingredient addition, RecipeCategory category, Item result) @ L30

  • 方法名:smithing
  • 源码定位:L30
  • 返回类型:SmithingTransformRecipeBuilder
  • 修饰符:public static

参数:

  • template: Ingredient
  • base: Ingredient
  • addition: Ingredient
  • category: RecipeCategory
  • result: Item

说明:

TODO

public SmithingTransformRecipeBuilder unlocks(String name, Criterion<?> criterion) @ L34

  • 方法名:unlocks
  • 源码定位:L34
  • 返回类型:SmithingTransformRecipeBuilder
  • 修饰符:public

参数:

  • name: String
  • criterion: Criterion<?>

说明:

TODO

public void save(RecipeOutput output, String id) @ L39

  • 方法名:save
  • 源码定位:L39
  • 返回类型:void
  • 修饰符:public

参数:

  • output: RecipeOutput
  • id: String

说明:

TODO

public void save(RecipeOutput output, ResourceKey<Recipe<?>> id) @ L43

  • 方法名:save
  • 源码定位:L43
  • 返回类型:void
  • 修饰符:public

参数:

  • output: RecipeOutput
  • id: ResourceKey<Recipe<?>>

说明:

TODO

代码

public class SmithingTransformRecipeBuilder {
    private final Ingredient template;
    private final Ingredient base;
    private final Ingredient addition;
    private final RecipeCategory category;
    private final ItemStackTemplate result;
    private final RecipeUnlockAdvancementBuilder advancementBuilder = new RecipeUnlockAdvancementBuilder();
 
    public SmithingTransformRecipeBuilder(Ingredient template, Ingredient base, Ingredient addition, RecipeCategory category, ItemStackTemplate result) {
        this.category = category;
        this.template = template;
        this.base = base;
        this.addition = addition;
        this.result = result;
    }
 
    public static SmithingTransformRecipeBuilder smithing(Ingredient template, Ingredient base, Ingredient addition, RecipeCategory category, Item result) {
        return new SmithingTransformRecipeBuilder(template, base, addition, category, new ItemStackTemplate(result));
    }
 
    public SmithingTransformRecipeBuilder unlocks(String name, Criterion<?> criterion) {
        this.advancementBuilder.unlockedBy(name, criterion);
        return this;
    }
 
    public void save(RecipeOutput output, String id) {
        this.save(output, ResourceKey.create(Registries.RECIPE, Identifier.parse(id)));
    }
 
    public void save(RecipeOutput output, ResourceKey<Recipe<?>> id) {
        SmithingTransformRecipe recipe = new SmithingTransformRecipe(
            new Recipe.CommonInfo(true), Optional.of(this.template), this.base, Optional.of(this.addition), this.result
        );
        output.accept(id, recipe, this.advancementBuilder.build(output, id, this.category));
    }
}

引用的其他类