Package pneumaticCraft.common.progwidgets

Examples of pneumaticCraft.common.progwidgets.IProgWidget


    }

    private void addProgWidgetTabs(int xStart, int yStart){
        List<IProgWidget> registeredWidgets = TileEntityProgrammer.registeredWidgets;
        for(int i = 0; i < registeredWidgets.size() / 2; i++) {
            IProgWidget widget = registeredWidgets.get(i);
            addAnimatedStat("programmingPuzzle." + widget.getWidgetString() + ".name", ItemProgrammingPuzzle.getStackForWidgetKey(widget.getWidgetString()), widget.getGuiTabColor(), true).setText(widget.getGuiTabText());
        }
        for(int i = registeredWidgets.size() / 2; i < registeredWidgets.size(); i++) {
            IProgWidget widget = registeredWidgets.get(i);
            addAnimatedStat("programmingPuzzle." + widget.getWidgetString() + ".name", ItemProgrammingPuzzle.getStackForWidgetKey(widget.getWidgetString()), widget.getGuiTabColor(), false).setText(widget.getGuiTabText());
        }
    }
View Full Code Here


        if(parameters != null) {
            for(IProgWidget widget : parameters) {
                if(widget != null && !isValidPlaced(widget)) return false;
            }
        }
        IProgWidget outputWidget = widget1.getOutputWidget();
        if(outputWidget != null && !isValidPlaced(outputWidget)) return false;
        return true;
    }
View Full Code Here

        //check for connection to the right of the dragged widget.
        Class<? extends IProgWidget>[] parameters = draggingWidget.getParameters();
        if(parameters != null) {
            for(IProgWidget widget : te.progWidgets) {
                IProgWidget outerPiece = draggingWidget;
                if(outerPiece.returnType() != null) {//When the piece is a parameter pice (area, item filter, text).
                    while(outerPiece.getConnectedParameters()[0] != null) {
                        outerPiece = outerPiece.getConnectedParameters()[0];
                    }
                }
                if(widget != draggingWidget && Math.abs(outerPiece.getX() + outerPiece.getWidth() / 2 - widget.getX()) <= FAULT_MARGIN) {
                    if(widget.returnType() != null) {
                        for(int i = 0; i < parameters.length; i++) {
                            if(parameters[i] == widget.returnType() && Math.abs(draggingWidget.getY() + i * 11 - widget.getY()) <= FAULT_MARGIN) {
                                setConnectingWidgetsToXY(draggingWidget, widget.getX() - draggingWidget.getWidth() / 2 - (outerPiece.getX() - draggingWidget.getX()), widget.getY() - i * 11);
                            }
                        }
                    } else {
                        Class<? extends IProgWidget>[] checkingPieceParms = widget.getParameters();
                        if(checkingPieceParms != null) {
                            for(int i = 0; i < checkingPieceParms.length; i++) {
                                if(checkingPieceParms[i] == parameters[0] && Math.abs(widget.getY() + i * 11 - draggingWidget.getY()) <= FAULT_MARGIN) {
                                    setConnectingWidgetsToXY(draggingWidget, widget.getX() - draggingWidget.getWidth() / 2 - (outerPiece.getX() - draggingWidget.getX()), widget.getY() + i * 11);
                                }
                            }
                        }
                    }
                }
View Full Code Here

                if(connectingWidgets[i] != null) {
                    if(i < connectingWidgets.length / 2) {
                        setConnectingWidgetsToXY(connectingWidgets[i], x + widget.getWidth() / 2, y + i * 11);
                    } else {
                        int totalWidth = 0;
                        IProgWidget branch = connectingWidgets[i];
                        while(branch != null) {
                            totalWidth += branch.getWidth() / 2;
                            branch = branch.getConnectedParameters()[0];
                        }
                        setConnectingWidgetsToXY(connectingWidgets[i], x - totalWidth, y + (i - connectingWidgets.length / 2) * 11);
                    }
                }
            }
        }
        IProgWidget outputWidget = widget.getOutputWidget();
        if(outputWidget != null) setConnectingWidgetsToXY(outputWidget, x, y + widget.getHeight() / 2);
    }
View Full Code Here

        if(connectingWidgets != null) {
            for(IProgWidget widg : connectingWidgets) {
                if(widg != null) deleteConnectingWidgets(widg);
            }
        }
        IProgWidget outputWidget = widget.getOutputWidget();
        if(outputWidget != null) deleteConnectingWidgets(outputWidget);
    }
View Full Code Here

        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glPopMatrix();
    }

    private void render(float x, float y, float z, float scale, ItemStack stack){
        IProgWidget widget = ItemProgrammingPuzzle.getWidgetForPiece(stack);
        if(widget == null) return;
        int width = widget.getWidth() + (widget.getParameters() != null && widget.getParameters().length > 0 ? 10 : 0);
        int height = widget.getHeight() + (widget.hasStepOutput() ? 5 : 0);

        GL11.glPushMatrix();
        GL11.glTranslated(x, y, z);
        // GL11.glDisable(GL11.GL_LIGHTING);
        //      GL11.glRotatef(-90F, 1F, 0, 0);
        // Scale, Translate, Rotate
        scale = scale / Math.max(height, width);
        GL11.glScalef(scale, scale, 1);
        GL11.glTranslatef(-width / 2, -height / 2, 0);
        //  GL11.glTranslatef(x, y, z);
        //GL11.glRotatef(-90F, 1F, 0, 0);

        widget.render();

        // GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glPopMatrix();
    }
View Full Code Here

        for(int i = 0; i < widgetTags.tagCount(); i++) {
            NBTTagCompound widgetTag = widgetTags.getCompoundTagAt(i);
            String widgetName = widgetTag.getString("name");
            for(IProgWidget widget : registeredWidgets) {
                if(widgetName.equals(widget.getWidgetString()) || widgetName.equals(widget.getLegacyString())) {//create the right progWidget for the given id tag.
                    IProgWidget addedWidget = widget.copy();
                    addedWidget.readFromNBT(widgetTag);
                    progWidgets.add(addedWidget);
                    break;
                }
            }
        }
View Full Code Here

                if(parameters != null) {
                    for(int i = 0; i < parameters.length; i++) {
                        for(IProgWidget widget : progWidgets) {
                            if(parameters[i] == widget.returnType()) {
                                if(widget != checkedWidget && widget.getX() + widget.getWidth() / 2 == checkedWidget.getX() && widget.getY() == checkedWidget.getY() + i * 11) {
                                    IProgWidget root = widget;
                                    while(root.getParent() != null) {
                                        root = root.getParent();
                                    }
                                    checkedWidget.setParameter(i + parameters.length, root);
                                }
                            }
                        }
View Full Code Here

                isExecuting = true;
                break;
            }
        }
        if(!isExecuting && curActiveWidget != null && (curWidgetTargetAI == null || !curWidgetTargetAI.shouldExecute())) {
            IProgWidget widget = curActiveWidget.getOutputWidget();
            if(widget != null) {
                setActiveWidget(widget);
            } else {
                if(cycleTimeCounter < MIN_CYCLE_TIME) {
                    if(curWidgetAI != null) removeTask(curWidgetAI);
View Full Code Here

TOP

Related Classes of pneumaticCraft.common.progwidgets.IProgWidget

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.