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; }
@Override public void draw() { int x = xPos; int y = yPos; int midW = width - borderLeft.w - borderRight.w; int midH = height - borderTop.h - borderBottom.h; // top row x += cornerTopLeft.draw(x, y); x += borderTop.drawScaledX(x, y, midW); cornerTopRight.draw(x, y); // center row x = xPos; y += borderTop.h; x += borderLeft.drawScaledY(x, y, midH); x += midW; borderRight.drawScaledY(x, y, midH); // bottom row x = xPos; y += midH; x += cornerBottomLeft.draw(x, y); x += borderBottom.drawScaledX(x, y, midW); cornerBottomRight.draw(x, y); } }
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); }
private static final GuiElementScalable BeamCenter = new GuiElementScalable(2, 180, 129, 7); protected GuiElementScalable beamC = new GuiElementScalable(0, 0, 0, 0); x += beamC.drawScaledX(x, y, buttons.xSize); beamR.draw(x, y); x += beamC.drawScaledX(x, y, toolInfo.xSize); beamR.draw(x, y);
private static GuiElement botRight = new GuiElement(resW+4, resH+4, 4, 4); private static GuiElementScalable top = new GuiElementScalable(4, 0, resW, 4); private static GuiElementScalable bot = new GuiElementScalable(4, 4 + resH, resW, 4); private static GuiElementScalable left = new GuiElementScalable(0, 4, 4, resH); private static GuiElementScalable right = new GuiElementScalable(4 + resW, 4, 4, resH); private static GuiElementScalable background = new GuiElementScalable(4,4, resW, resH); private static GuiElementScalable sliderBar = new GuiElementScalable(0, 88, 3, 8); private static GuiElement sliderTop = new GuiElement(3, 88, 3, 4); private static GuiElement sliderBot = new GuiElement(3, 92, 3, 4); background.drawScaled(guiLeft + 4, guiTop + 4, xSize - 8, ySize - 8);
@Override public GuiElementScalable shift(int xd, int yd) { GuiElementScalable element = new GuiElementScalable(this.x + xd, this.y + yd, this.w, this.h); element.setTextureSize(this.texW, texH); return element; } }
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 public void draw() { if(hidden) { return; } // slidebar background slideBarTop.draw(xPos, yPos); slideBar.drawScaledY(xPos, yPos + slideBarTop.h, getUsableSlidebarHeight()); slideBarBottom.draw(xPos, yPos + height - slideBarBottom.h); int x = xPos + sliderOffset; int y = yPos + getSliderTop(); // the slider depending on state if(enabled) { if(isScrolling) { sliderDisabled.draw(x, y); } else if(isHighlighted) { sliderHighlighted.draw(x, y); } else { slider.draw(x, y); } } else { sliderDisabled.draw(x, y); } }
public int drawScaledX(int xPos, int yPos, int width) { for(int i = 0; i < width / w; i++) { draw(xPos + i * w, yPos); } // remainder that doesn't fit total width int remainder = width % w; if(remainder > 0) { GuiScreen.drawModalRectWithCustomSizedTexture(xPos + width - remainder, yPos, x, y, remainder, h, texW, texH); } return width; }
@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() } }
public int drawScaledY(int xPos, int yPos, int height) { for(int i = 0; i < height / h; i++) { draw(xPos, yPos + i * h); } // remainder that doesn't fit total width int remainder = height % h; if(remainder > 0) { GuiScreen.drawModalRectWithCustomSizedTexture(xPos, yPos + height - remainder, x, y, w, remainder, texW, texH); } return w; }
public int drawScaled(int xPos, int yPos, int width, int height) { // we draw full height row-wise int full = height / this.h; for(int i = 0; i < full; i++) { drawScaledX(xPos, yPos + i * this.h, width); } yPos += full * this.h; // and the remainder is drawn manually int yRest = height % this.h; // the same as drawScaledX but with the remaining height for(int i = 0; i < width / w; i++) { drawScaledY(xPos + i * w, yPos, yRest); } // remainder that doesn't fit total width int remainder = width % w; if(remainder > 0) { GuiScreen.drawModalRectWithCustomSizedTexture(xPos + width - remainder, yPos, x, y, remainder, yRest, texW, texH); } return width; }
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; }
int y; for(y = 0; y < fullRows * slot.h && y < ySize; y += slot.h) { slot.drawScaledX(guiLeft, guiTop + y, w); slot.drawScaledX(guiLeft, guiTop + y, slotsLeft * slot.w); slotEmpty.drawScaledX(guiLeft + slotsLeft * slot.w, guiTop + y, w - slotsLeft * slot.w);
private void shiftSlider(int xd, int yd) { slider = new GuiWidgetSlider(sliderNormal.shift(xd, yd), sliderHover.shift(xd, yd), sliderHover.shift(xd, yd), sliderTop.shift(xd, yd), sliderBot.shift(xd, yd), sliderBar.shift(xd, yd)); }
protected GuiElement progressBar = new GuiElementScalable(176, 150, 3, 16, 256, 256); protected GuiElement unprogressBar = new GuiElementScalable(179, 150, 3, 16); protected GuiElement uberHeatBar = new GuiElementScalable(182, 150, 3, 16); protected GuiElement noMeltBar = new GuiElementScalable(185, 150, 3, 16); protected GuiElement completeBar = new GuiElementScalable(188, 150, 3, 16);
textBackground.drawScaledX(x, y, midW); y += textBackground.h;
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); }
protected GuiElement progressBar = new GuiElementScalable(176, 150, 3, 16, 256, 256); protected GuiElement unprogressBar = new GuiElementScalable(179, 150, 3, 16); protected GuiElement uberHeatBar = new GuiElementScalable(182, 150, 3, 16); protected GuiElement noMeltBar = new GuiElementScalable(185, 150, 3, 16);
protected GuiElement flame = new GuiElementScalable(176, 76, 28, 28, 256, 256);