Search in sources :

Example 16 with ItemStackKey

use of gregtech.api.util.ItemStackKey in project GregTech by GregTechCE.

the class ItemListSlotWidget method handleClientAction.

@Override
public void handleClientAction(int id, PacketBuffer buffer) {
    super.handleClientAction(id, buffer);
    if (id == 1) {
        try {
            ItemStack itemStack = buffer.readItemStack();
            int button = buffer.readVarInt();
            IItemInfo itemInfo = itemStack.isEmpty() ? null : gridWidget.getItemList().getItemInfo(new ItemStackKey(itemStack));
            handleMouseClick(itemInfo, button, false);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    } else if (id == 2) {
        try {
            ItemStack itemStack = buffer.readItemStack();
            IItemInfo itemInfo = gridWidget.getItemList().getItemInfo(new ItemStackKey(itemStack));
            if (itemInfo != null) {
                handleSelfShiftClick(itemInfo);
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
Also used : IItemInfo(gregtech.common.inventory.IItemInfo) IOException(java.io.IOException) ItemStack(net.minecraft.item.ItemStack) ItemStackKey(gregtech.api.util.ItemStackKey)

Aggregations

ItemStackKey (gregtech.api.util.ItemStackKey)16 ItemStack (net.minecraft.item.ItemStack)10 SimpleItemInfo (gregtech.common.inventory.SimpleItemInfo)3 BlockInfo (gregtech.api.util.BlockInfo)2 IItemInfo (gregtech.common.inventory.IItemInfo)2 IOException (java.io.IOException)2 BlockPos (net.minecraft.util.math.BlockPos)2 TIntArrayList (gnu.trove.list.array.TIntArrayList)1 WorldSceneRenderer (gregtech.api.render.scene.WorldSceneRenderer)1 IItemList (gregtech.common.inventory.IItemList)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 IBlockState (net.minecraft.block.state.IBlockState)1 InventoryPlayer (net.minecraft.entity.player.InventoryPlayer)1 InventoryCrafting (net.minecraft.inventory.InventoryCrafting)1