Mimic Vanilla behavior with shift clicking.

This commit is contained in:
AlgorithmX2 2014-08-28 11:32:53 -05:00
parent 4f9daaad08
commit 804164b3bf
7 changed files with 25 additions and 24 deletions

View file

@ -38,7 +38,6 @@ import appeng.client.render.BlockRenderInfo;
import appeng.client.render.WorldRender;
import appeng.client.texture.FlipableIcon;
import appeng.client.texture.MissingIcon;
import appeng.core.CommonHelper;
import appeng.core.features.AEFeature;
import appeng.core.features.AEFeatureHandler;
import appeng.core.features.IAEFeature;

View file

@ -669,6 +669,14 @@ public abstract class AEBaseContainer extends Container
protected void bindPlayerInventory(InventoryPlayer inventoryPlayer, int offset_x, int offset_y)
{
for (int i = 0; i < 9; i++)
{
if ( locked.contains( i ) )
addSlotToContainer( new SlotDisabled( inventoryPlayer, i, 8 + i * 18 + offset_x, 58 + offset_y ) );
else
addSlotToContainer( new SlotPlayerHotBar( inventoryPlayer, i, 8 + i * 18 + offset_x, 58 + offset_y ) );
}
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 9; j++)
@ -679,14 +687,6 @@ public abstract class AEBaseContainer extends Container
addSlotToContainer( new SlotPlayerInv( inventoryPlayer, j + i * 9 + 9, 8 + j * 18 + offset_x, offset_y + i * 18 ) );
}
}
for (int i = 0; i < 9; i++)
{
if ( locked.contains( i ) )
addSlotToContainer( new SlotDisabled( inventoryPlayer, i, 8 + i * 18 + offset_x, 58 + offset_y ) );
else
addSlotToContainer( new SlotPlayerHotBar( inventoryPlayer, i, 8 + i * 18 + offset_x, 58 + offset_y ) );
}
}
public ItemStack shiftStoreItem(ItemStack input)

View file

@ -2,7 +2,6 @@ package appeng.debug;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.LinkedList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;

View file

@ -491,7 +491,6 @@ public class CableBusContainer implements AEMultiTile, ICableBusContainer
public void onNeighborChanged()
{
TileEntity te = getTile();
hasRedstone = YesNo.UNDECIDED;
for (ForgeDirection s : ForgeDirection.values())

View file

@ -51,7 +51,7 @@ public abstract class InventoryAdaptor implements Iterable<ItemSlot>
if ( te instanceof EntityPlayer )
{
return new AdaptorIInventory( new AdaptorPlayerInventory( ((EntityPlayer) te).inventory ) );
return new AdaptorIInventory( new AdaptorPlayerInventory( ((EntityPlayer) te).inventory, false ) );
}
else if ( te instanceof ArrayList )
{

View file

@ -1,21 +1,24 @@
package appeng.util.inv;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
public class AdaptorPlayerInventory implements IInventory
{
private InventoryPlayer src;
private int min;
private int size;
private final IInventory src;
private final int min=0;
private final int size=36;
public AdaptorPlayerInventory(InventoryPlayer a) {
src = a;
min = 0; // a.getStartInventorySide( d );
size = 36; // a.getSizeInventorySide( d );
public AdaptorPlayerInventory(IInventory playerInv, boolean swap)
{
if ( swap )
src = new WrapperChainedInventory( new WrapperInventoryRange( playerInv, 9, size-9, false ), new WrapperInventoryRange( playerInv, 0, 9, false ) );
else
src = playerInv;
}
@Override

View file

@ -4,6 +4,8 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import com.google.common.collect.ImmutableList;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
@ -24,7 +26,7 @@ public class WrapperChainedInventory implements IInventory
private List<IInventory> l;
private HashMap<Integer, InvOffset> offsets;
public WrapperChainedInventory(IInventory ilist) {
public WrapperChainedInventory(IInventory... ilist) {
setInventory( ilist );
}
@ -67,10 +69,9 @@ public class WrapperChainedInventory implements IInventory
fullSize = offset;
}
public void setInventory(IInventory a)
public void setInventory(IInventory... a)
{
l = new ArrayList();
l.add( a );
l = ImmutableList.copyOf( a );
calculateSizes();
}