TransmuteRecipeBuilder.java

net.minecraft.data.recipes.TransmuteRecipeBuilder

信息

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

    TODO

字段/常量

  • category

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

      TODO

  • result

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

      TODO

  • input

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

      TODO

  • material

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

      TODO

  • advancementBuilder

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

      TODO

  • group

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

      TODO

  • materialCount

    • 类型: MinMaxBounds.Ints
    • 修饰符: private
    • 源码定位: L20
    • 说明:

      TODO

  • addMaterialCountToOutput

    • 类型: boolean
    • 修饰符: private
    • 源码定位: L21
    • 说明:

      TODO

内部类/嵌套类型

构造器

private TransmuteRecipeBuilder(RecipeCategory category, ItemStackTemplate result, Ingredient input, Ingredient material) @ L23

  • 构造器名:TransmuteRecipeBuilder
  • 源码定位:L23
  • 修饰符:private

参数:

  • category: RecipeCategory
  • result: ItemStackTemplate
  • input: Ingredient
  • material: Ingredient

说明:

TODO

方法

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

public static TransmuteRecipeBuilder transmute(RecipeCategory category, Ingredient input, Ingredient material, Item result) @ L30

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

参数:

  • category: RecipeCategory
  • input: Ingredient
  • material: Ingredient
  • result: Item

说明:

TODO

public static TransmuteRecipeBuilder transmute(RecipeCategory category, Ingredient input, Ingredient material, ItemStackTemplate result) @ L34

  • 方法名:transmute
  • 源码定位:L34
  • 返回类型:TransmuteRecipeBuilder
  • 修饰符:public static

参数:

  • category: RecipeCategory
  • input: Ingredient
  • material: Ingredient
  • result: ItemStackTemplate

说明:

TODO

public TransmuteRecipeBuilder unlockedBy(String name, Criterion<?> criterion) @ L38

  • 方法名:unlockedBy
  • 源码定位:L38
  • 返回类型:TransmuteRecipeBuilder
  • 修饰符:public

参数:

  • name: String
  • criterion: Criterion<?>

说明:

TODO

public TransmuteRecipeBuilder group(String group) @ L43

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

参数:

  • group: String

说明:

TODO

public TransmuteRecipeBuilder addMaterialCountToOutput() @ L48

  • 方法名:addMaterialCountToOutput
  • 源码定位:L48
  • 返回类型:TransmuteRecipeBuilder
  • 修饰符:public

参数:

说明:

TODO

public TransmuteRecipeBuilder setMaterialCount(MinMaxBounds.Ints materialCount) @ L53

  • 方法名:setMaterialCount
  • 源码定位:L53
  • 返回类型:TransmuteRecipeBuilder
  • 修饰符:public

参数:

  • materialCount: MinMaxBounds.Ints

说明:

TODO

public ResourceKey<Recipe<?>> defaultId() @ L58

  • 方法名:defaultId
  • 源码定位:L58
  • 返回类型:ResourceKey<Recipe<?>>
  • 修饰符:public

参数:

说明:

TODO

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

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

参数:

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

说明:

TODO

代码

public class TransmuteRecipeBuilder implements RecipeBuilder {
    private final RecipeCategory category;
    private final ItemStackTemplate result;
    private final Ingredient input;
    private final Ingredient material;
    private final RecipeUnlockAdvancementBuilder advancementBuilder = new RecipeUnlockAdvancementBuilder();
    private @Nullable String group;
    private MinMaxBounds.Ints materialCount = TransmuteRecipe.DEFAULT_MATERIAL_COUNT;
    private boolean addMaterialCountToOutput;
 
    private TransmuteRecipeBuilder(RecipeCategory category, ItemStackTemplate result, Ingredient input, Ingredient material) {
        this.category = category;
        this.result = result;
        this.input = input;
        this.material = material;
    }
 
    public static TransmuteRecipeBuilder transmute(RecipeCategory category, Ingredient input, Ingredient material, Item result) {
        return transmute(category, input, material, new ItemStackTemplate(result));
    }
 
    public static TransmuteRecipeBuilder transmute(RecipeCategory category, Ingredient input, Ingredient material, ItemStackTemplate result) {
        return new TransmuteRecipeBuilder(category, result, input, material);
    }
 
    public TransmuteRecipeBuilder unlockedBy(String name, Criterion<?> criterion) {
        this.advancementBuilder.unlockedBy(name, criterion);
        return this;
    }
 
    public TransmuteRecipeBuilder group(@Nullable String group) {
        this.group = group;
        return this;
    }
 
    public TransmuteRecipeBuilder addMaterialCountToOutput() {
        this.addMaterialCountToOutput = true;
        return this;
    }
 
    public TransmuteRecipeBuilder setMaterialCount(MinMaxBounds.Ints materialCount) {
        this.materialCount = materialCount;
        return this;
    }
 
    @Override
    public ResourceKey<Recipe<?>> defaultId() {
        return RecipeBuilder.getDefaultRecipeId(this.result);
    }
 
    @Override
    public void save(RecipeOutput output, ResourceKey<Recipe<?>> id) {
        TransmuteRecipe recipe = new TransmuteRecipe(
            RecipeBuilder.createCraftingCommonInfo(true),
            RecipeBuilder.createCraftingBookInfo(this.category, this.group),
            this.input,
            this.material,
            this.materialCount,
            this.result,
            this.addMaterialCountToOutput
        );
        output.accept(id, recipe, this.advancementBuilder.build(output, id, this.category));
    }
}

引用的其他类