diff --git a/client/gui/AEBaseGui.java b/client/gui/AEBaseGui.java index b5a75f84..07919e74 100644 --- a/client/gui/AEBaseGui.java +++ b/client/gui/AEBaseGui.java @@ -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; diff --git a/container/AEBaseContainer.java b/container/AEBaseContainer.java index 6a334d7a..1071458a 100644 --- a/container/AEBaseContainer.java +++ b/container/AEBaseContainer.java @@ -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; diff --git a/helpers/InventoryAction.java b/helpers/InventoryAction.java index dfc7ea47..5ffd30c6 100644 --- a/helpers/InventoryAction.java +++ b/helpers/InventoryAction.java @@ -6,5 +6,5 @@ public enum InventoryAction PICKUP_OR_SETDOWN, SPLIT_OR_PLACESINGLE, CREATIVE_DUPLICATE, SHIFT_CLICK, // extra... - MOVE_REGION + MOVE_REGION, PICKUP_SINGLE }