OSDN Git Service

修正・変更
[chemicraft/chemicraft.git] / common / pcc / chemicraft / container / ContainerElectrolysisTable.java
index 493692d..a1b9369 100644 (file)
@@ -1,8 +1,13 @@
 package pcc.chemicraft.container;
 
+import java.util.ArrayList;
+import java.util.Iterator;
+
 import net.minecraft.entity.player.EntityPlayer;
 import net.minecraft.inventory.Container;
+import net.minecraft.inventory.IInventory;
 import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
 import net.minecraft.world.World;
 import pcc.chemicraft.ChemiCraft;
 import pcc.chemicraft.inventory.InventoryElectrolysisFuel;
@@ -72,4 +77,39 @@ public class ContainerElectrolysisTable extends Container {
                return this.worldObj.getBlockId(this.posX, this.posY, this.posZ) != ChemiCraft.instance.electrolysisTableID ? false : par1EntityPlayer.getDistanceSq((double) this.posX + 0.5D, (double) this.posY + 0.5D, (double) this.posZ + 0.5D) <= 64.0D;
        }
 
+       @Override
+       public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
+       {
+               ItemStack var3 = null;
+               Slot var4 = (Slot)this.inventorySlots.get(par2);
+
+               if (var4 != null && var4.getHasStack())
+               {
+                       ItemStack var5 = var4.getStack();
+                       var3 = var5.copy();
+
+                       if (par2 < 18 ){
+                               if (!this.mergeItemStack(var5, 18, this.inventorySlots.size(), true))
+                               {
+                                       return null;
+                               }
+                       }
+                       else if (!this.mergeItemStack(var5, 16, 18, false))
+                       {
+                               return null;
+                       }
+
+                       if (var5.stackSize == 0)
+                       {
+                               var4.putStack((ItemStack)null);
+                       }
+                       else
+                       {
+                               var4.onSlotChanged();
+                       }
+               }
+
+               return var3;
+       }
+
 }