Gui/Container over haul to get Bus Guis working.

This commit is contained in:
AlgorithmX2
2014-01-01 02:57:16 -06:00
parent 2a4e4c0369
commit 6b37ef8847
10 changed files with 241 additions and 99 deletions
+6 -50
View File
@@ -3,7 +3,6 @@ package appeng.container.slot;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import appeng.util.Platform;
public class SlotFake extends AppEngSlot
{
@@ -15,40 +14,6 @@ public class SlotFake extends AppEngSlot
invSlot = idx;
}
public boolean isEnabled()
{
return true;
}
public void addToInv(ItemStack is)
{
if ( is != null )
{
ItemStack current = this.inventory.getStackInSlot( invSlot );
if ( current != null && Platform.isSameItem( current, is ) )
{
current.stackSize += is.stackSize;
if ( current.stackSize > inventory.getInventoryStackLimit() )
current.stackSize = inventory.getInventoryStackLimit();
}
else
{
current = is.copy();
if ( current.stackSize > inventory.getInventoryStackLimit() )
current.stackSize = inventory.getInventoryStackLimit();
this.inventory.setInventorySlotContents( invSlot, current );
}
}
else
{
this.inventory.setInventorySlotContents( invSlot, null );
}
}
@Override
public boolean canTakeStack(EntityPlayer par1EntityPlayer)
{
@@ -58,18 +23,6 @@ public class SlotFake extends AppEngSlot
@Override
public ItemStack decrStackSize(int par1)
{
ItemStack current = this.inventory.getStackInSlot( invSlot );
if ( current != null )
{
current.stackSize--;
if ( current.stackSize <= 0 )
{
this.inventory.setInventorySlotContents( invSlot, null );
}
}
return null;
}
@@ -79,15 +32,18 @@ public class SlotFake extends AppEngSlot
}
@Override
public void putStack(ItemStack par1ItemStack)
public void putStack(ItemStack is)
{
this.inventory.setInventorySlotContents( invSlot, par1ItemStack );
if ( is != null )
is = is.copy();
super.putStack( is );
}
@Override
public boolean isItemValid(ItemStack par1ItemStack)
{
return true;
return false;
}
}