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;
}
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;
}
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)));
}
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;
}
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;
}
Aggregations