use of com.minecolonies.api.crafting.RecipeStorage in project minecolonies by Minecolonies.
the class FurnaceRecipes method loadRecipes.
/**
* Load all the recipes in the recipe storage.
*
* @param recipeManager The recipe manager to parse.
*/
public void loadRecipes(final RecipeManager recipeManager) {
recipes.clear();
reverseRecipes.clear();
loadUtilityPredicates();
recipeManager.byType(IRecipeType.SMELTING).values().forEach(recipe -> {
final NonNullList<Ingredient> list = recipe.getIngredients();
if (list.size() == 1) {
for (final ItemStack smeltable : list.get(0).getItems()) {
if (!smeltable.isEmpty()) {
final RecipeStorage storage = StandardFactoryController.getInstance().getNewInstance(TypeConstants.RECIPE, StandardFactoryController.getInstance().getNewInstance(TypeConstants.ITOKEN), ImmutableList.of(new ItemStorage(smeltable)), 1, recipe.getResultItem(), Blocks.FURNACE, recipe.getId());
recipes.put(storage.getCleanedInput().get(0), storage);
final ItemStack output = recipe.getResultItem().copy();
output.setCount(1);
reverseRecipes.put(new ItemStorage(output), storage);
}
}
}
});
}
use of com.minecolonies.api.crafting.RecipeStorage in project minecolonies by Minecolonies.
the class UpdateClientWithRecipesMessage method fromBytes.
@Override
public void fromBytes(@NotNull final PacketBuffer buf) {
recipes = new HashMap<>();
final int size = buf.readInt();
for (int i = 0; i < size; i++) {
final ItemStack result = buf.readItem();
final RecipeStorage storage = StandardFactoryController.getInstance().deserialize(buf.readNbt());
recipes.put(new ItemStorage(result), storage);
}
}
use of com.minecolonies.api.crafting.RecipeStorage in project minecolonies by ldtteam.
the class FurnaceRecipes method loadRecipes.
/**
* Load all the recipes in the recipe storage.
*
* @param recipeManager The recipe manager to parse.
*/
public void loadRecipes(final RecipeManager recipeManager) {
recipes.clear();
reverseRecipes.clear();
loadUtilityPredicates();
recipeManager.byType(IRecipeType.SMELTING).values().forEach(recipe -> {
final NonNullList<Ingredient> list = recipe.getIngredients();
if (list.size() == 1) {
for (final ItemStack smeltable : list.get(0).getItems()) {
if (!smeltable.isEmpty()) {
final RecipeStorage storage = StandardFactoryController.getInstance().getNewInstance(TypeConstants.RECIPE, StandardFactoryController.getInstance().getNewInstance(TypeConstants.ITOKEN), ImmutableList.of(new ItemStorage(smeltable)), 1, recipe.getResultItem(), Blocks.FURNACE, recipe.getId());
recipes.put(storage.getCleanedInput().get(0), storage);
final ItemStack output = recipe.getResultItem().copy();
output.setCount(1);
reverseRecipes.put(new ItemStorage(output), storage);
}
}
}
});
}
use of com.minecolonies.api.crafting.RecipeStorage in project minecolonies by ldtteam.
the class UpdateClientWithRecipesMessage method fromBytes.
@Override
public void fromBytes(@NotNull final PacketBuffer buf) {
recipes = new HashMap<>();
final int size = buf.readInt();
for (int i = 0; i < size; i++) {
final ItemStack result = buf.readItem();
final RecipeStorage storage = StandardFactoryController.getInstance().deserialize(buf.readNbt());
recipes.put(new ItemStorage(result), storage);
}
}
Aggregations