public abstract class MalisisGui
extends net.minecraft.client.gui.GuiScreen
| Modifier and Type | Field and Description |
|---|---|
static GuiTexture |
BLOCK_TEXTURE |
static boolean |
cancelClose
Whether or not to cancel the next gui close event.
|
protected boolean |
constructed
Whether this GUI has been constructed.
|
protected int |
currentGuiScale
Currently used gui scale.
|
protected int |
displayHeight
Height of the window.
|
protected int |
displayWidth
Width of the window.
|
protected UIComponent<?> |
focusedComponent
Currently focused child component.
|
protected boolean |
guiscreenBackground
Determines if the screen should be darkened when the GUI is opened.
|
protected UIComponent<?> |
hoveredComponent
Currently hovered child component.
|
protected MalisisInventoryContainer |
inventoryContainer
Inventory container that handles the inventories and slots actions.
|
protected boolean |
isOverlay
Whether this GUI is considered as an overlay
|
protected java.util.Set<IKeyListener> |
keyListeners
List of
IKeyListener registered. |
protected long |
lastClickButton
Last clicked button
|
protected long |
lastClickTime
How long since last click.
|
protected int |
lastMouseX
Last known position of the mouse.
|
protected int |
lastMouseY
Last known position of the mouse.
|
protected GuiRenderer |
renderer
Renderer drawing the components.
|
protected net.minecraft.client.gui.ScaledResolution |
resolution
The resolution for the GUI
|
| Modifier | Constructor and Description |
|---|---|
protected |
MalisisGui() |
| Modifier and Type | Method and Description |
|---|---|
void |
addDebug(java.lang.String name,
java.lang.Object... objects) |
protected void |
addToScreen(UIComponent<?> component)
Adds container to the screen.
|
void |
animate(Animation<?> animation) |
void |
animate(Animation<?> animation,
int delay) |
void |
clearScreen()
Removes all the components from the screen
|
void |
close()
Closes this
MalisisGui. |
void |
closeOverlay() |
abstract void |
construct()
Called before display() if this
MalisisGui is not constructed yet. |
static MalisisGui |
currentGui()
Gets the current
MalisisGui displayed. |
static <T extends MalisisGui> |
currentGui(java.lang.Class<T> type)
Gets the current
MalisisGui of the specified type displayed. |
void |
display()
Displays this
MalisisGui. |
void |
display(boolean cancelClose)
Display this
MalisisGui. |
void |
displayOverlay() |
protected boolean |
doConstruct() |
boolean |
doesGuiPauseGame() |
void |
drawScreen(int mouseX,
int mouseY,
float partialTicks)
Draws this
MalisisGui. |
UIComponent<?> |
getComponentAt(int x,
int y)
Gets the
UIContainer at the specified coordinates inside this MalisisGui. |
long |
getElapsedTime()
Gets elapsed time since the GUI was opened.
|
static UIComponent<?> |
getFocusedComponent()
Gets the currently focused
UIComponent |
GuiTexture |
getGuiTexture()
Gets the default
GuiTexture used by the GuiRenderer. |
static UIComponent<?> |
getHoveredComponent() |
MalisisInventoryContainer |
getInventoryContainer()
Gets the
MalisisInventoryContainer for this MalisisGui. |
GuiRenderer |
getRenderer()
Gets the
GuiRenderer for this MalisisGui. |
void |
handleMouseInput()
Called every frame to handle mouse input.
|
static boolean |
isGuiCloseKey(int keyCode) |
void |
keyEvent(net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent event) |
protected void |
keyTyped(char keyChar,
int keyCode)
Called when a key is pressed on the keyboard.
|
protected void |
mouseClicked(int x,
int y,
int button)
Called when a mouse button is pressed down.
|
protected void |
mouseClickMove(int x,
int y,
int button,
long timer)
Called when the mouse is moved while a button is pressed.
|
protected void |
mouseReleased(int x,
int y,
int button)
Called when a mouse button is released.
|
void |
onGuiClosed() |
static void |
playSound(net.minecraft.util.SoundEvent sound) |
static void |
playSound(net.minecraft.util.SoundEvent sound,
float level) |
void |
registerKeyListener(IKeyListener listener)
Registers a
IKeyListener that will always receive keys types, even when not focused or hovered. |
void |
removeDebug(java.lang.String name) |
void |
renderOverlay(net.minecraftforge.client.event.RenderGameOverlayEvent.Post event) |
static void |
sendAction(MalisisInventoryContainer.ActionType action,
MalisisSlot slot,
int code)
Sends a GUI action to the server.
|
static boolean |
setFocusedComponent(UIComponent<?> component,
boolean focused) |
static boolean |
setHoveredComponent(UIComponent<?> component,
boolean hovered)
Sets the hovered state for a
UIComponent. |
void |
setInventoryContainer(MalisisInventoryContainer container)
Sets the
MalisisInventoryContainer for this MalisisGui. |
void |
setResolution()
Sets the resolution for this
MalisisGui. |
void |
setWorldAndResolution(net.minecraft.client.Minecraft minecraft,
int width,
int height)
Called when game resolution changes.
|
void |
unregisterKeyListener(IKeyListener listener)
Unregisters a previously registered IKeyListener.
|
void |
update(int mouseX,
int mouseY,
float partialTick)
Called every frame.
|
void |
updateGui()
Called from TE when TE is updated.
|
actionPerformed, addButton, confirmClicked, drawBackground, drawCreativeTabHoveringText, drawDefaultBackground, drawHoveringText, drawHoveringText, drawWorldBackground, getClipboardString, handleComponentClick, handleComponentHover, handleInput, handleKeyboardInput, initGui, isAltKeyDown, isCtrlKeyDown, isKeyComboCtrlA, isKeyComboCtrlC, isKeyComboCtrlV, isKeyComboCtrlX, isShiftKeyDown, onResize, renderToolTip, sendChatMessage, sendChatMessage, setClipboardString, setGuiSize, setText, updateScreenpublic static GuiTexture BLOCK_TEXTURE
public static boolean cancelClose
protected GuiRenderer renderer
protected int displayWidth
protected int displayHeight
protected int currentGuiScale
protected net.minecraft.client.gui.ScaledResolution resolution
protected boolean guiscreenBackground
protected int lastMouseX
protected int lastMouseY
protected long lastClickButton
protected long lastClickTime
protected MalisisInventoryContainer inventoryContainer
protected boolean isOverlay
protected UIComponent<?> hoveredComponent
protected UIComponent<?> focusedComponent
protected boolean constructed
protected java.util.Set<IKeyListener> keyListeners
IKeyListener registered.public abstract void construct()
MalisisGui is not constructed yet.protected boolean doConstruct()
public GuiRenderer getRenderer()
GuiRenderer for this MalisisGui.public void setInventoryContainer(MalisisInventoryContainer container)
MalisisInventoryContainer for this MalisisGui.container - the inventory containerpublic MalisisInventoryContainer getInventoryContainer()
MalisisInventoryContainer for this MalisisGui.public GuiTexture getGuiTexture()
GuiTexture used by the GuiRenderer.public long getElapsedTime()
public final void setWorldAndResolution(net.minecraft.client.Minecraft minecraft,
int width,
int height)
setWorldAndResolution in class net.minecraft.client.gui.GuiScreenpublic void setResolution()
MalisisGui.public void addDebug(java.lang.String name,
java.lang.Object... objects)
public void removeDebug(java.lang.String name)
protected void addToScreen(UIComponent<?> component)
component - the componentpublic void clearScreen()
public void registerKeyListener(IKeyListener listener)
IKeyListener that will always receive keys types, even when not focused or hovered.listener - the listenerpublic void unregisterKeyListener(IKeyListener listener)
listener - the listenerpublic UIComponent<?> getComponentAt(int x, int y)
UIContainer at the specified coordinates inside this MalisisGui.x - the x coordinatey - the y coordinatescreenpublic void handleMouseInput()
handleMouseInput in class net.minecraft.client.gui.GuiScreenprotected void mouseClicked(int x,
int y,
int button)
mouseClicked in class net.minecraft.client.gui.GuiScreenprotected void mouseClickMove(int x,
int y,
int button,
long timer)
mouseClickMove in class net.minecraft.client.gui.GuiScreenprotected void mouseReleased(int x,
int y,
int button)
mouseReleased in class net.minecraft.client.gui.GuiScreenprotected void keyTyped(char keyChar,
int keyCode)
keyTyped in class net.minecraft.client.gui.GuiScreenpublic void drawScreen(int mouseX,
int mouseY,
float partialTicks)
MalisisGui.drawScreen in class net.minecraft.client.gui.GuiScreenpublic void update(int mouseX,
int mouseY,
float partialTick)
mouseX - the mouse xmouseY - the mouse ypartialTick - the partial tickpublic void updateGui()
public void animate(Animation<?> animation)
public void animate(Animation<?> animation, int delay)
public boolean doesGuiPauseGame()
doesGuiPauseGame in class net.minecraft.client.gui.GuiScreenpublic void display()
MalisisGui.public void display(boolean cancelClose)
MalisisGui.cancelClose - the wether or not to cancel the next Gui close event (used for when the GUI is opened from command)public void close()
MalisisGui.public void displayOverlay()
public void closeOverlay()
public void onGuiClosed()
onGuiClosed in class net.minecraft.client.gui.GuiScreenpublic void renderOverlay(net.minecraftforge.client.event.RenderGameOverlayEvent.Post event)
public void keyEvent(net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent event)
public static MalisisGui currentGui()
MalisisGui displayed.MalisisGuipublic static <T extends MalisisGui> T currentGui(java.lang.Class<T> type)
MalisisGui of the specified type displayed.T - the generic typetype - the typepublic static void sendAction(MalisisInventoryContainer.ActionType action, MalisisSlot slot, int code)
action - the actionslot - the slotcode - the keyboard codepublic static UIComponent<?> getHoveredComponent()
UIComponent. null if there is no current GUI.public static boolean setHoveredComponent(UIComponent<?> component, boolean hovered)
UIComponent. If a UIComponent is currently hovered, it will be "unhovered" first.component - the component that gets his state changedhovered - the hovered statepublic static UIComponent<?> getFocusedComponent()
UIComponentpublic static boolean setFocusedComponent(UIComponent<?> component, boolean focused)
public static void playSound(net.minecraft.util.SoundEvent sound)
public static void playSound(net.minecraft.util.SoundEvent sound,
float level)
public static boolean isGuiCloseKey(int keyCode)