Class GuiContainer
- java.lang.Object
-
- net.minecraft.client.gui.Gui
-
- net.minecraft.client.gui.GuiScreen
-
- net.minecraft.client.gui.inventory.GuiContainer
-
- All Implemented Interfaces:
GuiYesNoCallback
- Direct Known Subclasses:
GuiBeacon
,GuiBrewingStand
,GuiChest
,GuiCrafting
,GuiDispenser
,GuiEnchantment
,GuiFurnace
,GuiHopper
,GuiMerchant
,GuiRepair
,GuiScreenHorseInventory
,InventoryEffectRenderer
public abstract class GuiContainer extends GuiScreen
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
dragSplitting
protected java.util.Set<Slot>
dragSplittingSlots
protected int
guiLeft
protected int
guiTop
protected static ResourceLocation
inventoryBackground
+ The location of the inventory background textureContainer
inventorySlots
protected int
xSize
+ The X size of the inventory window in pixels.protected int
ySize
+ The Y size of the inventory window in pixels.-
Fields inherited from class net.minecraft.client.gui.GuiScreen
allowUserInput, buttonList, fontRendererObj, height, itemRender, labelList, mc, showingCloseKey, width
-
Fields inherited from class net.minecraft.client.gui.Gui
icons, optionsBackground, statIcons, zLevel
-
-
Constructor Summary
Constructors Constructor Description GuiContainer(Container inventorySlotsIn)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected boolean
checkHotbarKeys(int keyCode)
+ This function is what controls the hotbar shortcut check when you press a number key when hovering a stack.boolean
doesGuiPauseGame()
+ Returns true if this GUI should pause the game when it is displayed in single-playerprotected abstract void
drawGuiContainerBackgroundLayer(float var1, int var2, int var3)
protected void
drawGuiContainerForegroundLayer(int mouseX, int mouseY)
+ Draw the foreground layer for the GuiContainer (everything in front of the items).void
drawScreen(int i, int j, float f)
+ Draws the screen and all the components in it.protected void
handleMouseClick(Slot slotIn, int slotId, int clickedButton, int clickType)
+ Called when the mouse is clicked over a slot or outside the gui.void
initGui()
+ Adds the buttons (and other controls) to the screen in question.protected boolean
isPointInRegion(int left, int top, int right, int bottom, int pointX, int pointY)
+ Test if the 2D point is in a rectangle (relative to the GUI).protected void
keyTyped(char parChar1, int parInt1)
+ Fired when a key is typed (except F11 which toggles full screen).protected void
mouseClicked(int parInt1, int parInt2, int parInt3)
+ Called when the mouse is clicked.protected void
mouseClickMove(int i, int j, int k, long var4)
+ Called when a mouse button is pressed and the mouse is moved around.protected void
mouseReleased(int i, int j, int k)
+ Called when a mouse button is released.void
onGuiClosed()
+ Called when the screen is unloaded.void
updateScreen()
+ Called from the main game loop to update the screen.-
Methods inherited from class net.minecraft.client.gui.GuiScreen
actionPerformed, confirmClicked, drawBackground, drawCreativeTabHoveringText, drawDefaultBackground, drawHoveringText, drawWorldBackground, getClipboardString, getCloseKey, handleComponentClick, handleComponentHover, handleInput, handleKeyboardInput, handleMouseInput, isAltKeyDown, isCtrlKeyDown, isKeyComboCtrlA, isKeyComboCtrlC, isKeyComboCtrlV, isKeyComboCtrlX, isShiftKeyDown, onResize, renderToolTip, sendChatMessage, sendChatMessage, setClipboardString, setText, setWorldAndResolution
-
Methods inherited from class net.minecraft.client.gui.Gui
drawCenteredString, drawGradientRect, drawHorizontalLine, drawModalRectWithCustomSizedTexture, drawRect, drawScaledCustomSizeModalRect, drawString, drawTexturedModalRect, drawTexturedModalRect, drawTexturedModalRect, drawVerticalLine
-
-
-
-
Field Detail
-
inventoryBackground
protected static final ResourceLocation inventoryBackground
+ The location of the inventory background texture
-
xSize
protected int xSize
+ The X size of the inventory window in pixels.
-
ySize
protected int ySize
+ The Y size of the inventory window in pixels.
-
inventorySlots
public Container inventorySlots
-
guiLeft
protected int guiLeft
-
guiTop
protected int guiTop
-
dragSplittingSlots
protected final java.util.Set<Slot> dragSplittingSlots
-
dragSplitting
protected boolean dragSplitting
-
-
Constructor Detail
-
GuiContainer
public GuiContainer(Container inventorySlotsIn)
-
-
Method Detail
-
initGui
public void initGui()
+ Adds the buttons (and other controls) to the screen in question. Called when the GUI is displayed and when the window resizes, the buttonList is cleared beforehand.
-
drawScreen
public void drawScreen(int i, int j, float f)
+ Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks- Overrides:
drawScreen
in classGuiScreen
-
drawGuiContainerForegroundLayer
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
+ Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY
-
drawGuiContainerBackgroundLayer
protected abstract void drawGuiContainerBackgroundLayer(float var1, int var2, int var3)
-
mouseClicked
protected void mouseClicked(int parInt1, int parInt2, int parInt3)
+ Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton- Overrides:
mouseClicked
in classGuiScreen
-
mouseClickMove
protected void mouseClickMove(int i, int j, int k, long var4)
+ Called when a mouse button is pressed and the mouse is moved around. Parameters are : mouseX, mouseY, lastButtonClicked & timeSinceMouseClick.- Overrides:
mouseClickMove
in classGuiScreen
-
mouseReleased
protected void mouseReleased(int i, int j, int k)
+ Called when a mouse button is released. Args : mouseX, mouseY, releaseButton- Overrides:
mouseReleased
in classGuiScreen
-
isPointInRegion
protected boolean isPointInRegion(int left, int top, int right, int bottom, int pointX, int pointY)
+ Test if the 2D point is in a rectangle (relative to the GUI). Args : rectX, rectY, rectWidth, rectHeight, pointX, pointY
-
handleMouseClick
protected void handleMouseClick(Slot slotIn, int slotId, int clickedButton, int clickType)
+ Called when the mouse is clicked over a slot or outside the gui.
-
keyTyped
protected void keyTyped(char parChar1, int parInt1)
+ Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code)
-
checkHotbarKeys
protected boolean checkHotbarKeys(int keyCode)
+ This function is what controls the hotbar shortcut check when you press a number key when hovering a stack. Args : keyCode, Returns true if a Hotbar key is pressed, else false
-
onGuiClosed
public void onGuiClosed()
+ Called when the screen is unloaded. Used to disable keyboard repeat events- Overrides:
onGuiClosed
in classGuiScreen
-
doesGuiPauseGame
public boolean doesGuiPauseGame()
+ Returns true if this GUI should pause the game when it is displayed in single-player- Overrides:
doesGuiPauseGame
in classGuiScreen
-
updateScreen
public void updateScreen()
+ Called from the main game loop to update the screen.- Overrides:
updateScreen
in classGuiScreen
-
-