@Override public boolean onMousePressed(int mouseX, int mouseY, int mouseButton) { if (!isFullyOpened()) { return false; } if (side == LEFT) { mouseX += currentWidth; } mouseX -= currentShiftX; mouseY -= currentShiftY; if (mouseX < 16 || mouseX >= 80 || mouseY < 20 || mouseY >= 84) { return false; } if (40 <= mouseX && mouseX < 56 && 24 <= mouseY && mouseY < 40) { handleSideChange(BlockHelper.SIDE_ABOVE[myTileFacing.getFacing()], mouseButton); } else if (20 <= mouseX && mouseX < 36 && 44 <= mouseY && mouseY < 60) { handleSideChange(BlockHelper.SIDE_LEFT[myTileFacing.getFacing()], mouseButton); } else if (40 <= mouseX && mouseX < 56 && 44 <= mouseY && mouseY < 60) { handleSideChange(myTileFacing.getFacing(), mouseButton); } else if (60 <= mouseX && mouseX < 76 && 44 <= mouseY && mouseY < 60) { handleSideChange(BlockHelper.SIDE_RIGHT[myTileFacing.getFacing()], mouseButton); } else if (40 <= mouseX && mouseX < 56 && 64 <= mouseY && mouseY < 80) { handleSideChange(BlockHelper.SIDE_BELOW[myTileFacing.getFacing()], mouseButton); } else if (60 <= mouseX && mouseX < 76 && 64 <= mouseY && mouseY < 80) { handleSideChange(BlockHelper.SIDE_OPPOSITE[myTileFacing.getFacing()], mouseButton); } return true; }
@Override protected void drawForeground() { drawTabIcon(CoreTextures.ICON_CONFIG); if (!isFullyOpened()) { return; } getFontRenderer().drawStringWithShadow(StringHelper.localize("info.cofh.configuration"), sideOffset() + 18, 6, headerColor); RenderHelper.setBlockTextureSheet(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); for (int pass = 0; pass < myTileTexture.getNumPasses(); pass++) { gui.drawIcon(myTileTexture.getTexture(BlockHelper.SIDE_ABOVE[myTileFacing.getFacing()], pass), 40, 24); gui.drawIcon(myTileTexture.getTexture(BlockHelper.SIDE_LEFT[myTileFacing.getFacing()], pass), 20, 44); gui.drawIcon(myTileTexture.getTexture(myTileFacing.getFacing(), pass), 40, 44); gui.drawIcon(myTileTexture.getTexture(BlockHelper.SIDE_RIGHT[myTileFacing.getFacing()], pass), 60, 44); gui.drawIcon(myTileTexture.getTexture(BlockHelper.SIDE_BELOW[myTileFacing.getFacing()], pass), 40, 64); gui.drawIcon(myTileTexture.getTexture(BlockHelper.SIDE_OPPOSITE[myTileFacing.getFacing()], pass), 60, 64); } GlStateManager.disableBlend(); RenderHelper.setDefaultFontTextureSheet(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); }
@Override public void addTooltip(List<String> list) { if (!isFullyOpened()) { list.add(StringHelper.localize("info.cofh.configuration")); } }
@Override public void initGui() { super.initGui(); // Right Side redstoneTab = addTab(new TabRedstoneControl(this, baseTile)); if (baseTile.hasTransferIn() || baseTile.hasTransferOut()) { configTab = addTab(new TabConfigurationTransfer(this, baseTile)); } else { configTab = addTab(new TabConfiguration(this, baseTile)); } // Left Side securityTab = addTab(new TabSecurity(this, baseTile, playerName)); securityTab.setVisible(baseTile.enableSecurity() && baseTile.isSecured()); if (!myInfo.isEmpty()) { addTab(new TabInfo(this, myInfo)); } }
@Override protected void drawBackground() { super.drawBackground(); if (!isFullyOpened()) { return; } float colorR = (backgroundColor >> 16 & 255) / 255.0F * 0.6F; float colorG = (backgroundColor >> 8 & 255) / 255.0F * 0.6F; float colorB = (backgroundColor & 255) / 255.0F * 0.6F; GlStateManager.color(colorR, colorG, colorB, 1.0F); gui.drawTexturedModalRect(16, 20, 16, 20, 64, 64); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); }
@Override public void initGui() { super.initGui(); // Right Side redstoneTab = addTab(new TabRedstoneControl(this, baseTile)); configTab = addTab(new TabConfiguration(this, baseTile)); // Left Side securityTab = addTab(new TabSecurity(this, baseTile, playerName)); securityTab.setVisible(baseTile.enableSecurity() && baseTile.isSecured()); if (!myInfo.isEmpty()) { addTab(new TabInfo(this, myInfo)); } addElement(new ElementEnergyStored(this, 80, 18, baseTile.getEnergyStorage()).setInfinite(baseTile.isCreative)); ElementSimple infoInput = (ElementSimple) new ElementSimple(this, 33, 16).setToolTip("info.cofh.input").setSize(20, 20).setTexture(TEX_INFO_INPUT, 20, 20); ElementSimple infoOutput = (ElementSimple) new ElementSimple(this, 123, 16).setToolTip("info.cofh.output").setSize(20, 20).setTexture(TEX_INFO_OUTPUT, 20, 20); addElement(infoInput); addElement(infoOutput); decRecv = new ElementButton(this, 28, 56, "DecRecv", 176, 0, 176, 14, 176, 28, 14, 14, TEX_PATH).setToolTipLocalized(true); incRecv = new ElementButton(this, 44, 56, "IncRecv", 190, 0, 190, 14, 190, 28, 14, 14, TEX_PATH).setToolTipLocalized(true); decSend = new ElementButton(this, 118, 56, "DecSend", 176, 0, 176, 14, 176, 28, 14, 14, TEX_PATH).setToolTipLocalized(true); incSend = new ElementButton(this, 134, 56, "IncSend", 190, 0, 190, 14, 190, 28, 14, 14, TEX_PATH).setToolTipLocalized(true); addElement(decRecv); addElement(incRecv); addElement(decSend); addElement(incSend); }