Revisión | b5c01e63364dca432a6db1dedd13976b00c14e83 (tree) |
---|---|
Tiempo | 2013-03-06 18:10:11 |
Autor | ponkotate <ponkotate@user...> |
Commiter | ponkotate |
Merge branch 'master' of https://scm.sourceforge.jp/gitroot/chemicraft/chemicraft
@@ -53,7 +53,7 @@ import cpw.mods.fml.common.registry.GameRegistry; | ||
53 | 53 | */ |
54 | 54 | @Mod(modid = "chemiCraft", name = "ChemiCraft", version = "beta") |
55 | 55 | @NetworkMod(clientSideRequired = true, serverSideRequired = true, versionBounds = "1.4.6", channels = "chemicraft", packetHandler = PacketHandler.class) |
56 | -public class ChemiCraft { | |
56 | +public class ChemiCraft implements Runnable { | |
57 | 57 | |
58 | 58 | public static final String[] ATOMSNAME = { |
59 | 59 | "Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", |
@@ -166,6 +166,16 @@ public class ChemiCraft { | ||
166 | 166 | private ChemiCraftAPI api = ChemiCraftAPI.instance(); |
167 | 167 | private ChemiCraftData chemicalData = new ChemiCraftData(); |
168 | 168 | |
169 | + /** | |
170 | + * このMODのスレッド | |
171 | + */ | |
172 | + private Thread thread; | |
173 | + | |
174 | + /** | |
175 | + * Eventのインスタンス(PostInit以降) | |
176 | + */ | |
177 | + private FMLPostInitializationEvent event; | |
178 | + | |
169 | 179 | @Mod.PreInit |
170 | 180 | public void chemiPreLoadMethod(final FMLPreInitializationEvent event) { |
171 | 181 | Configuration cfg = new Configuration(event.getSuggestedConfigurationFile()); |
@@ -228,9 +238,33 @@ public class ChemiCraft { | ||
228 | 238 | |
229 | 239 | @Mod.PostInit |
230 | 240 | 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 | + } | |
234 | 268 | } |
235 | 269 | |
236 | 270 | private void settingProcessing(final FMLPostInitializationEvent event) { |
@@ -316,9 +350,6 @@ public class ChemiCraft { | ||
316 | 350 | // GUIを追加します |
317 | 351 | NetworkRegistry.instance().registerGuiHandler(instance, proxy); |
318 | 352 | |
319 | - // 描画関係の読み込み | |
320 | - proxy.registerRenderInformation(); | |
321 | - | |
322 | 353 | //化学作業台類のレシピを追加します |
323 | 354 | GameRegistry.addRecipe(new ItemStack(this.blockPyrolysisTable), |
324 | 355 | new Object[]{ |
@@ -453,8 +484,8 @@ public class ChemiCraft { | ||
453 | 484 | new ItemStack(Item.bucketWater), |
454 | 485 | new ItemStack(Item.bucketWater), |
455 | 486 | new ItemStack(Item.bucketWater), |
456 | - }, | |
457 | - new ItemStack(this.itemChemicalCells, 1, 0), | |
487 | + }, | |
488 | + new ItemStack(this.itemChemicalCells, 1, 0), | |
458 | 489 | null); |
459 | 490 | |
460 | 491 | //手榴弾の追加 |
@@ -525,14 +556,10 @@ public class ChemiCraft { | ||
525 | 556 | } |
526 | 557 | |
527 | 558 | private void debug(final FMLPostInitializationEvent event) { |
528 | - //DebugTickingの追加 | |
529 | 559 | this.proxy.registerTickHandler(); |
530 | 560 | this.api.addCompound("Debug"); |
531 | 561 | this.api.settingCompoundHandler("Debug", new CompoundDebug()); |
532 | 562 | |
533 | - /* | |
534 | - * TWDebug | |
535 | - */ | |
536 | 563 | this.api.addToolAndWeaponRecipe(new ItemStack[] { |
537 | 564 | new ItemStack(Block.stone, 1, 1) |
538 | 565 | }, |
@@ -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 | +} |
@@ -7,22 +7,25 @@ import net.minecraft.world.chunk.IChunkProvider; | ||
7 | 7 | import net.minecraft.world.gen.feature.WorldGenMinable; |
8 | 8 | import cpw.mods.fml.common.IWorldGenerator; |
9 | 9 | |
10 | -public class WorldGenAtomsOre extends WorldGenMinable implements IWorldGenerator | |
11 | -{ | |
10 | +public class WorldGenAtomsOre extends WorldGenMinable implements IWorldGenerator { | |
12 | 11 | |
13 | 12 | private int frequency; |
14 | 13 | private int posY; |
15 | 14 | |
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) { | |
18 | 16 | super(id, meta, size); |
19 | 17 | this.frequency = frequency; |
20 | 18 | this.posY = posY; |
21 | 19 | } |
22 | 20 | |
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 | + | |
23 | 27 | @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) { | |
26 | 29 | for (int i = 0; i < this.frequency; i++) { |
27 | 30 | this.generate(par4World, par1Random, par2ChunkX * 16 + par1Random.nextInt(16), par1Random.nextInt(this.posY), par3ChunkZ * 16 + par1Random.nextInt(16)); |
28 | 31 | } |