From 352b0d09b7602764e8586d04496c70458878507b Mon Sep 17 00:00:00 2001 From: Adubbz Date: Mon, 22 Apr 2013 11:11:56 +1000 Subject: [PATCH] Added thermal expansion sawmill compatibility, moved BWG compatibility to the correct place --- .../configuration/BOPBiomes.java | 76 +---------- .../integration/BOPCrossIntegration.java | 117 +++++++++++++++++ .../api/ThermalExpansionInfo.java | 54 ++++++++ .../api/crafting/CraftingHelpers.java | 106 +++++++++++++++ .../api/crafting/CraftingManagers.java | 46 +++++++ .../api/crafting/ICrucibleManager.java | 39 ++++++ .../api/crafting/ICrucibleRecipe.java | 19 +++ .../api/crafting/IFurnaceManager.java | 38 ++++++ .../api/crafting/IFurnaceRecipe.java | 18 +++ .../api/crafting/IPulverizerManager.java | 79 +++++++++++ .../api/crafting/IPulverizerRecipe.java | 22 ++++ .../api/crafting/ISawmillManager.java | 78 +++++++++++ .../api/crafting/ISawmillRecipe.java | 22 ++++ .../api/crafting/ISmelterManager.java | 85 ++++++++++++ .../api/crafting/ISmelterRecipe.java | 24 ++++ .../api/crafting/ITransposerManager.java | 71 ++++++++++ .../api/crafting/ITransposerRecipe.java | 23 ++++ .../api/item/IChargeableItem.java | 52 ++++++++ .../api/item/ItemRegistry.java | 123 ++++++++++++++++++ .../api/tileentity/IAccessControl.java | 13 ++ .../api/tileentity/IRedstoneControl.java | 19 +++ .../api/tileentity/ITesseract.java | 30 +++++ src/minecraft/thermalexpansion/readme-api.txt | 37 ++++++ 23 files changed, 1116 insertions(+), 75 deletions(-) create mode 100644 src/minecraft/thermalexpansion/api/ThermalExpansionInfo.java create mode 100644 src/minecraft/thermalexpansion/api/crafting/CraftingHelpers.java create mode 100644 src/minecraft/thermalexpansion/api/crafting/CraftingManagers.java create mode 100644 src/minecraft/thermalexpansion/api/crafting/ICrucibleManager.java create mode 100644 src/minecraft/thermalexpansion/api/crafting/ICrucibleRecipe.java create mode 100644 src/minecraft/thermalexpansion/api/crafting/IFurnaceManager.java create mode 100644 src/minecraft/thermalexpansion/api/crafting/IFurnaceRecipe.java create mode 100644 src/minecraft/thermalexpansion/api/crafting/IPulverizerManager.java create mode 100644 src/minecraft/thermalexpansion/api/crafting/IPulverizerRecipe.java create mode 100644 src/minecraft/thermalexpansion/api/crafting/ISawmillManager.java create mode 100644 src/minecraft/thermalexpansion/api/crafting/ISawmillRecipe.java create mode 100644 src/minecraft/thermalexpansion/api/crafting/ISmelterManager.java create mode 100644 src/minecraft/thermalexpansion/api/crafting/ISmelterRecipe.java create mode 100644 src/minecraft/thermalexpansion/api/crafting/ITransposerManager.java create mode 100644 src/minecraft/thermalexpansion/api/crafting/ITransposerRecipe.java create mode 100644 src/minecraft/thermalexpansion/api/item/IChargeableItem.java create mode 100644 src/minecraft/thermalexpansion/api/item/ItemRegistry.java create mode 100644 src/minecraft/thermalexpansion/api/tileentity/IAccessControl.java create mode 100644 src/minecraft/thermalexpansion/api/tileentity/IRedstoneControl.java create mode 100644 src/minecraft/thermalexpansion/api/tileentity/ITesseract.java create mode 100644 src/minecraft/thermalexpansion/readme-api.txt diff --git a/src/minecraft/biomesoplenty/configuration/BOPBiomes.java b/src/minecraft/biomesoplenty/configuration/BOPBiomes.java index 0f96165fa..614f2166e 100644 --- a/src/minecraft/biomesoplenty/configuration/BOPBiomes.java +++ b/src/minecraft/biomesoplenty/configuration/BOPBiomes.java @@ -2,6 +2,7 @@ package biomesoplenty.configuration; import ted80.api.DefaultBiomeList; import net.minecraft.world.biome.BiomeGenBase; +import net.minecraftforge.common.BiomeDictionary; import net.minecraftforge.common.BiomeManager; import biomesoplenty.api.Biomes; @@ -194,81 +195,6 @@ public class BOPBiomes { //Initialize new world type WTBiomesOP = new WTBiomesOP(); - - if (Loader.isModLoaded("BWG4")) - { - if(Biomes.alps.isPresent()) { DefaultBiomeList.addBiome("BoP: Alps", Biomes.alps.get(), 1); } - if(Biomes.arctic.isPresent()) { DefaultBiomeList.addBiome("BoP: Arctic", Biomes.arctic.get(), 1); } - if(Biomes.badlands.isPresent()) { DefaultBiomeList.addBiome("BoP: Badlands", Biomes.badlands.get(), 4); } - if(Biomes.bambooForest.isPresent()) { DefaultBiomeList.addBiome("BoP: Bamboo Forest", Biomes.bambooForest.get(), 3); } - if(Biomes.bayou.isPresent()) { DefaultBiomeList.addBiome("BoP: Bayou", Biomes.bayou.get(), 3); } - if(Biomes.birchForest.isPresent()) { DefaultBiomeList.addBiome("BoP: Birch Forest", Biomes.birchForest.get(), 2); } - if(Biomes.bog.isPresent()) { DefaultBiomeList.addBiome("BoP: Bog", Biomes.bog.get(), 3); } - if(Biomes.borealForest.isPresent()) { DefaultBiomeList.addBiome("BoP: Boreal Forest", Biomes.borealForest.get(), 2); } - if(Biomes.canyon.isPresent()) { DefaultBiomeList.addBiome("BoP: Canyon", Biomes.canyon.get(), 4); } - if(Biomes.chaparral.isPresent()) { DefaultBiomeList.addBiome("BoP: Chaparral", Biomes.chaparral.get(), 2); } - if(Biomes.cherryBlossomGrove.isPresent()) { DefaultBiomeList.addBiome("BoP: Cherry Blossom Grove", Biomes.cherryBlossomGrove.get(), 2); } - if(Biomes.coniferousForest.isPresent()) { DefaultBiomeList.addBiome("BoP: Coniferous Forest", Biomes.coniferousForest.get(), 2); } - if(Biomes.crag.isPresent()) { DefaultBiomeList.addBiome("BoP: Crag", Biomes.crag.get(), 2); } - if(Biomes.deadForest.isPresent()) { DefaultBiomeList.addBiome("BoP: Dead Forest", Biomes.deadForest.get(), 2); } - if(Biomes.deadSwamp.isPresent()) { DefaultBiomeList.addBiome("BoP: Dead Swamp", Biomes.deadSwamp.get(), 2); } - if(Biomes.deadlands.isPresent()) { DefaultBiomeList.addBiome("BoP: Deadlands", Biomes.deadlands.get(), 4); } - if(Biomes.deciduousForest.isPresent()) { DefaultBiomeList.addBiome("BoP: Deciduous Forest", Biomes.deciduousForest.get(), 2); } - if(Biomes.drylands.isPresent()) { DefaultBiomeList.addBiome("BoP: Drylands", Biomes.drylands.get(), 4); } - if(Biomes.dunes.isPresent()) { DefaultBiomeList.addBiome("BoP: Dunes", Biomes.dunes.get(), 4); } - if(Biomes.fen.isPresent()) { DefaultBiomeList.addBiome("BoP: Fen", Biomes.fen.get(), 2); } - if(Biomes.field.isPresent()) { DefaultBiomeList.addBiome("BoP: Field", Biomes.field.get(), 2); } - if(Biomes.frostForest.isPresent()) { DefaultBiomeList.addBiome("BoP: Frost Forest", Biomes.frostForest.get(), 1); } - if(Biomes.fungiForest.isPresent()) { DefaultBiomeList.addBiome("BoP: Fungi Forest", Biomes.fungiForest.get(), 3); } - if(Biomes.garden.isPresent()) { DefaultBiomeList.addBiome("BoP: Garden", Biomes.garden.get(), 2); } - if(Biomes.glacier.isPresent()) { DefaultBiomeList.addBiome("BoP: Glacier", Biomes.glacier.get(), 1); } - if(Biomes.grassland.isPresent()) { DefaultBiomeList.addBiome("BoP: Grassland", Biomes.grassland.get(), 2); } - if(Biomes.grove.isPresent()) { DefaultBiomeList.addBiome("BoP: Grove", Biomes.grove.get(), 2); } - if(Biomes.heathland.isPresent()) { DefaultBiomeList.addBiome("BoP: Heathland", Biomes.heathland.get(), 4); } - if(Biomes.highland.isPresent()) { DefaultBiomeList.addBiome("BoP: Highland", Biomes.highland.get(), 2); } - if(Biomes.iceSheet.isPresent()) { DefaultBiomeList.addBiome("BoP: Ice Sheet", Biomes.iceSheet.get(), 1); } - if(Biomes.icyHills.isPresent()) { DefaultBiomeList.addBiome("BoP: Icy Hills", Biomes.icyHills.get(), 1); } - if(Biomes.jadeCliffs.isPresent()) { DefaultBiomeList.addBiome("BoP: Jade Cliffs", Biomes.jadeCliffs.get(), 2); } - if(Biomes.lushDesert.isPresent()) { DefaultBiomeList.addBiome("BoP: Lush Desert", Biomes.lushDesert.get(), 4); } - if(Biomes.lushSwamp.isPresent()) { DefaultBiomeList.addBiome("BoP: Lush Swamp", Biomes.lushSwamp.get(), 3); } - if(Biomes.mangrove.isPresent()) { DefaultBiomeList.addBiome("BoP: Mangrove", Biomes.mangrove.get(), 2); } - if(Biomes.mapleWoods.isPresent()) { DefaultBiomeList.addBiome("BoP: Maple Woods", Biomes.mapleWoods.get(), 2); } - if(Biomes.marsh.isPresent()) { DefaultBiomeList.addBiome("BoP: Marsh", Biomes.marsh.get(), 2); } - if(Biomes.meadow.isPresent()) { DefaultBiomeList.addBiome("BoP: Meadow", Biomes.meadow.get(), 2); } - if(Biomes.mesa.isPresent()) { DefaultBiomeList.addBiome("BoP: Mesa", Biomes.mesa.get(), 4); } - if(Biomes.moor.isPresent()) { DefaultBiomeList.addBiome("BoP: Moor", Biomes.moor.get(), 2); } - if(Biomes.mountain.isPresent()) { DefaultBiomeList.addBiome("BoP: Mountain", Biomes.mountain.get(), 2); } - if(Biomes.mysticGrove.isPresent()) { DefaultBiomeList.addBiome("BoP: Mystic Grove", Biomes.mysticGrove.get(), 3); } - if(Biomes.oasis.isPresent()) { DefaultBiomeList.addBiome("BoP: Oasis", Biomes.oasis.get(), 4); } - if(Biomes.ominousWoods.isPresent()) { DefaultBiomeList.addBiome("BoP: Ominous Woods", Biomes.ominousWoods.get(), 2); } - if(Biomes.orchard.isPresent()) { DefaultBiomeList.addBiome("BoP: Orchard", Biomes.orchard.get(), 2); } - if(Biomes.originValley.isPresent()) { DefaultBiomeList.addBiome("BoP: Origin Valley", Biomes.originValley.get(), 2); } - if(Biomes.outback.isPresent()) { DefaultBiomeList.addBiome("BoP: Outback", Biomes.outback.get(), 4); } - if(Biomes.pasture.isPresent()) { DefaultBiomeList.addBiome("BoP: Pasture", Biomes.pasture.get(), 2); } - if(Biomes.prairie.isPresent()) { DefaultBiomeList.addBiome("BoP: Prairie", Biomes.prairie.get(), 2); } - if(Biomes.quagmire.isPresent()) { DefaultBiomeList.addBiome("BoP: Quagmire", Biomes.quagmire.get(), 4); } - if(Biomes.rainforest.isPresent()) { DefaultBiomeList.addBiome("BoP: Rainforest", Biomes.rainforest.get(), 3); } - if(Biomes.redwoodForest.isPresent()) { DefaultBiomeList.addBiome("BoP: Redwood Forest", Biomes.redwoodForest.get(), 2); } - if(Biomes.sacredSprings.isPresent()) { DefaultBiomeList.addBiome("BoP: Sacred Springs", Biomes.sacredSprings.get(), 3); } - if(Biomes.savanna.isPresent()) { DefaultBiomeList.addBiome("BoP: Savanna", Biomes.savanna.get(), 4); } - if(Biomes.scrubland.isPresent()) { DefaultBiomeList.addBiome("BoP: Scrubland", Biomes.scrubland.get(), 4); } - if(Biomes.seasonalForest.isPresent()) { DefaultBiomeList.addBiome("BoP: Seasonal Forest", Biomes.seasonalForest.get(), 2); } - if(Biomes.shield.isPresent()) { DefaultBiomeList.addBiome("BoP: Shield", Biomes.shield.get(), 2); } - if(Biomes.shrubland.isPresent()) { DefaultBiomeList.addBiome("BoP: Shrubland", Biomes.shrubland.get(), 2); } - if(Biomes.snowyWoods.isPresent()) { DefaultBiomeList.addBiome("BoP: Snowy Woods", Biomes.snowyWoods.get(), 1); } - if(Biomes.spruceWoods.isPresent()) { DefaultBiomeList.addBiome("BoP: Spruce Woods", Biomes.spruceWoods.get(), 2); } - if(Biomes.steppe.isPresent()) { DefaultBiomeList.addBiome("BoP: Steppe", Biomes.steppe.get(), 4); } - if(Biomes.swampwoods.isPresent()) { DefaultBiomeList.addBiome("BoP: Swampwoods", Biomes.swampwoods.get(), 3); } - if(Biomes.temperateRainforest.isPresent()) { DefaultBiomeList.addBiome("BoP: Temperate Rainforest", Biomes.temperateRainforest.get(), 3); } - if(Biomes.thicket.isPresent()) { DefaultBiomeList.addBiome("BoP: Thicket", Biomes.thicket.get(), 2); } - if(Biomes.tropicalRainforest.isPresent()) { DefaultBiomeList.addBiome("BoP: Tropical Rainforest", Biomes.tropicalRainforest.get(), 3); } - if(Biomes.tropics.isPresent()) { DefaultBiomeList.addBiome("BoP: Tropics", Biomes.tropics.get(), 3); } - if(Biomes.tundra.isPresent()) { DefaultBiomeList.addBiome("BoP: Tundra", Biomes.tundra.get(), 1); } - if(Biomes.volcano.isPresent()) { DefaultBiomeList.addBiome("BoP: Volcano", Biomes.volcano.get(), 4); } - if(Biomes.wasteland.isPresent()) { DefaultBiomeList.addBiome("BoP: Wasteland", Biomes.wasteland.get(), 4); } - if(Biomes.wetland.isPresent()) { DefaultBiomeList.addBiome("BoP: Wetland", Biomes.wetland.get(), 3); } - if(Biomes.woodland.isPresent()) { DefaultBiomeList.addBiome("BoP: Woodland", Biomes.woodland.get(), 2); } - } //Spawning addSpawnBiome(Biomes.alps); diff --git a/src/minecraft/biomesoplenty/integration/BOPCrossIntegration.java b/src/minecraft/biomesoplenty/integration/BOPCrossIntegration.java index 8f94fa3b6..722611c35 100644 --- a/src/minecraft/biomesoplenty/integration/BOPCrossIntegration.java +++ b/src/minecraft/biomesoplenty/integration/BOPCrossIntegration.java @@ -1,5 +1,11 @@ package biomesoplenty.integration; +import net.minecraft.item.ItemStack; +import ted80.api.DefaultBiomeList; +import thermalexpansion.api.crafting.CraftingManagers; +import thermalexpansion.api.item.ItemRegistry; +import biomesoplenty.api.Biomes; +import biomesoplenty.api.Blocks; import biomesoplenty.configuration.BOPConfiguration; import cpw.mods.fml.common.Loader; @@ -20,6 +26,28 @@ public class BOPCrossIntegration { e.printStackTrace(System.err); } } + + if (Loader.isModLoaded("BWG4")) + { + try { + bwg4Init(); + } + catch (Exception e) { + System.out.println("[BiomesOPlenty] There was an error while integrating Better World Generation 4 with Biomes O' Plenty!"); + e.printStackTrace(System.err); + } + } + + if (Loader.isModLoaded("ThermalExpansion")) + { + try { + thermalExpansionInit(); + } + catch (Exception e) { + System.out.println("[BiomesOPlenty] There was an error while integrating Thermal Expansion with Biomes O' Plenty!"); + e.printStackTrace(System.err); + } + } } private static void forestryInit() @@ -214,4 +242,93 @@ public class BOPCrossIntegration { EnumHumidity.dampBiomeIds.add(BOPConfiguration.swamplandNewID); EnumHumidity.dampBiomeIds.add(BOPConfiguration.jungleNewID); } + + public static void bwg4Init() + { + if(Biomes.alps.isPresent()) { DefaultBiomeList.addBiome("BoP: Alps", Biomes.alps.get(), 1); } + if(Biomes.arctic.isPresent()) { DefaultBiomeList.addBiome("BoP: Arctic", Biomes.arctic.get(), 1); } + if(Biomes.badlands.isPresent()) { DefaultBiomeList.addBiome("BoP: Badlands", Biomes.badlands.get(), 4); } + if(Biomes.bambooForest.isPresent()) { DefaultBiomeList.addBiome("BoP: Bamboo Forest", Biomes.bambooForest.get(), 3); } + if(Biomes.bayou.isPresent()) { DefaultBiomeList.addBiome("BoP: Bayou", Biomes.bayou.get(), 3); } + if(Biomes.birchForest.isPresent()) { DefaultBiomeList.addBiome("BoP: Birch Forest", Biomes.birchForest.get(), 2); } + if(Biomes.bog.isPresent()) { DefaultBiomeList.addBiome("BoP: Bog", Biomes.bog.get(), 3); } + if(Biomes.borealForest.isPresent()) { DefaultBiomeList.addBiome("BoP: Boreal Forest", Biomes.borealForest.get(), 2); } + if(Biomes.canyon.isPresent()) { DefaultBiomeList.addBiome("BoP: Canyon", Biomes.canyon.get(), 4); } + if(Biomes.chaparral.isPresent()) { DefaultBiomeList.addBiome("BoP: Chaparral", Biomes.chaparral.get(), 2); } + if(Biomes.cherryBlossomGrove.isPresent()) { DefaultBiomeList.addBiome("BoP: Cherry Blossom Grove", Biomes.cherryBlossomGrove.get(), 2); } + if(Biomes.coniferousForest.isPresent()) { DefaultBiomeList.addBiome("BoP: Coniferous Forest", Biomes.coniferousForest.get(), 2); } + if(Biomes.crag.isPresent()) { DefaultBiomeList.addBiome("BoP: Crag", Biomes.crag.get(), 2); } + if(Biomes.deadForest.isPresent()) { DefaultBiomeList.addBiome("BoP: Dead Forest", Biomes.deadForest.get(), 2); } + if(Biomes.deadSwamp.isPresent()) { DefaultBiomeList.addBiome("BoP: Dead Swamp", Biomes.deadSwamp.get(), 2); } + if(Biomes.deadlands.isPresent()) { DefaultBiomeList.addBiome("BoP: Deadlands", Biomes.deadlands.get(), 4); } + if(Biomes.deciduousForest.isPresent()) { DefaultBiomeList.addBiome("BoP: Deciduous Forest", Biomes.deciduousForest.get(), 2); } + if(Biomes.drylands.isPresent()) { DefaultBiomeList.addBiome("BoP: Drylands", Biomes.drylands.get(), 4); } + if(Biomes.dunes.isPresent()) { DefaultBiomeList.addBiome("BoP: Dunes", Biomes.dunes.get(), 4); } + if(Biomes.fen.isPresent()) { DefaultBiomeList.addBiome("BoP: Fen", Biomes.fen.get(), 2); } + if(Biomes.field.isPresent()) { DefaultBiomeList.addBiome("BoP: Field", Biomes.field.get(), 2); } + if(Biomes.frostForest.isPresent()) { DefaultBiomeList.addBiome("BoP: Frost Forest", Biomes.frostForest.get(), 1); } + if(Biomes.fungiForest.isPresent()) { DefaultBiomeList.addBiome("BoP: Fungi Forest", Biomes.fungiForest.get(), 3); } + if(Biomes.garden.isPresent()) { DefaultBiomeList.addBiome("BoP: Garden", Biomes.garden.get(), 2); } + if(Biomes.glacier.isPresent()) { DefaultBiomeList.addBiome("BoP: Glacier", Biomes.glacier.get(), 1); } + if(Biomes.grassland.isPresent()) { DefaultBiomeList.addBiome("BoP: Grassland", Biomes.grassland.get(), 2); } + if(Biomes.grove.isPresent()) { DefaultBiomeList.addBiome("BoP: Grove", Biomes.grove.get(), 2); } + if(Biomes.heathland.isPresent()) { DefaultBiomeList.addBiome("BoP: Heathland", Biomes.heathland.get(), 4); } + if(Biomes.highland.isPresent()) { DefaultBiomeList.addBiome("BoP: Highland", Biomes.highland.get(), 2); } + if(Biomes.iceSheet.isPresent()) { DefaultBiomeList.addBiome("BoP: Ice Sheet", Biomes.iceSheet.get(), 1); } + if(Biomes.icyHills.isPresent()) { DefaultBiomeList.addBiome("BoP: Icy Hills", Biomes.icyHills.get(), 1); } + if(Biomes.jadeCliffs.isPresent()) { DefaultBiomeList.addBiome("BoP: Jade Cliffs", Biomes.jadeCliffs.get(), 2); } + if(Biomes.lushDesert.isPresent()) { DefaultBiomeList.addBiome("BoP: Lush Desert", Biomes.lushDesert.get(), 4); } + if(Biomes.lushSwamp.isPresent()) { DefaultBiomeList.addBiome("BoP: Lush Swamp", Biomes.lushSwamp.get(), 3); } + if(Biomes.mangrove.isPresent()) { DefaultBiomeList.addBiome("BoP: Mangrove", Biomes.mangrove.get(), 2); } + if(Biomes.mapleWoods.isPresent()) { DefaultBiomeList.addBiome("BoP: Maple Woods", Biomes.mapleWoods.get(), 2); } + if(Biomes.marsh.isPresent()) { DefaultBiomeList.addBiome("BoP: Marsh", Biomes.marsh.get(), 2); } + if(Biomes.meadow.isPresent()) { DefaultBiomeList.addBiome("BoP: Meadow", Biomes.meadow.get(), 2); } + if(Biomes.mesa.isPresent()) { DefaultBiomeList.addBiome("BoP: Mesa", Biomes.mesa.get(), 4); } + if(Biomes.moor.isPresent()) { DefaultBiomeList.addBiome("BoP: Moor", Biomes.moor.get(), 2); } + if(Biomes.mountain.isPresent()) { DefaultBiomeList.addBiome("BoP: Mountain", Biomes.mountain.get(), 2); } + if(Biomes.mysticGrove.isPresent()) { DefaultBiomeList.addBiome("BoP: Mystic Grove", Biomes.mysticGrove.get(), 3); } + if(Biomes.oasis.isPresent()) { DefaultBiomeList.addBiome("BoP: Oasis", Biomes.oasis.get(), 4); } + if(Biomes.ominousWoods.isPresent()) { DefaultBiomeList.addBiome("BoP: Ominous Woods", Biomes.ominousWoods.get(), 2); } + if(Biomes.orchard.isPresent()) { DefaultBiomeList.addBiome("BoP: Orchard", Biomes.orchard.get(), 2); } + if(Biomes.originValley.isPresent()) { DefaultBiomeList.addBiome("BoP: Origin Valley", Biomes.originValley.get(), 2); } + if(Biomes.outback.isPresent()) { DefaultBiomeList.addBiome("BoP: Outback", Biomes.outback.get(), 4); } + if(Biomes.pasture.isPresent()) { DefaultBiomeList.addBiome("BoP: Pasture", Biomes.pasture.get(), 2); } + if(Biomes.prairie.isPresent()) { DefaultBiomeList.addBiome("BoP: Prairie", Biomes.prairie.get(), 2); } + if(Biomes.quagmire.isPresent()) { DefaultBiomeList.addBiome("BoP: Quagmire", Biomes.quagmire.get(), 4); } + if(Biomes.rainforest.isPresent()) { DefaultBiomeList.addBiome("BoP: Rainforest", Biomes.rainforest.get(), 3); } + if(Biomes.redwoodForest.isPresent()) { DefaultBiomeList.addBiome("BoP: Redwood Forest", Biomes.redwoodForest.get(), 2); } + if(Biomes.sacredSprings.isPresent()) { DefaultBiomeList.addBiome("BoP: Sacred Springs", Biomes.sacredSprings.get(), 3); } + if(Biomes.savanna.isPresent()) { DefaultBiomeList.addBiome("BoP: Savanna", Biomes.savanna.get(), 4); } + if(Biomes.scrubland.isPresent()) { DefaultBiomeList.addBiome("BoP: Scrubland", Biomes.scrubland.get(), 4); } + if(Biomes.seasonalForest.isPresent()) { DefaultBiomeList.addBiome("BoP: Seasonal Forest", Biomes.seasonalForest.get(), 2); } + if(Biomes.shield.isPresent()) { DefaultBiomeList.addBiome("BoP: Shield", Biomes.shield.get(), 2); } + if(Biomes.shrubland.isPresent()) { DefaultBiomeList.addBiome("BoP: Shrubland", Biomes.shrubland.get(), 2); } + if(Biomes.snowyWoods.isPresent()) { DefaultBiomeList.addBiome("BoP: Snowy Woods", Biomes.snowyWoods.get(), 1); } + if(Biomes.spruceWoods.isPresent()) { DefaultBiomeList.addBiome("BoP: Spruce Woods", Biomes.spruceWoods.get(), 2); } + if(Biomes.steppe.isPresent()) { DefaultBiomeList.addBiome("BoP: Steppe", Biomes.steppe.get(), 4); } + if(Biomes.swampwoods.isPresent()) { DefaultBiomeList.addBiome("BoP: Swampwoods", Biomes.swampwoods.get(), 3); } + if(Biomes.temperateRainforest.isPresent()) { DefaultBiomeList.addBiome("BoP: Temperate Rainforest", Biomes.temperateRainforest.get(), 3); } + if(Biomes.thicket.isPresent()) { DefaultBiomeList.addBiome("BoP: Thicket", Biomes.thicket.get(), 2); } + if(Biomes.tropicalRainforest.isPresent()) { DefaultBiomeList.addBiome("BoP: Tropical Rainforest", Biomes.tropicalRainforest.get(), 3); } + if(Biomes.tropics.isPresent()) { DefaultBiomeList.addBiome("BoP: Tropics", Biomes.tropics.get(), 3); } + if(Biomes.tundra.isPresent()) { DefaultBiomeList.addBiome("BoP: Tundra", Biomes.tundra.get(), 1); } + if(Biomes.volcano.isPresent()) { DefaultBiomeList.addBiome("BoP: Volcano", Biomes.volcano.get(), 4); } + if(Biomes.wasteland.isPresent()) { DefaultBiomeList.addBiome("BoP: Wasteland", Biomes.wasteland.get(), 4); } + if(Biomes.wetland.isPresent()) { DefaultBiomeList.addBiome("BoP: Wetland", Biomes.wetland.get(), 3); } + if(Biomes.woodland.isPresent()) { DefaultBiomeList.addBiome("BoP: Woodland", Biomes.woodland.get(), 2); } + } + + public static void thermalExpansionInit() + { + CraftingManagers.sawmillManager.addRecipe(80, new ItemStack(Blocks.logs1.get(), 1, 0), new ItemStack(Blocks.planks.get(), 6, 0), ItemRegistry.getItem("sawdust", 1), 100); + CraftingManagers.sawmillManager.addRecipe(80, new ItemStack(Blocks.logs1.get(), 1, 1), new ItemStack(Blocks.planks.get(), 6, 1), ItemRegistry.getItem("sawdust", 1), 100); + CraftingManagers.sawmillManager.addRecipe(80, new ItemStack(Blocks.logs1.get(), 1, 2), new ItemStack(Blocks.planks.get(), 6, 2), ItemRegistry.getItem("sawdust", 1), 100); + CraftingManagers.sawmillManager.addRecipe(80, new ItemStack(Blocks.logs1.get(), 1, 3), new ItemStack(Blocks.planks.get(), 6, 3), ItemRegistry.getItem("sawdust", 1), 100); + CraftingManagers.sawmillManager.addRecipe(80, new ItemStack(Blocks.logs2.get(), 1, 0), new ItemStack(Blocks.planks.get(), 6, 4), ItemRegistry.getItem("sawdust", 1), 100); + CraftingManagers.sawmillManager.addRecipe(80, new ItemStack(Blocks.logs2.get(), 1, 1), new ItemStack(Blocks.planks.get(), 6, 5), ItemRegistry.getItem("sawdust", 1), 100); + CraftingManagers.sawmillManager.addRecipe(80, new ItemStack(Blocks.logs2.get(), 1, 2), new ItemStack(Blocks.planks.get(), 6, 6), ItemRegistry.getItem("sawdust", 1), 100); + CraftingManagers.sawmillManager.addRecipe(80, new ItemStack(Blocks.logs2.get(), 1, 3), new ItemStack(Blocks.planks.get(), 6, 7), ItemRegistry.getItem("sawdust", 1), 100); + CraftingManagers.sawmillManager.addRecipe(80, new ItemStack(Blocks.logs3.get(), 1, 0), new ItemStack(Blocks.planks.get(), 6, 8), ItemRegistry.getItem("sawdust", 1), 100); + CraftingManagers.sawmillManager.addRecipe(80, new ItemStack(Blocks.logs3.get(), 1, 1), new ItemStack(Blocks.planks.get(), 6, 9), ItemRegistry.getItem("sawdust", 1), 100); + } } diff --git a/src/minecraft/thermalexpansion/api/ThermalExpansionInfo.java b/src/minecraft/thermalexpansion/api/ThermalExpansionInfo.java new file mode 100644 index 000000000..bd01aaf37 --- /dev/null +++ b/src/minecraft/thermalexpansion/api/ThermalExpansionInfo.java @@ -0,0 +1,54 @@ + +package thermalexpansion.api; + +import net.minecraft.block.Block; +import net.minecraft.block.material.Material; +import net.minecraft.item.Item; +import net.minecraft.item.ItemBlock; +import net.minecraft.item.ItemStack; +import net.minecraftforge.liquids.LiquidStack; +import cpw.mods.fml.common.registry.GameRegistry; + +/** + * This class contains some general hooks that can be useful if Thermal Expansion is installed. + */ +public class ThermalExpansionInfo { + + public static ItemStack coal = new ItemStack(Item.coal, 1, 0); + public static ItemStack charcoal = new ItemStack(Item.coal, 1, 1); + + public static int lavaFuelValue = 18000; + + public static int getFuelValue(ItemStack theFuel) { + + if (theFuel == null) { + return 0; + } + if (theFuel.isItemEqual(coal)) { + return 4800; + } + if (theFuel.isItemEqual(charcoal)) { + return 3200; + } + int itemId = theFuel.getItem().itemID; + if (theFuel.getItem() instanceof ItemBlock && Block.blocksList[itemId].blockMaterial == Material.wood) { + return 450; + } + if (itemId == Item.stick.itemID) { + return 150; + } + if (itemId == Block.sapling.blockID) { + return 150; + } + return GameRegistry.getFuelValue(theFuel) * 3 / 2; + } + + public static int getFuelValue(LiquidStack theFuel) { + + if (theFuel.itemID == Block.lavaStill.blockID) { + return lavaFuelValue; + } + return 0; + } + +} diff --git a/src/minecraft/thermalexpansion/api/crafting/CraftingHelpers.java b/src/minecraft/thermalexpansion/api/crafting/CraftingHelpers.java new file mode 100644 index 000000000..aeb10bdb4 --- /dev/null +++ b/src/minecraft/thermalexpansion/api/crafting/CraftingHelpers.java @@ -0,0 +1,106 @@ + +package thermalexpansion.api.crafting; + +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import thermalexpansion.api.item.ItemRegistry; + +/** + * This class adds some basic and fool-proof recipe handlers that can help you out. They will add + * simple recipes that follow the TE defaults - they are not the only way of adding recipes. You can + * also use the more specific recipe functions defined in the Manager interfaces if necessary. Once + * again, only call these during @PostInit or things may not go so rosy. + */ +public class CraftingHelpers { + + private static ItemStack sawdust = ItemRegistry.getItem("sawdust", 1); + private static ItemStack slag = ItemRegistry.getItem("slag", 1); + private static ItemStack slagRich = ItemRegistry.getItem("slagRich", 1); + private static ItemStack fluxSand = new ItemStack(Block.sand); + + /** + * Ore x1 to Dust x2 conversion. 400 MJ. Will return false if recipe already exists. + */ + public static boolean addPulverizerOreToDustRecipe(ItemStack inputOre, ItemStack outputDust) { + + ItemStack ore = inputOre.copy(); + ore.stackSize = 1; + + ItemStack primaryDust = outputDust.copy(); + primaryDust.stackSize = 2; + + return CraftingManagers.pulverizerManager.addRecipe(400, ore, primaryDust, false); + } + + /** + * Ore x1 to Dust x2 conversion, 10% chance of Secondary x1 being generated. 400 MJ. Will return + * false if recipe already exists. + */ + public static boolean addPulverizerOreToDustRecipe(ItemStack inputOre, ItemStack outputDust, ItemStack outputSecondary) { + + ItemStack ore = inputOre.copy(); + ore.stackSize = 1; + + ItemStack primaryDust = outputDust.copy(); + primaryDust.stackSize = 2; + + ItemStack secondary = outputSecondary.copy(); + secondary.stackSize = 1; + + return CraftingManagers.pulverizerManager.addRecipe(400, ore, primaryDust, secondary, 10, false); + } + + /** + * Log x1 to Plank x6 conversion, 100% chance of Sawdust. 80 MJ. Will return false if recipe + * already exists. + */ + public static boolean addSawmillLogToPlankRecipe(ItemStack inputLog, ItemStack outputPlanks) { + + ItemStack log = inputLog.copy(); + log.stackSize = 1; + + ItemStack planks = outputPlanks.copy(); + planks.stackSize = 6; + + return CraftingManagers.sawmillManager.addRecipe(80, log, planks, sawdust, false); + } + + /** + * Dust x2, Sand x1 to Ingot x2, 25% chance of Slag. 80 MJ. Will return false if recipe already + * exists. + */ + public static boolean addSmelterDustToIngotsRecipe(ItemStack inputDust, ItemStack outputIngots) { + + ItemStack dust = inputDust.copy(); + dust.stackSize = 2; + + ItemStack ingots = outputIngots.copy(); + ingots.stackSize = 2; + + return CraftingManagers.smelterManager.addRecipe(80, dust, fluxSand, ingots, slag, 25, false); + } + + /** + * Ore x1, Sand x1 to Ingot x2, 5% chance of Rich Slag. 320 MJ. Also, Ore x1, Rich Slag x1 to + * Ingot x3, 75% chance of Slag. 400 MJ. Will return false if recipe already exists. + */ + public static boolean addSmelterOreToIngotsRecipe(ItemStack inputOre, ItemStack outputIngots) { + + ItemStack ore = inputOre.copy(); + ore.stackSize = 1; + + ItemStack ingots2 = outputIngots.copy(); + ingots2.stackSize = 2; + + ItemStack ingots3 = outputIngots.copy(); + ingots3.stackSize = 3; + + if (!CraftingManagers.smelterManager.addRecipe(320, ore, fluxSand, ingots2, slagRich, 5, false)) { + return false; + } + if (!CraftingManagers.smelterManager.addRecipe(400, ore, slagRich, ingots3, slag, 75, false)) { + return false; + } + return true; + } +} diff --git a/src/minecraft/thermalexpansion/api/crafting/CraftingManagers.java b/src/minecraft/thermalexpansion/api/crafting/CraftingManagers.java new file mode 100644 index 000000000..43d911496 --- /dev/null +++ b/src/minecraft/thermalexpansion/api/crafting/CraftingManagers.java @@ -0,0 +1,46 @@ +/** + * Team CoFH + * + * Thermal Expansion + */ + +package thermalexpansion.api.crafting; + +/** + * Allows access to all of the Thermal Expansion crafting managers. Add your recipes during @PostInit + * or risk a null pointer. :) + */ + +public class CraftingManagers { + + /** + * Allows you to add recipes to the Magma Crucible. See {@link ICrucibleManager} for details. + */ + public static ICrucibleManager crucibleManager; + + /** + * Allows you to add recipes to the Liquid Transposer. See {@link ITransposerManager} for + * details. + */ + public static ITransposerManager transposerManager; + + /** + * Allows you to add recipes to the Powered Furnace. See {@link IFurnaceManager} for details. + */ + public static IFurnaceManager furnaceManager; + + /** + * Allows you to add recipes to the Pulverizer. See {@link IPulverizerManager} for details. + */ + public static IPulverizerManager pulverizerManager; + + /** + * Allows you to add recipes to the Sawmill. See {@link ISawmillManager} for details. + */ + public static ISawmillManager sawmillManager; + + /** + * Allows you to add recipes to the Induction Smelter. See {@link ISmelterManager} for details. + */ + public static ISmelterManager smelterManager; +} diff --git a/src/minecraft/thermalexpansion/api/crafting/ICrucibleManager.java b/src/minecraft/thermalexpansion/api/crafting/ICrucibleManager.java new file mode 100644 index 000000000..552c31b3a --- /dev/null +++ b/src/minecraft/thermalexpansion/api/crafting/ICrucibleManager.java @@ -0,0 +1,39 @@ +/** + * Team CoFH + * + * Thermal Expansion + */ + +package thermalexpansion.api.crafting; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.liquids.LiquidStack; + +/** + * Provides an interface to the recipe manager of the Crucible. Accessible via + * {@link CraftingManagers.crucibleManager} + */ +public interface ICrucibleManager { + + /** + * Add a recipe to the Crucible. + * + * @param energy + * Energy needed to process the item. + * @param input + * ItemStack representing the input item. + * @param output + * LiquidStack representing the output liquid. + * @param overwrite + * Flag to enable recipe overwriting. This will only be allowed if enabled in the + * Thermal Expansion Configuration file and will be logged for information purposes. + */ + public boolean addRecipe(int energy, ItemStack input, LiquidStack output, boolean overwrite); + + public boolean addRecipe(int energy, ItemStack input, LiquidStack output); + + /** + * Access to the full list of recipes. + */ + ICrucibleRecipe[] getRecipeList(); +} diff --git a/src/minecraft/thermalexpansion/api/crafting/ICrucibleRecipe.java b/src/minecraft/thermalexpansion/api/crafting/ICrucibleRecipe.java new file mode 100644 index 000000000..9cc961284 --- /dev/null +++ b/src/minecraft/thermalexpansion/api/crafting/ICrucibleRecipe.java @@ -0,0 +1,19 @@ +/** + * Team CoFH + * + * Thermal Expansion + */ + +package thermalexpansion.api.crafting; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.liquids.LiquidStack; + +public interface ICrucibleRecipe { + + public ItemStack getInput(); + + public LiquidStack getOutput(); + + public int getEnergy(); +} diff --git a/src/minecraft/thermalexpansion/api/crafting/IFurnaceManager.java b/src/minecraft/thermalexpansion/api/crafting/IFurnaceManager.java new file mode 100644 index 000000000..ed2103506 --- /dev/null +++ b/src/minecraft/thermalexpansion/api/crafting/IFurnaceManager.java @@ -0,0 +1,38 @@ +/** + * Team CoFH + * + * Thermal Expansion + */ + +package thermalexpansion.api.crafting; + +import net.minecraft.item.ItemStack; + +/** + * Provides an interface to the recipe manager of the Powered Furnace. Accessible via + * {@link CraftingManagers.FurnaceManager} + */ +public interface IFurnaceManager { + + /** + * Add a recipe to the Powered Furnace. + * + * @param energy + * Energy needed to process the item. + * @param input + * ItemStack representing the input item. + * @param output + * ItemStack representing the output item. + * @param overwrite + * Flag to enable recipe overwriting. This will only be allowed if enabled in the + * Thermal Expansion Configuration file and will be logged for information purposes. + */ + public boolean addRecipe(int energy, ItemStack input, ItemStack output, boolean overwrite); + + public boolean addRecipe(int energy, ItemStack input, ItemStack output); + + /** + * Access to the full list of recipes. + */ + IFurnaceRecipe[] getRecipeList(); +} diff --git a/src/minecraft/thermalexpansion/api/crafting/IFurnaceRecipe.java b/src/minecraft/thermalexpansion/api/crafting/IFurnaceRecipe.java new file mode 100644 index 000000000..10f954c7a --- /dev/null +++ b/src/minecraft/thermalexpansion/api/crafting/IFurnaceRecipe.java @@ -0,0 +1,18 @@ +/** + * Team CoFH + * + * Thermal Expansion + */ + +package thermalexpansion.api.crafting; + +import net.minecraft.item.ItemStack; + +public interface IFurnaceRecipe { + + public ItemStack getInput(); + + public ItemStack getOutput(); + + public int getEnergy(); +} diff --git a/src/minecraft/thermalexpansion/api/crafting/IPulverizerManager.java b/src/minecraft/thermalexpansion/api/crafting/IPulverizerManager.java new file mode 100644 index 000000000..c354ee727 --- /dev/null +++ b/src/minecraft/thermalexpansion/api/crafting/IPulverizerManager.java @@ -0,0 +1,79 @@ +/** + * Team CoFH + * + * Thermal Expansion + */ + +package thermalexpansion.api.crafting; + +import net.minecraft.item.ItemStack; + +/** + * Provides an interface to the recipe manager of the Pulverizer. Accessible via + * {@link CraftingManagers.pulverizerManager} + */ +public interface IPulverizerManager { + + /** + * Add a recipe to the Pulverizer + * + * @param energy + * Energy needed to process the item. + * @param input + * ItemStack representing the input item. + * @param primaryOutput + * ItemStack representing the primary (only) output product. + * @param overwrite + * Flag to enable recipe overwriting. This will only be allowed if enabled in the + * Thermal Expansion Configuration file and will be logged for information purposes. + */ + public boolean addRecipe(int energy, ItemStack input, ItemStack primaryOutput, boolean overwrite); + + public boolean addRecipe(int energy, ItemStack input, ItemStack primaryOutput); + + /** + * Add a recipe to the Pulverizer + * + * @param energy + * Energy needed to process the item. + * @param input + * ItemStack representing the input item. + * @param primaryOutput + * ItemStack representing the primary output product. + * @param secondaryOutput + * ItemStack representing the secondary output product. Product % is taken to be 100. + * @param overwrite + * Flag to enable recipe overwriting. This will only be allowed if enabled in the + * Thermal Expansion Configuration file and will be logged for information purposes. + */ + public boolean addRecipe(int energy, ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput, boolean overwrite); + + public boolean addRecipe(int energy, ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput); + + /** + * Add a recipe to the Pulverizer + * + * @param energy + * Energy needed to process the item. + * @param input + * ItemStack representing the input item. + * @param outputPrimary + * ItemStack representing the primary output product. + * @param outputSecondary + * ItemStack representing the secondary output product. + * @param secondaryChance + * Integer representing % chance (out of 100) of the secondary product being created. + * + @param overwrite + * Flag to enable recipe overwriting. This will only be allowed if enabled in the + * Thermal Expansion Configuration file and will be logged for information purposes. + */ + public boolean addRecipe(int energy, ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput, int secondaryChance, boolean overwrite); + + public boolean addRecipe(int energy, ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput, int secondaryChance); + + /** + * Access to the list of recipes. + */ + IPulverizerRecipe[] getRecipeList(); +} diff --git a/src/minecraft/thermalexpansion/api/crafting/IPulverizerRecipe.java b/src/minecraft/thermalexpansion/api/crafting/IPulverizerRecipe.java new file mode 100644 index 000000000..47979ba51 --- /dev/null +++ b/src/minecraft/thermalexpansion/api/crafting/IPulverizerRecipe.java @@ -0,0 +1,22 @@ +/** + * Team CoFH + * + * Thermal Expansion + */ + +package thermalexpansion.api.crafting; + +import net.minecraft.item.ItemStack; + +public interface IPulverizerRecipe { + + public ItemStack getInput(); + + public ItemStack getPrimaryOutput(); + + public ItemStack getSecondaryOutput(); + + public int getSecondaryOutputChance(); + + public int getEnergy(); +} diff --git a/src/minecraft/thermalexpansion/api/crafting/ISawmillManager.java b/src/minecraft/thermalexpansion/api/crafting/ISawmillManager.java new file mode 100644 index 000000000..dffc8c2d9 --- /dev/null +++ b/src/minecraft/thermalexpansion/api/crafting/ISawmillManager.java @@ -0,0 +1,78 @@ +/** + * Team CoFH + * + * Thermal Expansion + */ + +package thermalexpansion.api.crafting; + +import net.minecraft.item.ItemStack; + +/** + * Provides an interface to the recipe manager of the Sawmill. Accessible via + * {@link CraftingManagers.sawmillManager} + */ +public interface ISawmillManager { + + /** + * Add a recipe to the Sawmill + * + * @param energy + * Energy needed to process the item. + * @param input + * ItemStack representing the input item. + * @param primaryOutput + * ItemStack representing the primary (only) output product. + * @param overwrite + * Flag to enable recipe overwriting. This will only be allowed if enabled in the + * Thermal Expansion Configuration file and will be logged for information purposes. + */ + public boolean addRecipe(int energy, ItemStack input, ItemStack primaryOutput, boolean overwrite); + + public boolean addRecipe(int energy, ItemStack input, ItemStack primaryOutput); + + /** + * Add a recipe to the Sawmill + * + * @param energy + * Energy needed to process the item. + * @param input + * ItemStack representing the input item. + * @param primaryOutput + * ItemStack representing the primary output product. + * @param secondaryOutput + * ItemStack representing the secondary output product. Product % is taken to be 100. + * @param overwrite + * Flag to enable recipe overwriting. This will only be allowed if enabled in the + * Thermal Expansion Configuration file and will be logged for information purposes. + */ + public boolean addRecipe(int energy, ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput, boolean overwrite); + + public boolean addRecipe(int energy, ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput); + + /** + * Add a recipe to the Sawmill + * + * @param energy + * Energy needed to process the item. + * @param input + * ItemStack representing the input item. + * @param outputprimaryOutput + * ItemStack representing the primary output product. + * @param outputsecondaryOutput + * ItemStack representing the secondary output product. + * @param secondaryChance + * Integer representing % chance (out of 100) of the secondary product being created. + * @param overwrite + * Flag to enable recipe overwriting. This will only be allowed if enabled in the + * Thermal Expansion Configuration file and will be logged for information purposes. + */ + public boolean addRecipe(int energy, ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput, int secondaryChance, boolean overwrite); + + public boolean addRecipe(int energy, ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput, int secondaryChance); + + /** + * Access to the list of recipes. + */ + ISawmillRecipe[] getRecipeList(); +} diff --git a/src/minecraft/thermalexpansion/api/crafting/ISawmillRecipe.java b/src/minecraft/thermalexpansion/api/crafting/ISawmillRecipe.java new file mode 100644 index 000000000..3a5b8c43c --- /dev/null +++ b/src/minecraft/thermalexpansion/api/crafting/ISawmillRecipe.java @@ -0,0 +1,22 @@ +/** + * Team CoFH + * + * Thermal Expansion + */ + +package thermalexpansion.api.crafting; + +import net.minecraft.item.ItemStack; + +public interface ISawmillRecipe { + + public ItemStack getInput(); + + public ItemStack getPrimaryOutput(); + + public ItemStack getSecondaryOutput(); + + public int getSecondaryOutputChance(); + + public int getEnergy(); +} diff --git a/src/minecraft/thermalexpansion/api/crafting/ISmelterManager.java b/src/minecraft/thermalexpansion/api/crafting/ISmelterManager.java new file mode 100644 index 000000000..192973a37 --- /dev/null +++ b/src/minecraft/thermalexpansion/api/crafting/ISmelterManager.java @@ -0,0 +1,85 @@ +/** + * Team CoFH + * + * Thermal Expansion + */ + +package thermalexpansion.api.crafting; + +import net.minecraft.item.ItemStack; + +/** + * Provides an interface to the recipe manager of the Induction Smelter. Accessible via + * {@link CraftingManagers.smelterManager} + */ +public interface ISmelterManager { + + /** + * Add a recipe to the Induction Smelter + * + * @param energy + * Energy needed to process the item. + * @param primaryInput + * ItemStack representing the primary input item. + * @param secondaryInput + * ItemStack representing the secondary input item. + * @param primaryOutput + * ItemStack representing the primary (only) output product. + * @param overwrite + * Flag to enable recipe overwriting. This will only be allowed if enabled in the + * Thermal Expansion Configuration file and will be logged for information purposes. + */ + public boolean addRecipe(int energy, ItemStack primaryInput, ItemStack secondaryInput, ItemStack primaryOutput, boolean overwrite); + + public boolean addRecipe(int energy, ItemStack primaryInput, ItemStack secondaryInput, ItemStack primaryOutput); + + /** + * Add a recipe to the Induction Smelter + * + * @param energy + * Energy needed to process the item. + * @param primaryInput + * ItemStack representing the primary input item. + * @param secondaryInput + * ItemStack representing the secondary input item. + * @param primaryOutput + * ItemStack representing the primary output product. + * @param secondaryOutput + * ItemStack representing the secondary output product. Product % is taken to be 100. + * @param overwrite + * Flag to enable recipe overwriting. This will only be allowed if enabled in the + * Thermal Expansion Configuration file and will be logged for information purposes. + */ + public boolean addRecipe(int energy, ItemStack primaryInput, ItemStack secondaryInput, ItemStack primaryOutput, ItemStack secondaryOutput, boolean overwrite); + + public boolean addRecipe(int energy, ItemStack primaryInput, ItemStack secondaryInput, ItemStack primaryOutput, ItemStack secondaryOutput); + + /** + * Add a recipe to the Induction Smelter + * + * @param energy + * Energy needed to process the item. + * @param primaryInput + * ItemStack representing the primary input item. + * @param secondaryInput + * ItemStack representing the secondary input item. + * @param primaryOutput + * ItemStack representing the primary output product. + * @param secondaryOutput + * ItemStack representing the secondary output product. + * @param secondaryChance + * Integer representing % chance (out of 100) of the secondary product being created. + * @param overwrite + * Flag to enable recipe overwriting. This will only be allowed if enabled in the + * Thermal Expansion Configuration file and will be logged for information purposes. + */ + public boolean addRecipe(int energy, ItemStack primaryInput, ItemStack secondaryInput, ItemStack primaryOutput, ItemStack secondaryOutput, int secondaryChance, + boolean overwrite); + + public boolean addRecipe(int energy, ItemStack primaryInput, ItemStack secondaryInput, ItemStack primaryOutput, ItemStack secondaryOutput, int secondaryChance); + + /** + * Access to the list of recipes. + */ + ISmelterRecipe[] getRecipeList(); +} diff --git a/src/minecraft/thermalexpansion/api/crafting/ISmelterRecipe.java b/src/minecraft/thermalexpansion/api/crafting/ISmelterRecipe.java new file mode 100644 index 000000000..92eda1852 --- /dev/null +++ b/src/minecraft/thermalexpansion/api/crafting/ISmelterRecipe.java @@ -0,0 +1,24 @@ +/** + * Team CoFH + * + * Thermal Expansion + */ + +package thermalexpansion.api.crafting; + +import net.minecraft.item.ItemStack; + +public interface ISmelterRecipe { + + public ItemStack getPrimaryInput(); + + public ItemStack getSecondaryInput(); + + public ItemStack getPrimaryOutput(); + + public ItemStack getSecondaryOutput(); + + public int getSecondaryOutputChance(); + + public int getEnergy(); +} diff --git a/src/minecraft/thermalexpansion/api/crafting/ITransposerManager.java b/src/minecraft/thermalexpansion/api/crafting/ITransposerManager.java new file mode 100644 index 000000000..90e8c22b2 --- /dev/null +++ b/src/minecraft/thermalexpansion/api/crafting/ITransposerManager.java @@ -0,0 +1,71 @@ +/** + * Team CoFH + * + * Thermal Expansion + */ + +package thermalexpansion.api.crafting; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.liquids.LiquidStack; + +/** + * Provides an interface to the recipe manager of the Liquid Transposer. Accessible via + * {@link CraftingManagers.transposerManager} + */ +public interface ITransposerManager { + + /** + * Add a recipe to the Liquid Transposer + * + * @param energy + * Energy needed to process the item. + * @param input + * ItemStack representing the input item. + * @param output + * ItemStack representing the output item. + * @param liquid + * LiquidStack representing the required liquid. + * @param reversible + * Flag the recipe as reversible (container can be emptied). + * @param overwrite + * Flag to enable recipe overwriting. This will only be allowed if enabled in the + * Thermal Expansion Configuration file and will be logged for information purposes. + */ + public boolean addFillRecipe(int energy, ItemStack input, ItemStack output, LiquidStack liquid, boolean reversible, boolean overwrite); + + public boolean addFillRecipe(int energy, ItemStack input, ItemStack output, LiquidStack liquid, boolean reversible); + + /** + * Add a recipe to the Liquid Transposer + * + * @param energy + * Energy needed to process the item. + * @param input + * ItemStack representing the input item. + * @param output + * ItemStack representing the output item - this can be NULL if necessary, if the + * recipe is NOT reversible. + * @param liquid + * LiquidStack representing the required liquid. + * @param chance + * Integer representing % chance (out of 100) of receiving the item - liquid will + * always be extracted. If output is NULL, this MUST be set to 0. The recipe will not + * be added otherwise. + * @param reversible + * Flag the recipe as reversible (container can be filled). + * @param overwrite + * Flag to enable recipe overwriting. This will only be allowed if enabled in the + * Thermal Expansion Configuration file and will be logged for information purposes. + */ + public boolean addExtractionRecipe(int energy, ItemStack input, ItemStack output, LiquidStack liquid, int chance, boolean reversible, boolean overwrite); + + public boolean addExtractionRecipe(int energy, ItemStack input, ItemStack output, LiquidStack liquid, int chance, boolean reversible); + + /** + * Access to the list of recipes. + */ + ITransposerRecipe[] getFillRecipeList(); + + ITransposerRecipe[] getExtractionRecipeList(); +} diff --git a/src/minecraft/thermalexpansion/api/crafting/ITransposerRecipe.java b/src/minecraft/thermalexpansion/api/crafting/ITransposerRecipe.java new file mode 100644 index 000000000..8a7e988c0 --- /dev/null +++ b/src/minecraft/thermalexpansion/api/crafting/ITransposerRecipe.java @@ -0,0 +1,23 @@ +/** + * Team CoFH + * + * Thermal Expansion + */ + +package thermalexpansion.api.crafting; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.liquids.LiquidStack; + +public interface ITransposerRecipe { + + public ItemStack getInput(); + + public ItemStack getOutput(); + + public LiquidStack getLiquid(); + + public int getEnergy(); + + public int getChance(); +} diff --git a/src/minecraft/thermalexpansion/api/item/IChargeableItem.java b/src/minecraft/thermalexpansion/api/item/IChargeableItem.java new file mode 100644 index 000000000..65ed04dd5 --- /dev/null +++ b/src/minecraft/thermalexpansion/api/item/IChargeableItem.java @@ -0,0 +1,52 @@ + +package thermalexpansion.api.item; + +import net.minecraft.item.ItemStack; + +/** + * Implement this interface on Item classes that support external manipulation of their internal + * energy storages. This interface does not provide methods for the underlying internal energy + * usage. + */ + +public interface IChargeableItem { + + /** + * Adds energy to an item. Returns the quantity of energy that was accepted. This should always + * return 0 if the item cannot be externally charged. + * + * @param theItem + * ItemStack to be charged. + * @param energy + * Maximum amount of energy to be sent into the item. + * @param doReceive + * If false, the charge will only be simulated. + * @return Amount of energy that was accepted by the item. + */ + public float receiveEnergy(ItemStack theItem, float energy, boolean doReceive); + + /** + * Removes energy from an item. Returns the quantity of energy that was removed. This should + * always return 0 if the item cannot be externally discharged. + * + * @param theItem + * ItemStack to be discharged. + * @param energy + * Maximum amount of energy to be removed from the item. + * @param doTransfer + * If false, the discharge will only be simulated. + * @return Amount of energy that was removed from the item. + */ + public float transferEnergy(ItemStack theItem, float energy, boolean doTransfer); + + /** + * Get the amount of energy currently stored in the item. + */ + public float getEnergyStored(ItemStack theItem); + + /** + * Get the max amount of energy that can be stored in the item. + */ + public float getMaxEnergyStored(ItemStack theItem); + +} diff --git a/src/minecraft/thermalexpansion/api/item/ItemRegistry.java b/src/minecraft/thermalexpansion/api/item/ItemRegistry.java new file mode 100644 index 000000000..e4d212370 --- /dev/null +++ b/src/minecraft/thermalexpansion/api/item/ItemRegistry.java @@ -0,0 +1,123 @@ + +package thermalexpansion.api.item; + +import java.util.Map; +import java.util.TreeMap; + +import net.minecraft.item.ItemStack; + +public final class ItemRegistry { + + private static final Map registry = new TreeMap(); + + /** + * Returns an ItemStack containing the item that corresponds to the provided name. + * + * @param name + * Name of the item. + * @param qty + * Requested quantity of the item. + */ + public static ItemStack getItem(String name, int qty) { + + ItemStack result = registry.get(name); + if (result != null) { + result = result.copy(); + result.stackSize = qty; + } + return result; + } + + /** + * Registers a new item with the ItemRegistry. + * + * @param name + * Name of the item. + * @param item + * ItemStack representing the item. + */ + public static void registerItem(String name, ItemStack item) { + + registry.put(name, item); + } + + /** + * Print a list of all currently registered items to the console. + */ + public static void printItemNames() { + + System.out.println("Printing all registered Thermal Expansion items:"); + for (String itemName : registry.keySet()) { + System.out.println(itemName); + } + } + + // String identifiers for obtaining Thermal Expansion Items: + + // dustIron - Dust obtained by pulverizing Iron Ore. + // dustGold - Dust obtained by pulverizing Gold Ore. + // dustObsidian - Dust obtained by pulverizing Obsidian. + // dustCopper - Dust obtained by pulverizing Copper Ore. + // dustTin - Dust obtained by pulverizing Tin Ore. + // dustSilver - Dust obtained by pulverizing Silver Ore. + // dustLead - Dust obtained by pulverizing Lead Ore. + // dustNickel - Dust obtained by pulverizing Ferrous Ore. + // dustPlatinum - Dust obtained as a secondary output from pulverizing Ferrous Ore (Shiny + // Ingots). + // dustElectrum - Dust obtained by crafting Gold and Silver Dusts together. + // dustInvar - Dust obtained by crafting 2 Iron Dusts and Ferrous Dust. + // dustBronze - Uncraftable + // dustBrass - Uncraftable + + // ingotCopper - Ingot obtained by smelting Copper Dust. + // ingotTin - Ingot obtained by smelting Tin Dust. + // ingotSilver - Ingot obtained by smelting Silver Dust. + // ingotLead - Ingot obtained by smelting Lead Dust. + // ingotNickel - Ingot obtained by smelting Ferrous Dust. + // ingotPlatinum - Ingot obtained by smelting Shiny Dust. + // ingotElectrum - Ingot obtained by smelting Electrum Dust. + // ingotInvar - Ingot obtained by smelting Invar Dust. + + // nuggetCopper - Nugget obtained from Copper Ingots. + // nuggetTin - Nugget obtained from Tin Ingots. + // nuggetSilver - Nugget obtained from Silver Ingots. + // nuggetLead - Nugget obtained from Lead Ingots. + // nuggetNickel - Nugget obtained from Ferrous Ingots. + // nuggetPlatinum - Nugget obtained from Shiny Ingots. + // nuggetElectrum - Nugget obtained from Electrum Ingots. + // nuggetInvar - Nugget obtained from Invar Ingots. + + // crystalSulfur - Sulfur + // crystalNiter - Niter + + // woodchips - Woodchips obtained by putting logs in a Pulverizer. + // sawdust - Sawdust obtained + // through the Sawmill. + // sawdustCompressed - Sawdust compressed into one item. + // slag - Slag obtained in Smelter which can be used to create rockwool. + // slagRich - Rich Slag obtained in Smelter which can be used to boost ore output. + + // pneumaticServo - Used in Thermal Expansion recipes for machines that do not use power. + // powerCoilGold - Used in Thermal Expansion recipes for machines that receive power. + // powerCoilSilver - Used in Thermal Expansion recipes for machines that send power. + // powerCoilElectrum - Used in Thermal Expansion recipes for machines that both send/receive + // power. + + // gearCopper - Copper Gear. + // gearTin - Tin Gear. + // gearInvar - Invar Gear. + + // wrench - Cresent Hammer, rotates and dismantles things. + // multimeter - Multimeter, used to read + // Redstone Energy Conduits and Liquiducts. + + // machineFrame - Used as a crafting recipe in many Thermal Expansion machines. + // energyCellFrameEmpty - Redstone Energy Cell before it has been filled with Liquid Redstone. + // energyCellFrameFull - Redstone Energy Cell after it has been filled with Liquid Redstone, but + // before it can be placed in the world. + // energyConduitEmpty - Redstone Energy Conduit before it is filled with Liquid Redstone. + // tesseractFrameEmpty - Tesseract before it has been filled with Liquid Ender. + // tesseractFrameFull - Tesseract after it has been filled with Liquid Ender, but before it can + // be placed in the world. + +} diff --git a/src/minecraft/thermalexpansion/api/tileentity/IAccessControl.java b/src/minecraft/thermalexpansion/api/tileentity/IAccessControl.java new file mode 100644 index 000000000..aeef665ec --- /dev/null +++ b/src/minecraft/thermalexpansion/api/tileentity/IAccessControl.java @@ -0,0 +1,13 @@ + +package thermalexpansion.api.tileentity; + +public interface IAccessControl { + + public boolean isPublic(); + + public boolean isFriends(); + + public boolean isPrivate(); + + public boolean setAccessMode(byte mode); +} diff --git a/src/minecraft/thermalexpansion/api/tileentity/IRedstoneControl.java b/src/minecraft/thermalexpansion/api/tileentity/IRedstoneControl.java new file mode 100644 index 000000000..ae058b9fa --- /dev/null +++ b/src/minecraft/thermalexpansion/api/tileentity/IRedstoneControl.java @@ -0,0 +1,19 @@ + +package thermalexpansion.api.tileentity; + +public interface IRedstoneControl { + + public boolean getRedstoneDisable(); + + public boolean getRedstoneState(); + + public boolean redstoneControl(); + + public boolean redstoneControlOrDisable(); + + public boolean setRedstoneDisable(boolean disable); + + public boolean setRedstoneState(boolean state); + + public boolean setRedstoneInfo(boolean disable, boolean state); +} diff --git a/src/minecraft/thermalexpansion/api/tileentity/ITesseract.java b/src/minecraft/thermalexpansion/api/tileentity/ITesseract.java new file mode 100644 index 000000000..78425a86a --- /dev/null +++ b/src/minecraft/thermalexpansion/api/tileentity/ITesseract.java @@ -0,0 +1,30 @@ + +package thermalexpansion.api.tileentity; + +import java.util.List; + +import net.minecraft.tileentity.TileEntity; + +/** + * This interface is implemented on Tesseract Tile Entities. + * + * @author King Lemming + * + */ +public interface ITesseract { + + /** + * Returns a list of the connected input Tesseracts as Tile Entities. The list will only contain + * valid inputs; disabled Tesseracts will not be shown. This will allow you to determine where + * they are and what is around them. + */ + public List getValidInputLinks(); + + /** + * Returns a list of the connected output Tesseracts as Tile Entities. The list will only + * contain valid outputs; disabled Tesseracts will not be shown. This will allow you to + * determine where they are and what is around them. + */ + public List getValidOutputLinks(); + +} diff --git a/src/minecraft/thermalexpansion/readme-api.txt b/src/minecraft/thermalexpansion/readme-api.txt new file mode 100644 index 000000000..6df875014 --- /dev/null +++ b/src/minecraft/thermalexpansion/readme-api.txt @@ -0,0 +1,37 @@ +Hi there! Thanks for taking a look at the TE API. Now before you go +integrate TE with your mod (which is awesome btw), please read this. +It'll save us both some grief in the future I promise. + +When the API changes and other mods have directly included parts/all of +it, that's bad. :( Sometimes you have to include a file - if it's an +interface or something. No worries, just please don't include the whole +API. To interface with the crafting handlers, you don't have to include +anything. Here's an example of how to do that: + +if (Loader.isModLoaded("ThermalExpansion")) { + + try { + + + + } catch (Exception e) { + + System.out.println(": Thermal Expansion integration was + unsuccessful - please contact the author of this mod to let them know + that the API may have changed."); + } +} + +Again, that doesn't have to be exactly what you do, but if you follow +these two steps: + +1. Use Loader.isModLoaded +2. Use a try/catch block just to be safe. + +then you will NOT have to actually include the TE API in your zip file, +unless you are directly implementing / testing for an interface. + +This also holds with most other mods as well, so hopefully it may help +you clean up your own zips and allow you to redistribute on your +schedule, not when another mod updates their API. ;) +