Package net.minecraft.client.gui
Class GuiScreen
- java.lang.Object
-
- net.minecraft.client.gui.Gui
-
- net.minecraft.client.gui.GuiScreen
-
- All Implemented Interfaces:
GuiYesNoCallback
- Direct Known Subclasses:
GuiAchievements
,GuiAuthenticationScreen
,GuiChat
,GuiCommandBlock
,GuiConnecting
,GuiContainer
,GuiControls
,GuiCustomizeSkin
,GuiDisconnected
,GuiDownloadTerrain
,GuiEditSign
,GuiErrorScreen
,GuiGameOver
,GuiHandshakeApprove
,GuiIngameMenu
,GuiLanguage
,GuiMainMenu
,GuiMemoryErrorScreen
,GuiMultiplayer
,GuiOptions
,GuiScreenAddServer
,GuiScreenBook
,GuiScreenEditProfile
,GuiScreenOptionsSounds
,GuiScreenResourcePacks
,GuiScreenServerList
,GuiScreenWorking
,GuiStats
,GuiVideoSettings
,GuiWinGame
,GuiYesNo
,ScreenChatOptions
public abstract class GuiScreen extends Gui implements GuiYesNoCallback
-
-
Field Summary
Fields Modifier and Type Field Description boolean
allowUserInput
protected java.util.List<GuiButton>
buttonList
+ A list of all the buttons in this container.protected FontRenderer
fontRendererObj
int
height
protected RenderItem
itemRender
protected java.util.List<GuiLabel>
labelList
+ A list of all the labels in this container.protected Minecraft
mc
protected long
showingCloseKey
int
width
-
Fields inherited from class net.minecraft.client.gui.Gui
icons, optionsBackground, statIcons, zLevel
-
-
Constructor Summary
Constructors Constructor Description GuiScreen()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
actionPerformed(GuiButton parGuiButton)
+ Called by the controls from the buttonList when activated.void
confirmClicked(boolean flag, int i)
boolean
doesGuiPauseGame()
+ Returns true if this GUI should pause the game when it is displayed in single-playervoid
drawBackground(int tint)
+ Draws the background (i is always 0 as of 1.2.2)protected void
drawCreativeTabHoveringText(java.lang.String s, int i, int j)
+ Draws the text when mouse is over creative inventory tab.void
drawDefaultBackground()
+ Draws either a gradient over the background screen (when it exists) or a flat gradient over background.pngprotected void
drawHoveringText(java.util.List<java.lang.String> list, int i, int j)
+ Draws a List of strings as a tooltip.void
drawScreen(int i, int j, float var3)
+ Draws the screen and all the components in it.void
drawWorldBackground(int i)
static java.lang.String
getClipboardString()
+ Returns a string stored in the system clipboard.protected int
getCloseKey()
protected boolean
handleComponentClick(IChatComponent parIChatComponent)
+ Executes the click event specified by the given chat componentprotected void
handleComponentHover(IChatComponent parIChatComponent, int parInt1, int parInt2)
+ Draws the hover event specified by the given chat componentvoid
handleInput()
+ Delegates mouse and keyboard input.void
handleKeyboardInput()
+ Handles keyboard input.void
handleMouseInput()
+ Handles mouse input.void
initGui()
+ Adds the buttons (and other controls) to the screen in question.static boolean
isAltKeyDown()
+ Returns true if either alt key is downstatic boolean
isCtrlKeyDown()
+ Returns true if either windows ctrl key is down or if either mac meta key is downstatic boolean
isKeyComboCtrlA(int parInt1)
static boolean
isKeyComboCtrlC(int parInt1)
static boolean
isKeyComboCtrlV(int parInt1)
static boolean
isKeyComboCtrlX(int parInt1)
static boolean
isShiftKeyDown()
+ Returns true if either shift key is downprotected 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 var1, int var2, int var3, 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
onResize(Minecraft mcIn, int parInt1, int parInt2)
+ Called when the GUI is resized in order to update the world and the resolutionprotected void
renderToolTip(ItemStack itemstack, int i, int j)
void
sendChatMessage(java.lang.String msg)
void
sendChatMessage(java.lang.String msg, boolean addToChat)
static void
setClipboardString(java.lang.String copyText)
+ Stores the given string in the system clipboardprotected void
setText(java.lang.String var1, boolean var2)
+ Sets the text of the chatvoid
setWorldAndResolution(Minecraft mc, int width, int height)
+ Causes the screen to lay out its subcomponents again.void
updateScreen()
+ Called from the main game loop to update the screen.-
Methods inherited from class net.minecraft.client.gui.Gui
drawCenteredString, drawGradientRect, drawHorizontalLine, drawModalRectWithCustomSizedTexture, drawRect, drawScaledCustomSizeModalRect, drawString, drawTexturedModalRect, drawTexturedModalRect, drawTexturedModalRect, drawVerticalLine
-
-
-
-
Field Detail
-
mc
protected Minecraft mc
-
itemRender
protected RenderItem itemRender
-
width
public int width
-
height
public int height
-
buttonList
protected java.util.List<GuiButton> buttonList
+ A list of all the buttons in this container.
-
labelList
protected java.util.List<GuiLabel> labelList
+ A list of all the labels in this container.
-
allowUserInput
public boolean allowUserInput
-
fontRendererObj
protected FontRenderer fontRendererObj
-
showingCloseKey
protected long showingCloseKey
-
-
Method Detail
-
drawScreen
public void drawScreen(int i, int j, float var3)
+ Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks
-
getCloseKey
protected int getCloseKey()
-
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)
-
getClipboardString
public static java.lang.String getClipboardString()
+ Returns a string stored in the system clipboard.
-
setClipboardString
public static void setClipboardString(java.lang.String copyText)
+ Stores the given string in the system clipboard
-
renderToolTip
protected void renderToolTip(ItemStack itemstack, int i, int j)
-
drawCreativeTabHoveringText
protected void drawCreativeTabHoveringText(java.lang.String s, int i, int j)
+ Draws the text when mouse is over creative inventory tab. Params: current creative tab to be checked, current mouse x position, current mouse y position.
-
drawHoveringText
protected void drawHoveringText(java.util.List<java.lang.String> list, int i, int j)
+ Draws a List of strings as a tooltip. Every entry is drawn on a seperate line.
-
handleComponentHover
protected void handleComponentHover(IChatComponent parIChatComponent, int parInt1, int parInt2)
+ Draws the hover event specified by the given chat component
-
setText
protected void setText(java.lang.String var1, boolean var2)
+ Sets the text of the chat
-
handleComponentClick
protected boolean handleComponentClick(IChatComponent parIChatComponent)
+ Executes the click event specified by the given chat component
-
sendChatMessage
public void sendChatMessage(java.lang.String msg)
-
sendChatMessage
public void sendChatMessage(java.lang.String msg, boolean addToChat)
-
mouseClicked
protected void mouseClicked(int parInt1, int parInt2, int parInt3)
+ Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton
-
mouseReleased
protected void mouseReleased(int i, int j, int k)
+ Called when a mouse button is released. Args : mouseX, mouseY, releaseButton
-
mouseClickMove
protected void mouseClickMove(int var1, int var2, int var3, long var4)
+ Called when a mouse button is pressed and the mouse is moved around. Parameters are : mouseX, mouseY, lastButtonClicked & timeSinceMouseClick.
-
actionPerformed
protected void actionPerformed(GuiButton parGuiButton)
+ Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
-
setWorldAndResolution
public void setWorldAndResolution(Minecraft mc, int width, int height)
+ Causes the screen to lay out its subcomponents again. This is the equivalent of the Java call Container.validate()
-
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.
-
handleInput
public void handleInput() throws java.io.IOException
+ Delegates mouse and keyboard input.- Throws:
java.io.IOException
-
handleMouseInput
public void handleMouseInput() throws java.io.IOException
+ Handles mouse input.- Throws:
java.io.IOException
-
handleKeyboardInput
public void handleKeyboardInput() throws java.io.IOException
+ Handles keyboard input.- Throws:
java.io.IOException
-
updateScreen
public void updateScreen()
+ Called from the main game loop to update the screen.
-
onGuiClosed
public void onGuiClosed()
+ Called when the screen is unloaded. Used to disable keyboard repeat events
-
drawDefaultBackground
public void drawDefaultBackground()
+ Draws either a gradient over the background screen (when it exists) or a flat gradient over background.png
-
drawWorldBackground
public void drawWorldBackground(int i)
-
drawBackground
public void drawBackground(int tint)
+ Draws the background (i is always 0 as of 1.2.2)
-
doesGuiPauseGame
public boolean doesGuiPauseGame()
+ Returns true if this GUI should pause the game when it is displayed in single-player
-
confirmClicked
public void confirmClicked(boolean flag, int i)
- Specified by:
confirmClicked
in interfaceGuiYesNoCallback
-
isCtrlKeyDown
public static boolean isCtrlKeyDown()
+ Returns true if either windows ctrl key is down or if either mac meta key is down
-
isShiftKeyDown
public static boolean isShiftKeyDown()
+ Returns true if either shift key is down
-
isAltKeyDown
public static boolean isAltKeyDown()
+ Returns true if either alt key is down
-
isKeyComboCtrlX
public static boolean isKeyComboCtrlX(int parInt1)
-
isKeyComboCtrlV
public static boolean isKeyComboCtrlV(int parInt1)
-
isKeyComboCtrlC
public static boolean isKeyComboCtrlC(int parInt1)
-
isKeyComboCtrlA
public static boolean isKeyComboCtrlA(int parInt1)
-
onResize
public void onResize(Minecraft mcIn, int parInt1, int parInt2)
+ Called when the GUI is resized in order to update the world and the resolution
-
-