import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
+import net.minecraft.src.ModLoader;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.Property;
import net.minecraftforge.oredict.OreDictionary;
import pcc.chemicraft.debug.CommandDeleteItem;
import pcc.chemicraft.debug.CommandGenDebugRoom;
import pcc.chemicraft.debug.CommandSetTile;
+import pcc.chemicraft.entity.EntityDust;
import pcc.chemicraft.item.ItemAtoms;
import pcc.chemicraft.item.ItemAtomsGrenade;
import pcc.chemicraft.item.ItemChemiCell;
import pcc.chemicraft.item.ItemCompounds;
+import pcc.chemicraft.item.ItemDust;
import pcc.chemicraft.item.ItemGasCollectingBottle;
import pcc.chemicraft.ore.BlockAtomOres;
import pcc.chemicraft.ore.ItemAtomOres;
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.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.common.registry.LanguageRegistry;
/**
* ChemiCraft本体
* @author P.C.C.
*/
@Mod(modid = "chemiCraft", name = "ChemiCraft", version = "beta")
@NetworkMod(clientSideRequired = true, serverSideRequired = true, versionBounds = "1.4.6", channels = "chemicraft", packetHandler = PacketHandler.class)
-public class ChemiCraft {
+public class ChemiCraft implements Runnable {
public static final String[] ATOMSNAME = {
"Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon",
public Item itemGasCollectingBottle;
public Item itemAtomGrenade;
public Item itemChemicalCells;
+ public Item itemDust;
/**
* このmodで使用するTextureのパス.
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";
+ public final String ENTITY_PARTICLE_TEXRURE = "/pcc/chemicraft/entityParticles/dust.png";
/**
* このmodに必要な補助クラスのインスタンス.
private ChemiCraftAPI api = ChemiCraftAPI.instance();
private ChemiCraftData chemicalData = new ChemiCraftData();
+ /**
+ * このMODのスレッド
+ */
+ private Thread thread;
+
+ /**
+ * Eventのインスタンス(PostInit以降)
+ */
+ private FMLPostInitializationEvent event;
+
@Mod.PreInit
public void chemiPreLoadMethod(final FMLPreInitializationEvent event) {
Configuration cfg = new Configuration(event.getSuggestedConfigurationFile());
@Mod.PostInit
public void chemiPostLoadMethod(final FMLPostInitializationEvent event) {
- this.settingProcessing(event);
- this.apiProcessing(event);
- this.debug(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) {
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");
+ 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");
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");
// GUIを追加します
NetworkRegistry.instance().registerGuiHandler(instance, proxy);
- // 描画関係の読み込み
- proxy.registerRenderInformation();
-
//化学作業台類のレシピを追加します
GameRegistry.addRecipe(new ItemStack(this.blockPyrolysisTable),
new Object[]{
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.addAtomOres("Ulexite", new String[]{"Na", "Ca", "B", "O", "H"}, new Integer[]{1, 1, 5, 17, 16}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // NaCaB5O6(OH)6・5H2O
api.addAtomOresLanguage("Ulexite", "ウレキサイト", "ja_JP");
// フッ素
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.addAtomOres("Dolomite", new String[]{"Ca", "Mg", "C", "O"}, new Integer[]{1, 1, 2, 6}, 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.addAtomOres("Gibbsite", new String[]{"Al", "O", "H"}, new Integer[]{3, 3, 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.addAtomOresLanguage("Quartz", "石英", "ja_JP");
// リン
- api.addAtomOres("Fluorapatite", new String[]{"Ca"}, new Integer[]{5}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // Ca5(PO4)3F
+ api.addAtomOres("Fluorapatite", new String[]{"Ca", "P", "O", "F"}, new Integer[]{5, 3, 12, 1}, 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.addAtomOres("Chlorapatite", new String[]{"Ca", "P", "O", "Cl"}, new Integer[]{5, 3, 12, 1}, 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.addAtomOres("Hydroxylapatite", new String[]{"Ca", "P", "O", "H"}, new Integer[]{5, 3, 13, 1}, this.atomOresID[api.getAtomOresLastIndex()], 5, 1, 50); // Ca5(PO4)3(OH)
api.addAtomOresLanguage("Hydroxylapatite", "水酸燐灰石", "ja_JP");
// カリウム
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, ChemiCraftData.ZINC),
+ null,
+ new ItemStack(this.itemAtoms, 1, ChemiCraftData.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 NBTRecipeGrenade()
);
- this.api.addDecompositionRecipe(new ItemStack(Item.potion, 1, 0),
+ this.api.addPyrolysisDecompositionRecipe(new ItemStack(Item.potion, 1, 0),
new Integer[] {ChemiCraftData.HYDROGEN, ChemiCraftData.OXYGEN},
new Integer[] {2, 1});
- this.api.addDecompositionRecipe(new ItemStack(this.itemCompounds, 1, this.api.getCompound("Water")),
+ this.api.addPyrolysisDecompositionRecipe(new ItemStack(this.itemCompounds, 1, this.api.getCompound("Water")),
new Integer[] {ChemiCraftData.HYDROGEN, ChemiCraftData.OXYGEN},
new Integer[] {2, 1});
for (int i = 0; i < api.getAtomOresName().sizeKeysList(); i++){
- this.api.addDecompositionRecipe(new ItemStack(this.blockAtomOres[i / 16], 1, i - i / 16 * 16),
+ this.api.addPyrolysisDecompositionRecipe(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);
+ //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) {
}
private void debug(final FMLPostInitializationEvent event) {
- //DebugTickingの追加
this.proxy.registerTickHandler();
this.api.addCompound("Debug");
this.api.settingCompoundHandler("Debug", new CompoundDebug());
- /*
- * TWDebug
- */
this.api.addToolAndWeaponRecipe(new ItemStack[] {
new ItemStack(Block.stone, 1, 1)
},