Search in sources :

Example 1 with ButtonSorter

use of blusunrize.immersiveengineering.client.gui.GuiSorter.ButtonSorter in project ImmersiveEngineering by BluSunrize.

the class GuiFluidSorter method drawScreen.

@Override
public void drawScreen(int mx, int my, float partial) {
    super.drawScreen(mx, my, partial);
    ArrayList<String> tooltip = new ArrayList<String>();
    for (GuiButton button : this.buttonList) {
        if (button instanceof ButtonSorter)
            if (mx > button.xPosition && mx < button.xPosition + 18 && my > button.yPosition && my < button.yPosition + 18) {
                int type = ((ButtonSorter) button).type;
                String[] split = I18n.format(Lib.DESC_INFO + "filter.nbt").split("<br>");
                for (int i = 0; i < split.length; i++) tooltip.add((i == 0 ? TextFormatting.WHITE : TextFormatting.GRAY) + split[i]);
            }
    }
    for (int side = 0; side < 6; side++) for (int i = 0; i < 8; i++) if (tile.filters[side][i] != null) {
        int x = guiLeft + 4 + (side / 2) * 58 + (i < 3 ? i * 18 : i > 4 ? (i - 5) * 18 : i == 3 ? 0 : 36);
        int y = guiTop + 22 + (side % 2) * 76 + (i < 3 ? 0 : i > 4 ? 36 : 18);
        if (mx > x && mx < x + 16 && my > y && my < y + 16)
            ClientUtils.addFluidTooltip(tile.filters[side][i], tooltip, 0);
    }
    if (!tooltip.isEmpty()) {
        ClientUtils.drawHoveringText(tooltip, mx, my, fontRendererObj, guiLeft + xSize, -1);
        RenderHelper.enableGUIStandardItemLighting();
    }
}
Also used : ButtonSorter(blusunrize.immersiveengineering.client.gui.GuiSorter.ButtonSorter) GuiButton(net.minecraft.client.gui.GuiButton) ArrayList(java.util.ArrayList)

Example 2 with ButtonSorter

use of blusunrize.immersiveengineering.client.gui.GuiSorter.ButtonSorter in project ImmersiveEngineering by BluSunrize.

the class GuiFluidSorter method actionPerformed.

@Override
protected void actionPerformed(GuiButton button) {
    if (button instanceof ButtonSorter && FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT) {
        int side = button.id;
        this.tile.sortWithNBT[side] = (byte) (this.tile.sortWithNBT[side] == 1 ? 0 : 1);
        NBTTagCompound tag = new NBTTagCompound();
        tag.setByteArray("sideConfig", this.tile.sortWithNBT);
        ImmersiveEngineering.packetHandler.sendToServer(new MessageTileSync(tile, tag));
        this.initGui();
    }
}
Also used : ButtonSorter(blusunrize.immersiveengineering.client.gui.GuiSorter.ButtonSorter) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) MessageTileSync(blusunrize.immersiveengineering.common.util.network.MessageTileSync)

Example 3 with ButtonSorter

use of blusunrize.immersiveengineering.client.gui.GuiSorter.ButtonSorter in project ImmersiveEngineering by BluSunrize.

the class GuiFluidSorter method initGui.

@Override
public void initGui() {
    super.initGui();
    this.buttonList.clear();
    for (int side = 0; side < 6; side++) {
        int x = guiLeft + 21 + (side / 2) * 58;
        int y = guiTop + 3 + (side % 2) * 76;
        ButtonSorter b = new ButtonSorter(side, x, y, 1);
        b.active = this.tile.doNBT(side);
        this.buttonList.add(b);
    }
}
Also used : ButtonSorter(blusunrize.immersiveengineering.client.gui.GuiSorter.ButtonSorter)

Aggregations

ButtonSorter (blusunrize.immersiveengineering.client.gui.GuiSorter.ButtonSorter)3 MessageTileSync (blusunrize.immersiveengineering.common.util.network.MessageTileSync)1 ArrayList (java.util.ArrayList)1 GuiButton (net.minecraft.client.gui.GuiButton)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1