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 classNested classes/interfaces inherited from class net.minecraft.client.gui.screens.Screen
Screen.NarratableSearchResult -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate PageButtonprivate static final FormattedCharSequenceprivate final ItemStackprivate Buttonprivate intprivate BookEditScreen.DisplayCacheprivate Buttonprivate static final Componentprivate static final Componentprivate Buttonprivate PageButtonprivate intUpdate ticks since the gui was openedprivate static final FormattedCharSequenceprivate final InteractionHandprivate static final intprivate static final intprivate booleanWhether the book's title or contents has been modified since being openedprivate booleanDetermines if the signing screen is openprivate longIn millisecondsprivate intprivate final Playerprivate final Componentprivate final TextFieldHelperprivate Componentprivate Buttonprivate static final intprivate static final intprivate Stringprivate final TextFieldHelperFields 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, widthFields inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
DOUBLE_CLICK_THRESHOLD_MS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidprivate booleanbookKeyPressed(int pKeyCode, int pScanCode, int pModifiers) Handles keypresses, clipboard functions, and page turningprivate voidchangeLine(int pYChange) booleancharTyped(char pCodePoint, int pModifiers) Called when a character is typed within the GUI element.private voidprivate voidprivate BookEditScreen.Pos2iconvertLocalToScreen(BookEditScreen.Pos2i pLocalScreenPos) private BookEditScreen.Pos2iconvertScreenToLocal(BookEditScreen.Pos2i pScreenPos) private Rect2icreatePartialLineSelection(String pInput, StringSplitter pSplitter, int pStartPos, int pEndPos, int pY, int pLineStart) private Rect2icreateSelection(BookEditScreen.Pos2i pCorner1, BookEditScreen.Pos2i pCorner2) private void(package private) static intfindLineFromPos(int[] pLineStarts, int pFind) private Stringprivate Stringprivate BookEditScreen.DisplayCacheprivate intprotected voidinit()private voidkeyDown()private voidkeyEnd()private voidkeyHome()booleankeyPressed(int pKeyCode, int pScanCode, int pModifiers) Called when a keyboard key is pressed within the GUI element.private voidkeyUp()booleanmouseClicked(double pMouseX, double pMouseY, int pButton) Called when a mouse button is clicked within the GUI element.booleanmouseDragged(double pMouseX, double pMouseY, int pButton, double pDragX, double pDragY) Called when the mouse is dragged within the GUI element.private voidpageBack()private voidprivate BookEditScreen.DisplayCachevoidrender(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick) Renders the graphical user interface (GUI) element.voidrenderBackground(GuiGraphics pGuiGraphics, int pMouseX, int pMouseY, float pPartialTick) private voidrenderCursor(GuiGraphics pGuiGraphics, BookEditScreen.Pos2i pCursorPos, boolean pIsEndOfText) private voidrenderHighlight(GuiGraphics pGuiGraphics, Rect2i[] pHighlightAreas) private voidsaveChanges(boolean pPublish) private voidselectWord(int pIndex) private voidsetClipboard(String p_98148_) private voidsetCurrentPageText(String p_98159_) voidtick()private booleantitleKeyPressed(int pKeyCode, int pScanCode, int pModifiers) Handles special keys pressed while editing the book's titleprivate voidprivate voidMethods 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, wrapScreenErrorMethods inherited from class net.minecraft.client.gui.components.events.AbstractContainerEventHandler
getFocused, isDragging, setDragging, setFocusedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.client.gui.components.events.ContainerEventHandler
getChildAt, getCurrentFocusPath, isFocused, keyReleased, mouseReleased, mouseScrolled, nextFocusPath, setFocusedMethods inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
mouseMovedMethods 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:
keyPressedin interfaceContainerEventHandler- Specified by:
keyPressedin interfaceGuiEventListener- Overrides:
keyPressedin classScreen- Parameters:
pKeyCode- the key code of the pressed key.pScanCode- the scan code of the pressed key.pModifiers- the keyboard modifiers.- Returns:
trueif the event is consumed,falseotherwise.
-
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:
trueif the event is consumed,falseotherwise.
-
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:
renderin interfaceRenderable- Overrides:
renderin 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:
renderBackgroundin 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:
trueif the event is consumed,falseotherwise.
-
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:
trueif the event is consumed,falseotherwise.
-
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
-