@Environment(value=CLIENT) public class BookEditScreen extends Screen
Modifier and Type | Class and Description |
---|---|
(package private) class |
BookEditScreen.Position |
Modifier and Type | Field and Description |
---|---|
private ButtonWidget |
cancelButton |
private int |
currentPage |
private int |
cursorIndex |
private boolean |
dirty |
private ButtonWidget |
doneButton |
private ButtonWidget |
finalizeButton |
private Hand |
hand |
private int |
highlightTo |
private ItemStack |
itemStack |
private int |
lastClickIndex |
private long |
lastClickTime |
private PageTurnWidget |
nextPageButton |
private List<String> |
pages |
private PlayerEntity |
player |
private PageTurnWidget |
previousPageButton |
private ButtonWidget |
signButton |
private boolean |
signing |
private int |
tickCounter |
private String |
title |
buttons, children, client, height, itemRenderer, passEvents, textRenderer, width
BACKGROUND_TEXTURE, GUI_ICONS_TEXTURE, STATS_ICON_TEXTURE
Constructor and Description |
---|
BookEditScreen(PlayerEntity playerEntity,
ItemStack itemStack,
Hand hand) |
Modifier and Type | Method and Description |
---|---|
private void |
appendNewPage() |
private void |
applyBackspaceKey(String content) |
private void |
applyDeleteKey(String content) |
private void |
applyDownArrowKey(String content) |
private void |
applyLeftArrowKey(String content) |
private void |
applyRightArrowKey(String content) |
private void |
applyUpArrowKey(String content) |
boolean |
charTyped(char chr,
int keyCode) |
private int |
countPages() |
private void |
drawHighlight(String content) |
private void |
drawHighlightRect(BookEditScreen.Position position1,
BookEditScreen.Position position2) |
private void |
finalizeBook(boolean signBook) |
private int |
getCharacterCountForStringWidth(String string,
int width) |
private int |
getCharacterCountForWidth(String text,
int width) |
private int |
getCharacterCountInFrontOfCursor(String content,
BookEditScreen.Position cursorPosition) |
private int |
getCharWidthInString(String string,
int index) |
private String |
getCurrentPageContent() |
private BookEditScreen.Position |
getCursorPositionForIndex(String content,
int index) |
private String |
getHighlightedText() |
private int |
getStringWidth(String text) |
protected void |
init() |
boolean |
keyPressed(int keyCode,
int scanCode,
int modifiers) |
private boolean |
keyPressedEditMode(int keyCode,
int scanCode,
int modifiers) |
private boolean |
keyPressedSignMode(int keyCode,
int scanCode,
int modifiers) |
private void |
localizePosition(BookEditScreen.Position position) |
boolean |
mouseClicked(double mouseX,
double mouseY,
int button) |
boolean |
mouseDragged(double mouseX,
double mouseY,
int button,
double deltaX,
double deltaY) |
private void |
moveCursorToBottom(String content) |
private void |
moveCursorToTop(String content) |
private void |
openNextPage() |
private void |
openPreviousPage() |
void |
removed() |
private void |
removeEmptyPages() |
private void |
removeHighlightedText() |
void |
render(int mouseX,
int mouseY,
float delta) |
private void |
setPageContent(String newContent) |
private String |
stripFromatting(String string) |
void |
tick() |
private void |
translateGlPositionToRelativePosition(BookEditScreen.Position position) |
private void |
translateRelativePositionToGlPosition(BookEditScreen.Position position) |
private void |
updateButtons() |
private void |
writeString(String string) |
addButton, addChild, children, getNarrationMessage, getTitle, getTooltipFromItem, handleTextClick, hasAltDown, hasControlDown, hasShiftDown, init, insertText, isCopy, isCut, isMouseOver, isPaste, isPauseScreen, isSelectAll, isValidCharacterForName, onClose, renderBackground, renderBackground, renderDirtBackground, renderTextHoverEffect, renderTooltip, renderTooltip, renderTooltip, resize, sendMessage, sendMessage, shouldCloseOnEsc, wrapScreenError
getFocused, isDragging, setDragging, setFocused
drawCenteredString, drawHorizontalLine, drawSprite, drawString, drawTexture, drawTexture, drawTexture, drawTexture, drawTexturedQuad, drawVerticalLine, fill, fill, fillGradient, getZOffset, setZOffset
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
changeFocus, focusOn, hoveredElement, keyReleased, mouseReleased, mouseScrolled, setInitialFocus
mouseMoved
private final PlayerEntity player
private final ItemStack itemStack
private boolean dirty
private boolean signing
private int tickCounter
private int currentPage
private String title
private int cursorIndex
private int highlightTo
private long lastClickTime
private int lastClickIndex
private PageTurnWidget nextPageButton
private PageTurnWidget previousPageButton
private ButtonWidget doneButton
private ButtonWidget signButton
private ButtonWidget finalizeButton
private ButtonWidget cancelButton
private final Hand hand
public BookEditScreen(PlayerEntity playerEntity, ItemStack itemStack, Hand hand)
private int countPages()
private void openPreviousPage()
private void openNextPage()
private void updateButtons()
private void removeEmptyPages()
private void finalizeBook(boolean signBook)
private void appendNewPage()
public boolean keyPressed(int keyCode, int scanCode, int modifiers)
keyPressed
in interface Element
keyPressed
in interface ParentElement
keyPressed
in class Screen
public boolean charTyped(char chr, int keyCode)
private boolean keyPressedEditMode(int keyCode, int scanCode, int modifiers)
private void applyBackspaceKey(String content)
private void applyDeleteKey(String content)
private void applyLeftArrowKey(String content)
private void applyRightArrowKey(String content)
private void applyUpArrowKey(String content)
private void applyDownArrowKey(String content)
private void moveCursorToTop(String content)
private void moveCursorToBottom(String content)
private void removeHighlightedText()
private int getCharWidthInString(String string, int index)
private boolean keyPressedSignMode(int keyCode, int scanCode, int modifiers)
private String getCurrentPageContent()
private void setPageContent(String newContent)
private void writeString(String string)
public void render(int mouseX, int mouseY, float delta)
private int getStringWidth(String text)
private int getCharacterCountForWidth(String text, int width)
private String getHighlightedText()
private void drawHighlight(String content)
private void drawHighlightRect(BookEditScreen.Position position1, BookEditScreen.Position position2)
private BookEditScreen.Position getCursorPositionForIndex(String content, int index)
private void localizePosition(BookEditScreen.Position position)
private void translateGlPositionToRelativePosition(BookEditScreen.Position position)
private void translateRelativePositionToGlPosition(BookEditScreen.Position position)
private int getCharacterCountForStringWidth(String string, int width)
private int getCharacterCountInFrontOfCursor(String content, BookEditScreen.Position cursorPosition)
public boolean mouseClicked(double mouseX, double mouseY, int button)
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY)