diff --git a/build.properties b/build.properties index 468bbe6..6a2b838 100644 --- a/build.properties +++ b/build.properties @@ -1,3 +1,3 @@ -#Wed, 10 Jul 2013 19:02:52 -0700 +#Mon, 16 Sep 2013 17:10:08 -0700 release.minecraft.version=1.6.2 -release.number=14 +release.number=17 diff --git a/src/common/burptech/BurpTechConfig.java b/src/common/burptech/BurpTechConfig.java index 0145e69..507c3d1 100644 --- a/src/common/burptech/BurpTechConfig.java +++ b/src/common/burptech/BurpTechConfig.java @@ -2,11 +2,10 @@ import java.io.File; -import burptech.block.Blocks; -import burptech.item.Items; +import burptech.block.*; +import burptech.item.*; import burptech.lib.*; -import net.minecraftforge.common.Configuration; -import net.minecraftforge.common.Property; +import net.minecraftforge.common.*; /* * All config for BurpTech here @@ -19,6 +18,7 @@ public class BurpTechConfig public Property enableMobsEatingOffOfGround; public Property enableMobsWandering; public Property enableGreedyVillagers; + public Property enableIlluminatedCocoa; public Property recipeCobwebs; public Property recipePortableWorkbench; @@ -26,7 +26,19 @@ public class BurpTechConfig public Property recipeEnderRucksack; public Property recipeCookedEgg; + + public Property enableNetherTechSolidFuels; + public Property blockIlluminatedCocoa; + public Property blockNetherCoal; + + public Property itemEnderRucksack; + public Property itemRucksack; + public Property itemPortableWorkbench; + public Property itemCookedEgg; + public Property itemNetherDust; + public Property itemNetherCoal; + /* * BurpTech Items */ @@ -67,6 +79,9 @@ public static BurpTechConfig load(File configFolder) result.enableGreedyVillagers = configuration.get(Constants.CONFIG_CATEGORY_TWEAKS, "EnableGreedyVillagers", true); result.enableGreedyVillagers.comment = "When enabled, villagers will follow players with diamonds and emeralds in there hands"; + result.enableIlluminatedCocoa = configuration.get(Constants.CONFIG_CATEGORY_TWEAKS, "IlluminatedCocoaPlants", true); + result.enableIlluminatedCocoa.comment = "When enabled, allows you to right click a grown cocoa plant with glowstone to turn it into a lamp"; + // Recipes result.recipeCobwebs = configuration.get(Constants.CONFIG_CATEGORY_RECIPES, "Cobwebs", true); result.recipeCobwebs.comment = "Enables crafting of cobwebs from string"; @@ -83,13 +98,27 @@ public static BurpTechConfig load(File configFolder) result.recipeCookedEgg = configuration.get(Constants.CONFIG_CATEGORY_RECIPES, "CookedEggs", true); result.recipeCookedEgg.comment = "Enables cooked eggs for food"; + // Nether Tech + result.enableNetherTechSolidFuels = configuration.get(Constants.CONFIG_CATEGORY_NETHERTECH, "SolidFuels", true); + result.enableNetherTechSolidFuels.comment = "Enables Nether Tech Solid Fuels"; + // Items - result.items = new Items(configuration); - result.items.create(); + result.itemEnderRucksack = configuration.getItem("EnderRucksack", burptech.lib.Constants.ITEM_START + 0); + result.itemRucksack = configuration.getItem("Rucksack", burptech.lib.Constants.ITEM_START + 1); + result.itemPortableWorkbench = configuration.getItem("PortableWorkbench", burptech.lib.Constants.ITEM_START + 2); + result.itemCookedEgg = configuration.getItem("CookedEgg", burptech.lib.Constants.ITEM_START + 3); + result.itemNetherDust = configuration.getItem("NetherDust", burptech.lib.Constants.ITEM_START + 4); + result.itemNetherCoal = configuration.getItem("NetherCoal", burptech.lib.Constants.ITEM_START + 5); + + result.items = new Items(); + result.items.create(result); // Blocks - result.blocks = new Blocks(configuration); - result.blocks.create(); + result.blockIlluminatedCocoa = configuration.getBlock("IlluminatedCocoaPlant", Constants.BLOCK_START + 0); + result.blockNetherCoal = configuration.getBlock("BlockNetherCoal", Constants.BLOCK_START + 1); + + result.blocks = new Blocks(); + result.blocks.create(result); // save only if modified if (configuration.hasChanged()) diff --git a/src/common/burptech/block/BlockIlluminatedCocoa.java b/src/common/burptech/block/BlockIlluminatedCocoa.java index 489a137..6e22386 100644 --- a/src/common/burptech/block/BlockIlluminatedCocoa.java +++ b/src/common/burptech/block/BlockIlluminatedCocoa.java @@ -25,7 +25,7 @@ public BlockIlluminatedCocoa(int blockId, boolean illuminated) @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { - if (blockID == BurpTechCore.configuration.blocks.illuminatedCocoaOn.blockID) + if (blockID == BurpTechCore.configuration.blocks.blockIlluminatedCocoaOn.blockID) return true; int meta = world.getBlockMetadata(x, y, z); @@ -37,7 +37,7 @@ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer p if (currentItem.itemID == Item.glowstone.itemID && ((meta & 12) >> 2) == 2) { - world.setBlock(x, y, z, BurpTechCore.configuration.blocks.illuminatedCocoaOn.blockID, meta, 1 | 2 | 4); + world.setBlock(x, y, z, BurpTechCore.configuration.blocks.blockIlluminatedCocoaOn.blockID, meta, 1 | 2 | 4); if (!player.capabilities.isCreativeMode) { currentItem.stackSize--; diff --git a/src/common/burptech/block/Blocks.java b/src/common/burptech/block/Blocks.java index 15fa63d..a5356ff 100644 --- a/src/common/burptech/block/Blocks.java +++ b/src/common/burptech/block/Blocks.java @@ -1,53 +1,41 @@ package burptech.block; +import cpw.mods.fml.common.registry.GameRegistry; +import burptech.BurpTechConfig; import burptech.BurpTechCore; import burptech.lib.Constants; import net.minecraft.block.Block; -import net.minecraftforge.common.*; +import net.minecraft.block.material.Material; +import net.minecraft.creativetab.CreativeTabs; /* * Block definitions for BurpTech */ public class Blocks { - Configuration configuration; + public Block blockIlluminatedCocoaOn; + public Block blockIlluminatedCocoaOff; + public Block blockNetherCoal; - public Block illuminatedCocoaOn; - public Block illuminatedCocoaOff; - - public Property enableIlluminatedCocoa; - - /* - * Default constructor - */ - public Blocks(Configuration configuration) - { - this.configuration = configuration; - } - - public void create() + public void create(BurpTechConfig configuration) { - enableIlluminatedCocoa = configuration.get(Constants.CONFIG_CATEGORY_TWEAKS, "IlluminatedCocoaPlants", true); - enableIlluminatedCocoa.comment = "When enabled, allows you to right click a grown cocoa plant with glowstone to turn it into a lamp"; + addIlluminatedCocoa(configuration); - if (enableIlluminatedCocoa.getBoolean(true)) - { - BurpTechCore.log.info("Adding Illuminated Cocoa Plants"); - AddIlluminatedCocoa(Constants.BLOCK_START + 0); - } + blockNetherCoal = (new Block(configuration.blockNetherCoal.getInt(), Material.rock)).setHardness(5.0F).setResistance(10.0F).setStepSound(Block.soundStoneFootstep).setUnlocalizedName("blockNetherCoal").setCreativeTab(CreativeTabs.tabMaterials).setTextureName(Constants.MOD_ID + ":" + "nether_coal_block"); + GameRegistry.registerBlock(blockNetherCoal, "blockNetherCoal"); } - private void AddIlluminatedCocoa(int defaultBlockID) + private void addIlluminatedCocoa(BurpTechConfig configuration) { - Property illuminatedCocoaOnBlockId = configuration.getBlock("IlluminatedCocoa", defaultBlockID, "The ID for the Illuminated Cocoa Plants. (Replaces default BlockCocoa)"); + if (!configuration.enableIlluminatedCocoa.getBoolean(true)) + return; + + int illuminatedCocoaPlantID = configuration.blockIlluminatedCocoa.getInt(); - int illuminatedCocoaPlantID = illuminatedCocoaOnBlockId.getInt(); - if (illuminatedCocoaPlantID != 0) - { - illuminatedCocoaOn = new BlockIlluminatedCocoa(illuminatedCocoaPlantID, true).setHardness(0.2F).setResistance(5.0F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("cocoa").setTextureName("cocoa"); - int cocoaPlantID = Block.cocoaPlant.blockID; - Block.blocksList[cocoaPlantID] = null; - illuminatedCocoaOff = new BlockIlluminatedCocoa(cocoaPlantID, false).setHardness(0.2F).setResistance(5.0F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("cocoa").setTextureName("cocoa"); - } + BurpTechCore.log.info("Enabling Illuminated Cocoa Blocks"); + blockIlluminatedCocoaOn = new BlockIlluminatedCocoa(illuminatedCocoaPlantID, true).setHardness(0.2F).setResistance(5.0F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("cocoa").setTextureName("cocoa"); + int cocoaPlantID = Block.cocoaPlant.blockID; + Block.blocksList[cocoaPlantID] = null; + blockIlluminatedCocoaOff = new BlockIlluminatedCocoa(cocoaPlantID, false).setHardness(0.2F).setResistance(5.0F).setStepSound(Block.soundWoodFootstep).setUnlocalizedName("cocoa").setTextureName("cocoa"); } } diff --git a/src/common/burptech/integration/AppliedEnergisticsIntegration.java b/src/common/burptech/integration/AppliedEnergisticsIntegration.java new file mode 100644 index 0000000..d1385ab --- /dev/null +++ b/src/common/burptech/integration/AppliedEnergisticsIntegration.java @@ -0,0 +1,19 @@ +package burptech.integration; + +import cpw.mods.fml.common.Loader; +import cpw.mods.fml.common.event.FMLInterModComms; +import net.minecraft.item.*; + +public class AppliedEnergisticsIntegration +{ + public static boolean addGrinderRecipe(ItemStack input, ItemStack output) + { + if (Loader.isModLoaded("AppliedEnergistics")) + { + // this is a fire and forget, need to verify that it actually works somehow + return FMLInterModComms.sendMessage("AppliedEnergistics", "add-grindable", input.itemID + "," + input.getItemDamage() + "," + output.itemID + "," + output.getItemDamage() + ",8"); + } + + return false; + } +} diff --git a/src/common/burptech/integration/GregTechIntegration.java b/src/common/burptech/integration/GregTechIntegration.java new file mode 100644 index 0000000..57931e5 --- /dev/null +++ b/src/common/burptech/integration/GregTechIntegration.java @@ -0,0 +1,11 @@ +package burptech.integration; + +import net.minecraft.item.ItemStack; + +public class GregTechIntegration +{ + public static boolean addGrinderRecipe(ItemStack input, ItemStack output1, ItemStack output2, ItemStack output3, ItemStack output4) + { + return false; + } +} diff --git a/src/common/burptech/integration/IndustrialcraftIntegration.java b/src/common/burptech/integration/IndustrialcraftIntegration.java new file mode 100644 index 0000000..a1c6cba --- /dev/null +++ b/src/common/burptech/integration/IndustrialcraftIntegration.java @@ -0,0 +1,11 @@ +package burptech.integration; + +import net.minecraft.item.*; + +public class IndustrialcraftIntegration +{ + public static boolean addMaceratorRecipe(ItemStack input, ItemStack output) + { + return false; + } +} diff --git a/src/common/burptech/integration/Integration.java b/src/common/burptech/integration/Integration.java new file mode 100644 index 0000000..72521b9 --- /dev/null +++ b/src/common/burptech/integration/Integration.java @@ -0,0 +1,23 @@ +package burptech.integration; + +import net.minecraft.item.ItemStack; + +public class Integration +{ + /* + * Adds a basic crushable item to mods that we integrate with. Returns true if any of them worked + */ + public static boolean addCrushableItem(ItemStack input, ItemStack output) + { + boolean isAddedToMod = false; + + isAddedToMod = isAddedToMod | AppliedEnergisticsIntegration.addGrinderRecipe(input, output); + isAddedToMod = isAddedToMod | GregTechIntegration.addGrinderRecipe(input, output, null, null, null); + isAddedToMod = isAddedToMod | IndustrialcraftIntegration.addMaceratorRecipe(input, output); + isAddedToMod = isAddedToMod | MekanismIntegration.addCrusherRecipe(input, output); + isAddedToMod = isAddedToMod | RailcraftIntegration.addRockCrusherRecipe(input, output, null, 0); + isAddedToMod = isAddedToMod | ThermalExpansionIntegration.addPulverizerRecipe(input, output, null, 0); + + return isAddedToMod; + } +} diff --git a/src/common/burptech/integration/MekanismIntegration.java b/src/common/burptech/integration/MekanismIntegration.java new file mode 100644 index 0000000..2328f3b --- /dev/null +++ b/src/common/burptech/integration/MekanismIntegration.java @@ -0,0 +1,28 @@ +package burptech.integration; + +import java.lang.reflect.Method; + +import burptech.BurpTechCore; +import cpw.mods.fml.common.Loader; +import net.minecraft.item.ItemStack; + +public class MekanismIntegration +{ + public static boolean addCrusherRecipe(ItemStack input, ItemStack output) + { + if (!Loader.isModLoaded("Mekanism")) + return false; + + try { + Class recipeClass = Class.forName("mekanism.common.RecipeHandler"); + Method m = recipeClass.getMethod("addCrusherRecipe", ItemStack.class, ItemStack.class); + m.invoke(null, input, output); + + return true; + } catch(Exception e) { + BurpTechCore.log.info("Error while adding Crusher Recipe to Mekanism: " + e.getMessage()); + } + + return false; + } +} diff --git a/src/common/burptech/integration/RailcraftIntegration.java b/src/common/burptech/integration/RailcraftIntegration.java new file mode 100644 index 0000000..288b508 --- /dev/null +++ b/src/common/burptech/integration/RailcraftIntegration.java @@ -0,0 +1,11 @@ +package burptech.integration; + +import net.minecraft.item.ItemStack; + +public class RailcraftIntegration +{ + public static boolean addRockCrusherRecipe(ItemStack input, ItemStack output, ItemStack bonus, float bonusChance) + { + return false; + } +} diff --git a/src/common/burptech/integration/ThermalExpansionIntegration.java b/src/common/burptech/integration/ThermalExpansionIntegration.java new file mode 100644 index 0000000..52a520d --- /dev/null +++ b/src/common/burptech/integration/ThermalExpansionIntegration.java @@ -0,0 +1,11 @@ +package burptech.integration; + +import net.minecraft.item.ItemStack; + +public class ThermalExpansionIntegration +{ + public static boolean addPulverizerRecipe(ItemStack input, ItemStack output, ItemStack bonus, float bonusChance) + { + return false; + } +} diff --git a/src/common/burptech/item/Items.java b/src/common/burptech/item/Items.java index 74e3b19..4f8976a 100644 --- a/src/common/burptech/item/Items.java +++ b/src/common/burptech/item/Items.java @@ -1,43 +1,42 @@ package burptech.item; -import burptech.lib.Constants; +import burptech.*; +import burptech.lib.*; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.Item; -import net.minecraft.item.ItemFood; -import net.minecraftforge.common.*; - +import net.minecraft.item.*; +import net.minecraftforge.oredict.OreDictionary; /* * Item definitions for BurpTech */ public class Items { - Configuration configuration; - public Item portableWorkbench; public Item rucksack; public Item enderRucksack; public Item cookedEgg; - /* - * Default constructor - */ - public Items(Configuration configuration) - { - this.configuration = configuration; - } - + public Item netherDust; + public Item netherCoal; + /* * Creates all of the item instances */ - public void create() + public void create(BurpTechConfig configuration) { - enderRucksack = new ItemRucksack(configuration.getItem("EnderRucksack", burptech.lib.Constants.ITEM_START + 0).getInt(), true).setUnlocalizedName("enderRucksack").setMaxStackSize(1).setCreativeTab(CreativeTabs.tabTools); - rucksack = new ItemRucksack(configuration.getItem("Rucksack", burptech.lib.Constants.ITEM_START + 1).getInt(), false).setUnlocalizedName("rucksack").setMaxStackSize(1).setCreativeTab(CreativeTabs.tabTools); - portableWorkbench = new ItemPortableWorkbench(configuration.getItem("PortableWorkbench", burptech.lib.Constants.ITEM_START + 2).getInt()).setUnlocalizedName("portableWorkbench").setMaxStackSize(1).setCreativeTab(CreativeTabs.tabTools);; + enderRucksack = new ItemRucksack(configuration.itemEnderRucksack.getInt(), true).setUnlocalizedName("enderRucksack").setMaxStackSize(1).setCreativeTab(CreativeTabs.tabTools); + rucksack = new ItemRucksack(configuration.itemRucksack.getInt(), false).setUnlocalizedName("rucksack").setMaxStackSize(1).setCreativeTab(CreativeTabs.tabTools); + portableWorkbench = new ItemPortableWorkbench(configuration.itemPortableWorkbench.getInt()).setUnlocalizedName("portableWorkbench").setMaxStackSize(1).setCreativeTab(CreativeTabs.tabTools);; + + cookedEgg = new ItemFood(configuration.itemCookedEgg.getInt(), 2, .1F, false).setUnlocalizedName("cookedEgg").setTextureName(Constants.MOD_ID + ":" + "egg_cooked").setMaxStackSize(16); + + netherDust = new Item(configuration.itemNetherDust.getInt()).setUnlocalizedName("netherDust").setCreativeTab(CreativeTabs.tabMaterials).setTextureName(Constants.MOD_ID + ":" + "nether_dust"); + // ore dictionary (pulled from: http://minecraftmodcustomstuff.wikia.com/wiki/Ore_Dictionary - more here: http://www.minecraftforge.net/wiki/Common_Oredict_names) + OreDictionary.registerOre("dustNetherrack", netherDust); + OreDictionary.registerOre("itemDustNetherrack", netherDust); - cookedEgg = new ItemFood(configuration.getItem("CookedEgg", burptech.lib.Constants.ITEM_START + 3).getInt(), 2, .1F, false).setUnlocalizedName("cookedEgg").setTextureName(Constants.MOD_ID + ":" + "egg_cooked").setMaxStackSize(16); + netherCoal = new Item(configuration.itemNetherCoal.getInt()).setUnlocalizedName("netherCoal").setCreativeTab(CreativeTabs.tabMaterials).setTextureName(Constants.MOD_ID + ":" + "nether_coal"); } } diff --git a/src/common/burptech/item/NetherTechSolidFuelHandler.java b/src/common/burptech/item/NetherTechSolidFuelHandler.java new file mode 100644 index 0000000..d65fbaa --- /dev/null +++ b/src/common/burptech/item/NetherTechSolidFuelHandler.java @@ -0,0 +1,27 @@ +package burptech.item; + +import burptech.BurpTechCore; +import net.minecraft.item.ItemStack; +import cpw.mods.fml.common.IFuelHandler; + +/** + * Solid Fuel NetherTech Fuel Handler + * + */ +public class NetherTechSolidFuelHandler implements IFuelHandler +{ + @Override + public int getBurnTime(ItemStack fuel) + { + if (fuel == null) + return 0; + + if (fuel.itemID == BurpTechCore.configuration.items.netherCoal.itemID) + return 1600 * 2; // coal * 2 + + if (fuel.itemID == BurpTechCore.configuration.blocks.blockNetherCoal.blockID) + return (1600 * 2) * 9; // (coal * 2) * 9 + + return 0; + } +} diff --git a/src/common/burptech/item/crafting/RecipesNetherTech.java b/src/common/burptech/item/crafting/RecipesNetherTech.java index 3924a04..06c2e29 100644 --- a/src/common/burptech/item/crafting/RecipesNetherTech.java +++ b/src/common/burptech/item/crafting/RecipesNetherTech.java @@ -1,5 +1,16 @@ package burptech.item.crafting; +import java.util.ArrayList; + +import net.minecraft.block.Block; +import net.minecraft.item.*; +import net.minecraftforge.oredict.OreDictionary; +import net.minecraftforge.oredict.ShapedOreRecipe; +import cpw.mods.fml.common.registry.*; +import burptech.*; +import burptech.item.*; +import burptech.integration.*; + public class RecipesNetherTech { /** @@ -7,6 +18,36 @@ public class RecipesNetherTech */ public void addRecipes() { + addSolidFuels(); + } + + private void addSolidFuels() + { + if (!BurpTechCore.configuration.enableNetherTechSolidFuels.getBoolean(true)) + return; + if (!Integration.addCrushableItem(new ItemStack(Block.netherrack), new ItemStack(BurpTechCore.configuration.items.netherDust))) + { + // add vanilla recipe for nether coal if no mods are present to support it + GameRegistry.addRecipe(new ItemStack(BurpTechCore.configuration.items.netherCoal), + new Object[] { "###", "#C#", "###", '#', new ItemStack(Block.netherrack), 'C', new ItemStack(Item.coal, 1, 1) }); + } else { + // find out if we have charcoal dust, if so, use it for our recipe + ArrayList charcoals = OreDictionary.getOres("dustCharcoal"); + + // add modded recipe. might switch this to a compression later with an intermediate item? + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(BurpTechCore.configuration.items.netherCoal), + new Object[] {"###", "#C#", "###", '#', "dustNetherrack", 'C', charcoals.size() == 0 ? new ItemStack(Item.coal, 1, 1) : "dustCharcoal" })); + + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(BurpTechCore.configuration.items.netherCoal), + new Object[] {"###", "#C#", "###", '#', "itemDustNetherrack", 'C', charcoals.size() == 0 ? new ItemStack(Item.coal, 1, 1) : "dustCharcoal" })); + } + + // nether coal block + GameRegistry.addRecipe(new ItemStack(BurpTechCore.configuration.blocks.blockNetherCoal), + new Object[] { "###", "###", "###", '#', BurpTechCore.configuration.items.netherCoal }); + + GameRegistry.registerFuelHandler(new NetherTechSolidFuelHandler()); } + } diff --git a/src/common/burptech/lib/Constants.java b/src/common/burptech/lib/Constants.java index 1396cd5..42da728 100644 --- a/src/common/burptech/lib/Constants.java +++ b/src/common/burptech/lib/Constants.java @@ -41,6 +41,11 @@ public final class Constants */ public static final String CONFIG_CATEGORY_RECIPES = "Recipes"; + /** + * Configuration Category for Nether Tech + */ + public static final String CONFIG_CATEGORY_NETHERTECH = "NetherTech"; + /** * GUI ID for Portable Workbench */ diff --git a/src/common/burptech/lib/LocalizationManager.java b/src/common/burptech/lib/LocalizationManager.java index b54f1c1..482cfdc 100644 --- a/src/common/burptech/lib/LocalizationManager.java +++ b/src/common/burptech/lib/LocalizationManager.java @@ -14,5 +14,9 @@ public static void addLocalization() LanguageRegistry.addName(BurpTechCore.configuration.items.enderRucksack, "Ender Rucksack"); LanguageRegistry.addName(BurpTechCore.configuration.items.cookedEgg, "Cooked Egg"); + + LanguageRegistry.addName(BurpTechCore.configuration.items.netherCoal, "Nether Infused Coal"); + LanguageRegistry.addName(BurpTechCore.configuration.items.netherDust, "Nether Dust"); + LanguageRegistry.addName(BurpTechCore.configuration.blocks.blockNetherCoal, "Block of Nether Infused Coal"); } } diff --git a/src/resources/assets/burptechcore/textures/blocks/nether_coal_block.png b/src/resources/assets/burptechcore/textures/blocks/nether_coal_block.png new file mode 100644 index 0000000..7b40d8f Binary files /dev/null and b/src/resources/assets/burptechcore/textures/blocks/nether_coal_block.png differ diff --git a/src/resources/pack.mcmeta b/src/resources/pack.mcmeta new file mode 100644 index 0000000..b8eeff1 --- /dev/null +++ b/src/resources/pack.mcmeta @@ -0,0 +1,7 @@ +{ + "pack": + { + "description": "BurpTech Resource Pack", + "pack_format": 1 + } +} \ No newline at end of file