Class MerchantScreen
java.lang.Object
net.minecraft.client.gui.DrawableHelper
net.minecraft.client.gui.AbstractParentElement
net.minecraft.client.gui.screen.Screen
net.minecraft.client.gui.screen.ingame.HandledScreen<MerchantScreenHandler>
net.minecraft.client.gui.screen.ingame.MerchantScreen
- All Implemented Interfaces:
Drawable,Element,ParentElement,ScreenHandlerProvider<MerchantScreenHandler>,TickableElement
@Environment(CLIENT) public class MerchantScreen extends HandledScreen<MerchantScreenHandler>
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classMerchantScreen.WidgetButtonPage -
Field Summary
Fields Modifier and Type Field Description private static TextDEPRECATED_TEXTprivate intindexStartOffsetprivate MerchantScreen.WidgetButtonPage[]offersprivate booleanscrollingprivate intselectedIndexprivate static TextSEPARATORprivate static IdentifierTEXTUREprivate static TextTRADES_TEXTFields inherited from class net.minecraft.client.gui.screen.ingame.HandledScreen
BACKGROUND_TEXTURE, backgroundHeight, backgroundWidth, cursorDragging, cursorDragSlots, focusedSlot, handler, playerInventory, playerInventoryTitleX, playerInventoryTitleY, titleX, titleY, x, yFields inherited from class net.minecraft.client.gui.screen.Screen
buttons, children, client, height, itemRenderer, passEvents, textRenderer, title, widthFields inherited from class net.minecraft.client.gui.DrawableHelper
GUI_ICONS_TEXTURE, OPTIONS_BACKGROUND_TEXTURE, STATS_ICON_TEXTURE -
Constructor Summary
Constructors Constructor Description MerchantScreen(MerchantScreenHandler handler, PlayerInventory inventory, Text title) -
Method Summary
Modifier and Type Method Description private booleancanScroll(int listSize)protected voiddrawBackground(MatrixStack matrices, float delta, int mouseX, int mouseY)protected voiddrawForeground(MatrixStack matrices, int mouseX, int mouseY)private voiddrawLevelInfo(MatrixStack matrices, int x, int y, TradeOffer tradeOffer)protected voidinit()Called when a screen should be initialized.booleanmouseClicked(double mouseX, double mouseY, int button)Callback for when a mouse button down event has been captured.booleanmouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY)Callback for when a mouse button drag event has been captured.booleanmouseScrolled(double mouseX, double mouseY, double amount)Callback for when a mouse button scroll event has been captured.voidrender(MatrixStack matrices, int mouseX, int mouseY, float delta)private voidrenderArrow(MatrixStack matrices, TradeOffer tradeOffer, int x, int y)private voidrenderFirstBuyItem(MatrixStack matrices, ItemStack adjustedFirstBuyItem, ItemStack originalFirstBuyItem, int x, int y)private voidrenderScrollbar(MatrixStack matrices, int x, int y, TradeOfferList tradeOffers)private voidsyncRecipeIndex()Methods inherited from class net.minecraft.client.gui.screen.ingame.HandledScreen
drawMouseoverTooltip, getScreenHandler, handleHotbarKeyPressed, isClickOutsideBounds, isPauseScreen, isPointWithinBounds, keyPressed, mouseReleased, onClose, onMouseClick, removed, tickMethods inherited from class net.minecraft.client.gui.screen.Screen
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, wrapScreenErrorMethods inherited from class net.minecraft.client.gui.AbstractParentElement
getFocused, isDragging, setDragging, setFocusedMethods inherited from class net.minecraft.client.gui.DrawableHelper
drawCenteredString, drawCenteredText, drawHorizontalLine, drawSprite, drawStringWithShadow, drawTexture, drawTexture, drawTexture, drawTexture, drawTextWithShadow, drawVerticalLine, fill, fillGradient, fillGradient, getZOffset, method_29343, setZOffsetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.client.gui.Element
mouseMovedMethods inherited from interface net.minecraft.client.gui.ParentElement
changeFocus, charTyped, focusOn, hoveredElement, keyReleased, setInitialFocus
-
Field Details
-
TEXTURE
-
TRADES_TEXT
-
SEPARATOR
-
DEPRECATED_TEXT
-
selectedIndex
private int selectedIndex -
offers
-
indexStartOffset
private int indexStartOffset -
scrolling
private boolean scrolling
-
-
Constructor Details
-
MerchantScreen
-
-
Method Details
-
syncRecipeIndex
private void syncRecipeIndex() -
init
protected void init()Called when a screen should be initialized.This method is called when this screen is
openedor resized.- Overrides:
initin classHandledScreen<MerchantScreenHandler>
-
drawForeground
- Overrides:
drawForegroundin classHandledScreen<MerchantScreenHandler>
-
drawBackground
- Specified by:
drawBackgroundin classHandledScreen<MerchantScreenHandler>
-
drawLevelInfo
-
renderScrollbar
-
render
- Specified by:
renderin interfaceDrawable- Overrides:
renderin classHandledScreen<MerchantScreenHandler>
-
renderArrow
-
renderFirstBuyItem
private void renderFirstBuyItem(MatrixStack matrices, ItemStack adjustedFirstBuyItem, ItemStack originalFirstBuyItem, int x, int y) -
canScroll
private boolean canScroll(int listSize) -
mouseScrolled
public boolean mouseScrolled(double mouseX, double mouseY, double amount)Callback for when a mouse button scroll event has been captured.- Parameters:
mouseX- the X coordinate of the mousemouseY- the Y coordinate of the mouseamount- value is> 1if scrolled down,< 1if scrolled up- Returns:
trueto indicate that the event handling is successful/valid- See Also:
Mouse.onMouseScroll(long, double, double)
-
mouseDragged
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY)Callback for when a mouse button drag event has been captured. The button number is identified by the constants inGLFWclass.- Specified by:
mouseDraggedin interfaceElement- Specified by:
mouseDraggedin interfaceParentElement- Overrides:
mouseDraggedin classHandledScreen<MerchantScreenHandler>- Parameters:
mouseX- 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 coordinate- Returns:
trueto indicate that the event handling is successful/valid- See Also:
Mouse.onCursorPos(long, double, double),GLFW.GLFW_MOUSE_BUTTON_1
-
mouseClicked
public boolean mouseClicked(double mouseX, double mouseY, int button)Callback for when a mouse button down event has been captured. The button number is identified by the constants inGLFWclass.- Specified by:
mouseClickedin interfaceElement- Specified by:
mouseClickedin interfaceParentElement- Overrides:
mouseClickedin classHandledScreen<MerchantScreenHandler>- Parameters:
mouseX- the X coordinate of the mousemouseY- the Y coordinate of the mousebutton- the mouse button number- Returns:
trueto indicate that the event handling is successful/valid- See Also:
Mouse.onMouseButton(long, int, int, int),GLFW.GLFW_MOUSE_BUTTON_1
-