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
+60 -5
View File
@@ -43,6 +43,11 @@ public abstract class AEBaseContainer extends Container
tileEntity = te;
}
public boolean canDragIntoSlot(Slot s)
{
return ((AppEngSlot) s).isDraggable;
}
public TileEntity getTileEntity()
{
return tileEntity;
@@ -298,6 +303,7 @@ public abstract class AEBaseContainer extends Container
private void updateSlot(Slot clickSlot)
{
// ???
detectAndSendChanges();
}
@@ -329,11 +335,60 @@ public abstract class AEBaseContainer extends Container
public void doAction(EntityPlayerMP player, InventoryAction action, int slot, IAEItemStack slotItem)
{
/*
* boolean isValidSlot = true;
*
* if ( slot < 0 || slot >= inventorySlots.size() ) isValidSlot = false;
*/
if ( slot >= 0 && slot < inventorySlots.size() )
{
Slot s = getSlot( slot );
if ( s instanceof SlotFake )
{
ItemStack hand = player.inventory.getItemStack();
switch (action)
{
case PICKUP_OR_SETDOWN:
if ( hand == null )
s.putStack( null );
else
s.putStack( hand.copy() );
break;
case SPLIT_OR_PLACESINGLE:
ItemStack is = s.getStack();
if ( is != null )
{
if ( hand == null )
is.stackSize--;
else if ( hand.isItemEqual( is ) )
is.stackSize = Math.min( is.getMaxStackSize(), is.stackSize + 1 );
else
{
is = hand.copy();
is.stackSize = 1;
}
s.putStack( is );
}
else if ( hand != null )
{
is = hand.copy();
is.stackSize = 1;
s.putStack( is );
}
break;
case CREATIVE_DUPLICATE:
case MOVE_REGION:
case SHIFT_CLICK:
default:
break;
}
}
return;
}
switch (action)
{