package extracells.container;

import extracells.part.PartFluidLevelEmitter;
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;

public class ContainerFluidEmitter extends Container {

    PartFluidLevelEmitter part;
    EntityPlayer player;

    public ContainerFluidEmitter(PartFluidLevelEmitter _part, EntityPlayer _player) {
        super();
        part = _part;
        player = _player;
        bindPlayerInventory(player.inventory);
    }

    protected void bindPlayerInventory(IInventory inventoryPlayer) {
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 9; j++) {
                addSlotToContainer(new Slot(inventoryPlayer, j + i * 9 + 9, 8 + j * 18, i * 18 + 84));
            }
        }

        for (int i = 0; i < 9; i++) {
            addSlotToContainer(new Slot(inventoryPlayer, i, 8 + i * 18, 142));
        }
    }

    @Override
    public ItemStack transferStackInSlot(EntityPlayer player, int slotnumber) {
        ItemStack itemstack = null;
        Slot slot = (Slot) inventorySlots.get(slotnumber);
        if (slot != null && slot.getHasStack()) {
            ItemStack itemstack1 = slot.getStack();
            itemstack = itemstack1.copy();
            itemstack.stackSize = 1;
            if (true)//tileentity.isItemValidForSlot(0, itemstack1))
            {
                if (slotnumber == 0) {
                    ((Slot) inventorySlots.get(0)).putStack(null);
                    return null;
                } else if (slotnumber >= 1 && slotnumber <= 36) {
                    ((Slot) inventorySlots.get(0)).putStack(itemstack);
                    return null;
                }
            }
        }
        return null;
    }

    @Override
    public boolean canInteractWith(EntityPlayer entityplayer) {
        return true;
    }
}

@@ -66,24 +66,126 @@
 velEmitter;%0A
+import net.minecraftforge.fluids.FluidContainerRegistry;%0Aimport net.minecraftforge.fluids.FluidStack;%0A
 import net.m
@@ -1372,26 +1372,25 @@
 emStack 
-itemstack1
+fluidItem
  = slot.
@@ -1403,44 +1403,8 @@
 ck()
-;%0A            itemstack = itemstack1
 .cop
@@ -1420,25 +1420,25 @@
         
-itemstack
+fluidItem
 .stackSi
@@ -1461,189 +1461,126 @@
     
-if (true)//tileentity.isItemValidForSlot(0, itemstack1))%0A            %7B%0A                if (slotnumber == 0) %7B%0A                    ((Slot) inventorySlots.get(0)).put
+FluidStack fluidStack = FluidContainerRegistry.getFluidForFilledItem(fluidItem);%0A            if(fluid
 Stack
-(
+ == 
 null)
-;%0A    
+ %7B%0A
     
@@ -1620,198 +1620,93 @@
     
-    %7D else if (slotnumber %3E= 1 && slotnumber %3C= 36) %7B%0A                    ((Slot) inventorySlots.get(0)).putStack(itemstack);%0A                    return null;%0A                %7D%0A            %7D
+%7D%0A            part.setFluid(0,fluidStack.getFluid(),player);%0A            return null;
 %0A   

Fix #110