diff --git a/Changelog.txt b/Changelog.txt index e96540d..5008358 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -2,10 +2,10 @@ -Changed: Pouches are now made differently; they no longer store color in Metadata, instead they use NBT, and can be any hex color! Note: Pouches can be dyed via Ore Dictionary Dyes! Unlike leather armor and sheep (might make a fix for that in V-Tweaks...) --Added Crafting Handler to address new changes to pouches. +-Added: Crafting Handler to address new changes to pouches. Take your "broken" pouch and put it in your crafting grid, you'll get a new one back, keeping all stored items --Added ability to clear pouch of color like vanilla armor; use a cauldron with water --Added the Scribe: new Tile Entity for crafting enchanted books. Only crafts Level I enchanted books; recipes and process times are non-configurable. +-Added: ability to clear pouch of color like vanilla armor; use a cauldron with water +-Added: the Scribe: new Tile Entity for crafting enchanted books. Only crafts Level I enchanted books; recipes and process times are non-configurable. The Scribe only crafts enchanted books at Level I. This is for balance, since it does not require XP any other ways. diff --git a/src/main/java/com/oitsjustjose/criss_cross/CrissCross.java b/src/main/java/com/oitsjustjose/criss_cross/CrissCross.java index 5f15899..3bdb2b5 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/CrissCross.java +++ b/src/main/java/com/oitsjustjose/criss_cross/CrissCross.java @@ -17,6 +17,7 @@ import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; @Mod(modid = Lib.modid, name = Lib.name, version = Lib.version, guiFactory = Lib.guifactory) @@ -40,12 +41,13 @@ public class CrissCross LibBlocks.init(); LibItems.init(); VanillaRecipes.init(); - CCMachineRecipes.init(); } - + @EventHandler - public static void init(FMLInitializationEvent event) + public static void postInit(FMLPostInitializationEvent event) { + CCMachineRecipes.init(); + if (event.getSide().isClient()) ClientProxy.init(); } diff --git a/src/main/java/com/oitsjustjose/criss_cross/lib/ConfigHandler.java b/src/main/java/com/oitsjustjose/criss_cross/lib/ConfigHandler.java index 9f59b32..e1d3d21 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/lib/ConfigHandler.java +++ b/src/main/java/com/oitsjustjose/criss_cross/lib/ConfigHandler.java @@ -31,7 +31,10 @@ public class ConfigHandler public static int woodchipperOutput; public static String woodchipperRecipeItem; public static String[] woodchipperFuels; - public static String[] defaultWoodchipperFuels = new String[] { "minecraft:water_bucket", "minecraft:potion:0", "CrissCross:magicBucket:0" }; + public static String[] defaultWoodchipperFuels = new String[] { "minecraft:water_bucket", "minecraft:potion:0", "crisscross:special_bucket:0" }; + + public static String[] scribeRecipes; + public static String[] defaultScribeRecipes = new String[] { "minecraft:fish:3*16=6", "minecraft:spider_eye:0*8=18", "minecraft:obsidian:0*8=3", "minecraft:prismarine_shard:0*16=8", "minecraft:feather:0*32=2", "minecraft:blaze_rod:0*8=20", "minecraft:blaze_powder:0*16=50", "minecraft:piston:0*4=19", "minecraft:prismarine_crystals:0*16=61", "minecraft:fish:0*16=62", "minecraft:potion:8269*1=5", "minecraft:slime:0*8=33", "minecraft:rotten_flesh:0*48=17", "minecraft:double_plant:4*64=7", "ingotIron*24=34", "ingotGold*12=49", "gemQuartz*16=48", "gemDiamond*8=51", "gemEmerald*3=21", "logWood*16=4", "blockIron*4=0", "blockQuartz*16=16", "blockLapis*12=35", "blockRedstone*8=32" }; public static int blockGeneratorProcessTimes; @@ -78,6 +81,8 @@ public class ConfigHandler woodchipperRecipeItem = config.getString("Woodchipper Crafting Item", config.CATEGORY_GENERAL, "minecraft:diamond_block", "This is the item located in the center of the crafting recipe for the Woodchipper. Formatted as: :: or :."); + scribeRecipes = config.get(config.CATEGORY_GENERAL, "Custom Scribe Recipes", defaultScribeRecipes, "Formatted as ::*=" + "\n" + "Also can be *qty=" + "\n" + "A list of custom additional recipes for the Scribe. Default ones cannot be disabled").getStringList(); + // Autosmith's Configs blockGeneratorProcessTimes = config.getInt("Stone Generators' Process Times", config.CATEGORY_GENERAL, 20, 0, Short.MAX_VALUE, "Control how many ticks it takes a stone generator to process an item. Default is 20; furnaces are 200."); diff --git a/src/main/java/com/oitsjustjose/criss_cross/recipes/CCMachineRecipes.java b/src/main/java/com/oitsjustjose/criss_cross/recipes/CCMachineRecipes.java index 3fdd339..575ae65 100644 --- a/src/main/java/com/oitsjustjose/criss_cross/recipes/CCMachineRecipes.java +++ b/src/main/java/com/oitsjustjose/criss_cross/recipes/CCMachineRecipes.java @@ -67,30 +67,54 @@ public class CCMachineRecipes public static void initScribeRecipes() { - ScribeRecipes.getInstance().addRecipe(new ItemStack(Items.fish, 16, 3), getEnchantedBook(Enchantment.aquaAffinity)); - ScribeRecipes.getInstance().addRecipe(new ItemStack(Items.spider_eye, 8), getEnchantedBook(Enchantment.baneOfArthropods)); - ScribeRecipes.getInstance().addRecipe(new ItemStack(Blocks.obsidian, 8), getEnchantedBook(Enchantment.blastProtection)); - ScribeRecipes.getInstance().addRecipe(new ItemStack(Items.prismarine_shard, 16), getEnchantedBook(Enchantment.depthStrider)); - ScribeRecipes.getInstance().addRecipe(new ItemStack(Items.feather, 32), getEnchantedBook(Enchantment.featherFalling)); - ScribeRecipes.getInstance().addRecipe(new ItemStack(Items.blaze_rod, 8), getEnchantedBook(Enchantment.fireAspect)); - ScribeRecipes.getInstance().addRecipe(new ItemStack(Items.blaze_powder, 16), getEnchantedBook(Enchantment.flame)); - ScribeRecipes.getInstance().addRecipe(new ItemStack(Blocks.piston, 4), getEnchantedBook(Enchantment.knockback)); - ScribeRecipes.getInstance().addRecipe(new ItemStack(Items.prismarine_crystals, 16), getEnchantedBook(Enchantment.luckOfTheSea)); - ScribeRecipes.getInstance().addRecipe(new ItemStack(Items.fish, 16, 0), getEnchantedBook(Enchantment.lure)); - ScribeRecipes.getInstance().addRecipe(new ItemStack(Items.potionitem, 1, 8269), getEnchantedBook(Enchantment.respiration)); - ScribeRecipes.getInstance().addRecipe(new ItemStack(Blocks.slime_block, 8), getEnchantedBook(Enchantment.silkTouch)); - ScribeRecipes.getInstance().addRecipe(new ItemStack(Items.rotten_flesh, 48), getEnchantedBook(Enchantment.smite)); - ScribeRecipes.getInstance().addRecipe(new ItemStack(Blocks.double_plant, 64, 4), getEnchantedBook(Enchantment.thorns)); - ScribeRecipes.getInstance().addRecipe("ingotIron", 24, getEnchantedBook(Enchantment.unbreaking)); - ScribeRecipes.getInstance().addRecipe("ingotGold", 12, getEnchantedBook(Enchantment.punch)); - ScribeRecipes.getInstance().addRecipe("gemQuartz", 16, getEnchantedBook(Enchantment.power)); - ScribeRecipes.getInstance().addRecipe("gemDiamond", 8, getEnchantedBook(Enchantment.infinity)); - ScribeRecipes.getInstance().addRecipe("gemEmerald", 3, getEnchantedBook(Enchantment.looting)); - ScribeRecipes.getInstance().addRecipe("logWood", 16, getEnchantedBook(Enchantment.projectileProtection)); - ScribeRecipes.getInstance().addRecipe("blockIron", 4, getEnchantedBook(Enchantment.protection)); - ScribeRecipes.getInstance().addRecipe("blockQuartz", 16, getEnchantedBook(Enchantment.sharpness)); - ScribeRecipes.getInstance().addRecipe("blockLapis", 12, getEnchantedBook(Enchantment.fortune)); - ScribeRecipes.getInstance().addRecipe("blockRedstone", 8, getEnchantedBook(Enchantment.efficiency)); + for (int i = 0; i < ConfigHandler.scribeRecipes.length; i++) + { + try + { + String[] parts = ConfigHandler.scribeRecipes[i].split("[\\W]"); + if (parts.length == 5) + { + String modid = parts[0]; + String object = parts[1]; + int metadata = Integer.parseInt(parts[2]); + int qty = Integer.parseInt(parts[3]); + int enchID = Integer.parseInt(parts[4]); + + if (ConfigHandler.findItemStack(modid, object) != null && Enchantment.getEnchantmentById(enchID) != null) + { + ItemStack newStack = ConfigHandler.findItemStack(modid, object); + ScribeRecipes.getInstance().addRecipe(new ItemStack(newStack.getItem(), qty, metadata), getEnchantedBook(enchID)); + } + else + { + CCLog.warn("Item " + ConfigHandler.scribeRecipes[i] + " could not be added to the Scribe's recipe list."); + CCLog.warn("Please confirm you have the name and formatting and ID's correct."); + } + } + else if (parts.length == 3) + { + String oreDict = parts[0]; + int qty = Integer.parseInt(parts[1]); + int enchID = Integer.parseInt(parts[2]); + + if (OreDictionary.getOres(oreDict).size() > 0) + { + if (Enchantment.getEnchantmentById(enchID) != null) + ScribeRecipes.getInstance().addRecipe(oreDict, qty, getEnchantedBook(enchID)); + else + CCLog.warn("Enchantment ID " + enchID + " does not appear to be valid. Skipping Scribe recipe addition."); + } + else + CCLog.warn("Ore Dictionary Name " + oreDict + " does not appear to be valid. Skipping Scribe recipe addition."); + } + else + CCLog.warn("Your formatting for entry " + (i + 1) + " does not appear to be correct."); + } + catch (Exception e) + { + CCLog.warn("Error reading itemstack for Scribe from input file at item: " + (i + 1)); + } + } } public static void initCropomatorRecipes() @@ -131,7 +155,7 @@ public class CCMachineRecipes } catch (Exception e) { - CCLog.warn("Error reading itemstack for inputs from input file at item: " + (i + 1)); + CCLog.warn("Error reading itemstack for Cropomator from input file at item: " + (i + 1)); } } @@ -171,7 +195,7 @@ public class CCMachineRecipes } catch (Exception e) { - CCLog.warn("Error reading itemstack for catalysts from input file at item: " + (i + 1)); + CCLog.warn("Error reading itemstack for Cropomator Cataylsts from input file at item: " + (i + 1)); } } } @@ -343,6 +367,14 @@ public class CCMachineRecipes } } + static ItemStack getEnchantedBook(int id) + { + ItemStack retBook = new ItemStack(Items.enchanted_book); + Items.enchanted_book.addEnchantment(retBook, new EnchantmentData(Enchantment.getEnchantmentById(id), 1)); + + return retBook; + } + static ItemStack getEnchantedBook(Enchantment enchantment) { ItemStack retBook = new ItemStack(Items.enchanted_book);