- private FMLPostInitializationEvent event;
-
- @Mod.PreInit
- public void chemiPreLoadMethod(final FMLPreInitializationEvent event) {
- Configuration cfg = new Configuration(event.getSuggestedConfigurationFile());
- cfg.load();
-
- Property pyrolysisTableIDProp = cfg.getBlock("PyrolysisTable", 2400);
- 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 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();
- 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();
-
- cfg.save();
- }
-
- @Mod.ServerStarting
- public void serverStarting(final FMLServerStartingEvent event) {
- event.registerServerCommand(new CommandSetTile());
- event.registerServerCommand(new CommandDeleteItem());
- event.registerServerCommand(new CommandGenDebugRoom());
- }
-
- @Mod.PostInit
- public void chemiPostLoadMethod(final FMLPostInitializationEvent event) {
- this.thread = new Thread(this);
- this.event = event;
- try {
- Thread.sleep(5000);
- } catch (InterruptedException e1) {
- e1.printStackTrace();
- }
- this.thread.start();
- try {
- this.thread.join();
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- proxy.registerRenderInformation();
- Thread.yield();
- }
-
- @Override
- public void run() {
- while (true) {
- if (proxy != null && instance != null) {
- this.settingProcessing(event);
- this.apiProcessing(event);
- this.debug(event);
- break;
- }
- }
- }
-
- private void settingProcessing(final FMLPostInitializationEvent event) {
-
- // Blockを追加します
- this.blockPyrolysisTable = new BlockPyrolysisTable(this.pyrolysisTableID, 0, Material.ground).
- setHardness(2.0F).
- setResistance(0.0F).
- setStepSound(Block.soundStoneFootstep).
- setBlockName("PyrolysisTable");
- this.blockElectrolysisTable = new BlockElectrolysisTable(this.electrolysisTableID, 1, Material.ground).
- setHardness(2.0F).
- setResistance(0.0F).
- setStepSound(Block.soundStoneFootstep).
- setBlockName("ElectrolysisTable");
- this.blockChemicalCombinationTable = new BlockChemicalCombinationTable(this.chemicalConbinationTableID, 2, Material.ground).
- setHardness(2.0F).
- setResistance(0.0F).
- setStepSound(Block.soundStoneFootstep).
- setBlockName("ChemicalCombinationTable");
- this.blockToolAndWeaponCraftingTable = new BlockToolAndWeaponCraftingTable(this.toolAndWeaponCraftingTableID, 3, Material.ground).
- setHardness(2.0F).
- setResistance(0.0F).
- setStepSound(Block.soundStoneFootstep).
- setBlockName("ToolAndWeaponCraftingTable");
- this.blockChemicalCraftingTable = new BlockChemicalCraftingTable(this.chemicalCraftingTableID, 4, Material.ground).
- setHardness(2.0F).
- setResistance(0.0F).
- setStepSound(Block.soundStoneFootstep).
- 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);
- MinecraftForge.setBlockHarvestLevel(this.blockAtomOres[i], "pickaxe", 2);
- }
-
- // 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").setIconIndex(3);
- this.itemDust = new ItemDust(15000).setItemName("dust").setIconIndex(12);
-
- // BlockをMinecraftに登録します
- GameRegistry.registerBlock(this.blockPyrolysisTable, "BlockPyrolysisTable");
- GameRegistry.registerBlock(this.blockChemicalCombinationTable, "BlockChemicalCombinationTable");
- GameRegistry.registerBlock(this.blockToolAndWeaponCraftingTable, "BlockToolAndWeaponCraftingTable");
- GameRegistry.registerBlock(this.blockChemicalCraftingTable, "BlockMaterialCraftingTable");
- GameRegistry.registerBlock(this.blockElectrolysisTable, "BlockElectrolysisTable");
-
- // Blockの名前を設定します
- this.nameAuxiliary.addName(this.blockPyrolysisTable, "PyrolysisTable");
- this.nameAuxiliary.addName(this.blockPyrolysisTable, "ja_JP", "熱分解台");
- this.nameAuxiliary.addName(this.blockChemicalCombinationTable, "ChemicalCombinationTable");
- this.nameAuxiliary.addName(this.blockChemicalCombinationTable, "ja_JP", "化合台");
- this.nameAuxiliary.addName(this.blockToolAndWeaponCraftingTable, "ToolAndWeaponCraftingTable");
- this.nameAuxiliary.addName(this.blockToolAndWeaponCraftingTable, "ja_JP", "ツール&武器製作台");
- this.nameAuxiliary.addName(this.blockChemicalCraftingTable, "ChemicalCraftingTable");
- this.nameAuxiliary.addName(this.blockChemicalCraftingTable, "ja_JP", "素材製作台");
- this.nameAuxiliary.addName(this.blockElectrolysisTable, "ElectrolysisTable");
- this.nameAuxiliary.addName(this.blockElectrolysisTable, "ja_JP", "電気分解台");
-
- // Itemの名前を設定します
- this.nameAuxiliary.addName(this.itemAtoms, ATOMSNAME);
- this.nameAuxiliary.addName(this.itemAtoms, "ja_JP", ATOMSNAMEJP);
- this.nameAuxiliary.addName(this.itemGasCollectingBottle, "GasCollectingBottle");
- this.nameAuxiliary.addName(this.itemGasCollectingBottle, "ja_JP", "集気瓶");
- this.nameAuxiliary.addName(this.itemAtomGrenade, "AtomGrenade");
- this.nameAuxiliary.addName(this.itemAtomGrenade, "ja_JP", "元素手榴弾");
- this.nameAuxiliary.addName(this.itemDust, "dust");
- this.nameAuxiliary.addName(this.itemDust, "ja_JP", "粉塵");
-
- // TileEntityを追加します
- GameRegistry.registerTileEntity(TileEntityPyrolysisTable.class, "TileEntityPyrolysisTable");
- GameRegistry.registerTileEntity(TileEntityChemicalCombinationTable.class, "TileEntityChemicalCombinationTable");
- GameRegistry.registerTileEntity(TileEntityToolAndWeaponCraftingTable.class, "TileEntityToolAndWeaponCraftingTable");
- GameRegistry.registerTileEntity(TileEntityChemicalCraftingTable.class, "TileEntityChemicalCraftingTable");
- GameRegistry.registerTileEntity(TileEntityElectrolysisTable.class, "TileEntityElectrolysisTable");
-
- // GUIを追加します
- NetworkRegistry.instance().registerGuiHandler(instance, proxy);
-
- //化学作業台類のレシピを追加します
- GameRegistry.addRecipe(new ItemStack(this.blockPyrolysisTable),
- new Object[]{
- "XYX", "ZAZ", "ZZZ",
- Character.valueOf('X'), new ItemStack(Item.ingotIron),
- Character.valueOf('Y'), new ItemStack(Block.workbench),
- Character.valueOf('Z'), new ItemStack(Block.stone),
- Character.valueOf('A'), new ItemStack(Item.bucketLava),
- });
- GameRegistry.addRecipe(new ItemStack(this.blockChemicalCombinationTable),
- new Object[]{
- "XYX", "ZAZ", "ZZZ",
- Character.valueOf('X'), new ItemStack(Item.ingotIron),
- Character.valueOf('Y'), new ItemStack(Block.workbench),
- Character.valueOf('Z'), new ItemStack(Block.stone),
- Character.valueOf('A'), new ItemStack(Block.obsidian),
- });
- GameRegistry.addRecipe(new ItemStack(this.blockToolAndWeaponCraftingTable),
- new Object[]{
- "XYX", "ZAZ", "ZZZ",
- Character.valueOf('X'), new ItemStack(Item.ingotIron),
- Character.valueOf('Y'), new ItemStack(Block.workbench),
- Character.valueOf('Z'), new ItemStack(Block.stone),
- Character.valueOf('A'), new ItemStack(Item.pickaxeSteel),
- });
- GameRegistry.addRecipe(new ItemStack(this.blockChemicalCraftingTable),
- new Object[]{
- "XYX", "ZAZ", "ZZZ",
- Character.valueOf('X'), new ItemStack(Item.ingotIron),
- Character.valueOf('Y'), new ItemStack(Block.workbench),
- Character.valueOf('Z'), new ItemStack(Block.stone),
- Character.valueOf('A'), new ItemStack(this.itemAtoms, 1, 0),
- });
-
- //電池を追加します
- api.addChemicalCell(itemChemicalCells, "ChemicalCell", 1000);
- api.addChemicalCellLanguage("ChemicalCell", "ja_JP", "化学電池");
-
- //元素入手手段
-
- // 水素
- // 水を分解。
-
- // ヘリウム
- // 未定。
-
- // リチウム
- api.addAtomOres("LithiumOre", new String[]{"Li", "Al", "Si", "O"}, new Integer[]{1, 1, 4, 10}, this.atomOresID[api.getAtomOresLastIndex()], 8, EnumOreSpawnFrequency.NORMAL); // LiAlSi4O10
- api.addAtomOresLanguage("LithiumOre", "リチウム鉱石", "ja_JP");
-
- // ベリリウム
- api.addAtomOres("BerylliumOre", new String[]{"Be", "Al", "Si", "O"}, new Integer[]{3, 2, 6, 18}, this.atomOresID[api.getAtomOresLastIndex()], 8, EnumOreSpawnFrequency.NORMAL); // Be3Al2Si6O18
- api.addAtomOresLanguage("BerylliumOre", "ベリリウム鉱石", "ja_JP");
-
- // ホウ素
- api.addAtomOres("BoronOre", new String[]{"Na", "Ca", "B", "O", "H"}, new Integer[]{1, 1, 5, 17, 16}, this.atomOresID[api.getAtomOresLastIndex()], 8, EnumOreSpawnFrequency.NORMAL); // NaCaB5O6(OH)6・5H2O
- api.addAtomOresLanguage("BoronOre", "ホウ素鉱石", "ja_JP");
-
- // 炭素
- api.addPyrolysisDecompositionRecipe(new ItemStack(Block.oreCoal), new Integer[]{chemicalData.CARBON}, new Integer[]{1});
-
- // フッ素
- api.addAtomOres("FluorineOre", new String[]{"Ca", "F"}, new Integer[]{1, 2}, this.atomOresID[api.getAtomOresLastIndex()], 8, EnumOreSpawnFrequency.NORMAL); // CaF2
- api.addAtomOresLanguage("FluorineOre", "フッ素鉱石", "ja_JP");
-
- // ナトリウム
- api.addAtomOres("SodiumOre", new String[]{"Na", "Cl"}, new Integer[]{1, 1}, this.atomOresID[api.getAtomOresLastIndex()], 8, EnumOreSpawnFrequency.NORMAL); // NaCl
- api.addAtomOresLanguage("SodiumOre", "ナトリウム鉱石", "ja_JP");
-
- // マグネシウム
- api.addAtomOres("MagnesiumOre", new String[]{"Ca", "Mg", "C", "O"}, new Integer[]{1, 1, 2, 6}, this.atomOresID[api.getAtomOresLastIndex()], 8, EnumOreSpawnFrequency.NORMAL); // CaMg(CO3)2
- api.addAtomOresLanguage("MagnesiumOre", "マグネシウム鉱石", "ja_JP");
-
- // アルミニウム
- api.addAtomOres("AluminiumOre", new String[]{"Al", "O", "H"}, new Integer[]{3, 3, 3}, this.atomOresID[api.getAtomOresLastIndex()], 8, EnumOreSpawnFrequency.NORMAL); // Al(OH)3
- api.addAtomOresLanguage("AluminiumOre", "アルミニウム鉱石", "ja_JP");
-
- // ケイ素
- // 1.5まで保留。
-
- // リン
- api.addAtomOres("PhosphorusOre", new String[]{"Ca", "P", "O", "F"}, new Integer[]{5, 3, 12, 1}, this.atomOresID[api.getAtomOresLastIndex()], 8, EnumOreSpawnFrequency.NORMAL); // Ca5(PO4)3F
- api.addAtomOresLanguage("PhosphorusOre", "リン鉱石", "ja_JP");
-
- // 硫黄
- api.addAtomOres("SulfurOre", new String[]{"S"}, new Integer[]{1}, this.atomOresID[api.getAtomOresLastIndex()], 8, EnumOreSpawnFrequency.NORMAL); // S
- api.addAtomOresLanguage("SulfurOre", "硫黄鉱石", "ja_JP");
-
- // カリウム
- api.addAtomOres("PotassiumOre", new String[]{"K", "Cl"}, new Integer[]{1, 1}, this.atomOresID[api.getAtomOresLastIndex()], 8, EnumOreSpawnFrequency.NORMAL); // KCl
- api.addAtomOresLanguage("PotassiumOre", "カリウム鉱石", "ja_JP");
-
- // カルシウム
- api.addAtomOres("CalciumOre", new String[]{"Ca", "C", "O"}, new Integer[]{1, 1, 3}, this.atomOresID[api.getAtomOresLastIndex()], 8, EnumOreSpawnFrequency.NORMAL); // CaCO3
- api.addAtomOresLanguage("CalciumOre", "カルシウム鉱石", "ja_JP");
-
- // スカンジウム
- api.addAtomOres("ScandiumOre", new String[]{"Sc", "Y", "Si", "O"}, new Integer[]{2, 2, 2, 7}, this.atomOresID[api.getAtomOresLastIndex()], 8, EnumOreSpawnFrequency.NORMAL); // (Sc,Y)2Si2O7
- api.addAtomOresLanguage("ScandiumOre", "スカンジウム鉱石", "ja_JP");
-
- // api.addAtomOres("元素名(英)", new String[]{"元素"}, new Integer[]{<数>}, this.atomOresID[api.getAtomOresLastIndex()], 8, EnumOreSpawnFrequency.NORMAL); // 化学式
- // 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を設定します
- this.api.settingCompoundHandler("Water", new CompoundWater());
-
- //化合物のレシピを追加します
- 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")));
-
- //化学電池の追加
- this.api.addMaterialRecipe(new ItemStack[] {
- null,
- null,
- null,
- new ItemStack(this.itemAtoms, 1, chemicalData.ZINC),
- null,
- new ItemStack(this.itemAtoms, 1, chemicalData.COPPER),
- new ItemStack(Item.bucketWater),
- new ItemStack(Item.bucketWater),
- new ItemStack(Item.bucketWater),
- },
- new ItemStack(this.itemChemicalCells, 1, 0),
- null);
-
- //手榴弾の追加
- this.api.addMaterialRecipe(new ItemStack[] {
- null,
- new ItemStack(Block.stone),
- null,
- new ItemStack(Block.stone),
- new ItemStack(Item.gunpowder),
- new ItemStack(Block.stone),
- null,
- new ItemStack(Block.stone),
- null
- },
- new ItemStack(this.itemAtomGrenade, 16, 0),
- new NBTRecipeGrenade()
- );
-
- this.api.addPyrolysisDecompositionRecipe(new ItemStack(Item.potion, 1, 0),
- new Integer[] {ChemiCraftData.HYDROGEN, chemicalData.OXYGEN},
- new Integer[] {2, 1});
-
- this.api.addPyrolysisDecompositionRecipe(new ItemStack(this.itemCompounds, 1, this.api.getCompound("Water")),
- new Integer[] {ChemiCraftData.HYDROGEN, chemicalData.OXYGEN},
- new Integer[] {2, 1});
-
- for (int i = 0; i < api.getAtomOresName().sizeKeysList(); i++){
- this.api.addPyrolysisDecompositionRecipe(new ItemStack(this.blockAtomOres[i / 16], 1, i - i / 16 * 16),
- api.getAtomOresAtoms().get(i),
- api.getAtomOresAmounts().get(i));
- }
-
- //Entityを追加
- LanguageRegistry.instance().addStringLocalization("entity.Dust.name", "en_US", "Dust");
- EntityRegistry.registerModEntity(EntityDust.class,
- "Dust",
- ModLoader.getUniqueEntityId(),
- this,
- 250,
- 5,
- true);
-
- this.api.addPyrolysisDecompositionFuel(new ItemStack(Item.coal), 2000*8);
- }
-
- private void apiProcessing(final FMLPostInitializationEvent event) {
- // API用の処理
- 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) {
- this.proxy.registerTickHandler();
- this.api.addCompound("Debug");
- this.api.settingCompoundHandler("Debug", new CompoundDebug());
-
- this.api.addToolAndWeaponRecipe(new ItemStack[] {
- new ItemStack(Block.stone, 1, 1)
- },
- new ItemStack(Block.dirt, 1, 0));
-
- }