Class BookViewScreen
java.lang.Object
net.minecraft.client.gui.components.events.AbstractContainerEventHandler
net.minecraft.client.gui.screens.Screen
net.minecraft.client.gui.screens.inventory.BookViewScreen
- All Implemented Interfaces:
ContainerEventHandler
,GuiEventListener
,Renderable
,TabOrderedElement
- Direct Known Subclasses:
LecternScreen
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class net.minecraft.client.gui.screens.Screen
Screen.NarratableSearchResult
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate PageButton
static final ResourceLocation
private BookViewScreen.BookAccess
private int
private List
<FormattedCharSequence> Holds a copy of the page text, split into page width linesprivate int
static final BookViewScreen.BookAccess
private PageButton
protected static final int
protected static final int
static final int
static final int
static final int
private Component
private final boolean
Determines if a sound is played when the page is turnedprotected static final int
protected static final int
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, title, width
Fields inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
DOUBLE_CLICK_THRESHOLD_MS
-
Constructor Summary
ConstructorsModifierConstructorDescriptionBookViewScreen
(BookViewScreen.BookAccess pBookAccess) private
BookViewScreen
(BookViewScreen.BookAccess pBookAccess, boolean pPlayTurnSound) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
protected void
protected boolean
forcePage
(int pPageNum) I'm not sure why this exists.getClickedComponentStyleAt
(double pMouseX, double pMouseY) private int
boolean
handleComponentClicked
(Style pStyle) protected void
init()
boolean
keyPressed
(int pKeyCode, int pScanCode, int pModifiers) Called when a keyboard key is pressed within the GUI element.boolean
mouseClicked
(double pMouseX, double pMouseY, int pButton) Called when a mouse button is clicked within the GUI element.protected void
pageBack()
protected void
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) void
setBookAccess
(BookViewScreen.BookAccess pBookAccess) boolean
setPage
(int pPageNum) Moves the book to the specified page and returns true if it exists,false
otherwise.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, 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, tick, 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
charTyped, getChildAt, getCurrentFocusPath, isFocused, keyReleased, mouseDragged, 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
-
PAGE_INDICATOR_TEXT_Y_OFFSET
public static final int PAGE_INDICATOR_TEXT_Y_OFFSET- See Also:
-
PAGE_TEXT_X_OFFSET
public static final int PAGE_TEXT_X_OFFSET- See Also:
-
PAGE_TEXT_Y_OFFSET
public static final int PAGE_TEXT_Y_OFFSET- See Also:
-
EMPTY_ACCESS
-
BOOK_LOCATION
-
TEXT_WIDTH
protected static final int TEXT_WIDTH- See Also:
-
TEXT_HEIGHT
protected static final int TEXT_HEIGHT- See Also:
-
IMAGE_WIDTH
protected static final int IMAGE_WIDTH- See Also:
-
IMAGE_HEIGHT
protected static final int IMAGE_HEIGHT- See Also:
-
bookAccess
-
currentPage
private int currentPage -
cachedPageComponents
Holds a copy of the page text, split into page width lines -
cachedPage
private int cachedPage -
pageMsg
-
forwardButton
-
backButton
-
playTurnSound
private final boolean playTurnSoundDetermines if a sound is played when the page is turned
-
-
Constructor Details
-
BookViewScreen
-
BookViewScreen
public BookViewScreen() -
BookViewScreen
-
-
Method Details
-
setBookAccess
-
setPage
public boolean setPage(int pPageNum) Moves the book to the specified page and returns true if it exists,false
otherwise. -
forcePage
protected boolean forcePage(int pPageNum) I'm not sure why this exists. The function it calls is public and does all the work. -
init
protected void init() -
createMenuControls
protected void createMenuControls() -
createPageControlButtons
protected void createPageControlButtons() -
getNumPages
private int getNumPages() -
pageBack
protected void pageBack() -
pageForward
protected void pageForward() -
updateButtonVisibility
private void updateButtonVisibility() -
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.
-
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
-
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.
-
handleComponentClicked
- Overrides:
handleComponentClicked
in classScreen
-
closeScreen
protected void closeScreen() -
getClickedComponentStyleAt
-