OSDN Git Service

修正
authormozipi <mozipi@users.sourceforge.jp>
Sat, 23 Feb 2013 10:10:14 +0000 (19:10 +0900)
committermozipi <mozipi@users.sourceforge.jp>
Sat, 23 Feb 2013 10:10:14 +0000 (19:10 +0900)
42 files changed:
common/pcc/chemicraft/ChemiCraft.java
common/pcc/chemicraft/ChemiCraftAPI.java
common/pcc/chemicraft/ChemiCraftData.java
common/pcc/chemicraft/block/BlockChemicalCombinationTable.java
common/pcc/chemicraft/block/BlockChemicalCraftingTable.java
common/pcc/chemicraft/block/BlockElectrolysisTable.java
common/pcc/chemicraft/block/BlockPyrolysisTable.java
common/pcc/chemicraft/block/BlockToolAndWeaponCraftingTable.java
common/pcc/chemicraft/client/ClientProxy.java
common/pcc/chemicraft/container/ContainerChemicalCombinationTable.java
common/pcc/chemicraft/container/ContainerChemicalCraftingTable.java
common/pcc/chemicraft/container/ContainerElectrolysis.java [deleted file]
common/pcc/chemicraft/container/ContainerElectrolysisTable.java
common/pcc/chemicraft/container/ContainerPyrolysisTable.java
common/pcc/chemicraft/container/ContainerToolAndWeaponCraftingTable.java
common/pcc/chemicraft/debug/CompoundHandlerTest.java
common/pcc/chemicraft/gui/GuiElectrolysisTable.java
common/pcc/chemicraft/inventory/InventoryPyrolysisTableMaterial.java
common/pcc/chemicraft/inventory/InventoryPyrolysisTableResult.java
common/pcc/chemicraft/item/ItemAtoms.java
common/pcc/chemicraft/item/ItemCompounds.java
common/pcc/chemicraft/item/ItemGasCollectingBottle.java
common/pcc/chemicraft/slot/SlotChemicalCombinationTableMaterial.java
common/pcc/chemicraft/slot/SlotPyrolysisTableMaterial.java
common/pcc/chemicraft/slot/SlotPyrolysisTableResult.java
common/pcc/chemicraft/system/ChemiCraftCraftingManager.java
common/pcc/chemicraft/system/CommonProxy.java
common/pcc/chemicraft/system/PacketHandler.java
common/pcc/chemicraft/tileentity/TileEntityElectrolysisTable.java
common/pcc/chemicraft/tileentity/TileEntityPyrolysisTable.java
common/pcc/chemicraft/util/Auxiliary.java
common/pcc/chemicraft/util/CreativeTabAtoms.java [deleted file]
common/pcc/chemicraft/util/MathHelperPlus.java [deleted file]
resources/chemicraft/blocks/cctable.png [deleted file]
resources/chemicraft/guis/ChemicalCombination.png [deleted file]
resources/chemicraft/guis/ElectrolysisTable.png [deleted file]
resources/chemicraft/guis/MaterialCrafting.png [deleted file]
resources/chemicraft/guis/Pyrolysis.png [deleted file]
resources/chemicraft/guis/ToolAndWeaponCrafting.png [deleted file]
resources/chemicraft/items/Atoms.png [deleted file]
resources/chemicraft/items/Compounds.png [deleted file]
resources/chemicraft/items/items.png [deleted file]

index 32dac1c..7b35bd9 100644 (file)
@@ -7,6 +7,7 @@ import net.minecraft.item.Item;
 import net.minecraft.item.ItemStack;
 import net.minecraftforge.common.Configuration;
 import net.minecraftforge.common.Property;
+import net.minecraftforge.oredict.OreDictionary;
 import pcc.chemicraft.block.BlockChemicalCombinationTable;
 import pcc.chemicraft.block.BlockChemicalCraftingTable;
 import pcc.chemicraft.block.BlockElectrolysisTable;
@@ -14,13 +15,18 @@ import pcc.chemicraft.block.BlockPyrolysisTable;
 import pcc.chemicraft.block.BlockToolAndWeaponCraftingTable;
 import pcc.chemicraft.compounds.CompoundDebug;
 import pcc.chemicraft.compounds.CompoundWater;
+import pcc.chemicraft.creativetab.CreativeTabAtomOres;
+import pcc.chemicraft.creativetab.CreativeTabChemiCraft;
 import pcc.chemicraft.debug.CommandDeleteItem;
 import pcc.chemicraft.debug.CommandGenDebugRoom;
 import pcc.chemicraft.debug.CommandSetTile;
 import pcc.chemicraft.item.ItemAtoms;
 import pcc.chemicraft.item.ItemAtomsGrenade;
+import pcc.chemicraft.item.ItemChemiCell;
 import pcc.chemicraft.item.ItemCompounds;
 import pcc.chemicraft.item.ItemGasCollectingBottle;
+import pcc.chemicraft.ore.BlockAtomOres;
+import pcc.chemicraft.ore.ItemAtomOres;
 import pcc.chemicraft.system.CommonProxy;
 import pcc.chemicraft.system.PacketHandler;
 import pcc.chemicraft.tileentity.TileEntityChemicalCombinationTable;
@@ -31,7 +37,6 @@ import pcc.chemicraft.tileentity.TileEntityToolAndWeaponCraftingTable;
 import pcc.chemicraft.util.Auxiliary;
 import pcc.chemicraft.util.Auxiliary.ArrayAuxiliary;
 import pcc.chemicraft.util.Auxiliary.NameAuxiliary;
-import pcc.chemicraft.util.CreativeTabAtoms;
 import pcc.chemicraft.util.NBTRecipeGrenade;
 import cpw.mods.fml.common.Mod;
 import cpw.mods.fml.common.SidedProxy;
@@ -41,7 +46,6 @@ import cpw.mods.fml.common.event.FMLServerStartingEvent;
 import cpw.mods.fml.common.network.NetworkMod;
 import cpw.mods.fml.common.network.NetworkRegistry;
 import cpw.mods.fml.common.registry.GameRegistry;
-
 /**
  * ChemiCraft本体
  * @author P.C.C.
@@ -78,13 +82,14 @@ public class ChemiCraft {
        /**
         * ChemiCraftのProxy.
         */
-       @SidedProxy(clientSide = "chemicraft.client.ClientProxy", serverSide = "chemicraft.system.CommonProxy")
+       @SidedProxy(clientSide = "pcc.chemicraft.client.ClientProxy", serverSide = "pcc.chemicraft.system.CommonProxy")
        public static CommonProxy proxy;
 
        /**
         * ChemiCraftのCreativeTab.
         */
-       public static final CreativeTabs creativeTab = new CreativeTabAtoms("ChemiCraft");
+       public static final CreativeTabs creativeTabChemiCraft = new CreativeTabChemiCraft("ChemiCraft");
+       public static final CreativeTabs creativeTabAtomsOre = new CreativeTabAtomOres("AtomsOre");
 
        /**
         * ItemID.
@@ -93,33 +98,38 @@ public class ChemiCraft {
        public int compoundsID;
        public int gasCollectingBottleID;
        public int atomGrenadeID;
+       public int chemicalCellsID;
 
        /**
         * BlockID.
         */
        public int pyrolysisTableID;
+       public int electrolysisTableID;
        public int chemicalConbinationTableID;
        public int toolAndWeaponCraftingTableID;
        public int chemicalCraftingTableID;
-       public int electrolysisTableID;
+
+       public int[] atomOresID = new int[3];
 
        /**
         * GUIID.
         */
        public int guiPyrolysisTableID;
+       public int guiElectrolysisTableID;
        public int guiChemicalCombinationTableID;
        public int guiToolAndWeaponCraftingTableID;
        public int guiChemicalCraftingTableID;
-       public int guiElectrolysisTableID;
 
        /**
         * Block型変数.
         */
        public Block blockPyrolysisTable;
+       public Block blockElectrolysisTable;
        public Block blockChemicalCombinationTable;
        public Block blockToolAndWeaponCraftingTable;
        public Block blockChemicalCraftingTable;
-       public Block blockElectrolysisTable;
+
+       public Block[] blockAtomOres = new Block[atomOresID.length];
 
        /**
         * Item型変数.
@@ -128,19 +138,23 @@ public class ChemiCraft {
        public Item itemCompounds;
        public Item itemGasCollectingBottle;
        public Item itemAtomGrenade;
+       public Item itemChemicalCells;
 
        /**
         * このmodで使用するTextureのパス.
         */
-       public final String ITEM_ATOMS_TEXTURE = "/chemicraft/items/Atoms.png";
-       public final String ITEM_COMPOUNDS_TEXTURE = "/chemicraft/items/Compounds.png";
-       public final String ITEM_TEXTURE = "/chemicraft/items/items.png";
-       public final String BLOCK_CHEMICALCRAFTING_TABLE_TEXTURE = "/chemicraft/blocks/cctable.png";
-       public final String GUI_PYROLYSIS_TEXTURE = "/chemicraft/guis/Pyrolysis.png";
-       public final String GUI_ELECTROLYSIS_TEXTURE = "/chemicraft/guis/Electrolysis.png";
-       public final String GUI_CHEMICALCOMBINATION_TEXTURE = "/chemicraft/guis/ChemicalCombination.png";
-       public final String GUI_TOOLANDWEAPONCRAFTING_TEXTURE = "/chemicraft/guis/ToolAndWeaponCrafting.png";
-       public final String GUI_CHEMICALCRAFTING_TEXTURE = "/chemicraft/guis/MaterialCrafting.png";
+       public final String ITEM_ATOMS_TEXTURE = "/pcc/chemicraft/items/Atoms.png";
+       public final String ITEM_COMPOUNDS_TEXTURE = "/pcc/chemicraft/items/Compounds.png";
+       public final String ITEM_VEGETABLES_TEXTURE = "/pcc/chemicraft/items/Vegetables.png";
+       public final String ITEM_TEXTURE = "/pcc/chemicraft/items/items.png";
+       public final String BLOCK_CHEMICAL_CRAFTING_TABLE_TEXTURE = "/pcc/chemicraft/blocks/cctable.png";
+       public final String BLOCK_ATOMS_ORE_TEXTURE = "/pcc/chemicraft/blocks/AtomsOre.png";
+       public final String BLOCK_VEGETABLES_TEXTURE = "/pcc/chemicraft/blocks/Vegetables.png";
+       public final String GUI_PYROLYSIS_TEXTURE = "/pcc/chemicraft/guis/Pyrolysis.png";
+       public final String GUI_ELECTROLYSIS_TEXTURE = "/pcc/chemicraft/guis/Electrolysis.png";
+       public final String GUI_CHEMICALCOMBINATION_TEXTURE = "/pcc/chemicraft/guis/ChemicalCombination.png";
+       public final String GUI_TOOLANDWEAPONCRAFTING_TEXTURE = "/pcc/chemicraft/guis/ToolAndWeaponCrafting.png";
+       public final String GUI_CHEMICALCRAFTING_TEXTURE = "/pcc/chemicraft/guis/MaterialCrafting.png";
 
        /**
         * このmodに必要な補助クラスのインスタンス.
@@ -149,7 +163,7 @@ public class ChemiCraft {
        public NameAuxiliary nameAuxiliary = new NameAuxiliary();
        public ArrayAuxiliary arrayAuxiliary = new ArrayAuxiliary();
 
-       private ChemiCraftAPI api = ChemiCraftAPI.getInstance();
+       private ChemiCraftAPI api = ChemiCraftAPI.instance();
        private ChemiCraftData chemicalData = new ChemiCraftData();
 
        @Mod.PreInit
@@ -158,37 +172,49 @@ public class ChemiCraft {
                cfg.load();
 
                Property pyrolysisTableIDProp = cfg.getBlock("PyrolysisTable", 2400);
-               Property chemicalCombinationTableIDProp = cfg.getBlock("ChemicalCombinationID", 2401);
-               Property toolAndWeaponCraftingTableIDProp = cfg.getBlock("ToolAndWeaponCraftingTableID", 2402);
-               Property chemicalCraftingTableIDProp = cfg.getBlock("ChemicalCraftingTableID", 2403);
-               Property electrolysisTableIDProp = cfg.getBlock("ElectrolysisTableID", 2404);
+               Property electrolysisTableIDProp = cfg.getBlock("ElectrolysisTable", 2401);
+               Property chemicalCombinationTableIDProp = cfg.getBlock("ChemicalCombinationID", 2402);
+               Property toolAndWeaponCraftingTableIDProp = cfg.getBlock("ToolAndWeaponCraftingTableID", 2403);
+               Property chemicalCraftingTableIDProp = cfg.getBlock("ChemicalCraftingTableID", 2404);
+
+               Property[] atomOresIDProp = new Property[this.atomOresID.length];
+               for (int i = 0; i < atomOresIDProp.length; i++) {
+                       atomOresIDProp[i] = cfg.getBlock("AtomsOreID:" + i, 2500 + i);
+               }
 
                Property atomsIDProp = cfg.getItem("AtomsID", 25000);
                Property compoundsIDProp = cfg.getItem("CompoundsID", 25001);
                Property gasCollectingBottleIDProp = cfg.getItem("gasCollectingBottleID", 25002);
                Property atomGrenadeIDProp = cfg.getItem("AtomGrenadeID", 25003);
+               Property chemicalCellsIDProp = cfg.getItem("ChemicalCellID", 25004);
 
                Property guiPyrolysisTableIDProp = cfg.get("GUI", "GUIPyrolysisID", 1000);
-               Property guiChemicalCombinationTableIDProp = cfg.get("GUI", "GUIChemicalCombinationTableID", 1001);
-               Property guiToolAndWeaponCraftingTableIDProp = cfg.get("GUI", "GUIToolAndWeaponCraftingTableID", 1002);
-               Property guiChemicalCraftingTableIDProp = cfg.get("GUI", "GUIChemicalCraftingTableID", 1003);
-               Property guiElectrolysisTableIDProp = cfg.get("GUI", "GUIElectrolysisTableID", 1004);
+               Property guiElectrolysisTableIDProp = cfg.get("GUI", "GUIElectrolysisTableIDProp", 1001);
+               Property guiChemicalCombinationTableIDProp = cfg.get("GUI", "GUIChemicalCombinationTableID", 1002);
+               Property guiToolAndWeaponCraftingTableIDProp = cfg.get("GUI", "GUIToolAndWeaponCraftingTableID", 1003);
+               Property guiChemicalCraftingTableIDProp = cfg.get("GUI", "GUIChemicalCraftingTableID", 1004);
 
 
                this.pyrolysisTableID = pyrolysisTableIDProp.getInt();
+               this.electrolysisTableID = electrolysisTableIDProp.getInt();
                this.chemicalConbinationTableID = chemicalCombinationTableIDProp.getInt();
                this.toolAndWeaponCraftingTableID = toolAndWeaponCraftingTableIDProp.getInt();
                this.chemicalCraftingTableID = chemicalCraftingTableIDProp.getInt();
-               this.electrolysisTableID = electrolysisTableIDProp.getInt();
+               for (int i = 0; i < atomOresID.length; i++) {
+                       this.atomOresID[i] = atomOresIDProp[i].getInt();
+               }
+
                this.atomsID = atomsIDProp.getInt();
                this.compoundsID = compoundsIDProp.getInt();
                this.gasCollectingBottleID = gasCollectingBottleIDProp.getInt();
                this.atomGrenadeID = atomGrenadeIDProp.getInt();
+               this.chemicalCellsID = chemicalCellsIDProp.getInt();
+
                this.guiPyrolysisTableID = guiPyrolysisTableIDProp.getInt();
+               this.guiElectrolysisTableID = guiElectrolysisTableIDProp.getInt();
                this.guiChemicalCombinationTableID = guiChemicalCombinationTableIDProp.getInt();
                this.guiToolAndWeaponCraftingTableID = guiToolAndWeaponCraftingTableIDProp.getInt();
                this.guiChemicalCraftingTableID = guiChemicalCraftingTableIDProp.getInt();
-               this.guiElectrolysisTableID = guiElectrolysisTableIDProp.getInt();
 
                cfg.save();
        }
@@ -215,32 +241,43 @@ public class ChemiCraft {
                                setResistance(0.0F).
                                setStepSound(Block.soundStoneFootstep).
                                setBlockName("PyrolysisTable");
-               this.blockChemicalCombinationTable = new BlockChemicalCombinationTable(this.chemicalConbinationTableID, 0, Material.ground).
+               this.blockElectrolysisTable = new BlockElectrolysisTable(this.electrolysisTableID, 1, Material.ground).
                                setHardness(2.0F).
                                setResistance(0.0F).
                                setStepSound(Block.soundStoneFootstep).
-                               setBlockName("ChemicalCombinationTable");
-               this.blockToolAndWeaponCraftingTable = new BlockToolAndWeaponCraftingTable(this.toolAndWeaponCraftingTableID, 0, Material.ground).
+                               setBlockName("ElectrolysisTable");
+               this.blockChemicalCombinationTable = new BlockChemicalCombinationTable(this.chemicalConbinationTableID, 2, Material.ground).
                                setHardness(2.0F).
                                setResistance(0.0F).
                                setStepSound(Block.soundStoneFootstep).
-                               setBlockName("ToolAndWeaponCraftingTable");
-               this.blockChemicalCraftingTable = new BlockChemicalCraftingTable(this.chemicalCraftingTableID, 0, Material.ground).
+                               setBlockName("ChemicalCombinationTable");
+               this.blockToolAndWeaponCraftingTable = new BlockToolAndWeaponCraftingTable(this.toolAndWeaponCraftingTableID, 3, Material.ground).
                                setHardness(2.0F).
                                setResistance(0.0F).
                                setStepSound(Block.soundStoneFootstep).
-                               setBlockName("ChemicalCraftingTable");
-               this.blockElectrolysisTable = new BlockElectrolysisTable(this.electrolysisTableID, 0, Material.ground).
+                               setBlockName("ToolAndWeaponCraftingTable");
+               this.blockChemicalCraftingTable = new BlockChemicalCraftingTable(this.chemicalCraftingTableID, 4, Material.ground).
                                setHardness(2.0F).
                                setResistance(0.0F).
                                setStepSound(Block.soundStoneFootstep).
-                               setBlockName("ElectrolysisTable");
+                               setBlockName("ChemicalCraftingTable");
+
+               for (int i = 0; i < blockAtomOres.length; i++)
+               {
+                       this.blockAtomOres[i] = new BlockAtomOres(this.atomOresID[i]).
+                                       setHardness(3.0F).
+                                       setResistance(0.0F).
+                                       setStepSound(Block.soundStoneFootstep).
+                                       setBlockName("AtomsOre" + i);
+                       GameRegistry.registerBlock(blockAtomOres[i], ItemAtomOres.class, "AtomsOre" + i);
+               }
 
                // Itemを追加します
                this.itemAtoms = new ItemAtoms(this.atomsID).setItemName("atoms");
                this.itemCompounds = new ItemCompounds(this.compoundsID).setItemName("compounds");
                this.itemGasCollectingBottle = new ItemGasCollectingBottle(this.gasCollectingBottleID).setItemName("gasCollectingBottle").setIconIndex(0);
                this.itemAtomGrenade = new ItemAtomsGrenade(this.atomGrenadeID).setItemName("grenade").setIconIndex(1);
+               this.itemChemicalCells = new ItemChemiCell(this.chemicalCellsID).setItemName("chemiCell");
 
                // BlockをMinecraftに登録します
                GameRegistry.registerBlock(this.blockPyrolysisTable, "BlockPyrolysisTable");
@@ -267,7 +304,7 @@ public class ChemiCraft {
                this.nameAuxiliary.addName(this.itemGasCollectingBottle, "GasCollectingBottle");
                this.nameAuxiliary.addName(this.itemGasCollectingBottle, "ja_JP", "集気瓶");
                this.nameAuxiliary.addName(this.itemAtomGrenade, "AtomGrenade");
-               this.nameAuxiliary.addName(this.itemAtomGrenade, "元素手榴弾");
+               this.nameAuxiliary.addName(this.itemAtomGrenade, "ja_JP", "元素手榴弾");
 
                // TileEntityを追加します
                GameRegistry.registerTileEntity(TileEntityPyrolysisTable.class, "TileEntityPyrolysisTable");
@@ -316,20 +353,93 @@ public class ChemiCraft {
                        Character.valueOf('A'), new ItemStack(this.itemAtoms, 1, 0),
                });
 
-               // 化合物を追加します
-               api.addLangCompound("ja_JP", "CarbonMonoxide", "一酸化炭素");
-               api.addLangCompound("ja_JP", "CarbonDioxide", "二酸化炭素");
-               api.addLangCompound("ja_JP", "Water", "水");
-
+               //電池を追加します
+               api.addChemicalCell(itemChemicalCells, "ChemicalCell", 1000);
+               api.addChemicalCellLanguage("ChemicalCell", "ja_JP", "化学電池");
+
+               //鉱石を追加します
+
+               // リチウム
+               api.addAtomOres("Petalite", new String[]{"Li", "Al", "Si", "O"}, new Integer[]{1, 1, 4, 10}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // LiAlSi4O10
+               api.addAtomOresLanguage("Petalite", "ペタル石", "ja_JP");
+               api.addAtomOres("Spodumene", new String[]{"Li", "Al", "Si", "O"}, new Integer[]{1, 1, 2, 6}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // LiAlSi2O6
+               api.addAtomOresLanguage("Spodumene", "リチア輝石", "ja_JP");
+
+               // ベリリウム
+               api.addAtomOres("Beryl", new String[]{"Be", "Al", "Si", "O"}, new Integer[]{3, 2, 6, 18}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // Be3Al2Si6O18
+               api.addAtomOresLanguage("Beryl", "緑柱石", "ja_JP");
+               api.addAtomOres("Chrysoberyl", new String[]{"Be", "Al", "O"}, new Integer[]{1, 2, 4}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // BeAl2O4
+               api.addAtomOresLanguage("Chrysoberyl", "金緑石", "ja_JP");
+
+               // ホウ素
+               api.addAtomOres("Ulexite", new String[]{"Na", "Ca", "B", "O"}, new Integer[]{1, 1, 5, 6}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50);   // NaCaB5O6(OH)6・5H2O
+               api.addAtomOresLanguage("Ulexite", "ウレキサイト", "ja_JP");
+
+               // フッ素
+               api.addAtomOres("Fluorite", new String[]{"Ca", "F"}, new Integer[]{1, 2}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // CaF2
+               api.addAtomOresLanguage("Fluorite", "蛍石", "ja_JP");
+               api.addAtomOres("Cryolite", new String[]{"Na", "Al", "F"}, new Integer[]{3, 1, 6}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // Na3AlF6
+               api.addAtomOresLanguage("Cryolite", "氷晶石", "ja_JP");
+
+               // ナトリウム
+               api.addAtomOres("RockSalt", new String[]{"Na", "Cl"}, new Integer[]{1, 1}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // NaCl
+               api.addAtomOresLanguage("RockSalt", "岩塩", "ja_JP");
+
+               // マグネシウム
+               api.addAtomOres("Dolomite", new String[]{"Ca", "Mg"}, new Integer[]{1, 1}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // CaMg(CO3)2
+               api.addAtomOresLanguage("Dolomite", "苦灰石", "ja_JP");
+               api.addAtomOres("Magnesite", new String[]{"Mg", "C", "O"}, new Integer[]{1, 1, 3}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // MgCO3
+               api.addAtomOresLanguage("Magnesite", "菱苦土石", "ja_JP");
+
+               // アルミニウム
+               api.addAtomOres("Gibbsite", new String[]{"Al"}, new Integer[]{3}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // Al(OH)3
+               api.addAtomOresLanguage("Gibbsite", "ギブス石", "ja_JP");
+               api.addAtomOres("Ruby", new String[]{"Al", "O"}, new Integer[]{2, 3}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // Al2O3
+               api.addAtomOresLanguage("Ruby", "ルビー", "ja_JP");
+               api.addAtomOres("Sapphire", new String[]{"Al", "O"}, new Integer[]{2, 3}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // Al2O3
+               api.addAtomOresLanguage("Sapphire", "サファイア", "ja_JP");
+
+               // ケイ素
+               api.addAtomOres("Quartz", new String[]{"Si", "O"}, new Integer[]{1, 2}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // SiO2
+               api.addAtomOresLanguage("Quartz", "石英", "ja_JP");
+
+               // リン
+               api.addAtomOres("Fluorapatite", new String[]{"Ca"}, new Integer[]{5}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // Ca5(PO4)3F
+               api.addAtomOresLanguage("Fluorapatite", "フッ素リン灰石", "ja_JP");
+               api.addAtomOres("Chlorapatite", new String[]{"Ca"}, new Integer[]{5}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // Ca5(PO4)3Cl
+               api.addAtomOresLanguage("Chlorapatite", "塩素燐灰石", "ja_JP");
+               api.addAtomOres("Hydroxylapatite", new String[]{"Ca"}, new Integer[]{5}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // Ca5(PO4)3(OH)
+               api.addAtomOresLanguage("Hydroxylapatite", "水酸燐灰石", "ja_JP");
+
+               // カリウム
+               api.addAtomOres("Sylvite", new String[]{"K", "Cl"}, new Integer[]{1, 1}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // KCl
+               api.addAtomOresLanguage("Sylvite", "カリ岩塩", "ja_JP");
+
+               // カルシウム
+               api.addAtomOres("Calcite", new String[]{"Ca", "C", "O"}, new Integer[]{1, 1, 3}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // CaCO3
+               api.addAtomOresLanguage("Calcite", "方解石", "ja_JP");
+
+               // api.addAtomOres("元素名(英)", new String[]{"元素"}, new Integer[]{<数>}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // 化学式
+               // api.addAtomOresLanguage("元素名(英)", "元素名(他国語)", "言語");
+
+               //化合物を追加します
+               this.api.addCompound("ja_JP", "ChlorousAcid", "亜塩素酸");
+               this.api.addCompound("ja_JP", "CarbonMonoxide", "一酸化炭素");
+               this.api.addCompound("ja_JP", "CarbonDioxide", "二酸化炭素");
+               this.api.addCompound("ja_JP", "Water", "水");
+               this.api.addCompound("ja_JP", "SodiumChloride", "塩化ナトリウム");
+               this.api.addCompound("ja_JP", "SodiumBicarbonate", "重曹");
 
                //化合物のHandlerを設定します
-               api.settingCompoundHandler("Water", new CompoundWater());
+               this.api.settingCompoundHandler("Water", new CompoundWater());
 
                //化合物のレシピを追加します
-               api.addChemicalCombinationRecipe(new String[]{"H", "O"}, new Integer[]{2, 1}, new ItemStack(this.itemCompounds, 1, api.getCompound("Water")));
+               this.api.addChemicalCombinationRecipe(new String[]{"Na", "O", "H"}, new Integer[]{1, 1, 1}, new ItemStack(this.itemCompounds, 1, this.api.getCompound("SodiumChloride")));
+               this.api.addChemicalCombinationRecipe(new String[]{"H", "O", "Cl"}, new Integer[]{1, 2, 1}, new ItemStack(this.itemCompounds, 1, this.api.getCompound("ChlorousAcid")));
+               this.api.addChemicalCombinationRecipe(new String[]{"H", "O"}, new Integer[]{2, 1}, new ItemStack(this.itemCompounds, 1, this.api.getCompound("Water")));
 
                //手榴弾の追加
-               api.addMaterialRecipe(new ItemStack[] {
+               this.api.addMaterialRecipe(new ItemStack[] {
                                null,
                                new ItemStack(Block.stone),
                                null,
@@ -344,38 +454,71 @@ public class ChemiCraft {
                new NBTRecipeGrenade()
                                );
 
-               api.addDecompositionRecipe(new ItemStack(Item.potion, 1, 0),
-                               new int[] {ChemiCraftData.HYDROGEN, ChemiCraftData.OXYGEN},
-                               new int[] {2, 1});
+               this.api.addDecompositionRecipe(new ItemStack(Item.potion, 1, 0),
+                               new Integer[] {ChemiCraftData.HYDROGEN, ChemiCraftData.OXYGEN},
+                               new Integer[] {2, 1});
 
-               api.addDecompositionRecipe(new ItemStack(this.itemCompounds, 1, api.getCompound("Water")),
-                               new int[] {ChemiCraftData.HYDROGEN, ChemiCraftData.OXYGEN},
-                               new int[] {2, 1});
+               this.api.addDecompositionRecipe(new ItemStack(this.itemCompounds, 1, this.api.getCompound("Water")),
+                               new Integer[] {ChemiCraftData.HYDROGEN, ChemiCraftData.OXYGEN},
+                               new Integer[] {2, 1});
 
-               api.addDecompositionFuel(new ItemStack(Item.coal), 2000*8);
+               for (int i = 0; i < api.getAtomOresName().sizeKeysList(); i++){
+                       this.api.addDecompositionRecipe(new ItemStack(this.blockAtomOres[i / 16], 1, i - i / 16 * 16),
+                                       api.getAtomOresAtoms().get(api.getAtomOresName().getKeyList(i)),
+                                       api.getAtomOresAmounts().get(api.getAtomOresName().getKeyList(i)));
+               }
+
+               this.api.addDecompositionFuel(new ItemStack(Item.coal), 2000*8);
        }
 
        private void apiProcessing(final FMLPostInitializationEvent event) {
                // API用の処理
-               this.nameAuxiliary.addName(itemCompounds, api.getInstance().getCompoundsName().toArray());
-               for (int i = 0; i < api.getCompoundsLang().size(); i++) {
-                       this.nameAuxiliary.addName(itemCompounds, api.getCompoundsLang().get(i), api.getInstance().getCompoundsLangName().toArray());
+               for (int i = 0; i < api.getAtomOresName().sizeKeysList(); i++)
+               {
+                       for (int j = 0; j < api.getAtomOresName().sizeElementsList(api.getAtomOresName().getKeyList(i)); j++)
+                       {
+                               this.nameAuxiliary.addName(new ItemStack(blockAtomOres[i / 16], 0, i - i / 16 * 16), api.getAtomOresLanguage().get(api.getAtomOresName().getKeyList(i), j), api.getAtomOresName().get(api.getAtomOresName().getKeyList(i), j));
+                               OreDictionary.registerOre("ore" + api.getAtomOresName().getKeyList(i), new ItemStack(blockAtomOres[i / 16], 1, i - i / 16 * 16));
+                       }
+               }
+
+               for (int i = 0; i < api.getAtomOres().size(); i++)
+               {
+                       GameRegistry.registerWorldGenerator(api.getAtomOres().get(i));
+               }
+
+               for (int i = 0; i < api.getChemicalCellsName().sizeKeysList(); i++)
+               {
+                       for (int j = 0; j < api.getChemicalCellsName().sizeElementsList(api.getChemicalCellsName().getKeyList(i)); j++)
+                       {
+                               this.nameAuxiliary.addName(new ItemStack(itemChemicalCells, 0, i), api.getChemicalCellsLanguage().get(api.getChemicalCellsName().getKeyList(i), j), api.getChemicalCellsName().get(api.getChemicalCellsName().getKeyList(i), j));
+                       }
                }
+
+               for (int i = 0; i < api.getCompoundsName().sizeKeysList(); i++)
+               {
+                       for (int j = 0; j < api.getCompoundsName().sizeElementsList(api.getCompoundsName().getKeyList(i)); j++)
+                       {
+                               this.nameAuxiliary.addName(new ItemStack(itemCompounds, 0, i), api.getCompoundsLang().get(api.getCompoundsName().getKeyList(i), j), api.getCompoundsName().get(api.getCompoundsName().getKeyList(i), j));
+                       }
+               }
+
        }
 
        private void debug(final FMLPostInitializationEvent event) {
                //DebugTickingの追加
                this.proxy.registerTickHandler();
-               api.addCompound("Debug");
+               this.api.addCompound("Debug");
                this.api.settingCompoundHandler("Debug", new CompoundDebug());
 
                /*
                 * TWDebug
                 */
-               api.addToolAndWeaponRecipe(new ItemStack[] {
+               this.api.addToolAndWeaponRecipe(new ItemStack[] {
                                new ItemStack(Block.stone, 1, 1)
                },
                new ItemStack(Block.dirt, 1, 0));
+
        }
 
 }
index 2110f73..821bb97 100644 (file)
@@ -3,13 +3,17 @@ package pcc.chemicraft;
 import java.util.ArrayList;
 import java.util.HashMap;
 
+import net.minecraft.item.Item;
 import net.minecraft.item.ItemStack;
+import pcc.chemicraft.gen.WorldGenAtomsOre;
 import pcc.chemicraft.system.ChemiCraftCraftingManager;
 import pcc.chemicraft.tileentity.TileEntityPyrolysisTable;
 import pcc.chemicraft.util.ChemicalNBTRecipe;
 import pcc.chemicraft.util.ICompoundHandler;
+import pcc.chemicraft.util.ListHash;
 import pcc.chemicraft.util.MaterialRecipe;
 
+
 /**
  * ChemiCraftのAPI
  * 基本的にAddonはこのクラスのインスタンスを使う
@@ -24,46 +28,56 @@ public class ChemiCraftAPI {
        private static ChemiCraftAPI instance = new ChemiCraftAPI();
 
 
+       public static ChemiCraftAPI instance(){
+               return instance;
+       }
+
+
        /**
-        * List of compounds names.
+        * 鉱石別元素数リスト
         */
-       private ArrayList<String> compoundsNameList = new ArrayList<String>();
+       private HashMap<String, Integer[]> atomOresAmountsHash = new HashMap<String, Integer[]>();
 
 
        /**
-        * List of compounds names(Some kind of language).
+        * 鉱石別元素リスト
         */
-       private ArrayList<String> compoundsLangNameList = new ArrayList<String>();
+       private HashMap<String, Integer[]> atomOresAtomsHash = new HashMap<String, Integer[]>();
 
 
        /**
-        * List of compounds the language names.
+        * 鉱石の言語リスト
         */
-       private ArrayList<String> compoundsLangList = new ArrayList<String>();
+       private ListHash<String, String> atomOresLangListHash = new ListHash<String, String>();
 
 
        /**
-        * List of compounds handlers.
+        * 鉱石リスト
         */
-       private ArrayList<ICompoundHandler> compoundHandlers = new ArrayList<ICompoundHandler>();
+       private ArrayList<WorldGenAtomsOre> atomOresList = new ArrayList<WorldGenAtomsOre>();
 
 
        /**
-        * 化合物の文字列をダメージ値に変換します。
+        * 鉱石名リスト
         */
-       private HashMap<String, Integer> compoundHash = new HashMap<String, Integer>();
+       private ListHash<String, String> atomOresNameListHash = new ListHash<String, String>();
+
 
 
        /**
-        * List of item name of handler to compounds.
+        * 電池言語リスト
         */
-       private ArrayList<String> compoundHandlerItemNames = new ArrayList<String>();
+       private ListHash<String, String> chemicalCellsLangListHash = new ListHash<String, String>();
 
 
        /**
-        * 化合台の原子の種類のリスト
+        * 電池名リスト
         */
-       private ArrayList<String[]> chemicalCombinationAtoms = new ArrayList<String[]>();
+       private ListHash<String, String> chemicalCellsNameListHash = new ListHash<String, String>();
+
+
+       private HashMap<ItemStack, Integer> chemicalCellsFuelList = new HashMap<ItemStack, Integer>();
+
 
 
        /**
@@ -73,15 +87,15 @@ public class ChemiCraftAPI {
 
 
        /**
-        * 化合台の結果のリスト
+        * 化合台の原子の種類のリスト
         */
-       private ArrayList<ItemStack> chemicalCombinationResult = new ArrayList<ItemStack>();
+       private ArrayList<String[]> chemicalCombinationAtoms = new ArrayList<String[]>();
 
 
        /**
-        * 素材製作台のレシピクラス
+        * 化合台の結果のリスト
         */
-       private ArrayList<MaterialRecipe> materialRecipe = new ArrayList<MaterialRecipe>();
+       private ArrayList<ItemStack> chemicalCombinationResult = new ArrayList<ItemStack>();
 
 
        /**
@@ -91,6 +105,43 @@ public class ChemiCraftAPI {
 
 
        /**
+        * List of item name of handler to compounds.
+        */
+       private ArrayList<String> compoundHandlerItemNames = new ArrayList<String>();
+
+
+       /**
+        * List of compounds handlers.
+        */
+       private ArrayList<ICompoundHandler> compoundHandlers = new ArrayList<ICompoundHandler>();
+
+
+       /**
+        * 化合物の文字列をダメージ値に変換します。
+        */
+       private HashMap<String, Integer> compoundHash = new HashMap<String, Integer>();
+
+
+       /**
+        * List of compounds the language names.
+        */
+       private ListHash<String, String> compoundsLangListHash = new ListHash<String, String>();
+
+
+       /**
+        * List of compounds names.
+        */
+       private ListHash<String, String> compoundsNameListHash = new ListHash<String, String>();
+
+
+
+       /**
+        * 素材製作台のレシピクラス
+        */
+       private ArrayList<MaterialRecipe> materialRecipe = new ArrayList<MaterialRecipe>();
+
+
+       /**
         * ツール&武器作成台の素材一覧のリスト
         */
        private ArrayList<ItemStack[]> toolAndWeaponMaterials = new ArrayList<ItemStack[]>();
@@ -102,6 +153,7 @@ public class ChemiCraftAPI {
        private ArrayList<ItemStack> toolAndWeaponResult = new ArrayList<ItemStack>();
 
 
+
        /**
         * ツール&武器作成台の不定形であるか
         */
@@ -110,48 +162,62 @@ public class ChemiCraftAPI {
 
 
        /**
-        * add compound.
-        * @param name compound name.
+        * 鉱石を追加します
+        * @param par1Name 鉱石名
+        * @param par2Atoms 元素
+        * @param par3Amounts 元素数
+        * @param par4Id ID
+        * @param par5Size 量
+        * @param par6Frequency 頻度
+        * @param par7PosY Y座標
         */
-       public void addCompound(String name){
-               addLangCompound("", name, "");
+       public void addAtomOres(String par1Name, Integer[] par2Atoms, Integer[] par3Amounts, int par4Id, int par5Size, int par6Frequency, int par7PosY){
+               atomOresList.add(new WorldGenAtomsOre(par4Id, getAtomOresMetaOfLastIndex(), par5Size, par6Frequency, par7PosY));
+               atomOresAtomsHash.put(par1Name, par2Atoms);
+               atomOresAmountsHash.put(par1Name, par3Amounts);
+               addAtomOresLanguage(par1Name, par1Name, "en_US");
+       }
+
+
+
+       public void addAtomOres(String par1Name, String[] par2Atoms, Integer[] par3Amounts, int par4Id, int par5Size, int par6Frequency, int par7PosY){
+               addAtomOres(par1Name, ChemiCraftData.toAtoms(par2Atoms), par3Amounts, par7PosY, par7PosY, par7PosY, par7PosY);
        }
 
 
 
        /**
-        * add compound corresponding to the language.
-        * @param lang Language to the corresponding
-        * @param englishName compound name
-        * @param langName compound name(specified language)
+        * 既に登録した鉱石の新しい名前・言語を追加します
+        * @param par1Name 英語名
+        * @param par2NewName 新しい名前
+        * @param par3Language 言語
         */
-       public void addLangCompound(String lang, String englishName, String langName){
-               compoundsNameList.add(englishName);
-               compoundsLangNameList.add(langName);
-               compoundsLangList.add(lang);
-               compoundHash.put(englishName, compoundHash.size());
+       public void addAtomOresLanguage(String par1Name, String par2NewName, String par3Language){
+               atomOresNameListHash.add(par1Name, par2NewName);
+               atomOresLangListHash.add(par1Name, par3Language);
        }
 
 
 
-       public int getCompound(String key){
-               if(compoundHash.get(key) != null){
-                       return compoundHash.get(key);
-               } else {
-                       return -1;
-               }
+       /**
+        * 電池を追加します
+        * @param par1Name
+        */
+       public void addChemicalCell(Item par1ChemicalCell, String par2Name, int par3OperationTime){
+               chemicalCellsFuelList.put(new ItemStack(par1ChemicalCell, 0, chemicalCellsNameListHash.sizeKeysList()), par3OperationTime);
+               addChemicalCellLanguage(par2Name, "en_US", par2Name);
        }
 
 
-
        /**
-        * setting compound handler.
-        * @param handlerItemName
-        * @param compoundHandler
+        * 既に登録した電池の新しい名前・言語を追加します
+        * @param par1Name 英語名
+        * @param par2NewName 新しい名前
+        * @param par3Language 言語
         */
-       public void settingCompoundHandler(String handlerItemName, ICompoundHandler compoundHandler){
-               compoundHandlers.add(compoundHandler);
-               compoundHandlerItemNames.add(handlerItemName);
+       public void addChemicalCellLanguage(String par1Name, String par3NewLanguage, String par2NewName){
+               chemicalCellsNameListHash.add(par1Name, par2NewName);
+               chemicalCellsLangListHash.add(par1Name, par3NewLanguage);
        }
 
 
@@ -170,17 +236,33 @@ public class ChemiCraftAPI {
 
 
        /**
-        * 分解台のレシピを追加します
-        * @param material 素材
-        * @param results 原子の元素番号の配列
-        * @param stacks 原子のできる数の配列
+        * add compound.
+        * @param name compound name.
         */
-       public void addDecompositionRecipe(ItemStack material, int[] results, int[] stacks) {
-               ItemStack[] itemstacks = new ItemStack[results.length];
-               for (int i = 0; i < itemstacks.length; i++) {
-                       itemstacks[i] = new ItemStack(ChemiCraft.instance.itemAtoms,stacks[i], results[i]);
-               }
-               TileEntityPyrolysisTable.addRecipe(material, itemstacks);
+       public void addCompound(String name){
+               compoundsNameListHash.add(name, name);
+               compoundsLangListHash.add(name, "en_US");
+               compoundHash.put(name, compoundHash.size());
+       }
+
+
+
+       /**
+        * add compound corresponding to the language.
+        * @param lang Language to the corresponding
+        * @param englishName compound name
+        * @param langName compound name(specified language)
+        */
+       public void addCompound(String lang, String englishName, String langName){
+               addCompound(englishName);
+               addCompoundLanguage(lang, englishName, langName);
+       }
+
+
+
+       public void addCompoundLanguage(String lang, String englishName, String langName){
+               compoundsNameListHash.add(englishName, langName);
+               compoundsLangListHash.add(englishName, lang);
        }
 
 
@@ -195,28 +277,30 @@ public class ChemiCraftAPI {
        }
 
 
-
        /**
-        * ツール&武器作成台のレシピを追加します
-        * @param materials 素材
-        * @param result 結果
+        * 分解台のレシピを追加します
+        * @param material 素材
+        * @param integers 原子の元素番号の配列
+        * @param integers2 原子のできる数の配列
         */
-       public void addToolAndWeaponRecipe(ItemStack[] materials, ItemStack result) {
-               toolAndWeaponMaterials.add(materials);
-               toolAndWeaponResult.add(result);
-               toolAndWeaponSharpless.add(false);
+       public void addDecompositionRecipe(ItemStack material, Integer[] integers, Integer[] integers2) {
+               ItemStack[] itemstacks = new ItemStack[integers.length];
+               for (int i = 0; i < itemstacks.length; i++) {
+                       itemstacks[i] = new ItemStack(ChemiCraft.instance.itemAtoms,integers2[i], integers[i]);
+               }
+               TileEntityPyrolysisTable.addRecipe(material, itemstacks);
        }
 
 
+
        /**
-        * ツール&武器作成台の不定形レシピを追加します
+        * 素材作成台のレシピを追加します
         * @param materials 素材
         * @param result 結果
+        * @param nbtRecipe NBT(Nullの場合はなし)
         */
-       public void addSharplessToolAndWeaponRecipe(ItemStack[] materials, ItemStack result) {
-               toolAndWeaponMaterials.add(materials);
-               toolAndWeaponResult.add(result);
-               toolAndWeaponSharpless.add(true);
+       public void addMaterialRecipe(ItemStack[] materials, ItemStack result, ChemicalNBTRecipe nbtRecipe){
+               materialRecipe.add(new MaterialRecipe(result, materials, nbtRecipe, false));
        }
 
 
@@ -234,54 +318,86 @@ public class ChemiCraftAPI {
 
 
        /**
-        * 素材作成台のレシピを追加します
+        * ツール&武器作成台の不定形レシピを追加します
         * @param materials 素材
         * @param result 結果
-        * @param nbtRecipe NBT(Nullの場合はなし)
         */
-       public void addMaterialRecipe(ItemStack[] materials, ItemStack result, ChemicalNBTRecipe nbtRecipe){
-               materialRecipe.add(new MaterialRecipe(result, materials, nbtRecipe, false));
+       public void addSharplessToolAndWeaponRecipe(ItemStack[] materials, ItemStack result) {
+               toolAndWeaponMaterials.add(materials);
+               toolAndWeaponResult.add(result);
+               toolAndWeaponSharpless.add(true);
+       }
+
+
+       /**
+        * ツール&武器作成台のレシピを追加します
+        * @param materials 素材
+        * @param result 結果
+        */
+       public void addToolAndWeaponRecipe(ItemStack[] materials, ItemStack result) {
+               toolAndWeaponMaterials.add(materials);
+               toolAndWeaponResult.add(result);
+               toolAndWeaponSharpless.add(false);
        }
+
+
+       public ArrayList<WorldGenAtomsOre> getAtomOres(){
+               return atomOresList;
+       }
+
+       
        //以下システム関連//////////////////////////////////////////////////////
 
-       public ArrayList<ICompoundHandler> getCompoundHandler(){
-               compoundHandlers.trimToSize();
-               return compoundHandlers;
+       public HashMap<String, Integer[]> getAtomOresAmounts(){
+               return atomOresAmountsHash;
+       }
+
 
+
+       public HashMap<String, Integer[]> getAtomOresAtoms(){
+               return atomOresAtomsHash;
        }
 
 
 
-       public ArrayList<String> getCompoundHandlerItemName(){
-               compoundHandlerItemNames.trimToSize();
-               return compoundHandlerItemNames;
+       public ListHash<String, String> getAtomOresLanguage(){
+               return atomOresLangListHash;
        }
 
 
 
-       public ArrayList<String> getCompoundsName(){
-               compoundsNameList.trimToSize();
-               return compoundsNameList;
+       public int getAtomOresLastIndex(){
+               return atomOresNameListHash.sizeKeysList() / 16;
        }
 
 
 
-       public ArrayList<String> getCompoundsLangName(){
-               compoundsLangNameList.trimToSize();
-               return compoundsLangNameList;
+       public int getAtomOresMetaOfLastIndex(){
+               return atomOresNameListHash.sizeKeysList() - getAtomOresLastIndex() * 16;
        }
 
 
 
-       public ArrayList<String> getCompoundsLang(){
-               compoundsLangList.trimToSize();
-               return compoundsLangList;
+       public ListHash<String, String> getAtomOresName(){
+               return atomOresNameListHash;
        }
 
 
 
-       public ArrayList<String[]> getChemicalCombinationAtoms(){
-               return chemicalCombinationAtoms;
+       public HashMap<ItemStack, Integer> getChemicalCellsFuelList(){
+               return chemicalCellsFuelList;
+       }
+
+
+
+       public ListHash<String, String> getChemicalCellsLanguage(){
+               return chemicalCellsLangListHash;
+       }
+
+
+
+       public ListHash<String, String> getChemicalCellsName(){
+               return chemicalCellsNameListHash;
        }
 
 
@@ -292,12 +408,61 @@ public class ChemiCraftAPI {
 
 
 
+       public ArrayList<String[]> getChemicalCombinationAtoms(){
+               return chemicalCombinationAtoms;
+       }
+
+
+
        public ArrayList<ItemStack> getChemicalCombinationResult(){
                return chemicalCombinationResult;
        }
 
 
 
+       public int getCompound(String key){
+               if(compoundHash.get(key) != null){
+                       return compoundHash.get(key);
+               } else {
+                       return -1;
+               }
+       }
+
+
+
+       public ArrayList<ICompoundHandler> getCompoundHandler(){
+               compoundHandlers.trimToSize();
+               return compoundHandlers;
+
+       }
+
+
+
+       public ArrayList<String> getCompoundHandlerItemName(){
+               compoundHandlerItemNames.trimToSize();
+               return compoundHandlerItemNames;
+       }
+
+
+
+       public ListHash<String, String> getCompoundsLang(){
+               return compoundsLangListHash;
+       }
+
+
+
+       public ListHash<String, String> getCompoundsName(){
+               return compoundsNameListHash;
+       }
+
+
+
+       public ChemiCraftCraftingManager getCraftingManager(){
+               return chemiCraftCraftingManager;
+       }
+
+
+
        public ArrayList<MaterialRecipe> getMaterialRecipe(){
                return materialRecipe;
        }
@@ -322,14 +487,14 @@ public class ChemiCraftAPI {
 
 
 
-       public ChemiCraftCraftingManager getCraftingManager(){
-               return chemiCraftCraftingManager;
-       }
-
-
-
-       public static ChemiCraftAPI getInstance(){
-               return instance;
+       /**
+        * setting compound handler.
+        * @param handlerItemName
+        * @param compoundHandler
+        */
+       public void settingCompoundHandler(String handlerItemName, ICompoundHandler compoundHandler){
+               compoundHandlers.add(compoundHandler);
+               compoundHandlerItemNames.add(handlerItemName);
        }
 
 }
index 2601196..9583cb5 100644 (file)
@@ -1,5 +1,7 @@
 package pcc.chemicraft;
 
+import java.util.ArrayList;
+
 public final class ChemiCraftData {
 
        public static final int HYDROGEN = 0;
@@ -255,4 +257,26 @@ public final class ChemiCraftData {
                "Cn", "Uut", "Uuq", "Uup", "Uuh", "Uus", "Uuo"
        };
 
+       public static int toAtoms(String sign){
+               for (int i = 0;i < ATOMSLIST.length;i++){
+                       if(ATOMSLIST[i].equals(sign)){
+                               return i;
+                       }
+               }
+               throw new IllegalArgumentException(String.format("Illegal toAtoms %s",sign));
+       }
+
+       public static Integer[] toAtoms(String[] signs){
+               ArrayList<Integer> atoms = new ArrayList<Integer>();
+               for (int i = 0;i < signs.length; i++)
+               {
+                       atoms.add((Integer)toAtoms(signs[i]));
+               }
+               return atoms.toArray(new Integer[0]);
+       }
+
+       public static String toSign(int atoms){
+               return ATOMSLIST[atoms];
+       }
+
 }
index 22eb6bf..c210065 100644 (file)
@@ -12,7 +12,7 @@ public class BlockChemicalCombinationTable extends BlockContainer {
 
        public BlockChemicalCombinationTable(int par1, int par2, Material par3Material) {
                super(par1, par2, par3Material);
-               this.setCreativeTab(ChemiCraft.creativeTab);
+               this.setCreativeTab(ChemiCraft.creativeTabChemiCraft);
        }
 
        @Override
@@ -25,7 +25,7 @@ public class BlockChemicalCombinationTable extends BlockContainer {
 
        @Override
        public String getTextureFile() {
-               return ChemiCraft.instance.BLOCK_CHEMICALCRAFTING_TABLE_TEXTURE;
+               return ChemiCraft.instance.BLOCK_CHEMICAL_CRAFTING_TABLE_TEXTURE;
        }
 
 
@@ -52,7 +52,7 @@ public class BlockChemicalCombinationTable extends BlockContainer {
                if(par1 == 0){
                        return 17;
                }else if(par1 == 1){
-                       return 1;
+                       return this.blockIndexInTexture;
                }else{
                        return 16;
                }
index 1c9e72c..281d54f 100644 (file)
@@ -12,7 +12,7 @@ public class BlockChemicalCraftingTable extends BlockContainer {
 
        public BlockChemicalCraftingTable(int par1, int par2, Material par3Material) {
                super(par1, par2, par3Material);
-               this.setCreativeTab(ChemiCraft.creativeTab);
+               this.setCreativeTab(ChemiCraft.creativeTabChemiCraft);
        }
 
 
@@ -26,7 +26,7 @@ public class BlockChemicalCraftingTable extends BlockContainer {
 
        @Override
        public String getTextureFile(){
-               return ChemiCraft.instance.BLOCK_CHEMICALCRAFTING_TABLE_TEXTURE;
+               return ChemiCraft.instance.BLOCK_CHEMICAL_CRAFTING_TABLE_TEXTURE;
        }
 
 
@@ -37,7 +37,7 @@ public class BlockChemicalCraftingTable extends BlockContainer {
                if(par1 == 0){
                        return 17;
                }else if(par1 == 1){
-                       return 3;
+                       return this.blockIndexInTexture;
                }else{
                        return 16;
                }
index 24dfc54..ce677ee 100644 (file)
@@ -6,25 +6,51 @@ import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.tileentity.TileEntity;
 import net.minecraft.world.World;
 import pcc.chemicraft.ChemiCraft;
+import pcc.chemicraft.debug.DebugTick;
 import pcc.chemicraft.tileentity.TileEntityElectrolysisTable;
 
 public class BlockElectrolysisTable extends BlockContainer
 {
 
-       public BlockElectrolysisTable(int par1, int par2, Material par3Material) {
+       public BlockElectrolysisTable(int par1, int par2, Material par3Material)
+       {
                super(par1, par2, par3Material);
-               this.setCreativeTab(ChemiCraft.creativeTab);
+               this.setCreativeTab(ChemiCraft.creativeTabChemiCraft);
        }
 
        @Override
-       public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9){
+       public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9)
+       {
                par5EntityPlayer.openGui(ChemiCraft.instance, ChemiCraft.instance.guiElectrolysisTableID, par1World, par2, par3, par4);
                return true;
        }
 
        @Override
-       public String getTextureFile(){
-               return ChemiCraft.instance.BLOCK_CHEMICALCRAFTING_TABLE_TEXTURE;
+       public String getTextureFile()
+       {
+               return ChemiCraft.instance.BLOCK_CHEMICAL_CRAFTING_TABLE_TEXTURE;
+       }
+
+       @Override
+       public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6)
+       {
+               TileEntity tileentity = par1World.getBlockTileEntity(par2, par3, par4);
+               if (tileentity != null) {
+                       DebugTick.removeDebugData("ElectrolysisTable" + "(x:" + tileentity.xCoord + " y:" + tileentity.yCoord + " z:" + tileentity.zCoord + ")");
+               }
+               super.breakBlock(par1World, par2, par3, par4, par5, par6);
+       }
+
+       @Override
+       public int getBlockTextureFromSide(int par1)
+       {
+               if (par1 == 0) {
+                       return 17;
+               } else if (par1 == 1) {
+                       return this.blockIndexInTexture;
+               } else {
+                       return 16;
+               }
        }
 
        @Override
index 4b7a2d5..3f3ccde 100644 (file)
@@ -13,7 +13,7 @@ public class BlockPyrolysisTable extends BlockContainer {
 
        public BlockPyrolysisTable(int par1, int par2, Material par3Material) {
                super(par1, par2, par3Material);
-               this.setCreativeTab(ChemiCraft.creativeTab);
+               this.setCreativeTab(ChemiCraft.creativeTabChemiCraft);
        }
 
        @Override
@@ -26,7 +26,7 @@ public class BlockPyrolysisTable extends BlockContainer {
 
        @Override
        public String getTextureFile(){
-               return ChemiCraft.instance.BLOCK_CHEMICALCRAFTING_TABLE_TEXTURE;
+               return ChemiCraft.instance.BLOCK_CHEMICAL_CRAFTING_TABLE_TEXTURE;
        }
 
 
@@ -51,7 +51,7 @@ public class BlockPyrolysisTable extends BlockContainer {
                if(par1 == 0){
                        return 17;
                }else if(par1 == 1){
-                       return 0;
+                       return this.blockIndexInTexture;
                }else{
                        return 16;
                }
index c484184..f73a388 100644 (file)
@@ -12,7 +12,7 @@ public class BlockToolAndWeaponCraftingTable extends BlockContainer {
 
        public BlockToolAndWeaponCraftingTable(int par1, int par2, Material par3Material) {
                super(par1, par2, par3Material);
-               this.setCreativeTab(ChemiCraft.creativeTab);
+               this.setCreativeTab(ChemiCraft.creativeTabChemiCraft);
        }
 
        @Override
@@ -25,7 +25,7 @@ public class BlockToolAndWeaponCraftingTable extends BlockContainer {
 
        @Override
        public String getTextureFile(){
-               return ChemiCraft.instance.BLOCK_CHEMICALCRAFTING_TABLE_TEXTURE;
+               return ChemiCraft.instance.BLOCK_CHEMICAL_CRAFTING_TABLE_TEXTURE;
        }
 
 
@@ -36,7 +36,7 @@ public class BlockToolAndWeaponCraftingTable extends BlockContainer {
                if(par1 == 0){
                        return 17;
                }else if(par1 == 1){
-                       return 2;
+                       return this.blockIndexInTexture;
                }else{
                        return 16;
                }
index 185c406..f2f2748 100644 (file)
@@ -5,6 +5,7 @@ import net.minecraft.tileentity.TileEntity;
 import net.minecraft.world.World;
 import net.minecraftforge.client.MinecraftForgeClient;
 import pcc.chemicraft.ChemiCraft;
+import pcc.chemicraft.container.ContainerElectrolysisTable;
 import pcc.chemicraft.debug.DebugTick;
 import pcc.chemicraft.entity.EntityAtomsGrenade;
 import pcc.chemicraft.gui.GuiChemicalCombinationTable;
@@ -28,12 +29,14 @@ public class ClientProxy extends CommonProxy {
 
        @Override
        public void registerRenderInformation() {
-               MinecraftForgeClient.preloadTexture(ChemiCraft.instance.BLOCK_CHEMICALCRAFTING_TABLE_TEXTURE);
+               MinecraftForgeClient.preloadTexture(ChemiCraft.instance.BLOCK_CHEMICAL_CRAFTING_TABLE_TEXTURE);
+               MinecraftForgeClient.preloadTexture(ChemiCraft.instance.BLOCK_ATOMS_ORE_TEXTURE);
                MinecraftForgeClient.preloadTexture(ChemiCraft.instance.ITEM_ATOMS_TEXTURE);
                MinecraftForgeClient.preloadTexture(ChemiCraft.instance.ITEM_COMPOUNDS_TEXTURE);
                MinecraftForgeClient.preloadTexture(ChemiCraft.instance.ITEM_TEXTURE);
-               MinecraftForgeClient.preloadTexture(ChemiCraft.instance.GUI_CHEMICALCOMBINATION_TEXTURE);
                MinecraftForgeClient.preloadTexture(ChemiCraft.instance.GUI_PYROLYSIS_TEXTURE);
+               MinecraftForgeClient.preloadTexture(ChemiCraft.instance.GUI_ELECTROLYSIS_TEXTURE);
+               MinecraftForgeClient.preloadTexture(ChemiCraft.instance.GUI_CHEMICALCOMBINATION_TEXTURE);
                MinecraftForgeClient.preloadTexture(ChemiCraft.instance.GUI_CHEMICALCRAFTING_TEXTURE);
                MinecraftForgeClient.preloadTexture(ChemiCraft.instance.GUI_TOOLANDWEAPONCRAFTING_TEXTURE);
                RenderingRegistry.registerEntityRenderingHandler(EntityAtomsGrenade.class, new RenderAtomsGrenade(0.5F));
@@ -48,6 +51,8 @@ public class ClientProxy extends CommonProxy {
                TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
                if (tileEntity instanceof TileEntityPyrolysisTable) {
                        return new GuiPyrolysisTable(player, (TileEntityPyrolysisTable) tileEntity);
+               }else if(tileEntity instanceof TileEntityElectrolysisTable){
+                       return new GuiElectrolysisTable(player, (TileEntityElectrolysisTable) tileEntity);
                }else if(tileEntity instanceof TileEntityChemicalCombinationTable){
                        return new GuiChemicalCombinationTable(player, (TileEntityChemicalCombinationTable) tileEntity);
                }else if(tileEntity instanceof TileEntityToolAndWeaponCraftingTable){
@@ -55,7 +60,7 @@ public class ClientProxy extends CommonProxy {
                }else if(tileEntity instanceof TileEntityChemicalCraftingTable){
                        return new GuiChemicalCraftingTable(player, (TileEntityChemicalCraftingTable) tileEntity);
                } else if (tileEntity instanceof TileEntityElectrolysisTable) {
-                       return new GuiElectrolysisTable(player, (TileEntityElectrolysisTable) tileEntity);
+                       return new ContainerElectrolysisTable(player, (TileEntityElectrolysisTable) tileEntity);
                }
                return null;
        }
index 4e1a37b..ada41bc 100644 (file)
@@ -86,7 +86,7 @@ public class ContainerChemicalCombinationTable extends Container {
 
        @Override
        public void onCraftMatrixChanged(IInventory par1IInventory){
-               this.invr.setInventorySlotContents(0, ChemiCraftAPI.getInstance().getCraftingManager().getChemicalCombinationResult(this.tileentity.getAtomsList(), this.tileentity.getAtomsAmountList()));
+               this.invr.setInventorySlotContents(0, ChemiCraftAPI.instance().getCraftingManager().getChemicalCombinationResult(this.tileentity.getAtomsList(), this.tileentity.getAtomsAmountList()));
                if (par1IInventory instanceof InventoryChemicalCombinationTableResult) {
                        PacketDispatcher.sendPacketToServer(this.tileentity.getDescriptionPacket());
                }
index 277ff92..9492bcd 100644 (file)
@@ -84,7 +84,7 @@ public class ContainerChemicalCraftingTable extends Container {
 
        @Override
        public void onCraftMatrixChanged(IInventory par1IInventory){
-               this.useNBT = ChemiCraftAPI.getInstance().getCraftingManager().chemicalCrafting(this.invm, this.invr, this.invn);
+               this.useNBT = ChemiCraftAPI.instance().getCraftingManager().chemicalCrafting(this.invm, this.invr, this.invn);
        }
 
        @Override
diff --git a/common/pcc/chemicraft/container/ContainerElectrolysis.java b/common/pcc/chemicraft/container/ContainerElectrolysis.java
deleted file mode 100644 (file)
index 6d612cc..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-package pcc.chemicraft.container;
-
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.inventory.Container;
-import net.minecraft.inventory.Slot;
-import net.minecraft.world.World;
-import pcc.chemicraft.ChemiCraft;
-import pcc.chemicraft.inventory.InventoryElectrolysisFuel;
-import pcc.chemicraft.inventory.InventoryElectrolysisMaterial;
-import pcc.chemicraft.inventory.InventoryElectrolysisResult;
-import pcc.chemicraft.slot.SlotElectrolysisMaterial;
-import pcc.chemicraft.slot.SlotElectrolysisResult;
-import pcc.chemicraft.tileentity.TileEntityElectrolysisTable;
-
-public class ContainerElectrolysis extends Container
-{
-
-       private World worldObj;
-
-       private int posX;
-       private int posY;
-       private int posZ;
-
-       private TileEntityElectrolysisTable tileEntity;
-
-       private InventoryElectrolysisMaterial invm;
-       private InventoryElectrolysisResult invr;
-       private InventoryElectrolysisFuel invf;
-
-       public ContainerElectrolysis(EntityPlayer par1EntityPlayer, TileEntityElectrolysisTable par2) {
-               super();
-               this.worldObj = par2.worldObj;
-               this.posX = par2.xCoord;
-               this.posY = par2.yCoord;
-               this.posZ = par2.zCoord;
-               this.invm = (InventoryElectrolysisMaterial) this.tileEntity.getInvMaterial();
-               this.invr = (InventoryElectrolysisResult) this.tileEntity.getInvResult();
-               this.invf = (InventoryElectrolysisFuel) this.tileEntity.getInvFuel();
-
-               this.addSlotToContainer(new SlotElectrolysisMaterial(invm, 0, 123, 34));
-               for (int i = 0; i < 16; i++) {
-                       this.addSlotToContainer(new SlotElectrolysisResult(invr, i, 123, 34));
-               }
-               this.addSlotToContainer(new SlotElectrolysisResult(invf, 0, 123, 34));
-
-               int var3;
-               for (var3 = 0; var3 < 3; ++var3)
-               {
-                       for (int var4 = 0; var4 < 9; ++var4)
-                       {
-                               this.addSlotToContainer(new Slot(par1EntityPlayer.inventory, var4 + var3 * 9 + 9, 8 + var4 * 18, 85 + var3 * 18));
-                       }
-               }
-
-               for (var3 = 0; var3 < 9; ++var3)
-               {
-                       this.addSlotToContainer(new Slot(par1EntityPlayer.inventory, var3, 8 + var3 * 18, 143));
-               }
-
-       }
-
-       @Override
-       public boolean canInteractWith(EntityPlayer par1EntityPlayer)
-       {
-               return this.worldObj.getBlockId(this.posX, this.posY, this.posZ) != ChemiCraft.instance.electrolysisTableID ? false : par1EntityPlayer.getDistanceSq((double) this.posX + 0.5D, (double) this.posY + 0.5D, (double) this.posZ + 0.5D) <= 64.0D;
-       }
-
-}
index 799c51d..522c85c 100644 (file)
@@ -4,15 +4,17 @@ import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.inventory.Container;
 import net.minecraft.inventory.Slot;
 import net.minecraft.world.World;
+import pcc.chemicraft.ChemiCraft;
 import pcc.chemicraft.inventory.InventoryElectrolysisFuel;
 import pcc.chemicraft.inventory.InventoryElectrolysisMaterial;
 import pcc.chemicraft.inventory.InventoryElectrolysisResult;
+import pcc.chemicraft.slot.SlotElectrolysisFuel;
 import pcc.chemicraft.slot.SlotElectrolysisMaterial;
 import pcc.chemicraft.slot.SlotElectrolysisResult;
 import pcc.chemicraft.tileentity.TileEntityElectrolysisTable;
 
-public class ContainerElectrolysisTable extends Container
-{
+
+public class ContainerElectrolysisTable extends Container {
 
        private World worldObj;
 
@@ -20,49 +22,52 @@ public class ContainerElectrolysisTable extends Container
        private int posY;
        private int posZ;
 
-       private TileEntityElectrolysisTable tileEntity;
+       private TileEntityElectrolysisTable tileentity;
 
        private InventoryElectrolysisMaterial invm;
        private InventoryElectrolysisResult invr;
        private InventoryElectrolysisFuel invf;
 
-       public ContainerElectrolysisTable(EntityPlayer par1EntityPlayer, TileEntityElectrolysisTable par2) {
+       public ContainerElectrolysisTable(EntityPlayer par1EntityPlayer, TileEntityElectrolysisTable par2){
                super();
+               this.tileentity = par2;
                this.worldObj = par2.worldObj;
                this.posX = par2.xCoord;
                this.posY = par2.yCoord;
                this.posZ = par2.zCoord;
-               this.invm = (InventoryElectrolysisMaterial) this.tileEntity.getInvMaterial();
-               this.invr = (InventoryElectrolysisResult) this.tileEntity.getInvResult();
-               this.invf = (InventoryElectrolysisFuel) this.tileEntity.getInvFuel();
+               this.invm = par2.getInvMaterial();
+               this.invr = par2.getInvResult();
+               this.invf = par2.getInvFuel();
+               this.invm.setEventHandler(this);
+               this.invr.setEventHandler(this);
+               this.invf.setEventHandler(this);
 
-               this.addSlotToContainer(new SlotElectrolysisMaterial(invm, 0, 123, 34));
-               for (int i = 0; i < 16; i++) {
-                       this.addSlotToContainer(new SlotElectrolysisResult(invr, i, 123, 34));
+               for (int i = 0; i < 4; i++) {
+                       for (int j = 0; j < 4; j++) {
+                               this.addSlotToContainer(new SlotElectrolysisResult(this.tileentity.getInvResult(), i*4 + j, 88+i*18, 17+j*18));
+                       }
                }
-               this.addSlotToContainer(new SlotElectrolysisResult(invf, 0, 123, 34));
+               this.addSlotToContainer(new SlotElectrolysisMaterial(this.tileentity.getInvMaterial(), 0, 27, 20));
+               this.addSlotToContainer(new SlotElectrolysisFuel(this.tileentity.getInvFuel(), 0, 27, 63));
 
                int var3;
                for (var3 = 0; var3 < 3; ++var3)
                {
                        for (int var4 = 0; var4 < 9; ++var4)
                        {
-                               this.addSlotToContainer(new Slot(par1EntityPlayer.inventory, var4 + var3 * 9 + 9, 8 + var4 * 18, 85 + var3 * 18));
+                               this.addSlotToContainer(new Slot(par1EntityPlayer.inventory, var4 + var3 * 9 + 9, 8 + var4 * 18, 121 + var3 * 18));
                        }
                }
 
                for (var3 = 0; var3 < 9; ++var3)
                {
-                       this.addSlotToContainer(new Slot(par1EntityPlayer.inventory, var3, 8 + var3 * 18, 143));
+                       this.addSlotToContainer(new Slot(par1EntityPlayer.inventory, var3, 8 + var3 * 18, 179));
                }
-
        }
 
        @Override
-       public boolean canInteractWith(EntityPlayer par1EntityPlayer)
-       {
-               return true;
-               //return this.worldObj.getBlockId(this.posX, this.posY, this.posZ) != ChemiCraft.instance.electrolysisTableID ? false : par1EntityPlayer.getDistanceSq((double) this.posX + 0.5D, (double) this.posY + 0.5D, (double) this.posZ + 0.5D) <= 64.0D;
+       public boolean canInteractWith(EntityPlayer par1EntityPlayer) {
+               return this.worldObj.getBlockId(this.posX, this.posY, this.posZ) != ChemiCraft.instance.electrolysisTableID ? false : par1EntityPlayer.getDistanceSq((double)this.posX + 0.5D, (double)this.posY + 0.5D, (double)this.posZ + 0.5D) <= 64.0D;
        }
 
 }
index bc3d466..38d6911 100644 (file)
@@ -10,6 +10,7 @@ import pcc.chemicraft.slot.SlotPyrolysisTableMaterial;
 import pcc.chemicraft.slot.SlotPyrolysisTableResult;
 import pcc.chemicraft.tileentity.TileEntityPyrolysisTable;
 
+
 public class ContainerPyrolysisTable extends Container {
 
        private World worldObj;
index d609775..767c98c 100644 (file)
@@ -2,68 +2,17 @@ package pcc.chemicraft.container;
 
 import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.inventory.Container;
-import net.minecraft.inventory.IInventory;
-import net.minecraft.inventory.Slot;
-import net.minecraft.world.World;
-import pcc.chemicraft.ChemiCraftAPI;
-import pcc.chemicraft.inventory.InventoryToolAndWeaponCraftingTableMaterial;
-import pcc.chemicraft.slot.SlotToolAndWeaponCraftingTableResult;
 import pcc.chemicraft.tileentity.TileEntityToolAndWeaponCraftingTable;
 
 public class ContainerToolAndWeaponCraftingTable extends Container {
 
-       private World worldobj;
-
-       private int posX;
-       private int posY;
-       private int posZ;
-
-       private TileEntityToolAndWeaponCraftingTable tileentity;
-
        public ContainerToolAndWeaponCraftingTable(EntityPlayer par1EntityPlayer, TileEntityToolAndWeaponCraftingTable par2){
                super();
-               this.tileentity = par2;
-               this.worldobj = this.tileentity.worldObj;
-               this.posX = this.tileentity.xCoord;
-               this.posY = this.tileentity.yCoord;
-               this.posZ = this.tileentity.zCoord;
-               this.tileentity.invm.setEventHandler(this);
-               this.tileentity.invr.setEventHandler(this);
-
-               for (int i = 0; i < 3; i++) {
-                       for (int j = 0; j < 3; j++) {
-                               this.addSlotToContainer(new Slot(this.tileentity.invm, i * 3 + j, 30 + i * 18, 17 + j * 18));
-                       }
-               }
-
-               this.addSlotToContainer(new SlotToolAndWeaponCraftingTableResult(this.tileentity.invr, 0, 125, 36));
-
-               int var3;
-               for (var3 = 0; var3 < 3; ++var3)
-               {
-                       for (int var4 = 0; var4 < 9; ++var4)
-                       {
-                               this.addSlotToContainer(new Slot(par1EntityPlayer.inventory, var4 + var3 * 9 + 9, 8 + var4 * 18, 85 + var3 * 18));
-                       }
-               }
-
-               for (var3 = 0; var3 < 9; ++var3)
-               {
-                       this.addSlotToContainer(new Slot(par1EntityPlayer.inventory, var3, 8 + var3 * 18, 143));
-               }
-
-       }
-
-       @Override
-       public void onCraftMatrixChanged(IInventory par1IInventory){
-               if (par1IInventory instanceof InventoryToolAndWeaponCraftingTableMaterial) {
-                       this.tileentity.invr.setInventorySlotContents(0, ChemiCraftAPI.getInstance().getCraftingManager().getToolAndWeaponCraftingResult(this.tileentity.invm));
-               }
        }
 
        @Override
        public boolean canInteractWith(EntityPlayer var1) {
-               return true;
+               return false;
        }
 
 }
index aa73952..780278a 100644 (file)
@@ -6,6 +6,7 @@ import net.minecraft.item.ItemStack;
 import net.minecraft.world.World;
 import pcc.chemicraft.util.ICompoundHandler;
 
+
 public class CompoundHandlerTest implements ICompoundHandler {
 
        @Override
index a0f7929..4ed9dcd 100644 (file)
@@ -2,21 +2,26 @@ package pcc.chemicraft.gui;
 
 import net.minecraft.client.gui.inventory.GuiContainer;
 import net.minecraft.entity.player.EntityPlayer;
+import pcc.chemicraft.ChemiCraft;
 import pcc.chemicraft.container.ContainerElectrolysisTable;
 import pcc.chemicraft.tileentity.TileEntityElectrolysisTable;
 
 public class GuiElectrolysisTable extends GuiContainer
 {
 
-       public GuiElectrolysisTable(EntityPlayer par1EntityPlayer, TileEntityElectrolysisTable par2) {
+       private TileEntityElectrolysisTable tileentity;
+
+       public GuiElectrolysisTable(EntityPlayer par1EntityPlayer, TileEntityElectrolysisTable par2)
+       {
                super(new ContainerElectrolysisTable(par1EntityPlayer, par2));
+               this.tileentity = par2;
                this.ySize = 204;
        }
 
        @Override
        protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3)
        {
-               //this.mc.renderEngine.bindTexture(this.mc.renderEngine.getTexture(ChemiCraft.instance.guiElectrolysisTableTexture));
+               this.mc.renderEngine.bindTexture(this.mc.renderEngine.getTexture(ChemiCraft.instance.GUI_ELECTROLYSIS_TEXTURE));
                this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
        }
 
index 5f1afa9..010b969 100644 (file)
@@ -109,4 +109,5 @@ public class InventoryPyrolysisTableMaterial implements IInventory {
        @Override
        public void closeChest() {
        }
+
 }
index 645fa6b..2d448b6 100644 (file)
@@ -94,7 +94,6 @@ public class InventoryPyrolysisTableResult implements IInventory {
 
        @Override
        public void onInventoryChanged() {
-               if(this.eventHandler != null) this.eventHandler.onCraftMatrixChanged(this);
        }
 
        @Override
@@ -109,4 +108,5 @@ public class InventoryPyrolysisTableResult implements IInventory {
        @Override
        public void closeChest() {
        }
+
 }
index 0a32c3b..4c2357f 100644 (file)
@@ -16,7 +16,7 @@ public class ItemAtoms extends Item {
                this.maxStackSize = 64;
                this.setHasSubtypes(true);
                this.setMaxDamage(0);
-               this.setCreativeTab(ChemiCraft.instance.creativeTab);
+               this.setCreativeTab(ChemiCraft.instance.creativeTabChemiCraft);
        }
 
 
index c493bf0..267b090 100644 (file)
@@ -19,15 +19,19 @@ public class ItemCompounds extends Item {
                super(par1);
                this.setHasSubtypes(true);
                this.setMaxDamage(0);
-               this.setCreativeTab(ChemiCraft.instance.creativeTab);
+               this.setCreativeTab(ChemiCraft.instance.creativeTabChemiCraft);
        }
 
        @Override
        public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
-               for(int i=0;i < ChemiCraftAPI.getInstance().getCompoundHandlerItemName().size();i++){
-                       if(ChemiCraftAPI.getInstance().getCompoundsName().get(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.getInstance().getCompoundHandlerItemName().get(i))){
-                               return ChemiCraftAPI.getInstance().getCompoundHandler().get(i).onItemUseHandler(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10);
+               try {
+                       for(int i=0;i < ChemiCraftAPI.instance().getCompoundHandlerItemName().size();i++){
+                               if(ChemiCraftAPI.instance().getCompoundsName().getKeyList(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.instance().getCompoundHandlerItemName().get(i))){
+                                       return ChemiCraftAPI.instance().getCompoundHandler().get(i).onItemUseHandler(par1ItemStack, par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10);
+                               }
                        }
+               } catch (IndexOutOfBoundsException e) {
+                       par1ItemStack.stackSize = 0;
                }
                return false;
        }
@@ -36,10 +40,14 @@ public class ItemCompounds extends Item {
        @Override
        public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
        {
-               for(int i=0;i < ChemiCraftAPI.getInstance().getCompoundHandlerItemName().size();i++){
-                       if(ChemiCraftAPI.getInstance().getCompoundsName().get(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.getInstance().getCompoundHandlerItemName().get(i))){
-                               ChemiCraftAPI.getInstance().getCompoundHandler().get(i).onItemRightClickHandler(par1ItemStack, par2World, par3EntityPlayer);
+               try {
+                       for(int i=0;i < ChemiCraftAPI.instance().getCompoundHandlerItemName().size();i++){
+                               if(ChemiCraftAPI.instance().getCompoundsName().getKeyList(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.instance().getCompoundHandlerItemName().get(i))){
+                                       ChemiCraftAPI.instance().getCompoundHandler().get(i).onItemRightClickHandler(par1ItemStack, par2World, par3EntityPlayer);
+                               }
                        }
+               } catch (IndexOutOfBoundsException e) {
+                       par1ItemStack.stackSize = 0;
                }
                return par1ItemStack;
        }
@@ -48,10 +56,15 @@ public class ItemCompounds extends Item {
 
        @Override
        public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5){
-               for(int i=0;i < ChemiCraftAPI.getInstance().getCompoundHandlerItemName().size();i++){
-                       if(ChemiCraftAPI.getInstance().getCompoundsName().get(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.getInstance().getCompoundHandlerItemName().get(i))){
-                               ChemiCraftAPI.getInstance().getCompoundHandler().get(i).onUpdateHandler(par1ItemStack, par2World, par3Entity, par4, par5);
+               try {
+                       for(int i=0;i < ChemiCraftAPI.instance().getCompoundHandlerItemName().size();i++){
+                               if(ChemiCraftAPI.instance().getCompoundsName().getKeyList(par1ItemStack.getItemDamage()).equals(ChemiCraftAPI.instance().getCompoundHandlerItemName().get(i))){
+                                       ChemiCraftAPI.instance().getCompoundHandler().get(i).onUpdateHandler(par1ItemStack, par2World, par3Entity, par4, par5);
+                               }
                        }
+               } catch (IndexOutOfBoundsException e) {
+                       par1ItemStack.stackSize = 0;
+                       par1ItemStack = null;
                }
        }
 
@@ -61,7 +74,7 @@ public class ItemCompounds extends Item {
        @SideOnly(Side.CLIENT)
        @Override
        public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List){
-               for(int type = 0; type < ChemiCraftAPI.getInstance().getCompoundsName().toArray().length; type++)
+               for(int type = 0; type < ChemiCraftAPI.instance().getCompoundsName().sizeKeysList(); type++)
                {
                        par3List.add(new ItemStack(par1, 1, type));
                        this.setIconIndex(type);
@@ -72,7 +85,12 @@ public class ItemCompounds extends Item {
 
        @Override
        public String getItemNameIS(ItemStack par1ItemStack){
-               return super.getItemName() + "." + ChemiCraftAPI.getInstance().getCompoundsName().toArray()[par1ItemStack.getItemDamage()];
+               try {
+                       return super.getItemName() + "." + ChemiCraftAPI.instance().getCompoundsName().getKeyList(par1ItemStack.getItemDamage());
+               } catch (ArrayIndexOutOfBoundsException e) {
+                       par1ItemStack.stackSize = 0;
+               }
+               return null;
        }
 
 
@@ -87,10 +105,14 @@ public class ItemCompounds extends Item {
        @SideOnly(Side.CLIENT)
        @Override
        public int getIconFromDamage(int par1){
-               for(int i=0;i < ChemiCraftAPI.getInstance().getCompoundHandlerItemName().size();i++){
-                       if(ChemiCraftAPI.getInstance().getCompoundsName().get(par1).equals(ChemiCraftAPI.getInstance().getCompoundHandlerItemName().get(i))){
-                               return ChemiCraftAPI.getInstance().getCompoundHandler().get(i).getIconIndexHandler();
+               try {
+                       for(int i=0;i < ChemiCraftAPI.instance().getCompoundHandlerItemName().size();i++){
+                               if(ChemiCraftAPI.instance().getCompoundsName().getKeyList(par1).equals(ChemiCraftAPI.instance().getCompoundHandlerItemName().get(i))){
+                                       return ChemiCraftAPI.instance().getCompoundHandler().get(i).getIconIndexHandler();
+                               }
                        }
+               } catch (IndexOutOfBoundsException e) {
+                       return 0;
                }
                return 0;
        }
index 1a59647..599c729 100644 (file)
@@ -7,16 +7,18 @@ import net.minecraft.item.ItemStack;
 import net.minecraft.world.World;
 import pcc.chemicraft.ChemiCraft;
 import pcc.chemicraft.ChemiCraftAPI;
-import pcc.chemicraft.util.MathHelperPlus;
+import pcc.chemicraft.util.Auxiliary.Probability;
 
 public class ItemGasCollectingBottle extends ItemAtomInfoContainer
 {
 
+       public Probability probability = new Probability();
+
        public ItemGasCollectingBottle(int id) {
                super(id);
                this.setMaxStackSize(1);
                this.setMaxDamage(2);
-               this.setCreativeTab(ChemiCraft.instance.creativeTab);
+               this.setCreativeTab(ChemiCraft.instance.creativeTabChemiCraft);
        }
 
        @Override
@@ -28,9 +30,9 @@ public class ItemGasCollectingBottle extends ItemAtomInfoContainer
 
                int heightValue = par2World.getHeightValue((int) par3EntityPlayer.posX, (int) par3EntityPlayer.posZ);
 
-               int result1 = MathHelperPlus.probability(99, 1);
-               int result2 = MathHelperPlus.probability(78, 21, 1);
-               int result3 = MathHelperPlus.probability(0.032, 0.0018, 0.000012, 0.00052);
+               int result1 = probability.getProbability(99.0D, 1.0D);
+               int result2 = probability.getProbability(78.0D, 21.0D, 1.0D);
+               int result3 = probability.getProbability(0.032D, 0.0018D, 0.000012D, 0.00052D);
                if (this.atomInfo.isOverY(heightValue)) {
                        if (result1 == 0) {
                                if (result2 == 0) {
@@ -42,7 +44,7 @@ public class ItemGasCollectingBottle extends ItemAtomInfoContainer
                                }
                        } else {
                                if (result3 == 0) {
-                                       this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, ChemiCraftAPI.getInstance().getCompound("CarbonDioxide")), par3EntityPlayer);
+                                       this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, ChemiCraftAPI.instance().getCompound("CarbonDioxide")), par3EntityPlayer);
                                } else if (result3 == 1) {
                                        this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemAtoms, 1, 9), par3EntityPlayer);
                                } else if (result3 == 2) {
@@ -53,12 +55,6 @@ public class ItemGasCollectingBottle extends ItemAtomInfoContainer
                        }
                }
 
-               // デバッグ用
-               if (par2World.isRemote) {
-                       par3EntityPlayer.addChatMessage("result1=" + result1 + " result2=" + result2 + " result3=" + result3);
-                       par3EntityPlayer.addChatMessage("このメッセージは開発版のみの表示ですが、もし製品版で表示されていた場合はご連絡ください。");
-               }
-
                return par1ItemStack;
        }
 
@@ -81,12 +77,12 @@ public class ItemGasCollectingBottle extends ItemAtomInfoContainer
                if (uniqueBlock instanceof BlockFire){
                        par1ItemStack.damageItem(1, par2EntityPlayer);
 
-                       int result1 = MathHelperPlus.probability(90, 10);
+                       int result1 = probability.getProbability(99, 1);
 
                        if (result1 == 0) {
-                               this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, ChemiCraftAPI.getInstance().getCompound("CarbonDioxide")), par2EntityPlayer);
+                               this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, ChemiCraftAPI.instance().getCompound("CarbonDioxide")), par2EntityPlayer);
                        } else {
-                               this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, ChemiCraftAPI.getInstance().getCompound("CarbonMonoxide")), par2EntityPlayer);
+                               this.isStackOrDrop(new ItemStack(ChemiCraft.instance.itemCompounds, 1, ChemiCraftAPI.instance().getCompound("CarbonMonoxide")), par2EntityPlayer);
                        }
 
                        return true;
@@ -97,7 +93,7 @@ public class ItemGasCollectingBottle extends ItemAtomInfoContainer
        @Override
        public String getTextureFile()
        {
-               return "/chemicraft/items/items.png";
+               return ChemiCraft.instance.ITEM_TEXTURE;
        }
 
 }
index 77d2c11..35995f4 100644 (file)
@@ -5,6 +5,7 @@ import net.minecraft.inventory.Slot;
 import net.minecraft.item.ItemStack;
 import pcc.chemicraft.ChemiCraft;
 
+
 public class SlotChemicalCombinationTableMaterial extends Slot {
 
        public SlotChemicalCombinationTableMaterial(IInventory par1iInventory, int par2, int par3, int par4) {
index f1351fa..a8c240c 100644 (file)
@@ -5,8 +5,8 @@ import net.minecraft.inventory.Slot;
 
 public class SlotPyrolysisTableMaterial extends Slot {
 
-       public SlotPyrolysisTableMaterial(IInventory par1IInventory, int par2, int par3, int par4) {
-               super(par1IInventory, par2, par3, par4);
+       public SlotPyrolysisTableMaterial(IInventory par1iInventory, int par2, int par3, int par4) {
+               super(par1iInventory, par2, par3, par4);
        }
 
 }
index da8cc66..b0c3a99 100644 (file)
@@ -6,12 +6,12 @@ import net.minecraft.item.ItemStack;
 
 public class SlotPyrolysisTableResult extends Slot {
 
-       public SlotPyrolysisTableResult(IInventory par1IInventory, int par2, int par3, int par4) {
-               super(par1IInventory, par2, par3, par4);
+       public SlotPyrolysisTableResult(IInventory par1iInventory, int par2,    int par3, int par4) {
+               super(par1iInventory, par2, par3, par4);
        }
 
-       public boolean isItemValid(ItemStack par1ItemStack)
-       {
+       @Override
+       public boolean isItemValid(ItemStack par1ItemStack){
                return false;
        }
 
index ab390a3..899fe83 100644 (file)
@@ -17,10 +17,11 @@ import pcc.chemicraft.util.ComparatorFormulaPart;
 import pcc.chemicraft.util.ComparatorItemStack;
 import pcc.chemicraft.util.FormulaPart;
 
+
 public class ChemiCraftCraftingManager {
 
        public ItemStack getToolAndWeaponCraftingResult(InventoryToolAndWeaponCraftingTableMaterial par1IInventory){
-               ChemiCraftAPI api = ChemiCraftAPI.getInstance();
+               ChemiCraftAPI api = ChemiCraftAPI.instance();
                ArrayList<ItemStack[]> materials = api.getToolAndWeaponMaterials();
                ArrayList<ItemStack> result = api.getToolAndWeaponResult();
                ArrayList<Boolean> sharpless = api.getToolAndWeaponSharpless();
@@ -66,7 +67,7 @@ public class ChemiCraftCraftingManager {
 
 
        public ItemStack getChemicalCombinationResult(ArrayList<String> atomsList, ArrayList<Integer> atomsAmountList){
-               ChemiCraftAPI api = ChemiCraftAPI.getInstance();
+               ChemiCraftAPI api = ChemiCraftAPI.instance();
                recipeSize :
                        for (int i = 0; i < api.getChemicalCombinationAtoms().size(); i++) {
                                FormulaPart[] var1 = new FormulaPart[atomsList.size()];
@@ -95,7 +96,7 @@ public class ChemiCraftCraftingManager {
 
 
        public ChemicalNBTRecipe chemicalCrafting(InventoryChemicalCraftingMaterial par1IInventory, InventoryChemicalCraftingResult par2IInventory, InventoryChemicalCraftingNBT par3IInventory){
-               ChemiCraftAPI api = ChemiCraftAPI.getInstance();
+               ChemiCraftAPI api = ChemiCraftAPI.instance();
                ChemicalNBTRecipe returnObj = null;
                for(int i = 0;i < api.getMaterialRecipe().size();i++){
                        ItemStack result = api.getMaterialRecipe().get(i).match(par1IInventory);
index 0782c6f..9f751dd 100644 (file)
@@ -34,16 +34,16 @@ public class CommonProxy implements IGuiHandler {
                        return null;
 
                TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
-               if(tileEntity instanceof TileEntityChemicalCombinationTable){
+               if (tileEntity instanceof TileEntityPyrolysisTable) {
+                       return new ContainerPyrolysisTable(player, (TileEntityPyrolysisTable) tileEntity);
+               }else if(tileEntity instanceof TileEntityChemicalCombinationTable){
                        return new ContainerChemicalCombinationTable(player, (TileEntityChemicalCombinationTable) tileEntity);
                }else if(tileEntity instanceof TileEntityToolAndWeaponCraftingTable){
                        return new ContainerToolAndWeaponCraftingTable(player, (TileEntityToolAndWeaponCraftingTable) tileEntity);
                }else if(tileEntity instanceof TileEntityChemicalCraftingTable){
                        return new ContainerChemicalCraftingTable(player, (TileEntityChemicalCraftingTable) tileEntity);
-               }else if(tileEntity instanceof TileEntityElectrolysisTable){
-                       return new ContainerElectrolysisTable(player, (TileEntityElectrolysisTable)tileEntity);
-               } else if(tileEntity instanceof TileEntityPyrolysisTable) {
-                       return new ContainerPyrolysisTable(player, (TileEntityPyrolysisTable)tileEntity);
+               } else if (tileEntity instanceof TileEntityElectrolysisTable) {
+                       return new ContainerElectrolysisTable(player, (TileEntityElectrolysisTable) tileEntity);
                }
                return null;
        }
index 969c964..a3abb0c 100644 (file)
@@ -101,7 +101,7 @@ public class PacketHandler implements IPacketHandler {
                return packet;
        }
 
-       public static Packet getPacket(TileEntityElectrolysisTable tileEntity) {
+       public static Packet getPacket(TileEntityChemicalCombinationTable tileEntity) {
                ByteArrayOutputStream var1 = new ByteArrayOutputStream(128);
                DataOutputStream var2 = new DataOutputStream(var1);
 
@@ -132,7 +132,7 @@ public class PacketHandler implements IPacketHandler {
                return packet;
        }
 
-       public static Packet getPacket(TileEntityChemicalCombinationTable tileEntity) {
+       public static Packet getPacket(TileEntityToolAndWeaponCraftingTable tileEntity) {
                ByteArrayOutputStream var1 = new ByteArrayOutputStream(128);
                DataOutputStream var2 = new DataOutputStream(var1);
 
@@ -163,7 +163,7 @@ public class PacketHandler implements IPacketHandler {
                return packet;
        }
 
-       public static Packet getPacket(TileEntityToolAndWeaponCraftingTable tileEntity) {
+       public static Packet getPacket(TileEntityChemicalCraftingTable tileEntity) {
                ByteArrayOutputStream var1 = new ByteArrayOutputStream(128);
                DataOutputStream var2 = new DataOutputStream(var1);
 
@@ -194,7 +194,9 @@ public class PacketHandler implements IPacketHandler {
                return packet;
        }
 
-       public static Packet getPacket(TileEntityChemicalCraftingTable tileEntity) {
+
+       public static Packet getPacket(TileEntityElectrolysisTable tileEntity)
+       {
                ByteArrayOutputStream var1 = new ByteArrayOutputStream(128);
                DataOutputStream var2 = new DataOutputStream(var1);
 
index 9ad1f58..eab33b4 100644 (file)
@@ -1,13 +1,23 @@
 package pcc.chemicraft.tileentity;
 
 import java.io.DataOutputStream;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Random;
 
+import net.minecraft.block.Block;
+import net.minecraft.item.ItemStack;
 import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
 import net.minecraft.network.packet.Packet;
 import net.minecraft.tileentity.TileEntity;
+import pcc.chemicraft.ChemiCraftAPI;
 import pcc.chemicraft.inventory.InventoryElectrolysisFuel;
 import pcc.chemicraft.inventory.InventoryElectrolysisMaterial;
 import pcc.chemicraft.inventory.InventoryElectrolysisResult;
+import pcc.chemicraft.system.PacketHandler;
+
+import com.google.common.io.ByteArrayDataInput;
 
 public class TileEntityElectrolysisTable extends TileEntity
 {
@@ -16,32 +26,363 @@ public class TileEntityElectrolysisTable extends TileEntity
        private InventoryElectrolysisResult invr = new InventoryElectrolysisResult();
        private InventoryElectrolysisFuel invf = new InventoryElectrolysisFuel();
 
-       public TileEntityElectrolysisTable() {
+       /**
+        * 電力
+        */
+       private float heat = 0;
 
-       }
+       /**
+        * 素材の電力時間
+        */
+       private float burnTime = 0;
+
+       /**
+        * 電池の残り電力時間
+        */
+       private float fuelRestTime = 0;
+
+       /**
+        * 最大熱量
+        */
+       private static final int MAX_HEAT = 1700;
+
+       /**
+        * 燃料が燃え始める最低熱量
+        */
+       private static final int MIN_HEAT = 400;
+
+       /**
+        * 燃料の燃焼速度比率・素材の燃焼速度比率の中心となる熱量
+        */
+       private static final int CENTER_HEAT = 1050;
+
+       /**
+        * 分解までの時間
+        */
+       private static final int MAX_BURN_TIME = 2000;
+
+       /**
+        * Random of instance.
+        */
+       public static final Random rand = new Random();
+
+       /**
+        * レシピのリスト
+        */
+       private static HashMap<ItemStack, ItemStack[]> recipeList = new HashMap<ItemStack, ItemStack[]>();
 
        @Override
-       public void readFromNBT(NBTTagCompound par1nbtTagCompound)
+       public void updateEntity()
        {
-               super.readFromNBT(par1nbtTagCompound);
+               boolean var1 = this.worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord);
+               if (this.worldObj.getBlockId(xCoord, yCoord-1, zCoord) == Block.fire.blockID) {
+                       if (this.heat < 1700) {
+                               if (this.worldObj.isRaining() && var1 && !this.worldObj.isThundering()) {
+                                       this.heat += 0.1F;
+                               } else if (this.worldObj.isThundering() && var1) {
+                                       this.heat += 0.25F;
+                               } else {
+                                       this.heat += 0.5F;
+                               }
+                       } else {
+                               this.heat = 1700;
+                       }
+               } else {
+                       if (this.heat > 0) {
+                               if(this.worldObj.isRaining() && var1 && !this.worldObj.isThundering()) {
+                                       this.heat -= 0.25F;
+                               } else if(this.worldObj.isThundering() && var1) {
+                                       this.heat -= 0.5F;
+                               } else {
+                                       this.heat -= 0.05F;
+                               }
+                       } else {
+                               this.heat = 0;
+                       }
+               }
+
+               if (this.fuelRestTime >= 0) {
+                       this.burnTime += 10 * CENTER_HEAT / this.heat;
+                       this.fuelRestTime -= 10 * CENTER_HEAT / this.heat;
+               }
+
+               if (this.burnTime >= MAX_BURN_TIME) {
+                       Iterator<ItemStack> itMaterial = recipeList.keySet().iterator();
+                       while (itMaterial.hasNext()) {
+                               ItemStack itemstackMaterial = itMaterial.next();
+                               ItemStack materialItem = this.invm.getStackInSlot(0);
+                               if (materialItem != null) {
+                                       if (this.isInItemCheck(itemstackMaterial)) {
+                                               //var2 = true;
+                                               if (itemstackMaterial.itemID == materialItem.itemID && itemstackMaterial.getItemDamage() == materialItem.getItemDamage()) {
+                                                       this.inItem(itemstackMaterial);
+                                                       if (materialItem.stackSize > 1) {
+                                                               this.invm.setInventorySlotContents(0, new ItemStack(materialItem.itemID, --materialItem.stackSize, materialItem.getItemDamage()));
+                                                       } else {
+                                                               this.invm.setInventorySlotContents(0, null);
+                                                       }
+                                                       break;
+                                               }
+                                       }
+                               }
+                       }
+                       this.burnTime = 0;
+               }
+
+               boolean var3 = false;
+               if (this.heat > MIN_HEAT) {
+                       Iterator<ItemStack> itMaterial = recipeList.keySet().iterator();
+                       while (itMaterial.hasNext()) {
+                               ItemStack itemstackMaterial = itMaterial.next();
+                               ItemStack materialItem = this.invm.getStackInSlot(0);
+                               if (materialItem != null) {
+                                       if (this.isInItemCheck(itemstackMaterial)) {
+                                               //var2 = true;
+                                               if (itemstackMaterial.itemID == materialItem.itemID && itemstackMaterial.getItemDamage() == materialItem.getItemDamage()) {
+                                                       var3 = true;
+                                                       if (this.fuelRestTime <= 0) {
+                                                               Iterator<ItemStack> itFuel = ChemiCraftAPI.instance().getChemicalCellsFuelList().keySet().iterator();
+                                                               while (itFuel.hasNext()) {
+                                                                       ItemStack itemstackFuel = itFuel.next();
+                                                                       ItemStack fuelItem = this.invf.getStackInSlot(0);
+                                                                       if (fuelItem != null) {
+                                                                               if (itemstackFuel.itemID == fuelItem.itemID && itemstackFuel.getItemDamage() == fuelItem.getItemDamage()) {
+                                                                                       this.fuelRestTime = ChemiCraftAPI.instance().getChemicalCellsFuelList().get(itemstackFuel);
+                                                                                       if (fuelItem.stackSize > 1) {
+                                                                                               this.invf.setInventorySlotContents(0, new ItemStack(fuelItem.itemID, --fuelItem.stackSize, fuelItem.getItemDamage()));
+                                                                                               break;
+                                                                                       } else {
+                                                                                               this.invf.setInventorySlotContents(0, null);
+                                                                                               break;
+                                                                                       }
+                                                                               }
+                                                                       }
+                                                               }
+                                                       }
+                                               }
+                                       }
+                               } else {
+                                       this.burnTime = 0;
+                                       //var2 = false;
+                               }
+                       }
+                       if (!var3) {
+                               this.burnTime = 0;
+                       }
+               }
        }
 
        @Override
-       public void writeToNBT(NBTTagCompound par1nbtTagCompound)
-       {
-               super.writeToNBT(par1nbtTagCompound);
+       public void readFromNBT(NBTTagCompound par1) {
+               super.readFromNBT(par1);
+               this.heat = par1.getFloat("Heat");
+               this.burnTime = par1.getFloat("BurnTime");
+               this.fuelRestTime = par1.getFloat("FuelRestTime");
+
+               NBTTagList var2 = par1.getTagList("Items");
+               for (int var3 = 0; var3 < var2.tagCount(); ++var3)
+               {
+                       NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3);
+                       int var5 = var4.getByte("Slot") & 255;
+
+                       if  (var5 >= 0 && var5 < this.invm.getSizeInventory())
+                       {
+                               this.invm.setInventorySlotContents(var5, ItemStack.loadItemStackFromNBT(var4));
+                       }
+               }
+
+               NBTTagList var6 = par1.getTagList("Items2");
+               for (int var3 = 0; var3 < var6.tagCount(); ++var3)
+               {
+                       NBTTagCompound var7 = (NBTTagCompound)var6.tagAt(var3);
+                       int var8 = var7.getByte("Slot2") & 255;
+
+                       if  (var8 >= 0 && var8 < this.invr.getSizeInventory())
+                       {
+                               this.invr.setInventorySlotContents(var8, ItemStack.loadItemStackFromNBT(var7));
+                       }
+               }
+
+               NBTTagList var9 = par1.getTagList("Items3");
+               for (int var3 = 0; var3 < var9.tagCount(); ++var3)
+               {
+                       NBTTagCompound var10 = (NBTTagCompound)var9.tagAt(var3);
+                       int var11 = var10.getByte("Slot3") & 255;
+
+                       if  (var11 >= 0 && var11 < this.invf.getSizeInventory())
+                       {
+                               this.invf.setInventorySlotContents(var11, ItemStack.loadItemStackFromNBT(var10));
+                       }
+               }
        }
 
        @Override
-       public void updateEntity()
-       {
+       public void writeToNBT(NBTTagCompound par1) {
+               super.writeToNBT(par1);
+               par1.setFloat("Heat", this.heat);
+               par1.setFloat("BurnTime", this.burnTime);
+               par1.setFloat("FuelRestTime", this.fuelRestTime);
+
+               NBTTagList var2 = new NBTTagList();
+               for (int var3 = 0; var3 < this.invm.getSizeInventory(); ++var3)
+               {
+                       if  (this.invm.getStackInSlot(var3) != null)
+                       {
+                               NBTTagCompound var4 = new NBTTagCompound();
+                               var4.setByte("Slot", (byte)var3);
+                               this.invm.getStackInSlot(var3).writeToNBT(var4);
+                               var2.appendTag(var4);
+                       }
+               }
+               par1.setTag("Items", var2);
+
+               NBTTagList var5 = new NBTTagList();
+               for (int var6 = 0; var6 < this.invr.getSizeInventory(); ++var6)
+               {
+                       if  (this.invr.getStackInSlot(var6) != null)
+                       {
+                               NBTTagCompound var7 = new NBTTagCompound();
+                               var7.setByte("Slot2", (byte)var6);
+                               this.invr.getStackInSlot(var6).writeToNBT(var7);
+                               var5.appendTag(var7);
+                       }
+               }
+               par1.setTag("Items2", var5);
 
+               NBTTagList var8 = new NBTTagList();
+               for (int var9 = 0; var9 < this.invf.getSizeInventory(); ++var9)
+               {
+                       if  (this.invf.getStackInSlot(var9) != null)
+                       {
+                               NBTTagCompound var10 = new NBTTagCompound();
+                               var10.setByte("Slot3", (byte)var9);
+                               this.invf.getStackInSlot(var9).writeToNBT(var10);
+                               var8.appendTag(var10);
+                       }
+               }
+               par1.setTag("Items3", var8);
        }
 
        @Override
-       public Packet getDescriptionPacket()
-       {
-               return this.getDescriptionPacket();
+       public Packet getDescriptionPacket() {
+               return PacketHandler.getPacket(this);
+       }
+
+       public void readPacket(ByteArrayDataInput data) {
+               try {
+                       this.heat = data.readFloat();
+                       this.burnTime = data.readInt();
+                       this.fuelRestTime = data.readFloat();
+                       for(int i = 0;i < this.invm.getSizeInventory();i++){
+                               int id = data.readInt();
+                               int size = data.readByte();
+                               int damage = data.readInt();
+                               if (id != 0 && size != 0){
+                                       this.invm.setInventorySlotContents(i, new ItemStack(id, size, damage));
+                               }else{
+                                       this.invm.setInventorySlotContents(i, null);
+                               }
+                       }
+
+                       for(int i = 0;i < this.invr.getSizeInventory();i++){
+                               int id = data.readInt();
+                               int size = data.readByte();
+                               int damage = data.readInt();
+                               if (id != 0 && size != 0){
+                                       this.invr.setInventorySlotContents(i, new ItemStack(id, size, damage));
+                               }else{
+                                       this.invr.setInventorySlotContents(i, null);
+                               }
+                       }
+
+                       for(int i = 0;i < this.invf.getSizeInventory();i++){
+                               int id = data.readInt();
+                               int size = data.readByte();
+                               int damage = data.readInt();
+                               if (id != 0 && size != 0){
+                                       this.invf.setInventorySlotContents(i, new ItemStack(id, size, damage));
+                               }else{
+                                       this.invf.setInventorySlotContents(i, null);
+                               }
+                       }
+               } catch (Exception e) {
+                       e.printStackTrace();
+               }
+       }
+
+
+       public void writePacket(DataOutputStream dos){
+               try {
+                       dos.writeFloat(this.heat);
+                       dos.writeFloat(this.burnTime);
+                       dos.writeFloat(this.fuelRestTime);
+                       for(int i = 0;i < this.invm.getSizeInventory();i++){
+                               int id = 0;
+                               int size = 0;
+                               int damage  = 0;
+                               ItemStack itemstack = this.invm.getStackInSlot(i);
+                               if (itemstack != null){
+                                       id = itemstack.itemID;
+                                       size = itemstack.stackSize;
+                                       damage = itemstack.getItemDamage();
+                                       dos.writeInt(id);
+                                       dos.writeByte(size);
+                                       dos.writeInt(damage);
+                               }else{
+                                       dos.writeInt(0);
+                                       dos.writeByte(0);
+                                       dos.writeInt(0);
+                               }
+                       }
+
+                       for(int i = 0;i < this.invr.getSizeInventory();i++){
+                               int id = 0;
+                               int size = 0;
+                               int damage  = 0;
+                               ItemStack itemstack = this.invr.getStackInSlot(i);
+                               if (itemstack != null){
+                                       id = itemstack.itemID;
+                                       size = itemstack.stackSize;
+                                       damage = itemstack.getItemDamage();
+                                       dos.writeInt(id);
+                                       dos.writeByte(size);
+                                       dos.writeInt(damage);
+                               }else{
+                                       dos.writeInt(0);
+                                       dos.writeByte(0);
+                                       dos.writeInt(0);
+                               }
+                       }
+
+                       for(int i = 0;i < this.invf.getSizeInventory();i++){
+                               int id = 0;
+                               int size = 0;
+                               int damage  = 0;
+                               ItemStack itemstack = this.invf.getStackInSlot(i);
+                               if (itemstack != null){
+                                       id = itemstack.itemID;
+                                       size = itemstack.stackSize;
+                                       damage = itemstack.getItemDamage();
+                                       dos.writeInt(id);
+                                       dos.writeByte(size);
+                                       dos.writeInt(damage);
+                               }else{
+                                       dos.writeInt(0);
+                                       dos.writeByte(0);
+                                       dos.writeInt(0);
+                               }
+                       }
+               } catch (Exception e) {
+                       e.printStackTrace();
+               }
+       }
+
+       public float getBurnTime() {
+               return this.burnTime;
+       }
+
+       public float getHeat() {
+               return this.heat;
        }
 
        public InventoryElectrolysisMaterial getInvMaterial(){
@@ -56,8 +397,79 @@ public class TileEntityElectrolysisTable extends TileEntity
                return this.invf;
        }
 
-       public void writePacket(DataOutputStream var2) {
+       public boolean isInItemCheck(ItemStack key) {
+               ItemStack[] results = recipeList.get(key).clone();
+               ItemStack[] containerResults = new ItemStack[this.invr.getSizeInventory()];
+               for (int j = 0; j < this.invr.getSizeInventory(); j++) {
+                       containerResults[j] = this.invr.getStackInSlot(j);
+               }
+
+               for (int i = 0; i < results.length; i++) {
+                       int var1 = results[i].itemID;
+                       int var3 = results[i].getItemDamage();
+                       int var5 = results[i].stackSize;
+                       for (int j = 0; j < containerResults.length; j++) {
+                               if (containerResults[j] == null) {
+                                       containerResults[j] = results[i];
+                                       results[i] = null;
+                                       break;
+                               } else {
+                                       int var2 = containerResults[j].itemID;
+                                       int var4 = containerResults[j].getItemDamage();
+                                       int var6 = containerResults[j].stackSize;
+                                       int var7 = containerResults[j].getMaxStackSize();
+                                       if (var1 == var2 && var3 == var4) {
+                                               if (var5 + var6 <= var7) {
+                                                       containerResults[j] = results[i];
+                                                       results[i] = null;
+                                                       break;
+                                               } else {
+                                                       var5 -= var7 - var6;
+                                               }
+                                       }
+                               }
+                       }
+               }
+               for (int i = 0; i < results.length; i++) {
+                       if (results[i] != null) {
+                               return false;
+                       }
+               }
+               return true;
+       }
+
+       public void inItem(ItemStack key) {
+               ItemStack[] results = recipeList.get(key);
 
+               for (int i = 0; i < results.length; i++) {
+                       ItemStack[] containerResults = new ItemStack[this.invr.getSizeInventory()];
+                       for (int j = 0; j < this.invr.getSizeInventory(); j++) {
+                               containerResults[j] = this.invr.getStackInSlot(j);
+                       }
+                       int var1 = results[i].itemID;
+                       int var3 = results[i].getItemDamage();
+                       int var5 = results[i].stackSize;
+                       for (int j = 0; j < containerResults.length; j++) {
+                               if (containerResults[j] == null) {
+                                       this.invr.setInventorySlotContents(j, results[i]);
+                                       break;
+                               } else {
+                                       int var2 = containerResults[j].itemID;
+                                       int var4 = containerResults[j].getItemDamage();
+                                       int var6 = containerResults[j].stackSize;
+                                       int var7 = containerResults[j].getMaxStackSize();
+                                       if (var1 == var2 && var3 == var4) {
+                                               if (var5 + var6 <= var7) {
+                                                       this.invr.setInventorySlotContents(j, new ItemStack(results[i].itemID, var5 + var6, results[i].getItemDamage()));
+                                                       break;
+                                               } else {
+                                                       this.invr.setInventorySlotContents(j, new ItemStack(results[i].itemID, var7, results[i].getItemDamage()));
+                                                       var5 -= var7 - var6;
+                                               }
+                                       }
+                               }
+                       }
+               }
        }
 
 }
index 315aa53..399fb40 100644 (file)
@@ -11,6 +11,8 @@ import net.minecraft.nbt.NBTTagCompound;
 import net.minecraft.nbt.NBTTagList;
 import net.minecraft.network.packet.Packet;
 import net.minecraft.tileentity.TileEntity;
+import pcc.chemicraft.debug.DebugData;
+import pcc.chemicraft.debug.DebugTick;
 import pcc.chemicraft.inventory.InventoryPyrolysisTableFuel;
 import pcc.chemicraft.inventory.InventoryPyrolysisTableMaterial;
 import pcc.chemicraft.inventory.InventoryPyrolysisTableResult;
@@ -77,7 +79,7 @@ public class TileEntityPyrolysisTable extends TileEntity {
        @Override
        public void updateEntity() {
 
-               //boolean var2 = false;
+               // boolean var2 = false;
 
                boolean var1 = this.worldObj.canBlockSeeTheSky(xCoord, yCoord + 1, zCoord);
                if (this.worldObj.getBlockId(xCoord, yCoord-1, zCoord) == Block.fire.blockID) {
@@ -186,7 +188,7 @@ public class TileEntityPyrolysisTable extends TileEntity {
                                new DebugData("BurnTime", this.burnTime),
                                new DebugData("アイテムが入るか", var2)
                                );
-                */
+               */
        }
 
        @Override
index 309675d..a34db96 100644 (file)
@@ -1,5 +1,7 @@
 package pcc.chemicraft.util;
 
+import java.util.ArrayList;
+
 import net.minecraft.block.Block;
 import net.minecraft.item.Item;
 import net.minecraft.item.ItemStack;
@@ -187,4 +189,42 @@ public class Auxiliary {
 
        }
 
+       public static class Probability {
+
+               /**
+                * Return probability(0,1,2,etc...).
+                */
+               public int getProbability(double... par1){
+                       ArrayList<Double> var1 = new ArrayList<Double>();
+                       for (int var2 = 0; var2 < par1.length; var2++) {
+                               var1.add(par1[var2]);
+                       }
+                       return getProbability(var1);
+               }
+
+               public int getProbability(ArrayList<Double> par1){
+
+                       double var1 = 0;
+
+                       for (int i = 0; i < par1.size(); i++){
+                               var1 += par1.get(i);
+                       }
+
+                       double var2 = 0;
+                       double var3 = Math.random();
+
+                       for (int j = 0; j < par1.size(); j++){
+                               double var4 = par1.get(j) / var1;
+                               var2 += var4;
+                               if (var2 >= var3){
+                                       return j;
+                               }else{
+                                       continue;
+                               }
+                       }
+                       return -1;
+               }
+
+       }
+
 }
diff --git a/common/pcc/chemicraft/util/CreativeTabAtoms.java b/common/pcc/chemicraft/util/CreativeTabAtoms.java
deleted file mode 100644 (file)
index 876e61b..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-package pcc.chemicraft.util;
-
-import net.minecraft.creativetab.CreativeTabs;
-import pcc.chemicraft.ChemiCraft;
-import cpw.mods.fml.relauncher.Side;
-import cpw.mods.fml.relauncher.SideOnly;
-
-public class CreativeTabAtoms extends CreativeTabs {
-
-       public CreativeTabAtoms(String type){
-               super(type);
-       }
-
-
-       @Override
-       @SideOnly(Side.CLIENT)
-       public int getTabIconItemIndex(){
-               return ChemiCraft.instance.itemGasCollectingBottle.shiftedIndex;
-       }
-
-
-
-       @Override
-       @SideOnly(Side.CLIENT)
-       public String getTranslatedTabLabel(){
-               return "Atoms";
-       }
-
-}
diff --git a/common/pcc/chemicraft/util/MathHelperPlus.java b/common/pcc/chemicraft/util/MathHelperPlus.java
deleted file mode 100644 (file)
index aaacea7..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-package pcc.chemicraft.util;
-
-import java.util.ArrayList;
-import java.util.Random;
-
-public class MathHelperPlus {
-
-       public static Random rand = new Random();
-
-       /**
-        * Return probability(0~).
-        */
-       public static int probability(double... par1) {
-               ArrayList<Double> var1 = new ArrayList<Double>();
-               for (int var2 = 0; var2 < par1.length; var2++) {
-                       var1.add(par1[var2]);
-               }
-               return probability(var1);
-       }
-
-       public static int probability(ArrayList<Double> par1) {
-               for (int i = 0; i < par1.size(); i++) {
-                       double var1 = par1.get(i) / 100;
-                       double var2 = Math.random();
-                       if (var1 <= var2) {
-                               return i;
-                       } else {
-                               continue;
-                       }
-               }
-               return -1;
-       }
-
-}
diff --git a/resources/chemicraft/blocks/cctable.png b/resources/chemicraft/blocks/cctable.png
deleted file mode 100644 (file)
index 59487e0..0000000
Binary files a/resources/chemicraft/blocks/cctable.png and /dev/null differ
diff --git a/resources/chemicraft/guis/ChemicalCombination.png b/resources/chemicraft/guis/ChemicalCombination.png
deleted file mode 100644 (file)
index bfcb411..0000000
Binary files a/resources/chemicraft/guis/ChemicalCombination.png and /dev/null differ
diff --git a/resources/chemicraft/guis/ElectrolysisTable.png b/resources/chemicraft/guis/ElectrolysisTable.png
deleted file mode 100644 (file)
index 9e9190a..0000000
Binary files a/resources/chemicraft/guis/ElectrolysisTable.png and /dev/null differ
diff --git a/resources/chemicraft/guis/MaterialCrafting.png b/resources/chemicraft/guis/MaterialCrafting.png
deleted file mode 100644 (file)
index 1660d6b..0000000
Binary files a/resources/chemicraft/guis/MaterialCrafting.png and /dev/null differ
diff --git a/resources/chemicraft/guis/Pyrolysis.png b/resources/chemicraft/guis/Pyrolysis.png
deleted file mode 100644 (file)
index 11002bf..0000000
Binary files a/resources/chemicraft/guis/Pyrolysis.png and /dev/null differ
diff --git a/resources/chemicraft/guis/ToolAndWeaponCrafting.png b/resources/chemicraft/guis/ToolAndWeaponCrafting.png
deleted file mode 100644 (file)
index 1e448d8..0000000
Binary files a/resources/chemicraft/guis/ToolAndWeaponCrafting.png and /dev/null differ
diff --git a/resources/chemicraft/items/Atoms.png b/resources/chemicraft/items/Atoms.png
deleted file mode 100644 (file)
index 01930f6..0000000
Binary files a/resources/chemicraft/items/Atoms.png and /dev/null differ
diff --git a/resources/chemicraft/items/Compounds.png b/resources/chemicraft/items/Compounds.png
deleted file mode 100644 (file)
index efca654..0000000
Binary files a/resources/chemicraft/items/Compounds.png and /dev/null differ
diff --git a/resources/chemicraft/items/items.png b/resources/chemicraft/items/items.png
deleted file mode 100644 (file)
index 39484a5..0000000
Binary files a/resources/chemicraft/items/items.png and /dev/null differ