public abstract class BaseComponent
extends net.minecraft.client.gui.screen.Screen
Modifier and Type | Field and Description |
---|---|
protected net.minecraft.client.gui.FontRenderer |
fontRenderer |
protected IKeyboardListener |
keyboardEventListener |
protected IMouseEventListener |
mouseEventListener |
protected GuiBase<?> |
parent |
protected java.util.List<java.lang.String> |
toolTip |
protected int |
xPos |
protected int |
yPos |
Constructor and Description |
---|
BaseComponent(GuiBase<?> parentGui,
int x,
int y) |
BaseComponent(GuiBase<?> parentGui,
net.minecraft.util.text.ITextComponent titleIn,
int x,
int y)
Main constructor for all components
|
Modifier and Type | Method and Description |
---|---|
java.awt.Rectangle |
getArea(int guiLeft,
int guiTop)
Used to get what area is being displayed, mainly used for JEI
|
java.util.List<java.lang.String> |
getDynamicToolTip(int mouseX,
int mouseY)
Used to determine if a dynamic tooltip is needed at runtime
|
abstract int |
getHeight()
Used to find how tall this is
|
IKeyboardListener |
getKeyboardEventListener() |
IMouseEventListener |
getMouseEventListener() |
GuiBase |
getParent() |
java.util.List<java.lang.String> |
getToolTip() |
abstract int |
getWidth()
Used to find how wide this is
|
int |
getXPos()
Accessors/Mutators *
|
int |
getYPos() |
boolean |
isMouseOver(int mouseX,
int mouseY)
Used to check if the mouse if currently over the component
You must have the getWidth() and getHeight() functions defined for this to work properly
|
void |
keyTyped(char letter,
int keyCode)
Used when a key is pressed
|
void |
mouseDown(double x,
double y,
int button)
Called when the mouse is pressed
|
void |
mouseDrag(double x,
double y,
int button,
double xDragAmount,
double yDragAmount)
Called when the user drags the component
|
void |
mouseScrolled(int dir)
Called when the mouse is scrolled
|
void |
mouseUp(double x,
double y,
int button)
Called when the mouse button is over the component and released
|
abstract void |
render(int guiLeft,
int guiTop,
int mouseX,
int mouseY)
Called to render the component
|
abstract void |
renderOverlay(int guiLeft,
int guiTop,
int mouseX,
int mouseY)
Called after base render, is already translated to guiLeft and guiTop, just move offset
|
void |
renderToolTip(int mouseX,
int mouseY)
Render the tooltip if you can
|
void |
setKeyboardEventListener(IKeyboardListener keyboardEventListener) |
void |
setMouseEventListener(IMouseEventListener mouseEventListener) |
void |
setParent(GuiBase parent) |
void |
setToolTip(java.util.List<java.lang.String> toolTip) |
void |
setXPos(int xPos) |
void |
setYPos(int yPos) |
addButton, children, getMinecraft, getNarrationMessage, getTitle, getTooltipFromItem, handleComponentClicked, hasAltDown, hasControlDown, hasShiftDown, init, init, insertText, isCopy, isCut, isMouseOver, isPaste, isPauseScreen, isSelectAll, isValidCharacterForName, keyPressed, onClose, removed, render, renderBackground, renderBackground, renderComponentHoverEffect, renderDirtBackground, renderTooltip, renderTooltip, renderTooltip, renderTooltip, resize, sendMessage, sendMessage, setSize, shouldCloseOnEsc, tick, wrapScreenError
getFocused, isDragging, setDragging, setFocused
blit, blit, blit, blit, blit, drawCenteredString, drawRightAlignedString, drawString, fill, fillGradient, hLine, innerBlit, vLine
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
protected int xPos
protected int yPos
protected GuiBase<?> parent
protected java.util.List<java.lang.String> toolTip
protected IMouseEventListener mouseEventListener
protected IKeyboardListener keyboardEventListener
protected net.minecraft.client.gui.FontRenderer fontRenderer
public BaseComponent(GuiBase<?> parentGui, int x, int y)
public BaseComponent(GuiBase<?> parentGui, net.minecraft.util.text.ITextComponent titleIn, int x, int y)
parentGui
- The parent Guix
- The x positiony
- The y positionpublic abstract void render(int guiLeft, int guiTop, int mouseX, int mouseY)
public abstract void renderOverlay(int guiLeft, int guiTop, int mouseX, int mouseY)
public abstract int getWidth()
public abstract int getHeight()
@Nullable public java.util.List<java.lang.String> getDynamicToolTip(int mouseX, int mouseY)
mouseX
- Mouse X PosmouseY
- Mouse Y Pospublic void renderToolTip(int mouseX, int mouseY)
mouseX
- Mouse XmouseY
- Mouse Ypublic java.awt.Rectangle getArea(int guiLeft, int guiTop)
public void mouseDown(double x, double y, int button)
x
- Mouse X Positiony
- Mouse Y Positionbutton
- Mouse Buttonpublic void mouseUp(double x, double y, int button)
x
- Mouse X Positiony
- Mouse Y Positionbutton
- Mouse Buttonpublic void mouseDrag(double x, double y, int button, double xDragAmount, double yDragAmount)
x
- Mouse X Positiony
- Mouse Y Positionbutton
- Mouse Buttonpublic void mouseScrolled(int dir)
dir
- 1 for positive, -1 for negativepublic boolean isMouseOver(int mouseX, int mouseY)
mouseX
- Mouse X PositionmouseY
- Mouse Y Positionpublic void keyTyped(char letter, int keyCode)
letter
- The letterkeyCode
- The codepublic int getXPos()
public void setXPos(int xPos)
public int getYPos()
public void setYPos(int yPos)
public GuiBase getParent()
public void setParent(GuiBase parent)
public java.util.List<java.lang.String> getToolTip()
public void setToolTip(java.util.List<java.lang.String> toolTip)
public IMouseEventListener getMouseEventListener()
public void setMouseEventListener(IMouseEventListener mouseEventListener)
public IKeyboardListener getKeyboardEventListener()
public void setKeyboardEventListener(IKeyboardListener keyboardEventListener)