Search in sources :

Example 96 with ItemStack

use of net.minecraft.item.ItemStack in project LogisticsPipes by RS485.

the class AEInterfaceInventoryHandler method decrStackSize.

@Override
public ItemStack decrStackSize(int i, int j) {
    if (cached == null) {
        initCache();
    }
    Entry<ItemIdentifier, Integer> entry = cached.get(i);
    ItemStack extracted = getMultipleItems(entry.getKey(), j);
    entry.setValue(entry.getValue() - j);
    return extracted;
}
Also used : ItemIdentifier(logisticspipes.utils.item.ItemIdentifier) ItemStack(net.minecraft.item.ItemStack) IAEItemStack(appeng.api.storage.data.IAEItemStack)

Example 97 with ItemStack

use of net.minecraft.item.ItemStack in project LogisticsPipes by RS485.

the class LogisticsRoutingBoardRobot method handleItem.

public LPTravelingItemServer handleItem(LPTravelingItemServer arrivingItem) {
    if (robot.isDead) {
        return arrivingItem;
    }
    ITransactor trans = InventoryHelper.getTransactorFor(robot, ForgeDirection.UNKNOWN);
    ItemStack inserted = trans.add(arrivingItem.getItemIdentifierStack().makeNormalStack(), ForgeDirection.UNKNOWN, false);
    if (inserted.stackSize != arrivingItem.getItemIdentifierStack().getStackSize()) {
        acceptsItems = false;
        startTransport();
        return arrivingItem;
    }
    inserted = trans.add(arrivingItem.getItemIdentifierStack().makeNormalStack(), ForgeDirection.UNKNOWN, true);
    if (inserted.stackSize != arrivingItem.getItemIdentifierStack().getStackSize()) {
        throw new UnsupportedOperationException("" + trans);
    }
    items.add(arrivingItem);
    if (currentTarget == null) {
        currentTarget = findTarget();
        refreshRoutingTable();
    }
    ticksWithContent = 0;
    return null;
}
Also used : ItemStack(net.minecraft.item.ItemStack) ITransactor(logisticspipes.utils.transactor.ITransactor)

Example 98 with ItemStack

use of net.minecraft.item.ItemStack in project LogisticsPipes by RS485.

the class ChipCraftingRecipes method loadRecipes.

@Override
protected void loadRecipes(CraftingParts parts) {
    ItemStack logisticsBlockFrame = new ItemStack(LogisticsPipes.LogisticsSolidBlock, 1, LogisticsSolidBlock.LOGISTICS_BLOCK_FRAME);
    RecipeManager.craftingManager.addRecipe(new ItemStack(LogisticsPipes.LogisticsSolidBlock, 1, LogisticsSolidBlock.LOGISTICS_POWER_JUNCTION), CraftingDependency.Basic, new RecipeManager.RecipeLayout(" c ", "rfr", "ibi"), new RecipeManager.RecipeIndex('c', parts.getChipBasic()), new RecipeManager.RecipeIndex('i', "ingotIron"), new RecipeManager.RecipeIndex('r', "dustRedstone"), new RecipeManager.RecipeIndex('f', logisticsBlockFrame), new RecipeManager.RecipeIndex('b', Blocks.redstone_block));
    RecipeManager.craftingManager.addRecipe(new ItemStack(LogisticsPipes.LogisticsSolidBlock, 1, LogisticsSolidBlock.LOGISTICS_SECURITY_STATION), CraftingDependency.Basic, new RecipeManager.RecipeLayout(" g ", "rfr", "iri"), new RecipeManager.RecipeIndex('g', parts.getChipAdvanced()), new RecipeManager.RecipeIndex('r', "dustRedstone"), new RecipeManager.RecipeIndex('f', logisticsBlockFrame), new RecipeManager.RecipeIndex('i', "ingotIron"));
    RecipeManager.craftingManager.addRecipe(new ItemStack(LogisticsPipes.LogisticsSolidBlock, 1, LogisticsSolidBlock.LOGISTICS_STATISTICS_TABLE), CraftingDependency.Basic, new RecipeManager.RecipeLayout(" g ", "rfr", " i "), new RecipeManager.RecipeIndex('g', parts.getChipAdvanced()), new RecipeManager.RecipeIndex('r', "dustRedstone"), new RecipeManager.RecipeIndex('f', logisticsBlockFrame), new RecipeManager.RecipeIndex('i', "ingotIron"));
    RecipeManager.craftingManager.addRecipe(new ItemStack(LogisticsPipes.LogisticsSolidBlock, 1, LogisticsSolidBlock.LOGISTICS_FUZZYCRAFTING_TABLE), CraftingDependency.Basic, new RecipeManager.RecipeLayoutSmall("c", "t"), new RecipeManager.RecipeIndex('c', parts.getChipBasic()), new RecipeManager.RecipeIndex('t', new ItemStack(LogisticsPipes.LogisticsSolidBlock, 1, LogisticsSolidBlock.LOGISTICS_AUTOCRAFTING_TABLE)));
    RecipeManager.craftingManager.addRecipe(new ItemStack(LogisticsPipes.logisticsRequestTable), CraftingDependency.Basic, new RecipeManager.RecipeLayout(" c ", "rfp", " k "), new RecipeManager.RecipeIndex('c', parts.getChipAdvanced()), new RecipeManager.RecipeIndex('r', LogisticsPipes.LogisticsRequestPipeMk2), new RecipeManager.RecipeIndex('f', new ItemStack(LogisticsPipes.LogisticsSolidBlock, 1, LogisticsSolidBlock.LOGISTICS_BLOCK_FRAME)), new RecipeManager.RecipeIndex('k', Blocks.chest), new RecipeManager.RecipeIndex('p', LogisticsPipes.LogisticsCraftingPipeMk1));
    RecipeManager.craftingManager.addRecipe(new ItemStack(LogisticsPipes.LogisticsBasicPipe), CraftingDependency.Basic, new RecipeManager.RecipeLayoutSmall("f", "p"), new RecipeManager.RecipeIndex('f', parts.getChipFpga()), new RecipeManager.RecipeIndex('p', new ItemStack(LogisticsPipes.BasicTransportPipe)));
}
Also used : ItemStack(net.minecraft.item.ItemStack)

Example 99 with ItemStack

use of net.minecraft.item.ItemStack in project LogisticsPipes by RS485.

the class DSUInventoryHandler method getMultipleItems.

@Override
public ItemStack getMultipleItems(ItemIdentifier itemIdent, int count) {
    ItemStack items = _tile.getStoredItemType();
    if (items == null || !ItemIdentifier.get(items).equals(itemIdent)) {
        return null;
    }
    if (_hideOnePerStack) {
        items.stackSize--;
    }
    if (count >= items.stackSize) {
        _tile.setStoredItemCount((_hideOnePerStack ? 1 : 0));
        return items;
    }
    ItemStack newItems = items.splitStack(count);
    _tile.setStoredItemCount(items.stackSize + (_hideOnePerStack ? 1 : 0));
    return newItems;
}
Also used : ItemStack(net.minecraft.item.ItemStack)

Example 100 with ItemStack

use of net.minecraft.item.ItemStack in project LogisticsPipes by RS485.

the class DSUInventoryHandler method getItemsAndCount.

@Override
public HashMap<ItemIdentifier, Integer> getItemsAndCount() {
    HashMap<ItemIdentifier, Integer> result = new HashMap<>();
    ItemStack items = _tile.getStoredItemType();
    if (items != null && items.stackSize > 0) {
        result.put(ItemIdentifier.get(items), items.stackSize - (_hideOnePerStack ? 1 : 0));
    }
    return result;
}
Also used : ItemIdentifier(logisticspipes.utils.item.ItemIdentifier) HashMap(java.util.HashMap) ItemStack(net.minecraft.item.ItemStack)

Aggregations

ItemStack (net.minecraft.item.ItemStack)9052 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)941 ArrayList (java.util.ArrayList)733 TileEntity (net.minecraft.tileentity.TileEntity)555 BlockPos (net.minecraft.util.math.BlockPos)551 EntityPlayer (net.minecraft.entity.player.EntityPlayer)526 IBlockState (net.minecraft.block.state.IBlockState)505 Block (net.minecraft.block.Block)494 Item (net.minecraft.item.Item)465 Slot (net.minecraft.inventory.Slot)448 EntityItem (net.minecraft.entity.item.EntityItem)423 Nonnull (javax.annotation.Nonnull)356 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)330 FluidStack (net.minecraftforge.fluids.FluidStack)289 NBTTagList (net.minecraft.nbt.NBTTagList)280 World (net.minecraft.world.World)277 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)269 ResourceLocation (net.minecraft.util.ResourceLocation)260 List (java.util.List)223 EnumFacing (net.minecraft.util.EnumFacing)208