public void setFullyOpen() { open = true; currentWidth = maxWidth; currentHeight = maxHeight; fullyOpen = true; updateElements(); }
/** * Corrects for shadowing differences in tabs to ensure that they always look nice - used in font rendering, typically. */ protected int posXOffset() { return posX() + sideOffset(); }
@Override public boolean onMousePressed(int mouseX, int mouseY, int mouseButton) { if (numAugments == 0) { return true; } if (!isFullyOpened()) { return false; } if (side == LEFT) { mouseX += currentWidth; } mouseX -= currentShiftX; mouseY -= currentShiftY; return mouseX >= slotsBorderX1 + sideOffset() && mouseX < slotsBorderX2 + sideOffset() && mouseY >= slotsBorderY1 && mouseY < slotsBorderY2; }
@Override public void initGui() { super.initGui(); // Right Side augmentTab = addTab(new TabAugment(this, (IAugmentableContainer) inventorySlots)); redstoneTab = addTab(new TabRedstoneControl(this, baseTile)); redstoneTab.setVisible(baseTile.hasRedstoneControl()); configTab = addTab(new TabConfigurationTransfer(this, baseTile)); // Left Side securityTab = addTab(new TabSecurity(this, baseTile, playerName)); securityTab.setVisible(baseTile.enableSecurity() && baseTile.isSecured()); if (baseTile.getMaxEnergyStored(null) > 0) { addTab(new TabEnergy(this, baseTile, false).displayStored(!baseTile.smallStorage())); } if (!myInfo.isEmpty()) { addTab(new TabInfo(this, myInfo)); } }
@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 public void initGui() { super.initGui(); // Left Side securityTab = addTab(new TabSecurity(this, baseTile, playerName)); securityTab.setVisible(baseTile.enableSecurity() && baseTile.isSecured()); if (!myInfo.isEmpty()) { addTab(new TabInfo(this, myInfo)); } }
public TabBase addTab(TabBase tab) { int yOffset = 4; for (TabBase tab1 : tabs) { if (tab1.side == tab.side && tab1.isVisible()) { yOffset += tab1.currentHeight; } } tab.setPosition(tab.side == TabBase.LEFT ? 0 : xSize, yOffset); tabs.add(tab); if (TabTracker.getOpenedLeftTab() != null && tab.getClass().equals(TabTracker.getOpenedLeftTab())) { tab.setFullyOpen(); } else if (TabTracker.getOpenedRightTab() != null && tab.getClass().equals(TabTracker.getOpenedRightTab())) { tab.setFullyOpen(); } return tab; }
@Override public void initGui() { super.initGui(); if (!myInfo.isEmpty()) { addTab(new TabInfo(this, myInfo)); } if (ItemSatchel.enableSecurity && secure) { addTab(new TabSecurity(this, (ISecurable) inventorySlots, playerName)); } }
public void toggleOpen() { if (open) { open = false; if (side == LEFT) { TabTracker.setOpenedLeftTab(null); } else { TabTracker.setOpenedRightTab(null); } fullyOpen = false; } else { open = true; if (side == LEFT) { TabTracker.setOpenedLeftTab(this.getClass()); } else { TabTracker.setOpenedRightTab(this.getClass()); } } updateElements(); }
@Override public boolean onMousePressed(int mouseX, int mouseY, int mouseButton) throws IOException { int shiftedMouseX = mouseX - this.posX(); int shiftedMouseY = mouseY - this.posY; if (!isFullyOpened()) { return false; } if (!scrollable || shiftedMouseY < 16 || shiftedMouseX < 108) { return super.onMousePressed(mouseX, mouseY, mouseButton); } if (shiftedMouseY < 52) { firstLine = MathHelper.clamp(firstLine - 1, 0, maxFirstLine); } else { firstLine = MathHelper.clamp(firstLine + 1, 0, maxFirstLine); } return true; }
@Override public void updateScreen() { super.updateScreen(); if (!baseTile.canAccess()) { this.mc.player.closeScreen(); } redstoneTab.setVisible(baseTile.hasRedstoneControl()); securityTab.setVisible(baseTile.enableSecurity() && baseTile.isSecured()); energyTab.setVisible(baseTile.showEnergyTab()); steamTab.setVisible(baseTile.showSteamTab()); steamTab.setProducer(baseTile.isSteamProducer()); }
@Override public void addTooltip(List<String> list) { if (!isFullyOpened()) { list.add(getTitle()); } }
@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(24, 16, 16, 20, 64, 24); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); }
@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(24, 16, 16, 20, 64, 24); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); }
@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 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(28, 20, 16, 20, 64, 64); gui.drawTexturedModalRect(6, 32, 16, 20, 20, 40); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); }
protected void updateElements() { for (ElementBase element : elements) { element.setVisible(this.isFullyOpened()); } }
protected void drawTabIcon(TextureAtlasSprite iconName) { gui.drawIcon(iconName, sideOffset(), 3); }
@Override public boolean onMouseWheel(int mouseX, int mouseY, int movement) { if (!isFullyOpened()) { return false; } if (movement > 0) { firstLine = MathHelper.clamp(firstLine - 1, 0, maxFirstLine); return true; } else if (movement < 0) { firstLine = MathHelper.clamp(firstLine + 1, 0, maxFirstLine); return true; } return false; }
public void setCurrentShift(int x, int y) { updateElements(); currentShiftX = x + offsetX; currentShiftY = y + offsetY; }