Java Code Examples for net.minecraft.item.crafting.Ingredient#fromStacks()
The following examples show how to use
net.minecraft.item.crafting.Ingredient#fromStacks() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MetaItemIngredientFactory.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
@Override public Ingredient parse(JsonContext context, JsonObject json) { String name = JsonUtils.getString(json, "name"); int amount = JsonUtils.getInt(json, "amount", 1); for (MetaItem<?> item : MetaItems.ITEMS) { MetaItem<?>.MetaValueItem value = item.getItem(name); if (value != null) { return Ingredient.fromStacks(value.getStackForm(amount)); } } return Ingredient.EMPTY; }
Example 2
Source File: ReColourRecipe.java From EnderStorage with MIT License | 5 votes |
@Override public ReColourRecipe read(ResourceLocation recipeId, JsonObject json) { String group = JSONUtils.getString(json, "group", ""); ItemStack result = ShapedRecipe.deserializeItem(JSONUtils.getJsonObject(json, "result")); Ingredient ingredient; JsonElement ing = json.get("ingredient"); if (ing != null) { ingredient = Ingredient.deserialize(ing); } else { ingredient = Ingredient.fromStacks(result); } return new ReColourRecipe(recipeId, group, result, ingredient); }
Example 3
Source File: CountableIngredient.java From GregTech with GNU Lesser General Public License v3.0 | 4 votes |
public static CountableIngredient from(ItemStack stack) { return new CountableIngredient(Ingredient.fromStacks(stack), stack.getCount()); }
Example 4
Source File: CountableIngredient.java From GregTech with GNU Lesser General Public License v3.0 | 4 votes |
public static CountableIngredient from(ItemStack stack, int amount) { return new CountableIngredient(Ingredient.fromStacks(stack), amount); }
Example 5
Source File: GTCraftTweakerIngredientInput.java From GT-Classic with GNU Lesser General Public License v3.0 | 4 votes |
@Override public Ingredient getIngredient() { return Ingredient.fromStacks(this.toNatives()); }