use of net.minecraftforge.oredict.ShapedOreRecipe in project Witchworks by Um-Mitternacht.
the class ShapedRecipe method build.
public void build() {
final List<Object> recipes = new ArrayList<>();
if (mirror) {
recipes.add(true);
}
if (rows.isEmpty())
throw new IllegalArgumentException("There must be at least one row in the recipe, please report this to the mod author!");
Collections.addAll(recipes, rows.toArray());
characters.forEach((character, o) -> {
recipes.add(character);
recipes.add(o);
});
final ShapedOreRecipe recipe = new ShapedOreRecipe(out, recipes.toArray());
CraftingManager.getInstance().getRecipeList().add(recipe);
}
use of net.minecraftforge.oredict.ShapedOreRecipe in project Railcraft by Railcraft.
the class CraftingPlugin method addRecipe.
public static void addRecipe(@Nullable ItemStack result, Object... recipeArray) {
ProcessedRecipe processedRecipe;
try {
processedRecipe = processRecipe(RecipeType.SHAPED, result, recipeArray);
} catch (InvalidRecipeException ex) {
Game.logTrace(Level.WARN, ex.getRawMessage());
return;
}
if (processedRecipe.isOreRecipe) {
IRecipe recipe = new ShapedOreRecipe(processedRecipe.result, processedRecipe.recipeArray);
addRecipe(recipe);
} else
GameRegistry.addRecipe(processedRecipe.result, processedRecipe.recipeArray);
}
use of net.minecraftforge.oredict.ShapedOreRecipe in project AgriCraft by AgriCraft.
the class ItemNugget method registerRecipes.
@Override
public void registerRecipes(IForgeRegistry<IRecipe> registry) {
for (AgriNuggetType type : AgriNuggetType.values()) {
// 1) Ore Dictionary registration.
AgriCore.getLogger("agricraft").info("Registering in Ore Dictionary: {0}", type.nugget);
ItemStack oneNugget = new ItemStack(this, 1, type.ordinal());
OreDictionary.registerOre(type.nugget, oneNugget);
// 2) Conditional recipes. Only if the ingot exists, because AgriCraft doesn't add its own.
ItemStack ingot = OreDictHelper.getIngot(type.ingot);
if (!ingot.isEmpty()) {
AgriCore.getLogger("agricraft").info("Adding a recipe to convert nine {0} into one {1}", type.nugget, type.ingot);
final ResourceLocation group = new ResourceLocation(AgriCraft.instance.getModId(), "combine_nugget");
final ResourceLocation name = new ResourceLocation(AgriCraft.instance.getModId(), "combine_nugget_" + type.name().toLowerCase());
final ShapedOreRecipe recipe = new ShapedOreRecipe(group, ingot, "nnn", "nnn", "nnn", 'n', type.nugget);
recipe.setRegistryName(name);
AgriCore.getLogger("agricraft").info("Registering nugget recipe: {0}!", recipe.getRegistryName());
registry.register(recipe);
}
}
}
use of net.minecraftforge.oredict.ShapedOreRecipe in project BetterWithAddons by DaedalusGame.
the class InteractionCondensedOutputs method addCondensingRecipe.
private void addCondensingRecipe(ForgeRegistry<IRecipe> registry, String id, ItemStack output, ItemStack material, ItemStack frame) {
ItemStack outmaterial = material.copy();
outmaterial.setCount(8);
ResourceLocation compressLoc = new ResourceLocation(Reference.MOD_ID, "compress_" + id);
registry.register(new ShapedOreRecipe(compressLoc, output, "aaa", "aba", "aaa", 'a', material, 'b', frame).setRegistryName(compressLoc));
}
use of net.minecraftforge.oredict.ShapedOreRecipe in project Charset by CharsetMC.
the class RecipeReplacement method process.
public void process(Collection<IRecipe> registry) {
for (IRecipe recipe : registry) {
ResourceLocation recipeName = recipe.getRegistryName();
boolean dirty = false;
if (recipe instanceof ShapedRecipes || recipe instanceof ShapelessRecipes || recipe instanceof ShapedOreRecipe || recipe instanceof ShapelessOreRecipe) {
NonNullList<Ingredient> ingredients = recipe.getIngredients();
for (int i = 0; i < ingredients.size(); i++) {
Ingredient ing = ingredients.get(i);
Ingredient ingNew = replaceIngredient(ing);
if (ingNew != null) {
ingredients.set(i, ingNew);
dirty = true;
}
}
} else if (recipe instanceof RecipeCharset) {
TCharObjectMap<Ingredient> charToIngredient = ((RecipeCharset) recipe).charToIngredient;
NonNullList<Ingredient> ingredients = recipe.getIngredients();
for (int i = 0; i < ingredients.size(); i++) {
Ingredient ing = ingredients.get(i);
Ingredient ingNew = replaceIngredient(ing);
if (ingNew != null) {
ingredients.set(i, ingNew);
TCharIterator iterator = charToIngredient.keySet().iterator();
while (iterator.hasNext()) {
char c = iterator.next();
if (charToIngredient.get(c) == ing) {
charToIngredient.put(c, ing);
}
}
dirty = true;
}
}
}
if (dirty) {
ModCharset.logger.info("Successfully edited " + recipeName + "!");
}
}
}
Aggregations