• R/O
  • HTTP
  • SSH
  • HTTPS

ChemiCraftNext: Commit


Commit MetaInfo

Revisiónb5c01e63364dca432a6db1dedd13976b00c14e83 (tree)
Tiempo2013-03-06 18:10:11
Autorponkotate <ponkotate@user...>
Commiterponkotate

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,33 @@ 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+ try {
244+ Thread.sleep(5000);
245+ } catch (InterruptedException e1) {
246+ e1.printStackTrace();
247+ }
248+ this.thread.start();
249+ try {
250+ this.thread.join();
251+ } catch (InterruptedException e) {
252+ e.printStackTrace();
253+ }
254+ proxy.registerRenderInformation();
255+ Thread.yield();
256+ }
257+
258+ @Override
259+ public void run() {
260+ while (true) {
261+ if (proxy != null && instance != null) {
262+ this.settingProcessing(event);
263+ this.apiProcessing(event);
264+ this.debug(event);
265+ break;
266+ }
267+ }
234268 }
235269
236270 private void settingProcessing(final FMLPostInitializationEvent event) {
@@ -316,9 +350,6 @@ public class ChemiCraft {
316350 // GUIを追加します
317351 NetworkRegistry.instance().registerGuiHandler(instance, proxy);
318352
319- // 描画関係の読み込み
320- proxy.registerRenderInformation();
321-
322353 //化学作業台類のレシピを追加します
323354 GameRegistry.addRecipe(new ItemStack(this.blockPyrolysisTable),
324355 new Object[]{
@@ -453,8 +484,8 @@ public class ChemiCraft {
453484 new ItemStack(Item.bucketWater),
454485 new ItemStack(Item.bucketWater),
455486 new ItemStack(Item.bucketWater),
456- },
457- new ItemStack(this.itemChemicalCells, 1, 0),
487+ },
488+ new ItemStack(this.itemChemicalCells, 1, 0),
458489 null);
459490
460491 //手榴弾の追加
@@ -525,14 +556,10 @@ public class ChemiCraft {
525556 }
526557
527558 private void debug(final FMLPostInitializationEvent event) {
528- //DebugTickingの追加
529559 this.proxy.registerTickHandler();
530560 this.api.addCompound("Debug");
531561 this.api.settingCompoundHandler("Debug", new CompoundDebug());
532562
533- /*
534- * TWDebug
535- */
536563 this.api.addToolAndWeaponRecipe(new ItemStack[] {
537564 new ItemStack(Block.stone, 1, 1)
538565 },
--- /dev/null
+++ b/common/pcc/chemicraft/gen/EnumOreSpawnFrequency.java
@@ -0,0 +1,34 @@
1+package pcc.chemicraft.gen;
2+
3+/**
4+ * 鉱石の出現頻度のEnumです。
5+ * @author mozipi
6+ */
7+public enum EnumOreSpawnFrequency {
8+
9+ HIGH(10),
10+ NORMAL(5),
11+ LOW(3),
12+ RARE(1);
13+
14+ /**
15+ * 鉱石の生成頻度
16+ */
17+ private short frequency;
18+
19+ /**
20+ * @param par1 鉱石の生成頻度
21+ */
22+ private EnumOreSpawnFrequency(int par1) {
23+ this.frequency = (short) par1;
24+ }
25+
26+ /**
27+ * 鉱石の生成頻度を返します
28+ * @return 鉱石の生成頻度
29+ */
30+ public short getFrequency() {
31+ return this.frequency;
32+ }
33+
34+}
--- a/common/pcc/chemicraft/gen/WorldGenAtomsOre.java
+++ b/common/pcc/chemicraft/gen/WorldGenAtomsOre.java
@@ -7,22 +7,25 @@ import net.minecraft.world.chunk.IChunkProvider;
77 import net.minecraft.world.gen.feature.WorldGenMinable;
88 import cpw.mods.fml.common.IWorldGenerator;
99
10-public class WorldGenAtomsOre extends WorldGenMinable implements IWorldGenerator
11-{
10+public class WorldGenAtomsOre extends WorldGenMinable implements IWorldGenerator {
1211
1312 private int frequency;
1413 private int posY;
1514
16- public WorldGenAtomsOre(int id, int meta, int size, int frequency, int posY)
17- {
15+ public WorldGenAtomsOre(int id, int meta, int size, int frequency, int posY) {
1816 super(id, meta, size);
1917 this.frequency = frequency;
2018 this.posY = posY;
2119 }
2220
21+ public WorldGenAtomsOre(int id, int meta, int size, EnumOreSpawnFrequency frequency, int posY) {
22+ super(id, meta, size);
23+ this.frequency = frequency.getFrequency();
24+ this.posY = posY;
25+ }
26+
2327 @Override
24- public void generate(Random par1Random, int par2ChunkX, int par3ChunkZ, World par4World, IChunkProvider par5ChunkGenerator, IChunkProvider par6ChunkProvider)
25- {
28+ public void generate(Random par1Random, int par2ChunkX, int par3ChunkZ, World par4World, IChunkProvider par5ChunkGenerator, IChunkProvider par6ChunkProvider) {
2629 for (int i = 0; i < this.frequency; i++) {
2730 this.generate(par4World, par1Random, par2ChunkX * 16 + par1Random.nextInt(16), par1Random.nextInt(this.posY), par3ChunkZ * 16 + par1Random.nextInt(16));
2831 }
Show on old repository browser