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
Superclass for GUIs that display a shop interface.
  • 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 boolean
    Whether to allow multiple objects to be affected by a transaction at once.
    Items that can be bought from the shop.
    protected int
    The index that is currently scrolled to in the buy tab.
    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.
    Items that can be sold to the shop.
    protected int
    The index that is currently scrolled to in the sell tab.

    Fields inherited from class net.minecraft.client.gui.screens.Screen

    BACKGROUND_LOCATION, children, font, height, minecraft, renderables, screenExecutor, title, width

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

    DOUBLE_CLICK_THRESHOLD_MS
  • Constructor Summary

    Constructors
    Constructor
    Description
    Initializes the container.
  • 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)
    Handles mouse input on the buy screen.
    protected boolean
    Checks if the side box containing the selected item is visible.
    boolean
    Returns true if this GUI should pause the game when it is displayed in single-player
    boolean
    mouseScrolled(double mouseX, double mouseY, double deltaX, double deltaY)
     
    void
    Closes the shop screen.
    void
    renderBackground(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTicks)
     
    protected void
    renderBuyScreen(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY)
    Renders the GUI for choosing items to buy or sell.
    void
    renderDirtBackground(net.minecraft.client.gui.GuiGraphics p_282281_)
     
    protected void
    renderMenu(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY)
    Renders the list of items displayed in the current tab.
    protected void
    Sends a packet to the server when buying an item.
    protected void
    Sends a packet to the server when selling an item.
    void
     

    Methods inherited from class net.minecraft.client.gui.screens.Screen

    added, addEventWidget, addRenderableOnly, addRenderableWidget, addWidget, afterKeyboardAction, afterMouseAction, afterMouseMove, changeFocus, children, clearFocus, clearWidgets, confirmLink, createArrowEvent, createTabEvent, findNarratableWidget, getBackgroundMusic, getMinecraft, getNarrationMessage, getRectangle, getTitle, getTooltipFromItem, getUsageNarration, handleComponentClicked, handleDelayedNarration, hasAltDown, hasControlDown, hasShiftDown, hideWidgets, init, init, insertText, isCopy, isCut, isMouseOver, isPaste, isSelectAll, isValidCharacterForName, keyPressed, narrationEnabled, onFilesDrop, openLink, rebuildWidgets, removed, removeWidget, render, renderTransparentBackground, renderWithTooltip, repositionElements, resize, runNarration, scheduleNarration, setInitialFocus, setTooltipForNextRenderPass, setTooltipForNextRenderPass, setTooltipForNextRenderPass, setTooltipForNextRenderPass, shouldCloseOnEsc, shouldNarrateNavigation, shouldRunNarration, suppressNarration, triggerImmediateNarration, updateNarratedWidget, updateNarrationState, 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, magicalSpecialHackyFocus, 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

    • buyItems

      public static ArrayList<ClientShopItem> buyItems
      Items that can be bought from the shop.
    • sellItems

      public static ArrayList<ClientShopItem> sellItems
      Items that can be sold to the shop.
    • 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.
    • allowMultiple

      protected boolean allowMultiple
      Whether to allow multiple objects to be affected by a transaction at once.
  • Constructor Details

    • AbstractShopScreen

      public AbstractShopScreen()
      Initializes the container.
  • Method Details

    • tick

      public void tick()
      Overrides:
      tick in class net.minecraft.client.gui.screens.Screen
    • isPauseScreen

      public boolean isPauseScreen()
      Returns true if this GUI should pause the game when it is displayed in single-player
      Overrides:
      isPauseScreen in class net.minecraft.client.gui.screens.Screen
    • mouseScrolled

      public boolean mouseScrolled(double mouseX, double mouseY, double deltaX, double deltaY)
    • isBuyMiniScreenVisible

      protected boolean isBuyMiniScreenVisible()
      Checks if the side box containing the selected item is visible.
      Returns:
      True if the side box is visible.
    • renderDirtBackground

      public void renderDirtBackground(net.minecraft.client.gui.GuiGraphics p_282281_)
      Overrides:
      renderDirtBackground 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
    • clickBuyScreen

      protected void clickBuyScreen(double mouseX, double mouseY)
      Handles mouse input on the buy screen.
      Parameters:
      mouseX - The x coordinate of the mouse.
      mouseY - The y coordinate of the mouse.
    • 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()
      Closes the shop screen.
      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)
      Renders the GUI for choosing items to buy or sell.
      Parameters:
      mouseX - The x coordinate of the mouse.
      mouseY - The y coordinate of the mouse.
    • renderMenu

      protected void renderMenu(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY)
      Renders the list of items displayed in the current tab.
      Parameters:
      mouseX - The x coordinate of the mouse.
      mouseY - The y coordinate of the mouse.