net.minecraft.client.gui.inventory.GuiContainerCreative Java Examples
The following examples show how to use
net.minecraft.client.gui.inventory.GuiContainerCreative.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CreativeMenuHandler.java From Cyberware with MIT License | 6 votes |
@SubscribeEvent public void handleButtons(InitGuiEvent event) { if (event.getGui() instanceof GuiContainerCreative) { GuiContainerCreative gui = (GuiContainerCreative) event.getGui(); int i = (gui.width - 136) / 2; int j = (gui.height - 195) / 2; List<GuiButton> buttons = event.getButtonList(); buttons.add(salvaged = new CEXButton(355, i + 166 + 4, j + 29 + 8, 0)); buttons.add(manufactured = new CEXButton(356, i + 166 + 4, j + 29 + 31, 1)); int selectedTabIndex = ReflectionHelper.getPrivateValue(GuiContainerCreative.class, (GuiContainerCreative) gui, 2); if (selectedTabIndex != Cyberware.creativeTab.getTabIndex()) { salvaged.visible = false; manufactured.visible = false; } event.setButtonList(buttons); } }
Example #2
Source File: CreativeMenuHandler.java From Cyberware with MIT License | 6 votes |
@SubscribeEvent public void handleTooltips(DrawScreenEvent.Post event) { if (isCorrectGui(event.getGui())) { int mouseX = event.getMouseX(); int mouseY = event.getMouseY(); GuiContainerCreative gui = (GuiContainerCreative) event.getGui(); int i = (gui.width - 136) / 2; int j = (gui.height - 195) / 2; if (isPointInRegion(i, j, salvaged.xPosition - i, 29 + 8, 18, 18, mouseX, mouseY)) { ClientUtils.drawHoveringText(gui, Arrays.asList(new String[] { I18n.format(CyberwareAPI.QUALITY_SCAVENGED.getUnlocalizedName()) } ), mouseX, mouseY, mc.getRenderManager().getFontRenderer()); } if (isPointInRegion(i, j, manufactured.xPosition - i, 29 + 8 + 23, 18, 18, mouseX, mouseY)) { ClientUtils.drawHoveringText(gui, Arrays.asList(new String[] { I18n.format(CyberwareAPI.QUALITY_MANUFACTURED.getUnlocalizedName()) } ), mouseX, mouseY, mc.getRenderManager().getFontRenderer()); } } }
Example #3
Source File: LayoutManager.java From NotEnoughItems with MIT License | 6 votes |
@Override public void load(GuiContainer gui) { if (isEnabled()) { setInputFocused(null); ItemList.loadItems.restart(); overlayRenderer = null; getLayoutStyle().init(); layout(gui); } NEIController.load(gui); if (checkCreativeInv(gui) && gui.mc.currentScreen instanceof GuiContainerCreative)//override creative with creative+ gui.mc.displayGuiScreen(null);//close the screen and wait for the server to open it for us }
Example #4
Source File: LayoutManager.java From NotEnoughItems with MIT License | 6 votes |
@Override public void load(GuiContainer gui) { if (isEnabled()) { setInputFocused(null); ItemList.loadItems.restart(); getLayoutStyle().init(); layout(gui); } NEIController.load(gui); if (checkCreativeInv(gui) && gui.mc.currentScreen instanceof GuiContainerCreative)//override creative with creative+ { gui.mc.displayGuiScreen(null);//close the screen and wait for the server to open it for us } }
Example #5
Source File: GuiInventoryTFC.java From TFC2 with GNU General Public License v3.0 | 5 votes |
@Override public void initGui() { super.buttonList.clear(); if (this.mc.playerController.isInCreativeMode()) { this.mc.displayGuiScreen(new GuiContainerCreative(this.mc.player)); } else super.initGui(); if (!this.mc.player.getActivePotionEffects().isEmpty()) { //this.guiLeft = 160 + (this.width - this.xSize - 200) / 2; this.guiLeft = (this.width - this.xSize) / 2; this.hasEffect = true; } buttonList.clear(); buttonList.add(new GuiInventoryButton(0, new Rectangle(guiLeft+176, guiTop + 3, 25, 20), new Rectangle(0, 103, 25, 20), Core.translate("gui.Inventory.Inventory"), new Rectangle(1,223,32,32))); buttonList.add(new GuiInventoryButton(1, new Rectangle(guiLeft+176, guiTop + 22, 25, 20), new Rectangle(0, 103, 25, 20), Core.translate("gui.Inventory.Skills"), new Rectangle(100,223,32,32))); buttonList.add(new GuiInventoryButton(2, new Rectangle(guiLeft+176, guiTop + 41, 25, 20), new Rectangle(0, 103, 25, 20), Core.translate("gui.Calendar.Calendar"), new Rectangle(34,223,32,32))); buttonList.add(new GuiInventoryButton(3, new Rectangle(guiLeft+176, guiTop + 60, 25, 20), new Rectangle(0, 103, 25, 20), Core.translate("gui.Inventory.Health"), new Rectangle(67,223,32,32))); }
Example #6
Source File: VanillaEnhancementsHud.java From Hyperium with GNU Lesser General Public License v3.0 | 5 votes |
@InvokeEvent public void onRenderArmor(GuiDrawScreenEvent e) { if ((Settings.ARMOR_PROT_POTENTIONAL || Settings.ARMOR_PROJ_POTENTIONAL) && (e.getScreen() instanceof GuiInventory || e.getScreen() instanceof GuiContainerCreative)) { ScaledResolution res = new ScaledResolution(mc); String message = getArmorString(); mc.currentScreen.drawString(mc.fontRendererObj, message, 10, res.getScaledHeight() - 16, -1); } }
Example #7
Source File: GuiInventoryTFC.java From TFC2 with GNU General Public License v3.0 | 5 votes |
@Override /** * Called from the main game loop to update the screen. */ public void updateScreen() { if (this.mc.playerController.isInCreativeMode()) this.mc.displayGuiScreen(new GuiContainerCreative(player)); }
Example #8
Source File: LayoutManager.java From NotEnoughItems with MIT License | 5 votes |
public boolean checkCreativeInv(GuiContainer gui) { if (gui instanceof GuiContainerCreative && invCreativeMode()) { NEICPH.sendCreativeInv(true); return true; } else if (gui instanceof GuiExtendedCreativeInv && !invCreativeMode()) { NEICPH.sendCreativeInv(false); return true; } return false; }
Example #9
Source File: LayoutManager.java From NotEnoughItems with MIT License | 5 votes |
@Override public void onPreDraw(GuiContainer gui) { if (!isHidden() && isEnabled() && gui instanceof InventoryEffectRenderer)//Reset the gui to the center of the screen, for potion effect offsets etc { gui.guiLeft = (gui.width - gui.xSize) / 2; gui.guiTop = (gui.height - gui.ySize) / 2; if (gui instanceof GuiContainerCreative && gui.buttonList.size() >= 2) { GuiButton button1 = (GuiButton) gui.buttonList.get(0); GuiButton button2 = (GuiButton) gui.buttonList.get(1); button1.xPosition = gui.guiLeft; button2.xPosition = gui.guiLeft + gui.xSize - 20; } } }
Example #10
Source File: NEICreativeGuiHandler.java From NotEnoughItems with MIT License | 5 votes |
@Override public VisiblityData modifyVisiblity(GuiContainer gui, VisiblityData currentVisibility) { if(!(gui instanceof GuiContainerCreative)) return currentVisibility; if(((GuiContainerCreative)gui).getSelectedTabIndex() != CreativeTabs.tabInventory.getTabIndex()) currentVisibility.showItemSection = currentVisibility.enableDeleteMode = false; return currentVisibility; }
Example #11
Source File: LayoutManager.java From NotEnoughItems with MIT License | 5 votes |
public boolean checkCreativeInv(GuiContainer gui) { if (gui instanceof GuiContainerCreative && invCreativeMode()) { NEIClientPacketHandler.sendCreativeInv(true); return true; } else if (gui instanceof GuiExtendedCreativeInv && !invCreativeMode()) { NEIClientPacketHandler.sendCreativeInv(false); return true; } return false; }
Example #12
Source File: CreativeMenuHandler.java From Cyberware with MIT License | 5 votes |
private boolean isCorrectGui(GuiScreen gui) { if (gui instanceof GuiContainerCreative) { int selectedTabIndex = ReflectionHelper.getPrivateValue(GuiContainerCreative.class, (GuiContainerCreative) gui, 2); if (selectedTabIndex == Cyberware.creativeTab.getTabIndex()) { return true; } } return false; }
Example #13
Source File: NEIController.java From NotEnoughItems with MIT License | 4 votes |
public static boolean canUseDeleteMode() { return !(NEIClientUtils.getGuiContainer() instanceof GuiContainerCreative); }
Example #14
Source File: GuiInfo.java From NotEnoughItems with MIT License | 4 votes |
public static void load() { API.registerNEIGuiHandler(new NEICreativeGuiHandler()); API.registerNEIGuiHandler(new NEIChestGuiHandler()); API.registerNEIGuiHandler(new NEIDummySlotHandler()); customSlotGuis.add(GuiContainerCreative.class); }
Example #15
Source File: ItemPanel.java From NotEnoughItems with MIT License | 4 votes |
private boolean handleDraggedClick(int mousex, int mousey, int button) { if (draggedStack.isEmpty()) { return false; } GuiContainer gui = NEIClientUtils.getGuiContainer(); boolean handled = false; for (INEIGuiHandler handler : GuiInfo.guiHandlers) { if (handler.handleDragNDrop(gui, mousex, mousey, draggedStack, button)) { handled = true; if (draggedStack.getCount() == 0) { draggedStack = ItemStack.EMPTY; return true; } } } if (handled) { return true; } Slot overSlot = gui.getSlotAtPosition(mousex, mousey); if (overSlot != null && overSlot.isItemValid(draggedStack)) { if (NEIClientConfig.canCheatItem(draggedStack)) { int contents = overSlot.getHasStack() ? overSlot.getStack().getCount() : 0; int add = button == 0 ? draggedStack.getCount() : 1; if (overSlot.getHasStack() && !NEIServerUtils.areStacksSameType(draggedStack, overSlot.getStack())) { contents = 0; } int total = Math.min(contents + add, Math.min(overSlot.getSlotStackLimit(), draggedStack.getMaxStackSize())); if (total > contents) { int slotNumber = overSlot.slotNumber; if (gui instanceof GuiContainerCreative) { //Because Mojang.. slotNumber = slotNumber - gui.inventorySlots.inventorySlots.size() + 9 + 36; } NEIClientUtils.setSlotContents(slotNumber, NEIServerUtils.copyStack(draggedStack, total), true); NEIClientPacketHandler.sendGiveItem(NEIServerUtils.copyStack(draggedStack, total), false, false); draggedStack.shrink(total - contents); } if (draggedStack.getCount() == 0) { draggedStack = ItemStack.EMPTY; } } else { draggedStack = ItemStack.EMPTY; } } else if (mousex < gui.getGuiLeft() || mousey < gui.getGuiTop() || mousex >= gui.getGuiLeft() + gui.getXSize() || mousey >= gui.getGuiTop() + gui.getYSize()) { draggedStack = ItemStack.EMPTY; } return true; }
Example #16
Source File: GuiInfo.java From NotEnoughItems with MIT License | 4 votes |
public static void load() { customSlotGuis.add(GuiContainerCreative.class); }
Example #17
Source File: NEIController.java From NotEnoughItems with MIT License | 4 votes |
public static boolean canUseDeleteMode() { return !(NEIClientUtils.getGuiContainer() instanceof GuiContainerCreative); }
Example #18
Source File: CreativeMenuHandler.java From Cyberware with MIT License | 4 votes |
@SubscribeEvent public void handleCreativeInventory(BackgroundDrawnEvent event) { if (event.getGui() instanceof GuiContainerCreative) { int selectedTabIndex = ReflectionHelper.getPrivateValue(GuiContainerCreative.class, (GuiContainerCreative) event.getGui(), 2); if (selectedTabIndex == Cyberware.creativeTab.getTabIndex()) { GuiContainerCreative gui = (GuiContainerCreative) event.getGui(); int i = (gui.width - 136) / 2; int j = (gui.height - 195) / 2; int xSize = 29; int ySize = 129; int xOffset = 0; boolean hasVisibleEffect = false; for(PotionEffect potioneffect : mc.thePlayer.getActivePotionEffects()) { Potion potion = potioneffect.getPotion(); if(potion.shouldRender(potioneffect)) { hasVisibleEffect = true; break; } } if (!this.mc.thePlayer.getActivePotionEffects().isEmpty() && hasVisibleEffect) { xOffset = 59; } salvaged.xPosition = salvaged.baseX + xOffset; manufactured.xPosition = manufactured.baseX + xOffset; GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(CEX_GUI_TEXTURES); gui.drawTexturedModalRect(i + 166 + xOffset, j + 29, 0, 0, xSize, ySize); salvaged.visible = true; manufactured.visible = true; } else { salvaged.visible = false; manufactured.visible = false; } } }