OSDN Git Service

競合確認
authormozipi <mozipi@users.sourceforge.jp>
Mon, 4 Feb 2013 09:16:07 +0000 (18:16 +0900)
committermozipi <mozipi@users.sourceforge.jp>
Mon, 4 Feb 2013 09:16:07 +0000 (18:16 +0900)
common/chemicraft/ChemiCraft.java
common/chemicraft/ChemiCraftAPI.java
common/chemicraft/compounds/CompoundDebug.java [new file with mode: 0644]
common/chemicraft/container/ContainerToolAndWeaponCraftingTable.java
common/chemicraft/tileentity/TileEntityPyrolysisTable.java
common/chemicraft/tileentity/TileEntityToolAndWeaponCraftingTable.java

index 231b97f..704344b 100644 (file)
@@ -2,6 +2,7 @@ package chemicraft;
 \r
 import net.minecraft.block.Block;\r
 import net.minecraft.block.material.Material;\r
+import net.minecraft.client.audio.SoundManager;\r
 import net.minecraft.creativetab.CreativeTabs;\r
 import net.minecraft.item.Item;\r
 import net.minecraft.item.ItemStack;\r
@@ -11,6 +12,7 @@ import chemicraft.block.BlockChemicalCombinationTable;
 import chemicraft.block.BlockChemicalCraftingTable;\r
 import chemicraft.block.BlockPyrolysisTable;\r
 import chemicraft.block.BlockToolAndWeaponCraftingTable;\r
+import chemicraft.compounds.CompoundDebug;\r
 import chemicraft.compounds.CompoundWater;\r
 import chemicraft.debug.CommandDeleteItem;\r
 import chemicraft.debug.CommandGenDebugRoom;\r
@@ -300,7 +302,6 @@ public class ChemiCraft {
                api.addLangCompound("ja_JP", "CarbonMonoxide", "一酸化炭素");\r
                api.addLangCompound("ja_JP", "CarbonDioxide", "二酸化炭素");\r
                api.addLangCompound("ja_JP", "Water", "水");\r
-               api.addCompound("Test");\r
 
 \r
                //化合物のHandlerを設定します\r
@@ -310,23 +311,30 @@ public class ChemiCraft {
                api.addChemicalCombinationRecipe(new String[]{"H", "O"}, new Integer[]{2, 1}, new ItemStack(this.itemCompounds, 1, api.getCompound("Water")));\r
 \r
                //手榴弾の追加\r
-               api.addMaterialRecipe(\r
-                               new ItemStack[]{\r
-                                               null,\r
-                                               new ItemStack(Block.stone),\r
-                                               null,\r
-                                               new ItemStack(Block.stone),\r
-                                               new ItemStack(Item.gunpowder),\r
-                                               new ItemStack(Block.stone),\r
-                                               null,\r
-                                               new ItemStack(Block.stone),\r
-                                               null\r
-                               },\r
-                               new ItemStack(this.itemAtomGrenade, 16, 0),\r
-                               new NBTRecipeGrenade()\r
+               api.addMaterialRecipe(new ItemStack[] {\r
+                               null,\r
+                               new ItemStack(Block.stone),\r
+                               null,\r
+                               new ItemStack(Block.stone),\r
+                               new ItemStack(Item.gunpowder),\r
+                               new ItemStack(Block.stone),\r
+                               null,\r
+                               new ItemStack(Block.stone),\r
+                               null\r
+               },\r
+               new ItemStack(this.itemAtomGrenade, 16, 0),\r
+               new NBTRecipeGrenade()\r
                                );\r
-               //Tickingの追加\r
-               this.proxy.registerTickHandler();\r
+\r
+               api.addDecompositionRecipe(new ItemStack(Item.potion, 1, 0),\r
+                               new int[] {ChemiCraftData.HYDROGEN, ChemiCraftData.OXYGEN},\r
+                               new int[] {2, 1});\r
+\r
+               api.addDecompositionRecipe(new ItemStack(this.itemCompounds, 1, api.getCompound("Water")),\r
+                               new int[] {ChemiCraftData.HYDROGEN, ChemiCraftData.OXYGEN},\r
+                               new int[] {2, 1});\r
+\r
+               api.addDecompositionFuel(new ItemStack(Item.coal), 2000*8);\r
        }\r
 \r
        private void apiProcessing(final FMLPostInitializationEvent event) {\r
@@ -338,6 +346,10 @@ public class ChemiCraft {
        }\r
 \r
        private void debug(final FMLPostInitializationEvent event) {\r
+               //DebugTickingの追加\r
+               this.proxy.registerTickHandler();\r
+               api.addCompound("Debug");\r
+               this.api.settingCompoundHandler("Debug", new CompoundDebug());\r
        }\r
 \r
 }\r
index b7b64e6..a538fed 100644 (file)
@@ -61,18 +61,6 @@ public class ChemiCraftAPI {
 
 
        /**
-        * 分解台の素材のリスト
-        */
-       private ArrayList<ItemStack> decompositionMaterial = new ArrayList<ItemStack>();
-
-
-       /**
-        * 分解台の結果のリスト
-        */
-       private ArrayList<ItemStack[]> decompositionResults = new ArrayList<ItemStack[]>();
-
-
-       /**
         * 化合台の原子の種類のリスト
         */
        private ArrayList<String[]> chemicalCombinationAtoms = new ArrayList<String[]>();
@@ -151,22 +139,6 @@ public class ChemiCraftAPI {
 
 
        /**
-        * 分解レシピを追加します。resultの要素数は0<= n <= 16にしてください。
-        * @param material 素材
-        * @param result 結果
-        */
-       public void addDecompositionRecipe(ItemStack material, ItemStack[] result){
-               if(result.length <= 16){
-                       decompositionMaterial.add(material);
-                       decompositionResults.add(result);
-               }else{
-                       System.err.println("ChemiCraft内でエラー:addDecompositionRecipeの引数resultの要素数が16を超えています。" + "Material:" + material + "  Result:" + result);
-               }
-       }
-
-
-
-       /**
         * 化合レシピを追加します。materialの要素数は0<= n <= 16にしてください。
         * @param material 素材
         * @param result 結果
@@ -182,14 +154,14 @@ public class ChemiCraftAPI {
        public void addDecompositionRecipe(ItemStack material, int[] results, int[] stacks) {
                ItemStack[] itemstacks = new ItemStack[results.length];
                for (int i = 0; i < itemstacks.length; i++) {
-                       itemstacks[i] = new ItemStack(ChemiCraft.instance.atomsID,stacks[i], results[i]);
+                       itemstacks[i] = new ItemStack(ChemiCraft.instance.itemAtoms,stacks[i], results[i]);
                }
                TileEntityPyrolysisTable.addRecipe(material, itemstacks);
        }
 
 
 
-       public void addDecompositionRecipe(ItemStack itemstack, int burnTime) {
+       public void addDecompositionFuel(ItemStack itemstack, int burnTime) {
                TileEntityPyrolysisTable.addFuel(itemstack, burnTime);
        }
 
@@ -242,18 +214,6 @@ public class ChemiCraftAPI {
 
 
 
-       public ArrayList<ItemStack> getDecompositionMaterial(){
-               return decompositionMaterial;
-       }
-
-
-
-       public ArrayList<ItemStack[]> getDecompositionResult(){
-               return decompositionResults;
-       }
-
-
-
        public ArrayList<String[]> getChemicalCombinationAtoms(){
                return chemicalCombinationAtoms;
        }
diff --git a/common/chemicraft/compounds/CompoundDebug.java b/common/chemicraft/compounds/CompoundDebug.java
new file mode 100644 (file)
index 0000000..9e5bf24
--- /dev/null
@@ -0,0 +1,45 @@
+package chemicraft.compounds;
+
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.projectile.EntityLargeFireball;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+import chemicraft.util.ICompoundHandler;
+
+public class CompoundDebug implements ICompoundHandler {
+
+       @Override
+       public ItemStack onItemRightClickHandler(ItemStack par1ItemStack,
+                       World par2World, EntityPlayer par3EntityPlayer) {
+               if (!par2World.isRemote) {
+                       double var1 = par3EntityPlayer.posX;
+                       double var2 = par3EntityPlayer.posY + 10;
+                       double var3 = par3EntityPlayer.posZ;
+                       double var4 = par3EntityPlayer.posX;
+                       double var5 = par3EntityPlayer.posY;
+                       double var6 = par3EntityPlayer.posZ;
+                       par2World.spawnEntityInWorld(new EntityLargeFireball(par2World, var1, var2, var3, var4, var5, var6));
+               }
+               return par1ItemStack;
+       }
+
+       @Override
+       public boolean onItemUseHandler(ItemStack par1ItemStack,
+                       EntityPlayer par2EntityPlayer, World par3World, int par4, int par5,
+                       int par6, int par7, float par8, float par9, float par10) {
+               return false;
+       }
+
+       @Override
+       public void onUpdateHandler(ItemStack par1ItemStack, World par2World,
+                       Entity par3Entity, int par4, boolean par5) {
+
+       }
+
+       @Override
+       public int getIconIndexHandler() {
+               return 0;
+       }
+
+}
index acadb79..b6b7c2c 100644 (file)
@@ -2,17 +2,56 @@ package chemicraft.container;
 
 import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.inventory.Container;
+import net.minecraft.inventory.Slot;
+import net.minecraft.world.World;
+import chemicraft.slot.SlotToolAndWeaponCraftingTableResult;
 import chemicraft.tileentity.TileEntityToolAndWeaponCraftingTable;
 
 public class ContainerToolAndWeaponCraftingTable extends Container {
 
+       private World worldobj;
+
+       private int posX;
+       private int posY;
+       private int posZ;
+
+       private TileEntityToolAndWeaponCraftingTable tileentity;
+
        public ContainerToolAndWeaponCraftingTable(EntityPlayer par1EntityPlayer, TileEntityToolAndWeaponCraftingTable par2){
                super();
+               this.tileentity = par2;
+               this.worldobj = this.tileentity.worldObj;
+               this.posX = this.tileentity.xCoord;
+               this.posY = this.tileentity.yCoord;
+               this.posZ = this.tileentity.zCoord;
+
+               for (int i = 0; i < 3; i++) {
+                       for (int j = 0; j < 3; j++) {
+                               this.addSlotToContainer(new Slot(this.tileentity.invm, i * 3 + i, 30 + i * 18, 17 + j * 18));
+                       }
+               }
+
+               this.addSlotToContainer(new SlotToolAndWeaponCraftingTableResult(this.tileentity.invr, 0, 125, 36));
+
+               int var3;
+               for (var3 = 0; var3 < 3; ++var3)
+               {
+                       for (int var4 = 0; var4 < 9; ++var4)
+                       {
+                               this.addSlotToContainer(new Slot(par1EntityPlayer.inventory, var4 + var3 * 9 + 9, 8 + var4 * 18, 85 + var3 * 18));
+                       }
+               }
+
+               for (var3 = 0; var3 < 9; ++var3)
+               {
+                       this.addSlotToContainer(new Slot(par1EntityPlayer.inventory, var3, 8 + var3 * 18, 143));
+               }
+
        }
 
        @Override
        public boolean canInteractWith(EntityPlayer var1) {
-               return false;
+               return true;
        }
 
 }
index 02b592d..9a451cb 100644 (file)
@@ -87,7 +87,7 @@ public class TileEntityPyrolysisTable extends TileEntity {
                                } else if (this.worldObj.isThundering() && var1) {
                                        this.heat += 0.25F;
                                } else {
-                                       this.heat += 3F;
+                                       this.heat += 0.5F;
                                }
                        } else {
                                this.heat = 1700;
@@ -121,7 +121,7 @@ public class TileEntityPyrolysisTable extends TileEntity {
                                                //var2 = true;
                                                if (itemstackMaterial.itemID == materialItem.itemID && itemstackMaterial.getItemDamage() == materialItem.getItemDamage()) {
                                                        this.inItem(itemstackMaterial);
-                                                       if (materialItem.stackSize >= 1) {
+                                                       if (materialItem.stackSize > 1) {
                                                                this.invm.setInventorySlotContents(0, new ItemStack(materialItem.itemID, --materialItem.stackSize, materialItem.getItemDamage()));
                                                        } else {
                                                                this.invm.setInventorySlotContents(0, null);
@@ -153,7 +153,7 @@ public class TileEntityPyrolysisTable extends TileEntity {
                                                                        if (fuelItem != null) {
                                                                                if (itemstackFuel.itemID == fuelItem.itemID && itemstackFuel.getItemDamage() == fuelItem.getItemDamage()) {
                                                                                        this.fuelRestTime = fuelList.get(itemstackFuel);
-                                                                                       if (fuelItem.stackSize >= 1) {
+                                                                                       if (fuelItem.stackSize > 1) {
                                                                                                this.invf.setInventorySlotContents(0, new ItemStack(fuelItem.itemID, --fuelItem.stackSize, fuelItem.getItemDamage()));
                                                                                                break;
                                                                                        } else {
@@ -417,8 +417,8 @@ public class TileEntityPyrolysisTable extends TileEntity {
        public boolean isInItemCheck(ItemStack key) {
                ItemStack[] results = recipeList.get(key).clone();
                ItemStack[] containerResults = new ItemStack[this.invr.getSizeInventory()];
-               for (int i = 0; i < this.invr.getSizeInventory(); i++) {
-                       containerResults[i] = this.invr.getStackInSlot(i);
+               for (int j = 0; j < this.invr.getSizeInventory(); j++) {
+                       containerResults[j] = this.invr.getStackInSlot(j);
                }
 
                for (int i = 0; i < results.length; i++) {
@@ -427,6 +427,7 @@ public class TileEntityPyrolysisTable extends TileEntity {
                        int var5 = results[i].stackSize;
                        for (int j = 0; j < containerResults.length; j++) {
                                if (containerResults[j] == null) {
+                                       containerResults[j] = results[i];
                                        results[i] = null;
                                        break;
                                } else {
@@ -436,6 +437,7 @@ public class TileEntityPyrolysisTable extends TileEntity {
                                        int var7 = containerResults[j].getMaxStackSize();
                                        if (var1 == var2 && var3 == var4) {
                                                if (var5 + var6 <= var7) {
+                                                       containerResults[j] = results[i];
                                                        results[i] = null;
                                                        break;
                                                } else {
@@ -455,12 +457,12 @@ public class TileEntityPyrolysisTable extends TileEntity {
 
        public void inItem(ItemStack key) {
                ItemStack[] results = recipeList.get(key);
-               ItemStack[] containerResults = new ItemStack[this.invr.getSizeInventory()];
-               for (int i = 0; i < this.invr.getSizeInventory(); i++) {
-                       containerResults[i] = this.invr.getStackInSlot(i);
-               }
 
                for (int i = 0; i < results.length; i++) {
+                       ItemStack[] containerResults = new ItemStack[this.invr.getSizeInventory()];
+                       for (int j = 0; j < this.invr.getSizeInventory(); j++) {
+                               containerResults[j] = this.invr.getStackInSlot(j);
+                       }
                        int var1 = results[i].itemID;
                        int var3 = results[i].getItemDamage();
                        int var5 = results[i].stackSize;
@@ -475,11 +477,6 @@ public class TileEntityPyrolysisTable extends TileEntity {
                                        int var7 = containerResults[j].getMaxStackSize();
                                        if (var1 == var2 && var3 == var4) {
                                                if (var5 + var6 <= var7) {
-                                                       System.out.println(var5);
-                                                       System.out.println(var6);
-                                                       System.out.println(var5 + var6);
-                                                       System.out.println(i);
-                                                       System.out.println(j);
                                                        this.invr.setInventorySlotContents(j, new ItemStack(results[i].itemID, var5 + var6, results[i].getItemDamage()));
                                                        break;
                                                } else {
index 44bc07e..32d3adc 100644 (file)
@@ -3,11 +3,16 @@ package chemicraft.tileentity;
 import java.io.DataOutputStream;
 
 import net.minecraft.tileentity.TileEntity;
+import chemicraft.inventory.InventoryToolAndWeaponCraftingTableMaterial;
+import chemicraft.inventory.InventoryToolAndWeaponCraftingTableResult;
 
 import com.google.common.io.ByteArrayDataInput;
 
 public class TileEntityToolAndWeaponCraftingTable extends TileEntity {
 
+       public InventoryToolAndWeaponCraftingTableMaterial invm = new InventoryToolAndWeaponCraftingTableMaterial();
+       public InventoryToolAndWeaponCraftingTableResult invr = new InventoryToolAndWeaponCraftingTableResult();
+
        public void readPacket(ByteArrayDataInput data) {
                try {
                } catch (Exception e) {