• R/O
  • HTTP
  • SSH
  • HTTPS

ChemiCraftNext: Commit


Commit MetaInfo

Revisiónf765184d4cff2134701a2d48b5c530151c3b1a21 (tree)
Tiempo2013-03-04 20:30:18
Autormozipi <mozipi@user...>
Commitermozipi

Log Message

処理をスレッド化した(ノリで

Cambiar Resumen

Diferencia incremental

--- a/common/pcc/chemicraft/ChemiCraft.java
+++ b/common/pcc/chemicraft/ChemiCraft.java
@@ -53,7 +53,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
5353 */
5454 @Mod(modid = "chemiCraft", name = "ChemiCraft", version = "beta")
5555 @NetworkMod(clientSideRequired = true, serverSideRequired = true, versionBounds = "1.4.6", channels = "chemicraft", packetHandler = PacketHandler.class)
56-public class ChemiCraft {
56+public class ChemiCraft implements Runnable {
5757
5858 public static final String[] ATOMSNAME = {
5959 "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon",
@@ -166,6 +166,16 @@ public class ChemiCraft {
166166 private ChemiCraftAPI api = ChemiCraftAPI.instance();
167167 private ChemiCraftData chemicalData = new ChemiCraftData();
168168
169+ /**
170+ * このMODのスレッド
171+ */
172+ private Thread thread;
173+
174+ /**
175+ * Eventのインスタンス(PostInit以降)
176+ */
177+ private FMLPostInitializationEvent event;
178+
169179 @Mod.PreInit
170180 public void chemiPreLoadMethod(final FMLPreInitializationEvent event) {
171181 Configuration cfg = new Configuration(event.getSuggestedConfigurationFile());
@@ -228,9 +238,28 @@ public class ChemiCraft {
228238
229239 @Mod.PostInit
230240 public void chemiPostLoadMethod(final FMLPostInitializationEvent event) {
231- this.settingProcessing(event);
232- this.apiProcessing(event);
233- this.debug(event);
241+ this.thread = new Thread(this);
242+ this.event = event;
243+ this.thread.start();
244+ try {
245+ this.thread.join();
246+ } catch (InterruptedException e) {
247+ e.printStackTrace();
248+ }
249+ proxy.registerRenderInformation();
250+ Thread.yield();
251+ }
252+
253+ @Override
254+ public void run() {
255+ while (true) {
256+ if (proxy != null && instance != null) {
257+ this.settingProcessing(event);
258+ this.apiProcessing(event);
259+ this.debug(event);
260+ break;
261+ }
262+ }
234263 }
235264
236265 private void settingProcessing(final FMLPostInitializationEvent event) {
@@ -316,9 +345,6 @@ public class ChemiCraft {
316345 // GUIを追加します
317346 NetworkRegistry.instance().registerGuiHandler(instance, proxy);
318347
319- // 描画関係の読み込み
320- proxy.registerRenderInformation();
321-
322348 //化学作業台類のレシピを追加します
323349 GameRegistry.addRecipe(new ItemStack(this.blockPyrolysisTable),
324350 new Object[]{
@@ -449,8 +475,8 @@ public class ChemiCraft {
449475 new ItemStack(Item.bucketWater),
450476 new ItemStack(Item.bucketWater),
451477 new ItemStack(Item.bucketWater),
452- },
453- new ItemStack(this.itemChemicalCells, 1, 0),
478+ },
479+ new ItemStack(this.itemChemicalCells, 1, 0),
454480 null);
455481
456482 //手榴弾の追加
@@ -521,14 +547,10 @@ public class ChemiCraft {
521547 }
522548
523549 private void debug(final FMLPostInitializationEvent event) {
524- //DebugTickingの追加
525550 this.proxy.registerTickHandler();
526551 this.api.addCompound("Debug");
527552 this.api.settingCompoundHandler("Debug", new CompoundDebug());
528553
529- /*
530- * TWDebug
531- */
532554 this.api.addToolAndWeaponRecipe(new ItemStack[] {
533555 new ItemStack(Block.stone, 1, 1)
534556 },
Show on old repository browser