@Environment(value=CLIENT) public abstract class HandledScreen<T extends ScreenHandler> extends Screen implements ScreenHandlerProvider<T>
buttons, children, client, height, itemRenderer, passEvents, textRenderer, title, widthGUI_ICONS_TEXTURE, OPTIONS_BACKGROUND_TEXTURE, STATS_ICON_TEXTURE| Constructor and Description |
|---|
HandledScreen(T handler,
PlayerInventory inventory,
Text title) |
| Modifier and Type | Method and Description |
|---|---|
private void |
calculateOffset() |
protected abstract void |
drawBackground(MatrixStack matrices,
float delta,
int mouseX,
int mouseY) |
protected void |
drawForeground(MatrixStack matrices,
int mouseX,
int mouseY) |
private void |
drawItem(ItemStack stack,
int xPosition,
int yPosition,
String amountText) |
protected void |
drawMouseoverTooltip(MatrixStack matrices,
int x,
int y) |
private void |
drawSlot(MatrixStack matrices,
Slot slot) |
T |
getScreenHandler() |
private Slot |
getSlotAt(double xPosition,
double yPosition) |
protected boolean |
handleHotbarKeyPressed(int keyCode,
int scanCode) |
protected void |
init()
Called when a screen should be initialized.
|
protected boolean |
isClickOutsideBounds(double mouseX,
double mouseY,
int left,
int top,
int button) |
boolean |
isPauseScreen() |
private boolean |
isPointOverSlot(Slot slot,
double pointX,
double pointY) |
protected boolean |
isPointWithinBounds(int xPosition,
int yPosition,
int width,
int height,
double pointX,
double pointY) |
boolean |
keyPressed(int keyCode,
int scanCode,
int modifiers)
Callback for when a key down event has been captured.
|
private void |
method_30107(int int2) |
boolean |
mouseClicked(double mouseX,
double mouseY,
int button)
Callback for when a mouse button down event
has been captured.
|
boolean |
mouseDragged(double mouseX,
double mouseY,
int button,
double deltaX,
double deltaY)
Callback for when a mouse button drag event
has been captured.
|
boolean |
mouseReleased(double mouseX,
double mouseY,
int button)
Callback for when a mouse button release event
has been captured.
|
void |
onClose() |
protected void |
onMouseClick(Slot slot,
int invSlot,
int clickData,
SlotActionType actionType) |
void |
removed() |
void |
render(MatrixStack matrices,
int mouseX,
int mouseY,
float delta) |
void |
tick() |
addButton, addChild, children, filesDragged, getNarrationMessage, getTitle, getTooltipFromItem, handleTextClick, hasAltDown, hasControlDown, hasShiftDown, init, insertText, isCopy, isCut, isMouseOver, isPaste, isSelectAll, isValidCharacterForName, renderBackground, renderBackground, renderBackgroundTexture, renderOrderedTooltip, renderTextHoverEffect, renderTooltip, renderTooltip, renderTooltip, resize, sendMessage, sendMessage, shouldCloseOnEsc, wrapScreenErrorgetFocused, isDragging, setDragging, setFocuseddrawCenteredString, drawCenteredText, drawHorizontalLine, drawSprite, drawStringWithShadow, drawTexture, drawTexture, drawTexture, drawTexture, drawTextWithShadow, drawVerticalLine, fill, fillGradient, fillGradient, getZOffset, method_29343, setZOffsetclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitchangeFocus, charTyped, focusOn, hoveredElement, keyReleased, mouseScrolled, setInitialFocusmouseMovedpublic static final Identifier BACKGROUND_TEXTURE
protected int backgroundWidth
protected int backgroundHeight
protected int titleX
protected int titleY
protected int playerInventoryTitleX
protected int playerInventoryTitleY
protected final T extends ScreenHandler handler
protected final PlayerInventory playerInventory
protected int x
protected int y
private boolean touchIsRightClickDrag
private ItemStack touchDragStack
private int touchDropX
private int touchDropY
private long touchDropTime
private ItemStack touchDropReturningStack
private long touchDropTimer
protected boolean cursorDragging
private int heldButtonType
private int heldButtonCode
private boolean cancelNextRelease
private int draggedStackRemainder
private long lastButtonClickTime
private int lastClickedButton
private boolean doubleClicking
private ItemStack quickMovingStack
public HandledScreen(T handler, PlayerInventory inventory, Text title)
protected void init()
This method is called when this screen is opened or resized.
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta)
protected void drawMouseoverTooltip(MatrixStack matrices, int x, int y)
protected void drawForeground(MatrixStack matrices, int mouseX, int mouseY)
protected abstract void drawBackground(MatrixStack matrices, float delta, int mouseX, int mouseY)
private void drawSlot(MatrixStack matrices, Slot slot)
private void calculateOffset()
public boolean mouseClicked(double mouseX,
double mouseY,
int button)
GLFW class.mouseClicked in interface ElementmouseClicked in interface ParentElementmouseX - the X coordinate of the mousemouseY - the Y coordinate of the mousebutton - the mouse button numbertrue to indicate that the event handling is successful/validMouse.onMouseButton(long, int, int, int),
GLFW.GLFW_MOUSE_BUTTON_1private void method_30107(int int2)
protected boolean isClickOutsideBounds(double mouseX,
double mouseY,
int left,
int top,
int button)
public boolean mouseDragged(double mouseX,
double mouseY,
int button,
double deltaX,
double deltaY)
GLFW class.mouseDragged in interface ElementmouseDragged in interface ParentElementmouseX - the current X coordinate of the mousemouseY - the current Y coordinate of the mousebutton - the mouse button numberdeltaX - the difference of the current X with the previous X coordinatedeltaY - the difference of the current Y with the previous Y coordinatetrue to indicate that the event handling is successful/validMouse.onCursorPos(long, double, double),
GLFW.GLFW_MOUSE_BUTTON_1public boolean mouseReleased(double mouseX,
double mouseY,
int button)
GLFW class.mouseReleased in interface ElementmouseReleased in interface ParentElementmouseX - the X coordinate of the mousemouseY - the Y coordinate of the mousebutton - the mouse button numbertrue to indicate that the event handling is successful/validMouse.onMouseButton(long, int, int, int),
GLFW.GLFW_MOUSE_BUTTON_1private boolean isPointOverSlot(Slot slot, double pointX, double pointY)
protected boolean isPointWithinBounds(int xPosition,
int yPosition,
int width,
int height,
double pointX,
double pointY)
protected void onMouseClick(Slot slot, int invSlot, int clickData, SlotActionType actionType)
public boolean keyPressed(int keyCode,
int scanCode,
int modifiers)
GLFW class.keyPressed in interface ElementkeyPressed in interface ParentElementkeyPressed in class ScreenkeyCode - the named key code of the event as described in the GLFW classscanCode - the unique/platform-specific scan code of the keyboard inputmodifiers - a GLFW bitfield describing the modifier keys that are held down (see GLFW Modifier key flags)true to indicate that the event handling is successful/validKeyboard.onKey(long, int, int, int, int),
GLFW.GLFW_KEY_Q,
GLFWKeyCallbackI.invoke(long, int, int, int, int)protected boolean handleHotbarKeyPressed(int keyCode,
int scanCode)
public boolean isPauseScreen()
isPauseScreen in class Screenpublic void tick()
tick in interface TickableElementtick in class Screenpublic T getScreenHandler()
getScreenHandler in interface ScreenHandlerProvider<T extends ScreenHandler>