OSDN Git Service

化合台Texturepush
authormozipi <mozipi@users.sourceforge.jp>
Wed, 2 Jan 2013 16:15:27 +0000 (01:15 +0900)
committermozipi <mozipi@users.sourceforge.jp>
Wed, 2 Jan 2013 16:15:27 +0000 (01:15 +0900)
common/chemicraft/container/ContainerDecompositionTable.java
common/chemicraft/inventory/InventoryDecompositionTableResult.java
common/chemicraft/system/ChemiCraftCraftingManager.java
common/chemicraft/tileentity/TileEntityChemicalCombinationTable.java
common/chemicraft/tileentity/TileEntityDecompositionTable.java
resources/chemicraft/guis/ChemicalCombination.png

index b2bd54e..746fabe 100644 (file)
@@ -2,17 +2,29 @@ package chemicraft.container;
 
 import net.minecraft.src.Container;
 import net.minecraft.src.EntityPlayer;
+import net.minecraft.src.World;
+import chemicraft.ChemiCraft;
 import chemicraft.tileentity.TileEntityDecompositionTable;
 
 public class ContainerDecompositionTable extends Container {
 
+       private World worldObj;
+
+       private int posX;
+       private int posY;
+       private int posZ;
+
        public ContainerDecompositionTable(EntityPlayer par1EntityPlayer, TileEntityDecompositionTable par2){
                super();
+               this.worldObj = par2.worldObj;
+               this.posX = par2.xCoord;
+               this.posY = par2.yCoord;
+               this.posZ = par2.zCoord;
        }
 
        @Override
-       public boolean canInteractWith(EntityPlayer var1) {
-               return false;
+       public boolean canInteractWith(EntityPlayer par1EntityPlayer) {
+               return this.worldObj.getBlockId(this.posX, this.posY, this.posZ) != ChemiCraft.instance.decompositionTableID ? false : par1EntityPlayer.getDistanceSq((double)this.posX + 0.5D, (double)this.posY + 0.5D, (double)this.posZ + 0.5D) <= 64.0D;
        }
 
 }
index c63192b..bb17ff3 100644 (file)
@@ -94,7 +94,6 @@ public class InventoryDecompositionTableResult implements IInventory {
 
        @Override
        public void onInventoryChanged() {
-               if(this.eventHandler != null) this.eventHandler.onCraftMatrixChanged(this);
        }
 
        @Override
index c4a96f2..5af5155 100644 (file)
@@ -14,51 +14,6 @@ import chemicraft.util.FormulaPart;
 public class ChemiCraftCraftingManager {
 
        public ItemStack[] getDecompositionResults(IInventory par1IInventory){
-               //Setting to Flag.
-               /*
-                * Commented by mozipi.
-               ((InventoryDecomposition)par1IInventory).setFlag(false);
-                */
-
-               //variable of results.
-               ItemStack[] results = null;
-
-               //Just loop of amount of added recipe.
-               for(int i1 = 0;i1 < ChemiCraftAPI.getInstance().getDecompositionMaterial().size();i1++){
-                       //Check of null of the Material Slot.
-                       if(par1IInventory.getStackInSlot(16) == null){ this.clearResults(par1IInventory, 16); return new ItemStack[16];}
-                       //Recipe the match?
-                       boolean match = true;
-                       //Reset the results.
-                       results  = new ItemStack[ChemiCraftAPI.getInstance().getDecompositionResult().get(i1).length];
-                       //Recipe ID & Damage.
-                       //Material ID & Damage.
-                       int materialID = par1IInventory.getStackInSlot(16).itemID;
-                       int materialDamage = par1IInventory.getStackInSlot(16).getItemDamage();
-                       int recipeID = ChemiCraftAPI.getInstance().getDecompositionMaterial().get(i1).itemID;
-                       int recipeDamage = ChemiCraftAPI.getInstance().getDecompositionMaterial().get(i1).getItemDamage();
-
-                       //ID check.
-                       if(materialID != recipeID){ match = false;}
-                       //Damage check.
-                       if(materialDamage != recipeDamage){ match = false;}
-
-                       //if "match == true"
-                       if(match){
-                               //Just loop of recipe size of recipe index i1.
-                               for(int i = 0;i < ChemiCraftAPI.getInstance().getDecompositionResult().get(i1).length;i++){
-                                       //Assignment to the results.
-                                       results[i] = new ItemStack(
-                                                       ChemiCraftAPI.getInstance().getDecompositionResult().get(i1)[i].itemID,
-                                                       ChemiCraftAPI.getInstance().getDecompositionResult().get(i1)[i].stackSize,
-                                                       ChemiCraftAPI.getInstance().getDecompositionResult().get(i1)[i].getItemDamage()
-                                                       );
-                               }
-                               //return the results.
-                               return results;
-                       }
-               }
-               //return the null.
                return null;
        }
 
@@ -67,25 +22,25 @@ public class ChemiCraftCraftingManager {
        public ItemStack getChemicalCombinationResult(ArrayList<String> atomsList, ArrayList<Integer> atomsAmountList){
                ChemiCraftAPI api = ChemiCraftAPI.getInstance();
                recipeSize :
-               for (int i = 0; i < api.getChemicalCombinationAtoms().size(); i++) {
-                       FormulaPart[] var1 = new FormulaPart[atomsList.size()];
-                       FormulaPart[] var2 = new FormulaPart[api.getChemicalCombinationAtoms().get(i).length];
-                       for (int j = 0; j < atomsList.size(); j++) {
-                               var1[j] = new FormulaPart(atomsList.get(j), atomsAmountList.get(j));
-                       }
-                       for (int j = 0; j < api.getChemicalCombinationAtoms().get(i).length; j++) {
-                               var2[j] = new FormulaPart(api.getChemicalCombinationAtoms().get(i)[j], api.getChemicalCombinationAmounts().get(i)[j]);
-                       }
-                       if (var1.length != var2.length) {
-                               continue recipeSize;
-                       }
-                       for (int j = 0; j < var1.length; j++) {
-                               if (!var1[j].equals(var2[j])) {
+                       for (int i = 0; i < api.getChemicalCombinationAtoms().size(); i++) {
+                               FormulaPart[] var1 = new FormulaPart[atomsList.size()];
+                               FormulaPart[] var2 = new FormulaPart[api.getChemicalCombinationAtoms().get(i).length];
+                               for (int j = 0; j < atomsList.size(); j++) {
+                                       var1[j] = new FormulaPart(atomsList.get(j), atomsAmountList.get(j));
+                               }
+                               for (int j = 0; j < api.getChemicalCombinationAtoms().get(i).length; j++) {
+                                       var2[j] = new FormulaPart(api.getChemicalCombinationAtoms().get(i)[j], api.getChemicalCombinationAmounts().get(i)[j]);
+                               }
+                               if (var1.length != var2.length) {
                                        continue recipeSize;
                                }
+                               for (int j = 0; j < var1.length; j++) {
+                                       if (!var1[j].equals(var2[j])) {
+                                               continue recipeSize;
+                                       }
+                               }
+                               return api.getChemicalCombinationResult().get(i);
                        }
-                       return api.getChemicalCombinationResult().get(i);
-               }
                return null;
        }
 
index d0d3607..1fe3c62 100644 (file)
@@ -154,7 +154,7 @@ public class TileEntityChemicalCombinationTable extends TileEntity {
 
                        ItemStack itemstack = new ItemStack(data.readInt(), data.readByte(), data.readInt());
                        if(itemstack.itemID != 0 && !this.worldObj.isRemote){
-                               this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.xCoord, this.yCoord, this.zCoord, itemstack));
+                               this.worldObj.spawnEntityInWorld(new EntityItem(this.worldObj, this.xCoord, this.yCoord + 1, this.zCoord, itemstack));
                        }
                        this.dropItems = null;
                } catch (Exception e) {
index abe1501..cb87c1f 100644 (file)
@@ -2,12 +2,29 @@ package chemicraft.tileentity;
 
 import java.io.DataOutputStream;
 
+import chemicraft.inventory.InventoryDecompositionTableMaterial;
+import chemicraft.inventory.InventoryDecompositionTableResult;
+
 import com.google.common.io.ByteArrayDataInput;
 
+import net.minecraft.src.NBTTagCompound;
 import net.minecraft.src.TileEntity;
 
 public class TileEntityDecompositionTable extends TileEntity {
 
+       private InventoryDecompositionTableMaterial invm = new InventoryDecompositionTableMaterial();
+       private InventoryDecompositionTableResult invr = new InventoryDecompositionTableResult();
+
+       @Override
+       public void readFromNBT(NBTTagCompound par1) {
+               super.readFromNBT(par1);
+       }
+
+       @Override
+       public void writeToNBT(NBTTagCompound par1) {
+               super.writeToNBT(par1);
+       }
+
        public void readPacket(ByteArrayDataInput data) {
                try {
                } catch (Exception e) {
@@ -23,4 +40,12 @@ public class TileEntityDecompositionTable extends TileEntity {
                }
        }
 
+       public InventoryDecompositionTableMaterial getInvMaterial() {
+               return this.invm;
+       }
+
+       public InventoryDecompositionTableResult getInvResult() {
+               return this.invr;
+       }
+
 }
index 72aa44d..4c235bc 100644 (file)
Binary files a/resources/chemicraft/guis/ChemicalCombination.png and b/resources/chemicraft/guis/ChemicalCombination.png differ