Search in sources :

Example 6 with GuiContainer

use of net.minecraft.client.gui.inventory.GuiContainer in project LogisticsPipes by RS485.

the class LogisticsGuiOverrenderer method renderOverGui.

@SuppressWarnings("unchecked")
public void renderOverGui() {
    if (hasBeenSaved) {
        hasBeenSaved = false;
        // Resore Mouse Pos
        try {
            fX.set(null, oldX);
            fY.set(null, oldY);
        } catch (Exception e) {
            if (LPConstants.DEBUG) {
                e.printStackTrace();
            }
        }
    }
    if (isOverlaySlotActive) {
        GuiContainer gui = (GuiContainer) FMLClientHandler.instance().getClient().currentScreen;
        int guiTop = gui.guiTop;
        int guiLeft = gui.guiLeft;
        int x = oldX * gui.width / FMLClientHandler.instance().getClient().displayWidth;
        int y = gui.height - oldY * gui.height / FMLClientHandler.instance().getClient().displayHeight - 1;
        for (Slot slot : (List<Slot>) gui.inventorySlots.inventorySlots) {
            if (isMouseOverSlot(gui, slot, x, y)) {
                GL11.glDisable(GL11.GL_LIGHTING);
                GL11.glDisable(GL11.GL_DEPTH_TEST);
                GL11.glTranslated(guiLeft, guiTop, 0);
                int k1 = slot.xDisplayPosition;
                int i1 = slot.yDisplayPosition;
                SimpleGraphics.drawGradientRect(k1, i1, k1 + 16, i1 + 16, 0xa0ff0000, 0xa0ff0000, 0.0);
                GL11.glEnable(GL11.GL_LIGHTING);
                GL11.glEnable(GL11.GL_DEPTH_TEST);
                if (clicked) {
                    MainProxy.sendPacketToServer(PacketHandler.getPacket(SlotFinderNumberPacket.class).setInventorySlot(slot.slotNumber).setSlot(this.slot).setPipePosX(pipePosX).setPipePosY(pipePosY).setPipePosZ(pipePosZ).setType(positionType).setPositionInt(positionInt).setPosX(targetPosX).setPosY(targetPosY).setPosZ(targetPosZ));
                    clicked = false;
                    FMLClientHandler.instance().getClient().thePlayer.closeScreen();
                    isOverlaySlotActive = false;
                }
                break;
            }
        }
        clicked = false;
    }
}
Also used : SlotFinderNumberPacket(logisticspipes.network.packets.pipe.SlotFinderNumberPacket) Slot(net.minecraft.inventory.Slot) List(java.util.List) GuiContainer(net.minecraft.client.gui.inventory.GuiContainer)

Aggregations

GuiContainer (net.minecraft.client.gui.inventory.GuiContainer)6 SideOnly (cpw.mods.fml.relauncher.SideOnly)4 List (java.util.List)3 ArrayList (java.util.ArrayList)2 GuiScreen (net.minecraft.client.gui.GuiScreen)2 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 GuiContainerManager (codechicken.nei.guihook.GuiContainerManager)1 IContainerTooltipHandler (codechicken.nei.guihook.IContainerTooltipHandler)1 IAdvancedSilkyRemovable (com.bluepowermod.api.block.IAdvancedSilkyRemovable)1 ISilkyRemovable (com.bluepowermod.api.block.ISilkyRemovable)1 Side (cpw.mods.fml.relauncher.Side)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 Locale (java.util.Locale)1 Map (java.util.Map)1 LPConstants (logisticspipes.LPConstants)1