public static InfoGuiOverlayDisplayParams create(GuiContainer gui, String guiClassName) { if (gui == null) { return InfoGuiOverlayDisplayParams.EMPTY; } // Check for blacklisted gui's if (isBlacklisted(gui)) { return InfoGuiOverlayDisplayParams.EMPTY; } int overlayX = 0; int overlayY = 0; if (ModConfig.extraSlotsSide().equals(ModConfig.POSITION_LEFT)) { overlayX = gui.getGuiLeft() - GuiExtraSlotsOverlay.GUI_WIDTH - ModConfig.extraSlotsMargin(); } else if (ModConfig.extraSlotsSide().equals(ModConfig.POSITION_RIGHT)) { overlayX = gui.getGuiLeft() + gui.getXSize() + ModConfig.extraSlotsMargin(); } overlayY = gui.getGuiTop() + gui.getYSize() - GuiExtraSlotsOverlay.GUI_HEIGHT - 4; // HOTFIX: Chest containers have their height (YSize) wrong if (gui instanceof GuiChest || gui instanceof GuiShulkerBox) { overlayY -= 1; } final InfoGuiOverlayDisplayParams displayParams = new InfoGuiOverlayDisplayParams(overlayX, overlayY, true); return displayParams; }
/** * Displays the GUI for interacting with a chest inventory. */ public void displayGUIChest(IInventory chestInventory) { String s = chestInventory instanceof IInteractionObject ? ((IInteractionObject)chestInventory).getGuiID() : "minecraft:container"; if ("minecraft:chest".equals(s)) { this.mc.displayGuiScreen(new GuiChest(this.inventory, chestInventory)); } else if ("minecraft:hopper".equals(s)) { this.mc.displayGuiScreen(new GuiHopper(this.inventory, chestInventory)); } else if ("minecraft:furnace".equals(s)) { this.mc.displayGuiScreen(new GuiFurnace(this.inventory, chestInventory)); } else if ("minecraft:brewing_stand".equals(s)) { this.mc.displayGuiScreen(new GuiBrewingStand(this.inventory, chestInventory)); } else if ("minecraft:beacon".equals(s)) { this.mc.displayGuiScreen(new GuiBeacon(this.inventory, chestInventory)); } else if (!"minecraft:dispenser".equals(s) && !"minecraft:dropper".equals(s)) { if ("minecraft:shulker_box".equals(s)) { this.mc.displayGuiScreen(new GuiShulkerBox(this.inventory, chestInventory)); } else { this.mc.displayGuiScreen(new GuiChest(this.inventory, chestInventory)); } } else { this.mc.displayGuiScreen(new GuiDispenser(this.inventory, chestInventory)); } }