Class AbstractShopScreen
java.lang.Object
net.minecraft.client.gui.components.events.AbstractContainerEventHandler
net.minecraft.client.gui.screens.Screen
com.pixelmonmod.pixelmon.client.gui.npc.AbstractShopScreen
- All Implemented Interfaces:
net.minecraft.client.gui.components.events.ContainerEventHandler,net.minecraft.client.gui.components.events.GuiEventListener,net.minecraft.client.gui.components.Renderable,net.minecraft.client.gui.components.TabOrderedElement
- Direct Known Subclasses:
ShopkeeperScreen,VendingMachineScreen
public abstract class AbstractShopScreen
extends net.minecraft.client.gui.screens.Screen
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.client.gui.screens.Screen
net.minecraft.client.gui.screens.Screen.NarratableSearchResult -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intThe index that is currently scrolled to in the buy tab.protected EnumBuySellprotected floatThe buy/sell quantity of the selected item in float.protected intThe buy/sell quantity of the currently selected item.protected intThe index of the currently selected item.protected booleanprotected intThe index that is currently scrolled to in the sell tab.Fields inherited from class net.minecraft.client.gui.screens.Screen
children, CUBE_MAP, font, FOOTER_SEPARATOR, HEADER_SEPARATOR, height, INWORLD_FOOTER_SEPARATOR, INWORLD_HEADER_SEPARATOR, MENU_BACKGROUND, minecraft, narratorButton, PANORAMA, renderables, screenExecutor, title, widthFields inherited from interface net.minecraft.client.gui.components.events.GuiEventListener
DOUBLE_CLICK_THRESHOLD_MS -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractShopScreen(List<ShopItem> shopItems, boolean sellable) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidclickBuyMiniScreen(double mouseX, double mouseY, boolean isInstant) Processes held mouse input on the quantity selection screen.protected voidclickBuyScreen(double mouseX, double mouseY) The main function for handling when this screen is clicked.protected booleanclickExitMenu(double mouseX, double mouseY) Handles the user clicking the exit button (the looping arrow) in the menu.protected booleanclickScrollArrows(double mouseX, double mouseY) Handles the user clicking the scroll arrows in the menu.protected voidclickShopList(double mouseX, double mouseY) Handles clicking one of the row of the sellable items.intintintprotected voidinit()protected booleanbooleanbooleankeyPressed(int keyCode, int scanCode, int modifiers) booleanmouseScrolled(double mouseX, double mouseY, double deltaX, double deltaY) voidonClose()voidrenderBackground(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTicks) protected voidrenderBuyMiniScreen(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, List<ShopItem> listItems) Renders the small screen that appears when a user clicks on a purchasable item.protected voidrenderBuyMiniScreenArrows(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY) Renders the images of the Mini Screen's arrows that adjust how many items the player wants to purchase.protected voidrenderBuyScreen(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY) The main render function for rendering an AbstractShopScreen.protected voidrenderCost(net.minecraft.client.gui.GuiGraphics graphics, int i, List<ShopItem> listItems, float topLimit, String cost, int costWidth) Renders the Poké Dollars sign and the cost of the item.protected voidrenderDebugScreen(net.minecraft.client.gui.GuiGraphics graphics) Draw a red cross in the screen to make it easier to see the center points if the user has pressed F3.protected voidrenderHoveredExitButton(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY) When the cursor is hovered over the exit button in the buttom right of the menu, it highlights the arrow.protected voidrenderListOfItems(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY) Renders the list of items displayed in the current tab.protected voidrenderMenuBackground(net.minecraft.client.gui.GuiGraphics p_332667_) protected voidrenderMenuItem(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, int startIndex, int i, List<ShopItem> listItems) Renders one of the menu items in the shop.protected voidrenderMiniScreenBuySellButton(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, double price, List<ShopItem> listItems) Renders the label for the button to finalize buying and selling as well as changing its color when the cursor hovers over it.protected voidrenderMiniScreenItemSprite(net.minecraft.client.gui.GuiGraphics graphics, List<ShopItem> listItems) Renders the label for the button to finalize buying and selling as well as changing its color when the cursor hovers over it.protected voidrenderMiniScreenPrice(net.minecraft.client.gui.GuiGraphics graphics, double price) Renders the label for the button to finalize buying and selling as well as changing its color when the cursor hovers over it.protected voidrenderMiniScreenQuantity(net.minecraft.client.gui.GuiGraphics graphics) Renders the label and the number for the quantity of items the player is looking to buy or sell.protected voidrenderPlayerMoney(net.minecraft.client.gui.GuiGraphics graphics) Renders how many Poké Dollars the player has at the top right of the menu.protected voidrenderScrollArrows(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, int startIndex, List<ShopItem> listItems) Potentially renders one arrow above and one arrow below the list of items to buy or sell, depending on how many items are available to buy/sell and how far the user has scrolled down the list.protected voidSends a packet to the server when buying an item.protected voidSends a packet to the server when selling an item.protected intsetShopItemRowColor(List<ShopItem> listItems, int i) While selling, grey out the text of a shop item if the player does not have the item or can't sell it.Methods inherited from class net.minecraft.client.gui.screens.Screen
added, addRenderableOnly, addRenderableWidget, addWidget, afterKeyboardAction, afterMouseAction, afterMouseMove, changeFocus, children, clearFocus, clearTooltipForNextRenderPass, clearWidgets, createArrowEvent, createTabEvent, findNarratableWidget, getBackgroundMusic, getMinecraft, getNarrationMessage, getRectangle, getTitle, getTooltipFromItem, getUsageNarration, handleComponentClicked, handleDelayedNarration, hasAltDown, hasControlDown, hasShiftDown, init, insertText, isCopy, isCut, isMouseOver, isPaste, isSelectAll, isValidCharacterForName, onFilesDrop, rebuildWidgets, removed, removeWidget, render, renderBlurredBackground, renderMenuBackground, renderMenuBackgroundTexture, renderPanorama, renderTransparentBackground, renderWithTooltip, repositionElements, resize, setInitialFocus, setInitialFocus, setTooltipForNextRenderPass, setTooltipForNextRenderPass, setTooltipForNextRenderPass, setTooltipForNextRenderPass, shouldCloseOnEsc, shouldNarrateNavigation, tick, 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
charTyped, getChildAt, getCurrentFocusPath, isFocused, keyReleased, mouseClicked, mouseDragged, mouseReleased, 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
-
shopItems
-
sellItems
-
buyItems
-
sellable
protected boolean sellable -
selectedItem
protected int selectedItemThe index of the currently selected item. -
quantity
protected int quantityThe buy/sell quantity of the currently selected item. -
floatQuantity
protected float floatQuantityThe buy/sell quantity of the selected item in float. -
buyStartIndex
protected int buyStartIndexThe index that is currently scrolled to in the buy tab. -
sellStartIndex
protected int sellStartIndexThe index that is currently scrolled to in the sell tab. -
currentTab
-
-
Constructor Details
-
AbstractShopScreen
-
-
Method Details
-
init
protected void init()- Overrides:
initin classnet.minecraft.client.gui.screens.Screen
-
mouseScrolled
public boolean mouseScrolled(double mouseX, double mouseY, double deltaX, double deltaY) -
isBuyMiniScreenVisible
protected boolean isBuyMiniScreenVisible() -
clickBuyScreen
protected void clickBuyScreen(double mouseX, double mouseY) The main function for handling when this screen is clicked.- Parameters:
mouseX- The cursor's x position.mouseY- The cursor's y position.
-
clickScrollArrows
protected boolean clickScrollArrows(double mouseX, double mouseY) Handles the user clicking the scroll arrows in the menu.- Parameters:
mouseX- The cursor's x position.mouseY- The cursor's y position.- Returns:
- true if the user successfully clicked a button and false if not.
-
clickExitMenu
protected boolean clickExitMenu(double mouseX, double mouseY) Handles the user clicking the exit button (the looping arrow) in the menu.- Parameters:
mouseX- The cursor's x position.mouseY- The cursor's y position.- Returns:
- true if the user successfully clicked the button and false if not.
-
clickShopList
protected void clickShopList(double mouseX, double mouseY) Handles clicking one of the row of the sellable items.- Parameters:
mouseX- The cursor's x position.mouseY- The cursor's y position.
-
clickBuyMiniScreen
protected void clickBuyMiniScreen(double mouseX, double mouseY, boolean isInstant) Processes held mouse input on the quantity selection screen.- Parameters:
mouseX- The x coordinate of the mouse.mouseY- The y coordinate of the mouse.isInstant- Whether the input will trigger an instant change.
-
onClose
public void onClose()- Overrides:
onClosein classnet.minecraft.client.gui.screens.Screen
-
sendBuyPacket
protected void sendBuyPacket()Sends a packet to the server when buying an item. -
sendSellPacket
protected void sendSellPacket()Sends a packet to the server when selling an item. -
renderBuyScreen
protected void renderBuyScreen(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY) The main render function for rendering an AbstractShopScreen.- Parameters:
graphics- The object rendering images on the screen.mouseX- The cursor's x position.mouseY- The cursor's y position.
-
renderPlayerMoney
protected void renderPlayerMoney(net.minecraft.client.gui.GuiGraphics graphics) Renders how many Poké Dollars the player has at the top right of the menu.- Parameters:
graphics- Does the rendering
-
renderListOfItems
protected void renderListOfItems(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY) Renders the list of items displayed in the current tab.- Parameters:
graphics- Handles drawing the images on the screen.mouseX- The cursor's x position.mouseY- The cursor's y position.
-
renderMenuItem
protected void renderMenuItem(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, int startIndex, int i, List<ShopItem> listItems) Renders one of the menu items in the shop.- Parameters:
graphics- The graphicsmouseX- The cursor's x position.mouseY- The cursor's y position.startIndex- The index in the list of items of the first item that is displayed in the shop.i- The i-th item being displayed.listItems- The full list ofShopItemthat can be bought or sold.
-
setShopItemRowColor
While selling, grey out the text of a shop item if the player does not have the item or can't sell it.- Parameters:
listItems- The full list of items that can be bought/sold.i- The i-th item being displayed.- Returns:
- An integer representing grey (0x888888) if the player can't sell, or white (0xFFFFFF) if they can.
-
renderCost
protected void renderCost(net.minecraft.client.gui.GuiGraphics graphics, int i, List<ShopItem> listItems, float topLimit, String cost, int costWidth) Renders the Poké Dollars sign and the cost of the item.- Parameters:
graphics- The object drawing the strings and images.i- The i-th item being displayed.listItems- The full list of items that can be bought or sold.topLimit- The y position of the i-th list item.cost- The cost of the item.costWidth- The width of the text of the cost.
-
renderScrollArrows
protected void renderScrollArrows(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, int startIndex, List<ShopItem> listItems) Potentially renders one arrow above and one arrow below the list of items to buy or sell, depending on how many items are available to buy/sell and how far the user has scrolled down the list.- Parameters:
graphics- The graphicsmouseX- The cursor's x position.mouseY- The cursor's y position.startIndex- The index of the first item shown.listItems- The full list of items that can be displayed.
-
renderHoveredExitButton
protected void renderHoveredExitButton(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY) When the cursor is hovered over the exit button in the buttom right of the menu, it highlights the arrow.- Parameters:
graphics- The object rendering stuff.mouseX- The cursor's x position.mouseY- The cursor's y position.
-
renderBuyMiniScreen
protected void renderBuyMiniScreen(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, List<ShopItem> listItems) Renders the small screen that appears when a user clicks on a purchasable item.- Parameters:
graphics- The object rendering stuff.mouseX- The cursor's x position.mouseY- The cursor's y position.listItems- The full list of items that can be bought.
-
renderMiniScreenPrice
protected void renderMiniScreenPrice(net.minecraft.client.gui.GuiGraphics graphics, double price) Renders the label for the button to finalize buying and selling as well as changing its color when the cursor hovers over it.- Parameters:
graphics- The object managing the rendering.price- The monetary value of the item being bought or sold.
-
renderMiniScreenBuySellButton
protected void renderMiniScreenBuySellButton(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, double price, List<ShopItem> listItems) Renders the label for the button to finalize buying and selling as well as changing its color when the cursor hovers over it.- Parameters:
graphics- The object managing the rendering.mouseX- The cursor's x position.mouseY- The cursor's y position.price- The monetary value of the item being bought or sold.listItems- The full list of items that can be bought or sold.
-
renderMiniScreenQuantity
protected void renderMiniScreenQuantity(net.minecraft.client.gui.GuiGraphics graphics) Renders the label and the number for the quantity of items the player is looking to buy or sell.- Parameters:
graphics- The object managing the rendering.
-
renderBuyMiniScreenArrows
protected void renderBuyMiniScreenArrows(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY) Renders the images of the Mini Screen's arrows that adjust how many items the player wants to purchase.- Parameters:
graphics- The object doing the rendering.mouseX- The cursor's x position.mouseY- The cursor's y position.
-
renderMiniScreenItemSprite
protected void renderMiniScreenItemSprite(net.minecraft.client.gui.GuiGraphics graphics, List<ShopItem> listItems) Renders the label for the button to finalize buying and selling as well as changing its color when the cursor hovers over it.- Parameters:
graphics- The object managing the rendering.listItems- The full list of items that can be bought or sold.
-
renderDebugScreen
protected void renderDebugScreen(net.minecraft.client.gui.GuiGraphics graphics) Draw a red cross in the screen to make it easier to see the center points if the user has pressed F3.- Parameters:
graphics- The graphics
-
isPauseScreen
public boolean isPauseScreen()- Overrides:
isPauseScreenin classnet.minecraft.client.gui.screens.Screen
-
renderMenuBackground
protected void renderMenuBackground(net.minecraft.client.gui.GuiGraphics p_332667_) - Overrides:
renderMenuBackgroundin classnet.minecraft.client.gui.screens.Screen
-
renderBackground
public void renderBackground(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTicks) - Overrides:
renderBackgroundin classnet.minecraft.client.gui.screens.Screen
-
keyPressed
public boolean keyPressed(int keyCode, int scanCode, int modifiers) - Specified by:
keyPressedin interfacenet.minecraft.client.gui.components.events.ContainerEventHandler- Specified by:
keyPressedin interfacenet.minecraft.client.gui.components.events.GuiEventListener- Overrides:
keyPressedin classnet.minecraft.client.gui.screens.Screen
-
getBuyScreenWidth
public int getBuyScreenWidth() -
getBuyScreenHeight
public int getBuyScreenHeight() -
getBuyScreenTopEdgePadding
public int getBuyScreenTopEdgePadding()
-