*/
@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",
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;
+ 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) {
// GUIを追加します
NetworkRegistry.instance().registerGuiHandler(instance, proxy);
- // 描画関係の読み込み
- proxy.registerRenderInformation();
-
//化学作業台類のレシピを追加します
GameRegistry.addRecipe(new ItemStack(this.blockPyrolysisTable),
new Object[]{
new ItemStack(Item.bucketWater),
new ItemStack(Item.bucketWater),
new ItemStack(Item.bucketWater),
- },
- new ItemStack(this.itemChemicalCells, 1, 0),
+ },
+ new ItemStack(this.itemChemicalCells, 1, 0),
null);
//手榴弾の追加
}
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)
},