use of net.minecraftforge.oredict.ShapedOreRecipe in project Engine by VoltzEngine-Project.
the class JsonCraftingRecipeData method genRecipes.
@Override
public void genRecipes(List<IRecipe> recipes) {
//If output is a string convert
if (output instanceof String) {
Object out = convertItemEntry((String) output);
if (out != null) {
output = out;
}
}
if (shaped) {
//Shaped starts with a series of strings representing the grid, then goes "char, item, char2, item2...."
boolean convert = false;
int gridEnd = 0;
for (int i = 0; i < data.length; i++) {
Object dataObject = data[i];
//Do not convert until after the first char entry
if (dataObject instanceof Character) {
if (gridEnd == 0) {
gridEnd = i;
}
convert = true;
} else if (convert) {
Object out = convertItemEntry((String) dataObject);
if (out != null) {
data[i] = out;
} else {
Engine.logger().error("The item value of [" + dataObject + "] could not be parsed into a valid recipe item entry. Recipe -> " + this);
return;
}
}
}
//Create recipe
if (output instanceof Block) {
if (largeGrid) {
recipes.add(new RecipeShapedOreLarge((Block) output, data));
} else {
recipes.add(new ShapedOreRecipe((Block) output, data));
}
} else if (output instanceof Item) {
if (largeGrid) {
recipes.add(new RecipeShapedOreLarge((Item) output, data));
} else {
recipes.add(new ShapedOreRecipe((Item) output, data));
}
} else if (output instanceof ItemStack) {
if (largeGrid) {
recipes.add(new RecipeShapedOreLarge((ItemStack) output, data));
} else {
recipes.add(new ShapedOreRecipe((ItemStack) output, data));
}
} else {
Engine.logger().error("The type of output value [" + output + "] could not be recognized for recipe creation. Recipe -> " + this);
}
} else {
//Shapeless is an array of string data
for (int i = 0; i < data.length; i++) {
Object dataObject = data[i];
if (dataObject instanceof String) {
//Convert entries to correct outputs
Object out = convertItemEntry((String) dataObject);
if (out != null) {
data[i] = out;
} else {
Engine.logger().error("The item value of [" + dataObject + "] could not be parsed into a valid recipe item entry. Recipe -> " + this);
return;
}
} else {
Engine.logger().error("The item value of [" + dataObject + "] is not a valid string for parsing. Recipe -> " + this);
return;
}
}
//Create recipe
if (output instanceof Block) {
recipes.add(new ShapelessOreRecipe((Block) output, data));
} else if (output instanceof Item) {
recipes.add(new ShapelessOreRecipe((Item) output, data));
} else if (output instanceof ItemStack) {
recipes.add(new ShapelessOreRecipe((ItemStack) output, data));
} else {
Engine.logger().error("The type of output value [" + output + "] could not be recognized for recipe creation. Recipe -> " + this);
}
}
}
use of net.minecraftforge.oredict.ShapedOreRecipe in project Engine by VoltzEngine-Project.
the class ItemSheetMetalTools method onPostInit.
@Override
public void onPostInit() {
//TODO add rivets to small cone recipe
if (Engine.itemSheetMetal != null) {
//Plate creation
GameRegistry.addRecipe(new RecipeSheetMetal(ItemSheetMetal.SheetMetal.FULL.stack(), "IH", 'I', UniversalRecipe.PRIMARY_METAL.get(), 'H', getHammer()));
GameRegistry.addRecipe(new RecipeSheetMetal(ItemSheetMetal.SheetMetal.RIVETS.stack(16), "H", "I", 'I', UniversalRecipe.PRIMARY_METAL.get(), 'H', getHammer()));
//Sheet metal reduction recipes
GameRegistry.addRecipe(new RecipeSheetMetal(ItemSheetMetal.SheetMetal.HALF.stack(2), "IC", 'I', ItemSheetMetal.SheetMetal.FULL.stack(), 'C', getShears()));
GameRegistry.addRecipe(new RecipeSheetMetal(ItemSheetMetal.SheetMetal.QUARTER.stack(2), "IC", 'I', ItemSheetMetal.SheetMetal.HALF.stack(), 'C', getShears()));
GameRegistry.addRecipe(new RecipeSheetMetal(ItemSheetMetal.SheetMetal.EIGHTH.stack(2), "IC", 'I', ItemSheetMetal.SheetMetal.QUARTER.stack(), 'C', getShears()));
GameRegistry.addRecipe(new RecipeSheetMetal(ItemSheetMetal.SheetMetal.THIRD.stack(3), "I", "C", 'I', ItemSheetMetal.SheetMetal.FULL.stack(), 'C', getShears()));
//Cone creations
GameRegistry.addRecipe(new RecipeSheetMetal(ItemSheetMetal.SheetMetal.TRIANGLE.stack(4), "I ", " C", 'I', ItemSheetMetal.SheetMetal.FULL.stack(), 'C', getShears()));
GameRegistry.addRecipe(new RecipeSheetMetal(ItemSheetMetal.SheetMetal.CONE_MICRO.stack(), "I ", " H", 'I', ItemSheetMetal.SheetMetal.TRIANGLE.stack(), 'H', getHammer()));
GameRegistry.addRecipe(new RecipeSheetMetal(ItemSheetMetal.SheetMetal.CONE_SMALL.stack(), " I ", "IHI", " I ", 'I', ItemSheetMetal.SheetMetal.TRIANGLE.stack(), 'H', getHammer()));
GameRegistry.addRecipe(new RecipeSheetMetal(ItemSheetMetal.SheetMetal.CONE_MEDIUM.stack(), " II", "IHI", "II ", 'I', ItemSheetMetal.SheetMetal.TRIANGLE.stack(), 'H', getHammer()));
//Fine creation
GameRegistry.addRecipe(new RecipeSheetMetal(ItemSheetMetal.SheetMetal.FIN_MICRO.stack(2), "C", "I", 'I', ItemSheetMetal.SheetMetal.TRIANGLE.stack(), 'C', getShears()));
GameRegistry.addRecipe(new RecipeSheetMetal(ItemSheetMetal.SheetMetal.FIN_SMALL.stack(2), "I ", " C", 'I', ItemSheetMetal.SheetMetal.HALF.stack(), 'C', getShears()));
//Curved plates
GameRegistry.addRecipe(new RecipeSheetMetal(ItemSheetMetal.SheetMetal.CURVED_1.stack(), "IH", 'I', ItemSheetMetal.SheetMetal.FULL.stack(), 'H', getHammer()));
GameRegistry.addRecipe(new RecipeSheetMetal(ItemSheetMetal.SheetMetal.CURVED_2.stack(), "IH", 'I', ItemSheetMetal.SheetMetal.CURVED_1.stack(), 'H', getHammer()));
GameRegistry.addRecipe(new RecipeSheetMetal(ItemSheetMetal.SheetMetal.CURVED_3.stack(), "IH", 'I', ItemSheetMetal.SheetMetal.CURVED_2.stack(), 'H', getHammer()));
GameRegistry.addRecipe(new RecipeSheetMetal(ItemSheetMetal.SheetMetal.CURVED_4.stack(), "IH", 'I', ItemSheetMetal.SheetMetal.CURVED_3.stack(), 'H', getHammer()));
//Cylinders
GameRegistry.addRecipe(new RecipeSheetMetal(ItemSheetMetal.SheetMetal.SMALL_CYLINDER.stack(), "IRH", 'I', ItemSheetMetal.SheetMetal.CURVED_4.stack(), 'H', getHammer(), 'R', ItemSheetMetal.SheetMetal.RIVETS.stack()));
GameRegistry.addRecipe(new RecipeSheetMetal(ItemSheetMetal.SheetMetal.HALF_CYLINDER.stack(), "IRI", 'I', ItemSheetMetal.SheetMetal.CURVED_4.stack(), 'R', ItemSheetMetal.SheetMetal.RIVETS.stack()));
GameRegistry.addRecipe(new RecipeSheetMetal(ItemSheetMetal.SheetMetal.CYLINDER.stack(), "IRI", 'I', ItemSheetMetal.SheetMetal.HALF_CYLINDER.stack(), 'R', ItemSheetMetal.SheetMetal.RIVETS.stack()));
}
GameRegistry.addRecipe(new ShapedOreRecipe(getHammer(), "III", " I ", " S ", 'I', UniversalRecipe.PRIMARY_METAL.get(), 'S', OreNames.WOOD_STICK));
GameRegistry.addRecipe(new ShapedOreRecipe(getShears(), "I I", " I ", "S S", 'I', UniversalRecipe.PRIMARY_METAL.get(), 'S', OreNames.WOOD_STICK));
}
use of net.minecraftforge.oredict.ShapedOreRecipe in project Engine by VoltzEngine-Project.
the class NuggetRecipeLoader method postInit.
@Override
public void postInit() {
if (DefinedGenItems.NUGGET.item != null) {
EnumSet<GenMaterial> mats = EnumSet.allOf(GenMaterial.class);
mats.remove(GenMaterial.UNKNOWN);
for (GenMaterial material : mats) {
if (OreDictionary.getOres("ingot" + LanguageUtility.capitalizeFirst(material.name().toLowerCase()), false).size() > 0 && !DefinedGenItems.NUGGET.ignoreMaterials.contains(material)) {
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(DefinedGenItems.NUGGET.item, 9, material.ordinal()), "ingot" + LanguageUtility.capitalizeFirst(material.name().toLowerCase())));
if (DefinedGenItems.INGOT.item != null) {
GameRegistry.addRecipe(new ShapedOreRecipe(DefinedGenItems.INGOT.stack(material), "nnn", "nnn", "nnn", 'n', new ItemStack(DefinedGenItems.NUGGET.item, 1, material.ordinal())));
} else {
GameRegistry.addRecipe(new ShapedOreRecipe(OreDictionary.getOres("ingot" + LanguageUtility.capitalizeFirst(material.name().toLowerCase())).get(0), "nnn", "nnn", "nnn", 'n', new ItemStack(DefinedGenItems.NUGGET.item, 1, material.ordinal())));
}
}
}
}
}
use of net.minecraftforge.oredict.ShapedOreRecipe in project Guide-API by TeamAmeriFrance.
the class TestBook method buildBook.
@Nullable
@Override
public Book buildBook() {
book = new Book();
book.setAuthor("TehNut");
book.setColor(Color.BLUE);
book.setDisplayName("Display Name");
book.setTitle("Title message");
book.setWelcomeMessage("Is this still a thing?");
List<CategoryAbstract> categories = Lists.newArrayList();
Map<ResourceLocation, EntryAbstract> entries = Maps.newHashMap();
List<IPage> pages = Lists.newArrayList();
pages.add(new PageText("Hello, this is\nsome text"));
pages.add(new PageFurnaceRecipe(Blocks.COBBLESTONE));
pages.add(new PageIRecipe(new ShapedOreRecipe(Items.ACACIA_BOAT, "X X", "XXX", 'X', "plankWood")));
Entry entry = new EntryItemStack(pages, "test.entry.name", new ItemStack(Items.POTATO));
entries.put(new ResourceLocation("guideapi", "entry"), entry);
categories.add(new CategoryItemStack(entries, "test.category.name", new ItemStack(Items.BANNER)));
book.setCategoryList(categories);
book.setRegistryName(new ResourceLocation("guideapi", "test_book"));
return book;
}
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);
}
Aggregations