SingleItemRecipeBuilder.java
net.minecraft.data.recipes.SingleItemRecipeBuilder
信息
- 全限定名:net.minecraft.data.recipes.SingleItemRecipeBuilder
- 类型:public class
- 包:net.minecraft.data.recipes
- 源码路径:src/main/java/net/minecraft/data/recipes/SingleItemRecipeBuilder.java
- 起始行号:L13
- 实现:RecipeBuilder
- 职责:
TODO
字段/常量
-
category- 类型:
RecipeCategory - 修饰符:
private final - 源码定位:
L14 - 说明:
TODO
- 类型:
-
result- 类型:
ItemStackTemplate - 修饰符:
private final - 源码定位:
L15 - 说明:
TODO
- 类型:
-
ingredient- 类型:
Ingredient - 修饰符:
private final - 源码定位:
L16 - 说明:
TODO
- 类型:
-
advancementBuilder- 类型:
RecipeUnlockAdvancementBuilder - 修饰符:
private final - 源码定位:
L17 - 说明:
TODO
- 类型:
-
factory- 类型:
SingleItemRecipe.Factory<?> - 修饰符:
private final - 源码定位:
L18 - 说明:
TODO
- 类型:
内部类/嵌套类型
- 无
构造器
private SingleItemRecipeBuilder(RecipeCategory category, SingleItemRecipe.Factory<?> factory, Ingredient ingredient, ItemStackTemplate result) @ L20
- 构造器名:SingleItemRecipeBuilder
- 源码定位:L20
- 修饰符:private
参数:
- category: RecipeCategory
- factory: SingleItemRecipe.Factory<?>
- ingredient: Ingredient
- result: ItemStackTemplate
说明:
TODO
public SingleItemRecipeBuilder(RecipeCategory category, SingleItemRecipe.Factory<?> factory, Ingredient ingredient, ItemLike result, int count) @ L27
- 构造器名:SingleItemRecipeBuilder
- 源码定位:L27
- 修饰符:public
参数:
- category: RecipeCategory
- factory: SingleItemRecipe.Factory<?>
- ingredient: Ingredient
- result: ItemLike
- count: int
说明:
TODO
方法
下面的方法块按源码顺序生成。
public static SingleItemRecipeBuilder stonecutting(Ingredient ingredient, RecipeCategory category, ItemLike result, int count) @ L31
- 方法名:stonecutting
- 源码定位:L31
- 返回类型:SingleItemRecipeBuilder
- 修饰符:public static
参数:
- ingredient: Ingredient
- category: RecipeCategory
- result: ItemLike
- count: int
说明:
TODO
public SingleItemRecipeBuilder unlockedBy(String name, Criterion<?> criterion) @ L35
- 方法名:unlockedBy
- 源码定位:L35
- 返回类型:SingleItemRecipeBuilder
- 修饰符:public
参数:
- name: String
- criterion: Criterion<?>
说明:
TODO
public SingleItemRecipeBuilder group(String group) @ L40
- 方法名:group
- 源码定位:L40
- 返回类型:SingleItemRecipeBuilder
- 修饰符:public
参数:
- group: String
说明:
TODO
public ResourceKey<Recipe<?>> defaultId() @ L44
- 方法名:defaultId
- 源码定位:L44
- 返回类型:ResourceKey<Recipe<?>>
- 修饰符:public
参数:
- 无
说明:
TODO
public void save(RecipeOutput output, ResourceKey<Recipe<?>> id) @ L49
- 方法名:save
- 源码定位:L49
- 返回类型:void
- 修饰符:public
参数:
- output: RecipeOutput
- id: ResourceKey<Recipe<?>>
说明:
TODO
代码
public class SingleItemRecipeBuilder implements RecipeBuilder {
private final RecipeCategory category;
private final ItemStackTemplate result;
private final Ingredient ingredient;
private final RecipeUnlockAdvancementBuilder advancementBuilder = new RecipeUnlockAdvancementBuilder();
private final SingleItemRecipe.Factory<?> factory;
private SingleItemRecipeBuilder(RecipeCategory category, SingleItemRecipe.Factory<?> factory, Ingredient ingredient, ItemStackTemplate result) {
this.category = category;
this.result = result;
this.ingredient = ingredient;
this.factory = factory;
}
public SingleItemRecipeBuilder(RecipeCategory category, SingleItemRecipe.Factory<?> factory, Ingredient ingredient, ItemLike result, int count) {
this(category, factory, ingredient, new ItemStackTemplate(result.asItem(), count));
}
public static SingleItemRecipeBuilder stonecutting(Ingredient ingredient, RecipeCategory category, ItemLike result, int count) {
return new SingleItemRecipeBuilder(category, StonecutterRecipe::new, ingredient, result, count);
}
public SingleItemRecipeBuilder unlockedBy(String name, Criterion<?> criterion) {
this.advancementBuilder.unlockedBy(name, criterion);
return this;
}
public SingleItemRecipeBuilder group(@Nullable String group) {
return this;
}
@Override
public ResourceKey<Recipe<?>> defaultId() {
return RecipeBuilder.getDefaultRecipeId(this.result);
}
@Override
public void save(RecipeOutput output, ResourceKey<Recipe<?>> id) {
SingleItemRecipe recipe = this.factory.create(new Recipe.CommonInfo(true), this.ingredient, this.result);
output.accept(id, recipe, this.advancementBuilder.build(output, id, this.category));
}
}引用的其他类
-
- 引用位置:
参数
- 引用位置:
-
- 引用位置:
实现/方法调用 - 关联成员:
RecipeBuilder.getDefaultRecipeId()
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
参数
- 引用位置:
-
RecipeUnlockAdvancementBuilder
- 引用位置:
字段/构造调用 - 关联成员:
RecipeUnlockAdvancementBuilder()
- 引用位置:
-
- 引用位置:
参数/返回值
- 引用位置:
-
- 引用位置:
参数/字段/构造调用 - 关联成员:
ItemStackTemplate()
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
参数/方法调用/构造调用/返回值 - 关联成员:
CommonInfo(), Recipe.CommonInfo()
- 引用位置:
-
- 引用位置:
参数/字段
- 引用位置:
-
- 引用位置:
参数
- 引用位置: