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

    Fields
    Modifier and Type
    Field
    Description
    protected List<ShopItem>
     
    protected int
    The index that is currently scrolled to in the buy tab.
    protected EnumBuySell
     
    protected float
    The buy/sell quantity of the selected item in float.
    protected int
    The buy/sell quantity of the currently selected item.
    protected int
    The index of the currently selected item.
    protected boolean
     
    protected List<ShopItem>
     
    protected int
    The index that is currently scrolled to in the sell tab.
    protected List<ShopItem>
     

    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, width

    Fields inherited from interface net.minecraft.client.gui.components.events.GuiEventListener

    DOUBLE_CLICK_THRESHOLD_MS
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractShopScreen(List<ShopItem> shopItems, boolean sellable)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    clickBuyMiniScreen(double mouseX, double mouseY, boolean isInstant)
    Processes held mouse input on the quantity selection screen.
    protected void
    clickBuyScreen(double mouseX, double mouseY)
    The main function for handling when this screen is clicked.
    protected boolean
    clickExitMenu(double mouseX, double mouseY)
    Handles the user clicking the exit button (the looping arrow) in the menu.
    protected boolean
    clickScrollArrows(double mouseX, double mouseY)
    Handles the user clicking the scroll arrows in the menu.
    protected void
    clickShopList(double mouseX, double mouseY)
    Handles clicking one of the row of the sellable items.
    int
     
    int
     
    int
     
    protected void
     
    protected boolean
     
    boolean
     
    boolean
    keyPressed(int keyCode, int scanCode, int modifiers)
     
    boolean
    mouseScrolled(double mouseX, double mouseY, double deltaX, double deltaY)
     
    void
     
    void
    renderBackground(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTicks)
     
    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.
    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.
    protected void
    renderBuyScreen(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY)
    The main render function for rendering an AbstractShopScreen.
    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.
    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.
    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.
    protected void
    renderListOfItems(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY)
    Renders the list of items displayed in the current tab.
    protected void
    renderMenuBackground(net.minecraft.client.gui.GuiGraphics p_332667_)
     
    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.
    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.
    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.
    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.
    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.
    protected void
    renderPlayerMoney(net.minecraft.client.gui.GuiGraphics graphics)
    Renders how many Poké Dollars the player has at the top right of the menu.
    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.
    protected void
    Sends a packet to the server when buying an item.
    protected void
    Sends a packet to the server when selling an item.
    protected int
    setShopItemRowColor(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, 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, mouseClicked, mouseDragged, mouseReleased, 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

    • shopItems

      protected List<ShopItem> shopItems
    • sellItems

      protected List<ShopItem> sellItems
    • buyItems

      protected List<ShopItem> buyItems
    • sellable

      protected boolean sellable
    • selectedItem

      protected int selectedItem
      The index of the currently selected item.
    • quantity

      protected int quantity
      The buy/sell quantity of the currently selected item.
    • floatQuantity

      protected float floatQuantity
      The buy/sell quantity of the selected item in float.
    • buyStartIndex

      protected int buyStartIndex
      The index that is currently scrolled to in the buy tab.
    • sellStartIndex

      protected int sellStartIndex
      The index that is currently scrolled to in the sell tab.
    • currentTab

      protected EnumBuySell currentTab
  • Constructor Details

    • AbstractShopScreen

      protected AbstractShopScreen(List<ShopItem> shopItems, boolean sellable)
  • Method Details

    • init

      protected void init()
      Overrides:
      init in class net.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:
      onClose in class net.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 graphics
      mouseX - 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 of ShopItem that can be bought or sold.
    • setShopItemRowColor

      protected int setShopItemRowColor(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.
      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 graphics
      mouseX - 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:
      isPauseScreen in class net.minecraft.client.gui.screens.Screen
    • renderMenuBackground

      protected void renderMenuBackground(net.minecraft.client.gui.GuiGraphics p_332667_)
      Overrides:
      renderMenuBackground in class net.minecraft.client.gui.screens.Screen
    • renderBackground

      public void renderBackground(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTicks)
      Overrides:
      renderBackground in class net.minecraft.client.gui.screens.Screen
    • keyPressed

      public boolean keyPressed(int keyCode, int scanCode, int modifiers)
      Specified by:
      keyPressed in interface net.minecraft.client.gui.components.events.ContainerEventHandler
      Specified by:
      keyPressed in interface net.minecraft.client.gui.components.events.GuiEventListener
      Overrides:
      keyPressed in class net.minecraft.client.gui.screens.Screen
    • getBuyScreenWidth

      public int getBuyScreenWidth()
    • getBuyScreenHeight

      public int getBuyScreenHeight()
    • getBuyScreenTopEdgePadding

      public int getBuyScreenTopEdgePadding()