Shift+Right Click.

This commit is contained in:
AlgorithmX2 2014-01-29 19:20:48 -06:00
parent bdc48457ec
commit b21af365cf
3 changed files with 37 additions and 2 deletions

View file

@ -107,7 +107,7 @@ public abstract class AEBaseGui extends GuiContainer
stack = ((SlotME) slot).getAEStack();
break;
case 1:
action = InventoryAction.SHIFT_CLICK;
action = ctrlDown == 1 ? InventoryAction.PICKUP_SINGLE : InventoryAction.SHIFT_CLICK;
stack = ((SlotME) slot).getAEStack();
break;

View file

@ -14,6 +14,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.SecurityPermissions;
import appeng.api.networking.IGrid;
import appeng.api.networking.IGridNode;
@ -38,6 +39,7 @@ import appeng.container.slot.SlotPlayerInv;
import appeng.helpers.InventoryAction;
import appeng.util.InventoryAdaptor;
import appeng.util.Platform;
import appeng.util.inv.AdaptorPlayerHand;
public abstract class AEBaseContainer extends Container
{
@ -505,6 +507,39 @@ public abstract class AEBaseContainer extends Container
adp.addItems( ais.getItemStack() );
}
break;
case PICKUP_SINGLE:
if ( powerSrc == null || cellInv == null )
return;
if ( slotItem != null )
{
int liftQty = 1;
ItemStack isg = player.inventory.getItemStack();
if ( isg != null )
{
if ( isg.stackSize >= isg.getMaxStackSize() )
liftQty = 0;
if ( !Platform.isSameItem( slotItem.getItemStack(), isg ) )
liftQty = 0;
}
if ( liftQty > 0 )
{
IAEItemStack ais = slotItem.copy();
ais.setStackSize( 1 );
ais = Platform.poweredExtraction( powerSrc, cellInv, ais, mySrc );
InventoryAdaptor ia = new AdaptorPlayerHand( player );
ItemStack fail = ia.addItems( ais.getItemStack() );
if ( fail != null )
cellInv.injectItems( ais, Actionable.MODULATE, mySrc );
player.updateHeldItem();
}
}
break;
case PICKUP_OR_SETDOWN:
if ( powerSrc == null || cellInv == null )
return;

View file

@ -6,5 +6,5 @@ public enum InventoryAction
PICKUP_OR_SETDOWN, SPLIT_OR_PLACESINGLE, CREATIVE_DUPLICATE, SHIFT_CLICK,
// extra...
MOVE_REGION
MOVE_REGION, PICKUP_SINGLE
}