|
@@ -1,9 +1,6 @@
|
|
package me.km.recipes;
|
|
package me.km.recipes;
|
|
|
|
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
-import java.util.Iterator;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
import me.km.blocks.EnumMetals;
|
|
import me.km.blocks.EnumMetals;
|
|
import me.km.blocks.ModBlocks;
|
|
import me.km.blocks.ModBlocks;
|
|
import me.km.items.ModItems;
|
|
import me.km.items.ModItems;
|
|
@@ -14,16 +11,12 @@ import net.minecraft.init.Items;
|
|
import net.minecraft.item.EnumDyeColor;
|
|
import net.minecraft.item.EnumDyeColor;
|
|
import net.minecraft.item.Item;
|
|
import net.minecraft.item.Item;
|
|
import net.minecraft.item.ItemStack;
|
|
import net.minecraft.item.ItemStack;
|
|
-import net.minecraft.item.crafting.CraftingManager;
|
|
|
|
import net.minecraft.item.crafting.FurnaceRecipes;
|
|
import net.minecraft.item.crafting.FurnaceRecipes;
|
|
import net.minecraft.item.crafting.IRecipe;
|
|
import net.minecraft.item.crafting.IRecipe;
|
|
import net.minecraft.item.crafting.Ingredient;
|
|
import net.minecraft.item.crafting.Ingredient;
|
|
import net.minecraft.item.crafting.ShapedRecipes;
|
|
import net.minecraft.item.crafting.ShapedRecipes;
|
|
import net.minecraft.item.crafting.ShapelessRecipes;
|
|
import net.minecraft.item.crafting.ShapelessRecipes;
|
|
import net.minecraft.util.NonNullList;
|
|
import net.minecraft.util.NonNullList;
|
|
-import net.minecraft.util.ResourceLocation;
|
|
|
|
-import net.minecraftforge.fml.common.registry.ForgeRegistries;
|
|
|
|
-import net.minecraftforge.registries.ForgeRegistry;
|
|
|
|
import net.minecraftforge.registries.IForgeRegistry;
|
|
import net.minecraftforge.registries.IForgeRegistry;
|
|
|
|
|
|
public class ModRecipes
|
|
public class ModRecipes
|
|
@@ -68,6 +61,9 @@ public class ModRecipes
|
|
{
|
|
{
|
|
ShapedRecipes recipe = newShapedRecipe(group, pattern, result, chars, stacks);
|
|
ShapedRecipes recipe = newShapedRecipe(group, pattern, result, chars, stacks);
|
|
recipe.setRegistryName(buildRegistryName(result));
|
|
recipe.setRegistryName(buildRegistryName(result));
|
|
|
|
+ System.out.println("Registering " + recipe.getRegistryName());
|
|
|
|
+ System.out.println(recipe.getIngredients());
|
|
|
|
+ System.out.println(recipe.getRecipeOutput());
|
|
r.register(recipe);
|
|
r.register(recipe);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -153,6 +149,8 @@ public class ModRecipes
|
|
new char[] {'X'}, new ItemStack[][] {{new ItemStack(ModBlocks.realHayBlock)}});
|
|
new char[] {'X'}, new ItemStack[][] {{new ItemStack(ModBlocks.realHayBlock)}});
|
|
registerShaped(r, "", new String[] {" X ", "XXX"}, new ItemStack(ModItems.strawHat),
|
|
registerShaped(r, "", new String[] {" X ", "XXX"}, new ItemStack(ModItems.strawHat),
|
|
new char[] {'X'}, new ItemStack[][] {{new ItemStack(Items.WHEAT)}});
|
|
new char[] {'X'}, new ItemStack[][] {{new ItemStack(Items.WHEAT)}});
|
|
|
|
+ registerShaped(r, "", new String[] {"XXX", "XXX"}, new ItemStack(ModItems.campFire),
|
|
|
|
+ new char[] {'X'}, new ItemStack[][] {{new ItemStack(Items.STICK)}});
|
|
registerShaped(r, "", new String[] {"XXX", "GCG", "XXX"}, new ItemStack(ModBlocks.lantern),
|
|
registerShaped(r, "", new String[] {"XXX", "GCG", "XXX"}, new ItemStack(ModBlocks.lantern),
|
|
new char[] {'X', 'G', 'C'}, new ItemStack[][]
|
|
new char[] {'X', 'G', 'C'}, new ItemStack[][]
|
|
{
|
|
{
|
|
@@ -193,6 +191,7 @@ public class ModRecipes
|
|
{ModItems.copperBoots, ModItems.bronzeBoots}
|
|
{ModItems.copperBoots, ModItems.bronzeBoots}
|
|
};
|
|
};
|
|
addArmorRecipes(r, armorItems);
|
|
addArmorRecipes(r, armorItems);
|
|
|
|
+ addArmorNuggetRecipes(fr, armorItems, ModItems.copperNugget, ModItems.bronzeNugget);
|
|
|
|
|
|
// additionel old tool recipes
|
|
// additionel old tool recipes
|
|
String[][] toolPatterns = new String[][]
|
|
String[][] toolPatterns = new String[][]
|
|
@@ -256,8 +255,18 @@ public class ModRecipes
|
|
{ModBlocks.realHayBlock, new ItemStack(ModItems.hayBundle, 9)},
|
|
{ModBlocks.realHayBlock, new ItemStack(ModItems.hayBundle, 9)},
|
|
};
|
|
};
|
|
addIngotRecipes(r, ingotItems);
|
|
addIngotRecipes(r, ingotItems);
|
|
-
|
|
|
|
- addNuggetRecipes(fr, toolItems, armorItems, ModItems.copperNugget, ModItems.bronzeNugget);
|
|
|
|
|
|
+
|
|
|
|
+ // tool nuggets
|
|
|
|
+ toolItems = new Object[][]
|
|
|
|
+ {
|
|
|
|
+ {ModItems.copperPickaxe, ModItems.copperShovel, ModItems.copperAxe, ModItems.copperHoe, ModItems.copperSword, ModItems.copperStick, ModItems.copperDagger, ModItems.copperHammer},
|
|
|
|
+ {ModItems.bronzePickaxe, ModItems.bronzeShovel, ModItems.bronzeAxe, ModItems.bronzeHoe, ModItems.bronzeSword, ModItems.bronzeStick, ModItems.bronzeDagger, ModItems.bronzeHammer},
|
|
|
|
+ {ModItems.ironStick, ModItems.ironDagger, ModItems.ironHammer},
|
|
|
|
+ {ModItems.goldStick, ModItems.goldDagger, ModItems.goldHammer}
|
|
|
|
+ };
|
|
|
|
+ addToolNuggetRecipes(fr, toolItems, ModItems.copperNugget, ModItems.bronzeNugget, Items.IRON_NUGGET, Items.GOLD_NUGGET);
|
|
|
|
+
|
|
|
|
+ addWoodRecipes(r);
|
|
}
|
|
}
|
|
|
|
|
|
// -----------------------------------------------------------------------------------
|
|
// -----------------------------------------------------------------------------------
|
|
@@ -358,14 +367,10 @@ public class ModRecipes
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private static void addNuggetRecipes(FurnaceRecipes fr, Object[][] toolItems, Item[][] armorItems, Item... nuggets)
|
|
|
|
|
|
+ private static void addArmorNuggetRecipes(FurnaceRecipes fr, Item[][] armorItems, Item... nuggets)
|
|
{
|
|
{
|
|
for(int i = 0; i < nuggets.length; i++)
|
|
for(int i = 0; i < nuggets.length; i++)
|
|
{
|
|
{
|
|
- for(int j = 1; j < toolItems.length; j++)
|
|
|
|
- {
|
|
|
|
- fr.addSmelting((Item) toolItems[j][i], new ItemStack(nuggets[i]), 0.1f);
|
|
|
|
- }
|
|
|
|
for(int j = 1; j < armorItems.length; j++)
|
|
for(int j = 1; j < armorItems.length; j++)
|
|
{
|
|
{
|
|
fr.addSmelting((Item) armorItems[j][i], new ItemStack(nuggets[i]), 0.1f);
|
|
fr.addSmelting((Item) armorItems[j][i], new ItemStack(nuggets[i]), 0.1f);
|
|
@@ -373,6 +378,17 @@ public class ModRecipes
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private static void addToolNuggetRecipes(FurnaceRecipes fr, Object[][] toolItems, Item... nuggets)
|
|
|
|
+ {
|
|
|
|
+ for(int i = 0; i < nuggets.length; i++)
|
|
|
|
+ {
|
|
|
|
+ for(Object toolItem : toolItems[i])
|
|
|
|
+ {
|
|
|
|
+ fr.addSmelting((Item) toolItem, new ItemStack(nuggets[i]), 0.1f);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
private static void addMetalRecipes(IForgeRegistry<IRecipe> r, String group, String[] pattern, Item output, int amount)
|
|
private static void addMetalRecipes(IForgeRegistry<IRecipe> r, String group, String[] pattern, Item output, int amount)
|
|
{
|
|
{
|
|
char[] chars = new char[] {'X'};
|
|
char[] chars = new char[] {'X'};
|
|
@@ -403,4 +419,50 @@ public class ModRecipes
|
|
}
|
|
}
|
|
registerShaped(r, "", pattern, result, chars, stacks);
|
|
registerShaped(r, "", pattern, result, chars, stacks);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ private static void addWoodRecipes(IForgeRegistry<IRecipe> r)
|
|
|
|
+ {
|
|
|
|
+ ItemStack[] planks = new ItemStack[]
|
|
|
|
+ {
|
|
|
|
+ new ItemStack(Blocks.PLANKS, 1, 0), new ItemStack(Blocks.PLANKS, 1, 1),
|
|
|
|
+ new ItemStack(Blocks.PLANKS, 1, 2), new ItemStack(Blocks.PLANKS, 1, 3),
|
|
|
|
+ new ItemStack(Blocks.PLANKS, 1, 4), new ItemStack(Blocks.PLANKS, 1, 5)
|
|
|
|
+ };
|
|
|
|
+ String[] pattern = new String[] {"X X", "X X", "XXX"};
|
|
|
|
+ ItemStack[] result = new ItemStack[]
|
|
|
|
+ {
|
|
|
|
+ new ItemStack(ModBlocks.cauldronOak), new ItemStack(ModBlocks.cauldronSpruce),
|
|
|
|
+ new ItemStack(ModBlocks.cauldronBirch), new ItemStack(ModBlocks.cauldronJungle),
|
|
|
|
+ new ItemStack(ModBlocks.cauldronAcacia), new ItemStack(ModBlocks.cauldronBigOak)
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ for(int i = 0; i < planks.length; i++)
|
|
|
|
+ {
|
|
|
|
+ registerShaped(r, "", pattern, result[i], new char[] {'X'}, new ItemStack[][] {{planks[i]}});
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ result = new ItemStack[]
|
|
|
|
+ {
|
|
|
|
+ new ItemStack(ModBlocks.crateOak), new ItemStack(ModBlocks.crateSpruce),
|
|
|
|
+ new ItemStack(ModBlocks.crateBirch), new ItemStack(ModBlocks.crateJungle),
|
|
|
|
+ new ItemStack(ModBlocks.crateAcacia), new ItemStack(ModBlocks.crateBigOak)
|
|
|
|
+ };
|
|
|
|
+ pattern = new String[] {"XXX", "XXX", "XXX"};
|
|
|
|
+ for(int i = 0; i < planks.length; i++)
|
|
|
|
+ {
|
|
|
|
+ registerShaped(r, "", pattern, result[i], new char[] {'X'}, new ItemStack[][] {{planks[i]}});
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ result = new ItemStack[]
|
|
|
|
+ {
|
|
|
|
+ new ItemStack(ModBlocks.barrelOak), new ItemStack(ModBlocks.barrelSpruce),
|
|
|
|
+ new ItemStack(ModBlocks.barrelBirch), new ItemStack(ModBlocks.barrelJungle),
|
|
|
|
+ new ItemStack(ModBlocks.barrelAcacia), new ItemStack(ModBlocks.barrelBigOak)
|
|
|
|
+ };
|
|
|
|
+ pattern = new String[] {"X X", "XXX", "X X"};
|
|
|
|
+ for(int i = 0; i < planks.length; i++)
|
|
|
|
+ {
|
|
|
|
+ registerShaped(r, "", pattern, result[i], new char[] {'X'}, new ItemStack[][] {{planks[i]}});
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|