private void shift(int xd, int yd) { border.borderTop = top.shift(xd, yd); border.borderBottom = bot.shift(xd, yd); border.borderLeft = left.shift(xd, yd); border.borderRight = right.shift(xd, yd); border.cornerTopLeft = topLeft.shift(xd, yd); border.cornerTopRight = topRight.shift(xd, yd); border.cornerBottomLeft = botLeft.shift(xd, yd); border.cornerBottomRight = botRight.shift(xd, yd); }
@Override public void updatePosition(int parentX, int parentY, int parentSizeX, int parentSizeY) { super.updatePosition(parentX, parentY, parentSizeX, parentSizeY); // we actually want to be on top of the parent this.guiLeft = parentX; this.guiTop = parentY - this.ySize; tabs.setPosition(guiLeft + 4, guiTop); }
protected void updateSlider() { int max = 0; if(sliderActive) { slider.show(); max = slotCount / columns - rows + 1; // the assumption here is that for an active slider this always is >0 } else { slider.hide(); } slider.setPosition(guiLeft + xSize - slider.width, guiTop); slider.setSize(ySize); slider.setSliderParameters(0, max, 1); }
@Override public void draw() { int x = xPos; int y = yPos; // background if(highlighted) { x += leftHighlight.draw(x, y); x += centerHighlight.drawScaledX(x, y, width - left.w - right.w); rightHighlight.draw(x, y); } else { x += left.draw(x, y); x += center.drawScaledX(x, y, width - left.w - right.w); right.draw(x, y); } // text x = xPos + left.w + 1; //fontRenderer.drawStringWithShadow() } }
@Override public void updatePosition(int parentX, int parentY, int parentSizeX, int parentSizeY) { super.updatePosition(parentX, parentY, parentSizeX, parentSizeY); border.setPosition(guiLeft, guiTop); border.setSize(xSize, ySize); slider.setPosition(guiRight() - border.w - 2, guiTop + border.h + 12); slider.setSize(this.ySize - border.h * 2 - 2 - 12); updateSliderParameters(); }
public GuiSearedFurnaceSideInventory(GuiMultiModule parent, Container container, TileSearedFurnace furnace, int slotCount, int columns) { super(parent, container, slotCount, columns, false, true); this.furnace = furnace; GuiElement.defaultTexH = 256; GuiElement.defaultTexW = 256; slot = new GuiElementScalable(0, 166, 22, 18); slotEmpty = new GuiElementScalable(22, 166, 22, 18); yOffset = 0; }
@Override protected void drawIcon(Minecraft mc) { mc.getTextureManager().bindTexture(Icons.ICON); Icons.ICON_Anvil.draw(x, y); }
protected int drawSlots(int xPos, int yPos) { int width = columns * slot.w; int height = ySize - border.h * 2; int fullRows = (lastSlotId - firstSlotId) / columns; int y; for(y = 0; y < fullRows * slot.h && y < height; y += slot.h) { slot.drawScaledX(xPos, yPos + y, width); } // draw partial row and unused slots int slotsLeft = (lastSlotId - firstSlotId) % columns; if(slotsLeft > 0) { slot.drawScaledX(xPos, yPos + y, slotsLeft * slot.w); // empty slots that don't exist slotEmpty.drawScaledX(xPos + slotsLeft * slot.w, yPos + y, width - slotsLeft * slot.w); } return width; } }
@Override protected void updateSlider() { sliderActive = slotCount > columns * rows; super.updateSlider(); slider.setEnabled(sliderActive); slider.show(); }
@Override public boolean shouldDrawSlot(Slot slot) { // all visible if(!slider.isEnabled()) { return true; } int index = slot.getSlotIndex(); return (firstSlotId <= index && lastSlotId > index); // inside visible area //|| indexStart > index || indexEnd <= index; // or not our concern }
public GuiTinkerTabs(GuiTinkerStation parent, Container container) { super(parent, container, false, false); this.parent = parent; this.xSize = GUI_TabActiveC.w; this.ySize = GUI_TabActiveC.h; this.tabs = new GuiWidgetTabs(parent, GUI_Tab, GUI_Tab, GUI_Tab, GUI_TabActiveL, GUI_TabActiveC, GUI_TabActiveR); this.tabData = Lists.newArrayList(); }
public void update(int mouseX, int mouseY) { if(!sliderActive) { return; } slider.update(mouseX, mouseY, !isMouseOverFullSlot(mouseX, mouseY) && isMouseInModule(mouseX, mouseY)); updateSlots(); }
protected void metal() { toolInfo.metal(); traitInfo.metal(); buttonDecorationTop = SlotSpaceTop.shift(SlotSpaceTop.w * 2, 0); buttonDecorationBot = SlotSpaceBottom.shift(SlotSpaceBottom.w * 2, 0); panelDecorationL = PanelSpaceL.shift(18 * 2, 0); panelDecorationR = PanelSpaceR.shift(18 * 2, 0); buttons.metal(); beamL = BeamLeft.shift(0, BeamLeft.h); beamR = BeamRight.shift(0, BeamRight.h); beamC = BeamCenter.shift(0, BeamCenter.h); }
public GuiSmelterySideInventory(GuiMultiModule parent, Container container, TileSmeltery smeltery, int slotCount, int columns) { super(parent, container, slotCount, columns, false, true); this.smeltery = smeltery; GuiElement.defaultTexH = 256; GuiElement.defaultTexW = 256; slot = new GuiElementScalable(0, 166, 22, 18); slotEmpty = new GuiElementScalable(22, 166, 22, 18); yOffset = 0; }
protected void drawIcon(Slot slot, GuiElement element) { this.mc.getTextureManager().bindTexture(Icons.ICON); element.draw(slot.xPos + this.cornerX - 1, slot.yPos + this.cornerY - 1); }
@Override public boolean shouldDrawSlot(Slot slot) { if(slot.getSlotIndex() >= slotCount) { return false; } // all visible if(!slider.isEnabled()) { return true; } return firstSlotId <= slot.getSlotIndex() && lastSlotId > slot.getSlotIndex(); }