// updates slot visibility protected void updateSlots() { firstSlotId = slider.getValue() * columns; lastSlotId = Math.min(slotCount, firstSlotId + getDisplayedRows() * columns); int xd = border.w + xOffset; int yd = border.h + yOffset; if (shouldDrawName()) { yd += textBackground.h; } for (Object o : inventorySlots.inventorySlots) { Slot slot = (Slot) o; if (shouldDrawSlot(slot)) { // calc position of the slot int offset = slot.getSlotIndex() - firstSlotId; int x = (offset % columns) * this.slot.w; int y = (offset / columns) * this.slot.h; slot.xDisplayPosition = xd + x + 1; slot.yDisplayPosition = yd + y + 1; if (this.right) { slot.xDisplayPosition += parent.realWidth; } else { slot.xDisplayPosition -= this.xSize; } } else { slot.xDisplayPosition = 0; slot.yDisplayPosition = 0; } } }
@Overrideprotected void func_146977_a(Slot slot) { if (slot instanceof SlotChiselInput) { GL11.glPushMatrix(); GL11.glScalef(2, 2, 2); slot.xDisplayPosition -= 16; slot.yDisplayPosition -= 16; super.func_146977_a(slot); slot.xDisplayPosition += 16; slot.yDisplayPosition += 16; GL11.glPopMatrix(); } else { super.func_146977_a(slot); } }
// updates slot visibility public void updateSlots() { // calculate displayed slots firstSlotId = slider.getValue() * columns; lastSlotId = Math.min(slotCount, firstSlotId + rows * columns); for (Slot slot : container.inventorySlots) { if (shouldDrawSlot(slot)) { // calc position of the slot int offset = slot.getSlotIndex() - firstSlotId; int x = (offset % columns) * GuiDynInventory.slot.w; int y = (offset / columns) * GuiDynInventory.slot.h; slot.xDisplayPosition = xOffset + x + 1; slot.yDisplayPosition = yOffset + y + 1; } else { slot.xDisplayPosition = 0; slot.yDisplayPosition = 0; } } }
@Override protected Slot addSlotToContainer(Slot slot) { if (player.worldObj.isRemote && CustomizeableGuiHandler.moveableInvElements != null && CustomizeableGuiHandler.moveableInvElements.size() > this.inventorySlots.size()) { GuiButtonMoveableElement bme = CustomizeableGuiHandler.moveableInvElements.get(this.inventorySlots.size()); if (bme != null) { if (bme.hideElement) { IInventory iinv = slot.inventory; int indx = slot.getSlotIndex(); int x = slot.xDisplayPosition; int y = slot.yDisplayPosition; slot = new SlotNull(iinv, indx, x, y); } slot.xDisplayPosition = bme.elementX + 1; slot.yDisplayPosition = bme.elementY + 1; } } else if (CommonProxy.hiddenSlots.containsKey(player.getCommandSenderName())) { boolean[] hidden = CommonProxy.hiddenSlots.get(player.getCommandSenderName()); if (hidden != null && hidden.length > this.inventorySlots.size() && hidden[this.inventorySlots.size()]) { IInventory iinv = slot.inventory; int indx = slot.getSlotIndex(); int x = slot.xDisplayPosition; int y = slot.yDisplayPosition; slot = new SlotNull(iinv, indx, x, y); } } // System.out.print(this.inventorySlots.size()+":"+(slot instanceof SlotNull)+", "); slot.slotNumber = this.inventorySlots.size(); this.inventorySlots.add(slot); this.inventoryItemStacks.add((Object) null); return slot; }