Search in sources :

Example 1 with PipeItemsCraftingLogistics

use of logisticspipes.pipes.PipeItemsCraftingLogistics in project LogisticsPipes by RS485.

the class CraftingPipeSign method render.

@Override
@SideOnly(Side.CLIENT)
public void render(CoreRoutedPipe pipe, LogisticsRenderPipe renderer) {
    PipeItemsCraftingLogistics cpipe = (PipeItemsCraftingLogistics) pipe;
    FontRenderer var17 = renderer.func_147498_b();
    if (cpipe != null) {
        List<ItemIdentifierStack> craftables = cpipe.getCraftedItems();
        String name = "";
        if (craftables != null && craftables.size() > 0) {
            ItemStack itemstack = craftables.get(0).unsafeMakeNormalStack();
            renderer.renderItemStackOnSign(itemstack);
            Item item = itemstack.getItem();
            GL11.glDepthMask(false);
            GL11.glRotatef(-180.0F, 1.0F, 0.0F, 0.0F);
            GL11.glTranslatef(0.5F, +0.08F, 0.0F);
            GL11.glScalef(1.0F / 90.0F, 1.0F / 90.0F, 1.0F / 90.0F);
            try {
                name = item.getItemStackDisplayName(itemstack);
            } catch (Exception e) {
                try {
                    name = item.getUnlocalizedName();
                } catch (Exception e1) {
                }
            }
            var17.drawString("ID: " + String.valueOf(Item.getIdFromItem(item)), -var17.getStringWidth("ID: " + String.valueOf(Item.getIdFromItem(item))) / 2, 0 * 10 - 4 * 5, 0);
            ModuleCrafter logisticsMod = cpipe.getLogisticsModule();
            if (logisticsMod.satelliteId != 0) {
                var17.drawString("Sat ID: " + String.valueOf(logisticsMod.satelliteId), -var17.getStringWidth("Sat ID: " + String.valueOf(logisticsMod.satelliteId)) / 2, 1 * 10 - 4 * 5, 0);
            }
        } else {
            GL11.glRotatef(-180.0F, 1.0F, 0.0F, 0.0F);
            GL11.glTranslatef(0.5F, +0.08F, 0.0F);
            GL11.glScalef(1.0F / 90.0F, 1.0F / 90.0F, 1.0F / 90.0F);
            name = "Empty";
        }
        name = renderer.cut(name, var17);
        var17.drawString(name, -var17.getStringWidth(name) / 2 - 15, 3 * 10 - 4 * 5, 0);
        GL11.glDepthMask(true);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    }
}
Also used : PipeItemsCraftingLogistics(logisticspipes.pipes.PipeItemsCraftingLogistics) Item(net.minecraft.item.Item) FontRenderer(net.minecraft.client.gui.FontRenderer) ItemIdentifierStack(logisticspipes.utils.item.ItemIdentifierStack) ItemStack(net.minecraft.item.ItemStack) ModuleCrafter(logisticspipes.modules.ModuleCrafter) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 2 with PipeItemsCraftingLogistics

use of logisticspipes.pipes.PipeItemsCraftingLogistics in project LogisticsPipes by RS485.

the class LogisticsTriggerProvider method getInternalTriggers.

@Override
public Collection<ITriggerInternal> getInternalTriggers(IStatementContainer pipe) {
    if (pipe.getTile() instanceof LPBCTileGenericPipe) {
        LogisticsTileGenericPipe lPipe = ((LPBCTileGenericPipe) pipe.getTile()).getLpPipe();
        LinkedList<ITriggerInternal> triggers = new LinkedList<>();
        if (lPipe.pipe instanceof PipeItemsSupplierLogistics || lPipe.pipe instanceof PipeItemsFluidSupplier) {
            triggers.add(BuildCraftProxy.LogisticsFailedTrigger);
        }
        if (lPipe.pipe instanceof PipeItemsCraftingLogistics) {
            triggers.add(BuildCraftProxy.LogisticsCraftingTrigger);
        }
        if (lPipe.pipe instanceof CoreRoutedPipe) {
            //Only show this conditional on Gates that can accept parameters
            triggers.add(BuildCraftProxy.LogisticsHasDestinationTrigger);
        }
        if (!triggers.isEmpty()) {
            return triggers;
        }
    }
    return null;
}
Also used : PipeItemsCraftingLogistics(logisticspipes.pipes.PipeItemsCraftingLogistics) PipeItemsFluidSupplier(logisticspipes.pipes.PipeItemsFluidSupplier) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) PipeItemsSupplierLogistics(logisticspipes.pipes.PipeItemsSupplierLogistics) CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe) LPBCTileGenericPipe(logisticspipes.proxy.buildcraft.subproxies.LPBCTileGenericPipe) LinkedList(java.util.LinkedList) ITriggerInternal(buildcraft.api.statements.ITriggerInternal)

Example 3 with PipeItemsCraftingLogistics

use of logisticspipes.pipes.PipeItemsCraftingLogistics in project LogisticsPipes by RS485.

the class RequestRunningCraftingTasks method processPacket.

@Override
public void processPacket(EntityPlayer player) {
    LogisticsStatisticsTileEntity tile = this.getTile(player.getEntityWorld(), LogisticsStatisticsTileEntity.class);
    CoreRoutedPipe pipe = tile.getConnectedPipe();
    if (pipe == null) {
        return;
    }
    List<ItemIdentifierStack> items = new ArrayList<>();
    for (ExitRoute r : pipe.getRouter().getIRoutersByCost()) {
        if (r == null) {
            continue;
        }
        if (r.destination.getPipe() instanceof PipeItemsCraftingLogistics) {
            PipeItemsCraftingLogistics crafting = (PipeItemsCraftingLogistics) r.destination.getPipe();
            List<ItemIdentifierStack> content = crafting.getItemOrderManager().getContentList(player.getEntityWorld());
            items.addAll(content);
        }
    }
    MainProxy.sendPacketToPlayer(PacketHandler.getPacket(RunningCraftingTasks.class).setIdentList(items), player);
}
Also used : LogisticsStatisticsTileEntity(logisticspipes.blocks.stats.LogisticsStatisticsTileEntity) PipeItemsCraftingLogistics(logisticspipes.pipes.PipeItemsCraftingLogistics) ArrayList(java.util.ArrayList) CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe) ItemIdentifierStack(logisticspipes.utils.item.ItemIdentifierStack) ExitRoute(logisticspipes.routing.ExitRoute)

Example 4 with PipeItemsCraftingLogistics

use of logisticspipes.pipes.PipeItemsCraftingLogistics in project LogisticsPipes by RS485.

the class FindMostLikelyRecipeComponents method processPacket.

@Override
public void processPacket(EntityPlayer player) {
    TileEntity tile = this.getTile(player.getEntityWorld(), TileEntity.class);
    CoreRoutedPipe pipe = null;
    if (tile instanceof LogisticsCraftingTableTileEntity) {
        for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
            TileEntity conn = CoordinateUtils.add(((LogisticsCraftingTableTileEntity) tile).getLPPosition(), dir).getTileEntity(player.getEntityWorld());
            if (conn instanceof LogisticsTileGenericPipe) {
                if (((LogisticsTileGenericPipe) conn).pipe instanceof PipeItemsCraftingLogistics) {
                    pipe = (CoreRoutedPipe) ((LogisticsTileGenericPipe) conn).pipe;
                    break;
                }
            }
        }
    } else if (tile instanceof LogisticsTileGenericPipe) {
        if (((LogisticsTileGenericPipe) tile).pipe instanceof PipeBlockRequestTable) {
            pipe = (CoreRoutedPipe) ((LogisticsTileGenericPipe) tile).pipe;
        }
    }
    List<Integer> list = new ArrayList<Integer>(content.size());
    while (list.size() < content.size()) {
        list.add(-1);
    }
    if (pipe == null)
        return;
    LinkedList<ItemIdentifier> craftable = null;
    for (int j = 0; j < content.size(); j++) {
        GuiRecipeImport.Canidates canidates = content.get(j);
        int maxItemPos = -1;
        int max = 0;
        for (int i = 0; i < canidates.order.size(); i++) {
            ItemIdentifier ident = canidates.order.get(i).getItem();
            int newAmount = SimpleServiceLocator.logisticsManager.getAmountFor(ident, pipe.getRouter().getIRoutersByCost());
            if (newAmount > max) {
                max = newAmount;
                maxItemPos = i;
            }
        }
        if (max < 64) {
            if (craftable == null) {
                craftable = SimpleServiceLocator.logisticsManager.getCraftableItems(pipe.getRouter().getIRoutersByCost());
            }
            for (ItemIdentifier craft : craftable) {
                for (int i = 0; i < canidates.order.size(); i++) {
                    ItemIdentifier ident = canidates.order.get(i).getItem();
                    if (craft == ident) {
                        maxItemPos = i;
                        break;
                    }
                }
            }
        }
        list.set(j, maxItemPos);
    }
    MainProxy.sendPacketToPlayer(PacketHandler.getPacket(MostLikelyRecipeComponentsResponse.class).setResponse(list), player);
}
Also used : GuiRecipeImport(logisticspipes.gui.popup.GuiRecipeImport) PipeItemsCraftingLogistics(logisticspipes.pipes.PipeItemsCraftingLogistics) PipeBlockRequestTable(logisticspipes.pipes.PipeBlockRequestTable) ArrayList(java.util.ArrayList) CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe) TileEntity(net.minecraft.tileentity.TileEntity) LogisticsCraftingTableTileEntity(logisticspipes.blocks.crafting.LogisticsCraftingTableTileEntity) ItemIdentifier(logisticspipes.utils.item.ItemIdentifier) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) LogisticsCraftingTableTileEntity(logisticspipes.blocks.crafting.LogisticsCraftingTableTileEntity)

Example 5 with PipeItemsCraftingLogistics

use of logisticspipes.pipes.PipeItemsCraftingLogistics in project LogisticsPipes by RS485.

the class CraftingPipeSign method getRenderData.

@Override
public IPipeSignData getRenderData(CoreRoutedPipe pipe) {
    PipeItemsCraftingLogistics cpipe = (PipeItemsCraftingLogistics) pipe;
    if (cpipe != null) {
        List<ItemIdentifierStack> craftables = cpipe.getCraftedItems();
        if (craftables != null && craftables.size() > 0) {
            ItemIdentifierStack itemIdentifierStack = craftables.get(0);
            ModuleCrafter logisticsMod = cpipe.getLogisticsModule();
            return new CraftingPipeSignData(itemIdentifierStack, logisticsMod.satelliteId);
        } else {
            return new CraftingPipeSignData(null, -1);
        }
    }
    return null;
}
Also used : PipeItemsCraftingLogistics(logisticspipes.pipes.PipeItemsCraftingLogistics) ItemIdentifierStack(logisticspipes.utils.item.ItemIdentifierStack) ModuleCrafter(logisticspipes.modules.ModuleCrafter)

Aggregations

PipeItemsCraftingLogistics (logisticspipes.pipes.PipeItemsCraftingLogistics)5 CoreRoutedPipe (logisticspipes.pipes.basic.CoreRoutedPipe)3 ItemIdentifierStack (logisticspipes.utils.item.ItemIdentifierStack)3 ArrayList (java.util.ArrayList)2 ModuleCrafter (logisticspipes.modules.ModuleCrafter)2 LogisticsTileGenericPipe (logisticspipes.pipes.basic.LogisticsTileGenericPipe)2 ITriggerInternal (buildcraft.api.statements.ITriggerInternal)1 SideOnly (cpw.mods.fml.relauncher.SideOnly)1 LinkedList (java.util.LinkedList)1 LogisticsCraftingTableTileEntity (logisticspipes.blocks.crafting.LogisticsCraftingTableTileEntity)1 LogisticsStatisticsTileEntity (logisticspipes.blocks.stats.LogisticsStatisticsTileEntity)1 GuiRecipeImport (logisticspipes.gui.popup.GuiRecipeImport)1 PipeBlockRequestTable (logisticspipes.pipes.PipeBlockRequestTable)1 PipeItemsFluidSupplier (logisticspipes.pipes.PipeItemsFluidSupplier)1 PipeItemsSupplierLogistics (logisticspipes.pipes.PipeItemsSupplierLogistics)1 LPBCTileGenericPipe (logisticspipes.proxy.buildcraft.subproxies.LPBCTileGenericPipe)1 ExitRoute (logisticspipes.routing.ExitRoute)1 ItemIdentifier (logisticspipes.utils.item.ItemIdentifier)1 FontRenderer (net.minecraft.client.gui.FontRenderer)1 Item (net.minecraft.item.Item)1