Class BookEditScreen
java.lang.Object
net.minecraft.client.gui.components.events.AbstractContainerEventHandler
net.minecraft.client.gui.screens.Screen
net.minecraft.client.gui.screens.inventory.BookEditScreen
- All Implemented Interfaces:
ContainerEventHandler
,GuiEventListener
,Renderable
,TabOrderedElement
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
(package private) static class
(package private) static class
Nested classes/interfaces inherited from class net.minecraft.client.gui.screens.Screen
Screen.NarratableSearchResult
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate PageButton
private static final FormattedCharSequence
private final ItemStack
private Button
private int
private BookEditScreen.DisplayCache
private Button
private static final Component
private static final Component
private Button
private PageButton
private int
Update ticks since the gui was openedprivate static final FormattedCharSequence
private final InteractionHand
private static final int
private static final int
private boolean
Whether the book's title or contents has been modified since being openedprivate boolean
Determines if the signing screen is openprivate long
In millisecondsprivate int
private final Player
private final Component
private final TextFieldHelper
private Component
private Button
private static final int
private static final int
private String
private final TextFieldHelper
Fields inherited from class net.minecraft.client.gui.screens.Screen
CUBE_MAP, font, FOOTER_SEPARATOR, HEADER_SEPARATOR, height, INWORLD_FOOTER_SEPARATOR, INWORLD_HEADER_SEPARATOR, MENU_BACKGROUND, minecraft, narratorButton, PANORAMA, renderables, screenExecutor, width
Fields inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
DOUBLE_CLICK_THRESHOLD_MS
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
private boolean
bookKeyPressed
(int pKeyCode, int pScanCode, int pModifiers) Handles keypresses, clipboard functions, and page turningprivate void
changeLine
(int pYChange) boolean
charTyped
(char pCodePoint, int pModifiers) Called when a character is typed within the GUI element.private void
private void
private BookEditScreen.Pos2i
convertLocalToScreen
(BookEditScreen.Pos2i pLocalScreenPos) private BookEditScreen.Pos2i
convertScreenToLocal
(BookEditScreen.Pos2i pScreenPos) private Rect2i
createPartialLineSelection
(String pInput, StringSplitter pSplitter, int pStartPos, int pEndPos, int pY, int pLineStart) private Rect2i
createSelection
(BookEditScreen.Pos2i pCorner1, BookEditScreen.Pos2i pCorner2) private void
(package private) static int
findLineFromPos
(int[] pLineStarts, int pFind) private String
private String
private BookEditScreen.DisplayCache
private int
protected void
init()
private void
keyDown()
private void
keyEnd()
private void
keyHome()
boolean
keyPressed
(int pKeyCode, int pScanCode, int pModifiers) Called when a keyboard key is pressed within the GUI element.private void
keyUp()
boolean
mouseClicked
(double pMouseX, double pMouseY, int pButton) Called when a mouse button is clicked within the GUI element.boolean
mouseDragged
(double pMouseX, double pMouseY, int pButton, double pDragX, double pDragY) Called when the mouse is dragged within the GUI element.private void
pageBack()
private void
private BookEditScreen.DisplayCache
void
render
(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick) Renders the graphical user interface (GUI) element.void
renderBackground
(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick) private void
renderCursor
(GuiGraphics pGuiGraphics, BookEditScreen.Pos2i pCursorPos, boolean pIsEndOfText) private void
renderHighlight
(GuiGraphics pGuiGraphics, Rect2i[] pHighlightAreas) private void
saveChanges
(boolean pPublish) private void
selectWord
(int pIndex) private void
setClipboard
(String p_98148_) private void
setCurrentPageText
(String p_98159_) void
tick()
private boolean
titleKeyPressed
(int pKeyCode, int pScanCode, int pModifiers) Handles special keys pressed while editing the book's titleprivate void
private void
Methods inherited from class net.minecraft.client.gui.screens.Screen
added, addRenderableOnly, addRenderableWidget, addWidget, afterKeyboardAction, afterMouseAction, afterMouseMove, changeFocus, children, clearFocus, clearTooltipForNextRenderPass, clearWidgets, findNarratableWidget, getBackgroundMusic, getMinecraft, getNarrationMessage, getRectangle, getTitle, getTooltipFromItem, getUsageNarration, handleComponentClicked, handleDelayedNarration, hasAltDown, hasControlDown, hasShiftDown, init, insertText, isCopy, isCut, isMouseOver, isPaste, isPauseScreen, isSelectAll, isValidCharacterForName, onClose, onFilesDrop, rebuildWidgets, removed, removeWidget, renderBlurredBackground, renderMenuBackground, renderMenuBackground, renderMenuBackgroundTexture, renderPanorama, renderTransparentBackground, renderWithTooltip, repositionElements, resize, setInitialFocus, setInitialFocus, setTooltipForNextRenderPass, setTooltipForNextRenderPass, setTooltipForNextRenderPass, setTooltipForNextRenderPass, shouldCloseOnEsc, shouldNarrateNavigation, triggerImmediateNarration, updateNarratedWidget, updateNarrationState, updateNarratorStatus, wrapScreenError
Methods inherited from class net.minecraft.client.gui.components.events.AbstractContainerEventHandler
getFocused, isDragging, setDragging, setFocused
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.client.gui.components.events.ContainerEventHandler
getChildAt, getCurrentFocusPath, isFocused, keyReleased, mouseReleased, mouseScrolled, nextFocusPath, setFocused
Methods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
mouseMoved
Methods inherited from interface net.minecraft.client.gui.components.TabOrderedElement
getTabOrderGroup
-
Field Details
-
TEXT_WIDTH
private static final int TEXT_WIDTH- See Also:
-
TEXT_HEIGHT
private static final int TEXT_HEIGHT- See Also:
-
IMAGE_WIDTH
private static final int IMAGE_WIDTH- See Also:
-
IMAGE_HEIGHT
private static final int IMAGE_HEIGHT- See Also:
-
EDIT_TITLE_LABEL
-
FINALIZE_WARNING_LABEL
-
BLACK_CURSOR
-
GRAY_CURSOR
-
owner
-
book
-
isModified
private boolean isModifiedWhether the book's title or contents has been modified since being opened -
isSigning
private boolean isSigningDetermines if the signing screen is open -
frameTick
private int frameTickUpdate ticks since the gui was opened -
currentPage
private int currentPage -
pages
-
title
-
pageEdit
-
titleEdit
-
lastClickTime
private long lastClickTimeIn milliseconds -
lastIndex
private int lastIndex -
forwardButton
-
backButton
-
doneButton
-
signButton
-
finalizeButton
-
cancelButton
-
hand
-
displayCache
-
pageMsg
-
ownerText
-
-
Constructor Details
-
BookEditScreen
-
-
Method Details
-
setClipboard
-
getClipboard
-
getNumPages
private int getNumPages() -
tick
public void tick() -
init
protected void init() -
pageBack
private void pageBack() -
pageForward
private void pageForward() -
updateButtonVisibility
private void updateButtonVisibility() -
eraseEmptyTrailingPages
private void eraseEmptyTrailingPages() -
saveChanges
private void saveChanges(boolean pPublish) -
updateLocalCopy
private void updateLocalCopy() -
appendPageToBook
private void appendPageToBook() -
keyPressed
public boolean keyPressed(int pKeyCode, int pScanCode, int pModifiers) Called when a keyboard key is pressed within the GUI element.- Specified by:
keyPressed
in interfaceContainerEventHandler
- Specified by:
keyPressed
in interfaceGuiEventListener
- Overrides:
keyPressed
in classScreen
- Parameters:
pKeyCode
- the key code of the pressed key.pScanCode
- the scan code of the pressed key.pModifiers
- the keyboard modifiers.- Returns:
true
if the event is consumed,false
otherwise.
-
charTyped
public boolean charTyped(char pCodePoint, int pModifiers) Called when a character is typed within the GUI element.- Parameters:
pCodePoint
- the code point of the typed character.pModifiers
- the keyboard modifiers.- Returns:
true
if the event is consumed,false
otherwise.
-
bookKeyPressed
private boolean bookKeyPressed(int pKeyCode, int pScanCode, int pModifiers) Handles keypresses, clipboard functions, and page turning -
keyUp
private void keyUp() -
keyDown
private void keyDown() -
changeLine
private void changeLine(int pYChange) -
keyHome
private void keyHome() -
keyEnd
private void keyEnd() -
titleKeyPressed
private boolean titleKeyPressed(int pKeyCode, int pScanCode, int pModifiers) Handles special keys pressed while editing the book's title -
getCurrentPageText
-
setCurrentPageText
-
render
Renders the graphical user interface (GUI) element.- Specified by:
render
in interfaceRenderable
- Overrides:
render
in classScreen
- Parameters:
pGuiGraphics
- the GuiGraphics object used for rendering.pMouseX
- the x-coordinate of the mouse cursor.pMouseY
- the y-coordinate of the mouse cursor.pPartialTick
- the partial tick time.
-
renderBackground
public void renderBackground(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick) - Overrides:
renderBackground
in classScreen
-
renderCursor
private void renderCursor(GuiGraphics pGuiGraphics, BookEditScreen.Pos2i pCursorPos, boolean pIsEndOfText) -
renderHighlight
-
convertScreenToLocal
-
convertLocalToScreen
-
mouseClicked
public boolean mouseClicked(double pMouseX, double pMouseY, int pButton) Called when a mouse button is clicked within the GUI element.- Parameters:
pMouseX
- the X coordinate of the mouse.pMouseY
- the Y coordinate of the mouse.pButton
- the button that was clicked.- Returns:
true
if the event is consumed,false
otherwise.
-
selectWord
private void selectWord(int pIndex) -
mouseDragged
public boolean mouseDragged(double pMouseX, double pMouseY, int pButton, double pDragX, double pDragY) Called when the mouse is dragged within the GUI element.- Parameters:
pMouseX
- the X coordinate of the mouse.pMouseY
- the Y coordinate of the mouse.pButton
- the button that is being dragged.pDragX
- the X distance of the drag.pDragY
- the Y distance of the drag.- Returns:
true
if the event is consumed,false
otherwise.
-
getDisplayCache
-
clearDisplayCache
private void clearDisplayCache() -
clearDisplayCacheAfterPageChange
private void clearDisplayCacheAfterPageChange() -
rebuildDisplayCache
-
findLineFromPos
static int findLineFromPos(int[] pLineStarts, int pFind) -
createPartialLineSelection
private Rect2i createPartialLineSelection(String pInput, StringSplitter pSplitter, int pStartPos, int pEndPos, int pY, int pLineStart) -
createSelection
-