Java源码示例:net.minecraft.item.ItemConvertible
示例1
@Override
public List<ItemStack> onSheared(ItemStack item, IWorld world, BlockPos pos, int fortune) {
List<ItemStack> drops = new java.util.ArrayList<>();
if (!this.world.isClient) {
this.setSheared(true);
int count = 1 + this.random.nextInt(3);
ItemConvertible wool = DROPS.get(this.getColor());
for (int i = 0; i < count; i++) {
drops.add(new ItemStack(wool));
}
}
this.playSound(SoundEvents.ENTITY_SHEEP_SHEAR, 1.0F, 1.0F);
return drops;
}
示例2
public static RecipeInfo<ShapelessRecipe> shapeless(String group, ItemStack output, ItemConvertible[]... inputs) {
DefaultedList<Ingredient> ingredients = DefaultedList.of();
for (ItemConvertible[] input : inputs) {
ingredients.add(Ingredient.ofItems(input));
}
return new RecipeInfo<>(id -> new ShapelessRecipe(id, group, output, ingredients), RecipeSerializer.SHAPELESS, output);
}
示例3
/**
* Gets the render stacks ({@link Item#getStackForRender()}) of each item in a tag.
*/
private static List<ItemStack> getRenderStacks(Tag<? extends ItemConvertible> tag) {
ImmutableList.Builder<ItemStack> builder = ImmutableList.builder();
for (ItemConvertible item : tag.values()) {
builder.add(new ItemStack(item));
}
return builder.build();
}
示例4
private static Advancement create(String name, int x, int y, ItemConvertible icon, Advancement parent) {
return create(name, x, y, icon, parent, false);
}
示例5
private static Advancement create(String name, int x, int y, ItemConvertible icon, Advancement parent, boolean special) {
return create(name, x, y, new ItemStack(icon), parent, special);
}
示例6
public static <T extends Recipe<?>> RecipeInfo<T> of(Function<Identifier, Recipe<?>> creator, RecipeSerializer<T> recipeType, ItemConvertible output) {
return of(creator, recipeType, new ItemStack(output));
}
示例7
public static <T extends Recipe<?>> RecipeInfo<T> of(Function<Identifier, Recipe<?>> creator, RecipeSerializer<T> recipeType, ItemConvertible output, int count) {
return of(creator, recipeType, new ItemStack(output, count));
}
示例8
public static RecipeInfo<ShapedRecipe> shaped(ItemConvertible output, Object... args) {
return shaped("", output, args);
}
示例9
public static RecipeInfo<ShapedRecipe> shaped(int count, ItemConvertible output, Object... args) {
return shaped("", count, output, args);
}
示例10
public static RecipeInfo<ShapedRecipe> shaped(String group, ItemConvertible output, Object... args) {
return shaped(group, new ItemStack(output), args);
}
示例11
public static RecipeInfo<ShapedRecipe> shaped(String group, int count, ItemConvertible output, Object... args) {
return shaped(group, new ItemStack(output, count), args);
}
示例12
public static RecipeInfo<ShapelessRecipe> shapeless(String group, ItemStack output, ItemConvertible... inputs) {
ItemConvertible[][] newInputs = new ItemConvertible[inputs.length][1];
for (int i = 0; i < inputs.length; i++)
newInputs[i] = new ItemConvertible[] {inputs[i]};
return shapeless(group, output, newInputs);
}
示例13
public static RecipeInfo<ShapelessRecipe> shapeless(String group, ItemConvertible output, ItemConvertible... inputs) {
return shapeless(group, new ItemStack(output), inputs);
}
示例14
public static RecipeInfo<ShapelessRecipe> shapeless(String group, int count, ItemConvertible output, ItemConvertible... inputs) {
return shapeless(group, new ItemStack(output, count), inputs);
}
示例15
public static RecipeInfo<ShapelessRecipe> shapeless(String group, ItemConvertible output, ItemConvertible[]... inputs) {
return shapeless(group, new ItemStack(output), inputs);
}
示例16
public static RecipeInfo<ShapelessRecipe> shapeless(String group, int count, ItemConvertible output, ItemConvertible[]... inputs) {
return shapeless(group, new ItemStack(output, count), inputs);
}
示例17
public static RecipeInfo<ShapelessRecipe> shapeless(ItemStack output, ItemConvertible... inputs) {
return shapeless("", output, inputs);
}
示例18
public static RecipeInfo<ShapelessRecipe> shapeless(ItemConvertible output, ItemConvertible... inputs) {
return shapeless("", output, inputs);
}
示例19
public static RecipeInfo<ShapelessRecipe> shapeless(int count, ItemConvertible output, ItemConvertible... inputs) {
return shapeless("", count, output, inputs);
}
示例20
public static RecipeInfo<ShapelessRecipe> shapeless(ItemStack output, ItemConvertible[]... inputs) {
return shapeless("", output, inputs);
}
示例21
public static RecipeInfo<ShapelessRecipe> shapeless(ItemConvertible output, ItemConvertible[]... inputs) {
return shapeless("", output, inputs);
}
示例22
public static RecipeInfo<ShapelessRecipe> shapeless(int count, ItemConvertible output, ItemConvertible[]... inputs) {
return shapeless("", count, output, inputs);
}
示例23
public WItem(Tag<? extends ItemConvertible> tag) {
this(getRenderStacks(tag));
}