Revisión | 2ab5cb303023512efe770a29280f580dae802e25 (tree) |
---|---|
Tiempo | 2013-02-04 18:16:07 |
Autor | mozipi <mozipi@user...> |
Commiter | mozipi |
競合確認
@@ -2,6 +2,7 @@ package chemicraft; | ||
2 | 2 | |
3 | 3 | import net.minecraft.block.Block; |
4 | 4 | import net.minecraft.block.material.Material; |
5 | +import net.minecraft.client.audio.SoundManager; | |
5 | 6 | import net.minecraft.creativetab.CreativeTabs; |
6 | 7 | import net.minecraft.item.Item; |
7 | 8 | import net.minecraft.item.ItemStack; |
@@ -11,6 +12,7 @@ import chemicraft.block.BlockChemicalCombinationTable; | ||
11 | 12 | import chemicraft.block.BlockChemicalCraftingTable; |
12 | 13 | import chemicraft.block.BlockPyrolysisTable; |
13 | 14 | import chemicraft.block.BlockToolAndWeaponCraftingTable; |
15 | +import chemicraft.compounds.CompoundDebug; | |
14 | 16 | import chemicraft.compounds.CompoundWater; |
15 | 17 | import chemicraft.debug.CommandDeleteItem; |
16 | 18 | import chemicraft.debug.CommandGenDebugRoom; |
@@ -300,7 +302,6 @@ public class ChemiCraft { | ||
300 | 302 | api.addLangCompound("ja_JP", "CarbonMonoxide", "一酸化炭素"); |
301 | 303 | api.addLangCompound("ja_JP", "CarbonDioxide", "二酸化炭素"); |
302 | 304 | api.addLangCompound("ja_JP", "Water", "水"); |
303 | - api.addCompound("Test"); | |
304 | 305 | |
305 | 306 | |
306 | 307 | //化合物のHandlerを設定します |
@@ -310,23 +311,30 @@ public class ChemiCraft { | ||
310 | 311 | api.addChemicalCombinationRecipe(new String[]{"H", "O"}, new Integer[]{2, 1}, new ItemStack(this.itemCompounds, 1, api.getCompound("Water"))); |
311 | 312 | |
312 | 313 | //手榴弾の追加 |
313 | - api.addMaterialRecipe( | |
314 | - new ItemStack[]{ | |
315 | - null, | |
316 | - new ItemStack(Block.stone), | |
317 | - null, | |
318 | - new ItemStack(Block.stone), | |
319 | - new ItemStack(Item.gunpowder), | |
320 | - new ItemStack(Block.stone), | |
321 | - null, | |
322 | - new ItemStack(Block.stone), | |
323 | - null | |
324 | - }, | |
325 | - new ItemStack(this.itemAtomGrenade, 16, 0), | |
326 | - new NBTRecipeGrenade() | |
314 | + api.addMaterialRecipe(new ItemStack[] { | |
315 | + null, | |
316 | + new ItemStack(Block.stone), | |
317 | + null, | |
318 | + new ItemStack(Block.stone), | |
319 | + new ItemStack(Item.gunpowder), | |
320 | + new ItemStack(Block.stone), | |
321 | + null, | |
322 | + new ItemStack(Block.stone), | |
323 | + null | |
324 | + }, | |
325 | + new ItemStack(this.itemAtomGrenade, 16, 0), | |
326 | + new NBTRecipeGrenade() | |
327 | 327 | ); |
328 | - //Tickingの追加 | |
329 | - this.proxy.registerTickHandler(); | |
328 | + | |
329 | + api.addDecompositionRecipe(new ItemStack(Item.potion, 1, 0), | |
330 | + new int[] {ChemiCraftData.HYDROGEN, ChemiCraftData.OXYGEN}, | |
331 | + new int[] {2, 1}); | |
332 | + | |
333 | + api.addDecompositionRecipe(new ItemStack(this.itemCompounds, 1, api.getCompound("Water")), | |
334 | + new int[] {ChemiCraftData.HYDROGEN, ChemiCraftData.OXYGEN}, | |
335 | + new int[] {2, 1}); | |
336 | + | |
337 | + api.addDecompositionFuel(new ItemStack(Item.coal), 2000*8); | |
330 | 338 | } |
331 | 339 | |
332 | 340 | private void apiProcessing(final FMLPostInitializationEvent event) { |
@@ -338,6 +346,10 @@ public class ChemiCraft { | ||
338 | 346 | } |
339 | 347 | |
340 | 348 | private void debug(final FMLPostInitializationEvent event) { |
349 | + //DebugTickingの追加 | |
350 | + this.proxy.registerTickHandler(); | |
351 | + api.addCompound("Debug"); | |
352 | + this.api.settingCompoundHandler("Debug", new CompoundDebug()); | |
341 | 353 | } |
342 | 354 | |
343 | 355 | } |
@@ -61,18 +61,6 @@ public class ChemiCraftAPI { | ||
61 | 61 | |
62 | 62 | |
63 | 63 | /** |
64 | - * 分解台の素材のリスト | |
65 | - */ | |
66 | - private ArrayList<ItemStack> decompositionMaterial = new ArrayList<ItemStack>(); | |
67 | - | |
68 | - | |
69 | - /** | |
70 | - * 分解台の結果のリスト | |
71 | - */ | |
72 | - private ArrayList<ItemStack[]> decompositionResults = new ArrayList<ItemStack[]>(); | |
73 | - | |
74 | - | |
75 | - /** | |
76 | 64 | * 化合台の原子の種類のリスト |
77 | 65 | */ |
78 | 66 | private ArrayList<String[]> chemicalCombinationAtoms = new ArrayList<String[]>(); |
@@ -151,22 +139,6 @@ public class ChemiCraftAPI { | ||
151 | 139 | |
152 | 140 | |
153 | 141 | /** |
154 | - * 分解レシピを追加します。resultの要素数は0<= n <= 16にしてください。 | |
155 | - * @param material 素材 | |
156 | - * @param result 結果 | |
157 | - */ | |
158 | - public void addDecompositionRecipe(ItemStack material, ItemStack[] result){ | |
159 | - if(result.length <= 16){ | |
160 | - decompositionMaterial.add(material); | |
161 | - decompositionResults.add(result); | |
162 | - }else{ | |
163 | - System.err.println("ChemiCraft内でエラー:addDecompositionRecipeの引数resultの要素数が16を超えています。" + "Material:" + material + " Result:" + result); | |
164 | - } | |
165 | - } | |
166 | - | |
167 | - | |
168 | - | |
169 | - /** | |
170 | 142 | * 化合レシピを追加します。materialの要素数は0<= n <= 16にしてください。 |
171 | 143 | * @param material 素材 |
172 | 144 | * @param result 結果 |
@@ -182,14 +154,14 @@ public class ChemiCraftAPI { | ||
182 | 154 | public void addDecompositionRecipe(ItemStack material, int[] results, int[] stacks) { |
183 | 155 | ItemStack[] itemstacks = new ItemStack[results.length]; |
184 | 156 | for (int i = 0; i < itemstacks.length; i++) { |
185 | - itemstacks[i] = new ItemStack(ChemiCraft.instance.atomsID,stacks[i], results[i]); | |
157 | + itemstacks[i] = new ItemStack(ChemiCraft.instance.itemAtoms,stacks[i], results[i]); | |
186 | 158 | } |
187 | 159 | TileEntityPyrolysisTable.addRecipe(material, itemstacks); |
188 | 160 | } |
189 | 161 | |
190 | 162 | |
191 | 163 | |
192 | - public void addDecompositionRecipe(ItemStack itemstack, int burnTime) { | |
164 | + public void addDecompositionFuel(ItemStack itemstack, int burnTime) { | |
193 | 165 | TileEntityPyrolysisTable.addFuel(itemstack, burnTime); |
194 | 166 | } |
195 | 167 |
@@ -242,18 +214,6 @@ public class ChemiCraftAPI { | ||
242 | 214 | |
243 | 215 | |
244 | 216 | |
245 | - public ArrayList<ItemStack> getDecompositionMaterial(){ | |
246 | - return decompositionMaterial; | |
247 | - } | |
248 | - | |
249 | - | |
250 | - | |
251 | - public ArrayList<ItemStack[]> getDecompositionResult(){ | |
252 | - return decompositionResults; | |
253 | - } | |
254 | - | |
255 | - | |
256 | - | |
257 | 217 | public ArrayList<String[]> getChemicalCombinationAtoms(){ |
258 | 218 | return chemicalCombinationAtoms; |
259 | 219 | } |
@@ -0,0 +1,45 @@ | ||
1 | +package chemicraft.compounds; | |
2 | + | |
3 | +import net.minecraft.entity.Entity; | |
4 | +import net.minecraft.entity.player.EntityPlayer; | |
5 | +import net.minecraft.entity.projectile.EntityLargeFireball; | |
6 | +import net.minecraft.item.ItemStack; | |
7 | +import net.minecraft.world.World; | |
8 | +import chemicraft.util.ICompoundHandler; | |
9 | + | |
10 | +public class CompoundDebug implements ICompoundHandler { | |
11 | + | |
12 | + @Override | |
13 | + public ItemStack onItemRightClickHandler(ItemStack par1ItemStack, | |
14 | + World par2World, EntityPlayer par3EntityPlayer) { | |
15 | + if (!par2World.isRemote) { | |
16 | + double var1 = par3EntityPlayer.posX; | |
17 | + double var2 = par3EntityPlayer.posY + 10; | |
18 | + double var3 = par3EntityPlayer.posZ; | |
19 | + double var4 = par3EntityPlayer.posX; | |
20 | + double var5 = par3EntityPlayer.posY; | |
21 | + double var6 = par3EntityPlayer.posZ; | |
22 | + par2World.spawnEntityInWorld(new EntityLargeFireball(par2World, var1, var2, var3, var4, var5, var6)); | |
23 | + } | |
24 | + return par1ItemStack; | |
25 | + } | |
26 | + | |
27 | + @Override | |
28 | + public boolean onItemUseHandler(ItemStack par1ItemStack, | |
29 | + EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, | |
30 | + int par6, int par7, float par8, float par9, float par10) { | |
31 | + return false; | |
32 | + } | |
33 | + | |
34 | + @Override | |
35 | + public void onUpdateHandler(ItemStack par1ItemStack, World par2World, | |
36 | + Entity par3Entity, int par4, boolean par5) { | |
37 | + | |
38 | + } | |
39 | + | |
40 | + @Override | |
41 | + public int getIconIndexHandler() { | |
42 | + return 0; | |
43 | + } | |
44 | + | |
45 | +} |
@@ -2,17 +2,56 @@ package chemicraft.container; | ||
2 | 2 | |
3 | 3 | import net.minecraft.entity.player.EntityPlayer; |
4 | 4 | import net.minecraft.inventory.Container; |
5 | +import net.minecraft.inventory.Slot; | |
6 | +import net.minecraft.world.World; | |
7 | +import chemicraft.slot.SlotToolAndWeaponCraftingTableResult; | |
5 | 8 | import chemicraft.tileentity.TileEntityToolAndWeaponCraftingTable; |
6 | 9 | |
7 | 10 | public class ContainerToolAndWeaponCraftingTable extends Container { |
8 | 11 | |
12 | + private World worldobj; | |
13 | + | |
14 | + private int posX; | |
15 | + private int posY; | |
16 | + private int posZ; | |
17 | + | |
18 | + private TileEntityToolAndWeaponCraftingTable tileentity; | |
19 | + | |
9 | 20 | public ContainerToolAndWeaponCraftingTable(EntityPlayer par1EntityPlayer, TileEntityToolAndWeaponCraftingTable par2){ |
10 | 21 | super(); |
22 | + this.tileentity = par2; | |
23 | + this.worldobj = this.tileentity.worldObj; | |
24 | + this.posX = this.tileentity.xCoord; | |
25 | + this.posY = this.tileentity.yCoord; | |
26 | + this.posZ = this.tileentity.zCoord; | |
27 | + | |
28 | + for (int i = 0; i < 3; i++) { | |
29 | + for (int j = 0; j < 3; j++) { | |
30 | + this.addSlotToContainer(new Slot(this.tileentity.invm, i * 3 + i, 30 + i * 18, 17 + j * 18)); | |
31 | + } | |
32 | + } | |
33 | + | |
34 | + this.addSlotToContainer(new SlotToolAndWeaponCraftingTableResult(this.tileentity.invr, 0, 125, 36)); | |
35 | + | |
36 | + int var3; | |
37 | + for (var3 = 0; var3 < 3; ++var3) | |
38 | + { | |
39 | + for (int var4 = 0; var4 < 9; ++var4) | |
40 | + { | |
41 | + this.addSlotToContainer(new Slot(par1EntityPlayer.inventory, var4 + var3 * 9 + 9, 8 + var4 * 18, 85 + var3 * 18)); | |
42 | + } | |
43 | + } | |
44 | + | |
45 | + for (var3 = 0; var3 < 9; ++var3) | |
46 | + { | |
47 | + this.addSlotToContainer(new Slot(par1EntityPlayer.inventory, var3, 8 + var3 * 18, 143)); | |
48 | + } | |
49 | + | |
11 | 50 | } |
12 | 51 | |
13 | 52 | @Override |
14 | 53 | public boolean canInteractWith(EntityPlayer var1) { |
15 | - return false; | |
54 | + return true; | |
16 | 55 | } |
17 | 56 | |
18 | 57 | } |
@@ -87,7 +87,7 @@ public class TileEntityPyrolysisTable extends TileEntity { | ||
87 | 87 | } else if (this.worldObj.isThundering() && var1) { |
88 | 88 | this.heat += 0.25F; |
89 | 89 | } else { |
90 | - this.heat += 3F; | |
90 | + this.heat += 0.5F; | |
91 | 91 | } |
92 | 92 | } else { |
93 | 93 | this.heat = 1700; |
@@ -121,7 +121,7 @@ public class TileEntityPyrolysisTable extends TileEntity { | ||
121 | 121 | //var2 = true; |
122 | 122 | if (itemstackMaterial.itemID == materialItem.itemID && itemstackMaterial.getItemDamage() == materialItem.getItemDamage()) { |
123 | 123 | this.inItem(itemstackMaterial); |
124 | - if (materialItem.stackSize >= 1) { | |
124 | + if (materialItem.stackSize > 1) { | |
125 | 125 | this.invm.setInventorySlotContents(0, new ItemStack(materialItem.itemID, --materialItem.stackSize, materialItem.getItemDamage())); |
126 | 126 | } else { |
127 | 127 | this.invm.setInventorySlotContents(0, null); |
@@ -153,7 +153,7 @@ public class TileEntityPyrolysisTable extends TileEntity { | ||
153 | 153 | if (fuelItem != null) { |
154 | 154 | if (itemstackFuel.itemID == fuelItem.itemID && itemstackFuel.getItemDamage() == fuelItem.getItemDamage()) { |
155 | 155 | this.fuelRestTime = fuelList.get(itemstackFuel); |
156 | - if (fuelItem.stackSize >= 1) { | |
156 | + if (fuelItem.stackSize > 1) { | |
157 | 157 | this.invf.setInventorySlotContents(0, new ItemStack(fuelItem.itemID, --fuelItem.stackSize, fuelItem.getItemDamage())); |
158 | 158 | break; |
159 | 159 | } else { |
@@ -417,8 +417,8 @@ public class TileEntityPyrolysisTable extends TileEntity { | ||
417 | 417 | public boolean isInItemCheck(ItemStack key) { |
418 | 418 | ItemStack[] results = recipeList.get(key).clone(); |
419 | 419 | ItemStack[] containerResults = new ItemStack[this.invr.getSizeInventory()]; |
420 | - for (int i = 0; i < this.invr.getSizeInventory(); i++) { | |
421 | - containerResults[i] = this.invr.getStackInSlot(i); | |
420 | + for (int j = 0; j < this.invr.getSizeInventory(); j++) { | |
421 | + containerResults[j] = this.invr.getStackInSlot(j); | |
422 | 422 | } |
423 | 423 | |
424 | 424 | for (int i = 0; i < results.length; i++) { |
@@ -427,6 +427,7 @@ public class TileEntityPyrolysisTable extends TileEntity { | ||
427 | 427 | int var5 = results[i].stackSize; |
428 | 428 | for (int j = 0; j < containerResults.length; j++) { |
429 | 429 | if (containerResults[j] == null) { |
430 | + containerResults[j] = results[i]; | |
430 | 431 | results[i] = null; |
431 | 432 | break; |
432 | 433 | } else { |
@@ -436,6 +437,7 @@ public class TileEntityPyrolysisTable extends TileEntity { | ||
436 | 437 | int var7 = containerResults[j].getMaxStackSize(); |
437 | 438 | if (var1 == var2 && var3 == var4) { |
438 | 439 | if (var5 + var6 <= var7) { |
440 | + containerResults[j] = results[i]; | |
439 | 441 | results[i] = null; |
440 | 442 | break; |
441 | 443 | } else { |
@@ -455,12 +457,12 @@ public class TileEntityPyrolysisTable extends TileEntity { | ||
455 | 457 | |
456 | 458 | public void inItem(ItemStack key) { |
457 | 459 | ItemStack[] results = recipeList.get(key); |
458 | - ItemStack[] containerResults = new ItemStack[this.invr.getSizeInventory()]; | |
459 | - for (int i = 0; i < this.invr.getSizeInventory(); i++) { | |
460 | - containerResults[i] = this.invr.getStackInSlot(i); | |
461 | - } | |
462 | 460 | |
463 | 461 | for (int i = 0; i < results.length; i++) { |
462 | + ItemStack[] containerResults = new ItemStack[this.invr.getSizeInventory()]; | |
463 | + for (int j = 0; j < this.invr.getSizeInventory(); j++) { | |
464 | + containerResults[j] = this.invr.getStackInSlot(j); | |
465 | + } | |
464 | 466 | int var1 = results[i].itemID; |
465 | 467 | int var3 = results[i].getItemDamage(); |
466 | 468 | int var5 = results[i].stackSize; |
@@ -475,11 +477,6 @@ public class TileEntityPyrolysisTable extends TileEntity { | ||
475 | 477 | int var7 = containerResults[j].getMaxStackSize(); |
476 | 478 | if (var1 == var2 && var3 == var4) { |
477 | 479 | if (var5 + var6 <= var7) { |
478 | - System.out.println(var5); | |
479 | - System.out.println(var6); | |
480 | - System.out.println(var5 + var6); | |
481 | - System.out.println(i); | |
482 | - System.out.println(j); | |
483 | 480 | this.invr.setInventorySlotContents(j, new ItemStack(results[i].itemID, var5 + var6, results[i].getItemDamage())); |
484 | 481 | break; |
485 | 482 | } else { |
@@ -3,11 +3,16 @@ package chemicraft.tileentity; | ||
3 | 3 | import java.io.DataOutputStream; |
4 | 4 | |
5 | 5 | import net.minecraft.tileentity.TileEntity; |
6 | +import chemicraft.inventory.InventoryToolAndWeaponCraftingTableMaterial; | |
7 | +import chemicraft.inventory.InventoryToolAndWeaponCraftingTableResult; | |
6 | 8 | |
7 | 9 | import com.google.common.io.ByteArrayDataInput; |
8 | 10 | |
9 | 11 | public class TileEntityToolAndWeaponCraftingTable extends TileEntity { |
10 | 12 | |
13 | + public InventoryToolAndWeaponCraftingTableMaterial invm = new InventoryToolAndWeaponCraftingTableMaterial(); | |
14 | + public InventoryToolAndWeaponCraftingTableResult invr = new InventoryToolAndWeaponCraftingTableResult(); | |
15 | + | |
11 | 16 | public void readPacket(ByteArrayDataInput data) { |
12 | 17 | try { |
13 | 18 | } catch (Exception e) { |