public abstract class GuiContainer extends GuiScreen
Modifier and Type | Field and Description |
---|---|
private Slot |
clickedSlot
Used when touchscreen is enabled.
|
private Slot |
currentDragTargetSlot |
private boolean |
doubleClick |
private ItemStack |
draggedStack
Used when touchscreen is enabled
|
private long |
dragItemDropDelay |
protected boolean |
dragSplitting |
private int |
dragSplittingButton |
private int |
dragSplittingLimit |
private int |
dragSplittingRemnant |
protected java.util.Set<Slot> |
dragSplittingSlots |
protected int |
guiLeft
Starting X position for the Gui.
|
protected int |
guiTop
Starting Y position for the Gui.
|
private boolean |
ignoreMouseUp |
protected static ResourceLocation |
inventoryBackground
The location of the inventory background texture
|
Container |
inventorySlots
A list of the players inventory slots
|
private boolean |
isRightMouseClick
Used when touchscreen is enabled.
|
private int |
lastClickButton |
private Slot |
lastClickSlot |
private long |
lastClickTime |
private ItemStack |
returningStack
Used when touchscreen is enabled
|
private Slot |
returningStackDestSlot |
private long |
returningStackTime |
private ItemStack |
shiftClickedSlot |
private Slot |
theSlot
holds the slot currently hovered
|
private int |
touchUpX |
private int |
touchUpY |
protected int |
xSize
The X size of the inventory window in pixels.
|
protected int |
ySize
The Y size of the inventory window in pixels.
|
allowUserInput, buttonList, fontRendererObj, height, itemRender, labelList, mc, width
icons, optionsBackground, statIcons, zLevel
Constructor and Description |
---|
GuiContainer(Container inventorySlotsIn) |
Modifier and Type | Method and 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-player
|
protected abstract void |
drawGuiContainerBackgroundLayer(float partialTicks,
int mouseX,
int mouseY)
Args : renderPartialTicks, mouseX, mouseY
|
protected void |
drawGuiContainerForegroundLayer(int mouseX,
int mouseY)
Draw the foreground layer for the GuiContainer (everything in front of the items).
|
private void |
drawItemStack(ItemStack stack,
int x,
int y,
java.lang.String altText)
Render an ItemStack.
|
void |
drawScreen(int mouseX,
int mouseY,
float partialTicks)
Draws the screen and all the components in it.
|
private void |
drawSlot(Slot slotIn) |
private Slot |
getSlotAtPosition(int x,
int y)
Returns the slot at the given coordinates or null if there is none.
|
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.
|
private boolean |
isMouseOverSlot(Slot slotIn,
int mouseX,
int mouseY)
Returns if the passed mouse position is over the specified slot.
|
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 typedChar,
int keyCode)
Fired when a key is typed (except F11 which toggles full screen).
|
protected void |
mouseClicked(int mouseX,
int mouseY,
int mouseButton)
Called when the mouse is clicked.
|
protected void |
mouseClickMove(int mouseX,
int mouseY,
int clickedMouseButton,
long timeSinceLastClick)
Called when a mouse button is pressed and the mouse is moved around.
|
protected void |
mouseReleased(int mouseX,
int mouseY,
int state)
Called when a mouse button is released.
|
void |
onGuiClosed()
Called when the screen is unloaded.
|
private void |
updateDragSplitting() |
void |
updateScreen()
Called from the main game loop to update the screen.
|
actionPerformed, confirmClicked, drawBackground, drawCreativeTabHoveringText, drawDefaultBackground, drawHoveringText, drawWorldBackground, getClipboardString, handleComponentClick, handleComponentHover, handleInput, handleKeyboardInput, handleMouseInput, isAltKeyDown, isCtrlKeyDown, isKeyComboCtrlA, isKeyComboCtrlC, isKeyComboCtrlV, isKeyComboCtrlX, isShiftKeyDown, onResize, renderToolTip, sendChatMessage, sendChatMessage, setClipboardString, setText, setWorldAndResolution
drawCenteredString, drawGradientRect, drawHorizontalLine, drawModalRectWithCustomSizedTexture, drawRect, drawScaledCustomSizeModalRect, drawString, drawTexturedModalRect, drawTexturedModalRect, drawTexturedModalRect, drawVerticalLine
protected static final ResourceLocation inventoryBackground
protected int xSize
protected int ySize
public Container inventorySlots
protected int guiLeft
protected int guiTop
private Slot theSlot
private Slot clickedSlot
private boolean isRightMouseClick
private ItemStack draggedStack
private int touchUpX
private int touchUpY
private Slot returningStackDestSlot
private long returningStackTime
private ItemStack returningStack
private Slot currentDragTargetSlot
private long dragItemDropDelay
protected final java.util.Set<Slot> dragSplittingSlots
protected boolean dragSplitting
private int dragSplittingLimit
private int dragSplittingButton
private boolean ignoreMouseUp
private int dragSplittingRemnant
private long lastClickTime
private Slot lastClickSlot
private int lastClickButton
private boolean doubleClick
private ItemStack shiftClickedSlot
public GuiContainer(Container inventorySlotsIn)
public void initGui()
public void drawScreen(int mouseX, int mouseY, float partialTicks)
drawScreen
in class GuiScreen
private void drawItemStack(ItemStack stack, int x, int y, java.lang.String altText)
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
protected abstract void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
private void drawSlot(Slot slotIn)
private void updateDragSplitting()
private Slot getSlotAtPosition(int x, int y)
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws java.io.IOException
mouseClicked
in class GuiScreen
java.io.IOException
protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick)
mouseClickMove
in class GuiScreen
protected void mouseReleased(int mouseX, int mouseY, int state)
mouseReleased
in class GuiScreen
private boolean isMouseOverSlot(Slot slotIn, int mouseX, int mouseY)
protected boolean isPointInRegion(int left, int top, int right, int bottom, int pointX, int pointY)
protected void handleMouseClick(Slot slotIn, int slotId, int clickedButton, int clickType)
protected void keyTyped(char typedChar, int keyCode) throws java.io.IOException
protected boolean checkHotbarKeys(int keyCode)
public void onGuiClosed()
onGuiClosed
in class GuiScreen
public boolean doesGuiPauseGame()
doesGuiPauseGame
in class GuiScreen
public void updateScreen()
updateScreen
in class GuiScreen