Class PokemonScreen

java.lang.Object
net.minecraft.client.gui.components.events.AbstractContainerEventHandler
net.minecraft.client.gui.screens.Screen
com.pixelmonmod.pixelmon.client.gui.pc.PokemonScreen
All Implemented Interfaces:
HideMouse, 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:
PCScreen

public abstract class PokemonScreen extends net.minecraft.client.gui.screens.Screen implements HideMouse
Backend of the PC GUI.
  • Field Details

    • SLOT_WIDTH

      protected static final int SLOT_WIDTH
      The width of an individual Pokémon slot.
      See Also:
    • SLOT_HEIGHT

      protected static final int SLOT_HEIGHT
      The height of an individual Pokémon slot.
      See Also:
    • PC_NUM_WIDTH

      public static final int PC_NUM_WIDTH
      The number of Pokémon that can fit along the width of the GUI.
      See Also:
    • PC_NUM_HEIGHT

      public static final int PC_NUM_HEIGHT
      The number of Pokémon that can fit along the height of the PC GUI.
      See Also:
    • PADDING_LEFT

      protected static final int PADDING_LEFT
      See Also:
    • PADDING_TOP

      protected static final int PADDING_TOP
      See Also:
    • EVENT_CONSUMED_FLAG

      public static final boolean EVENT_CONSUMED_FLAG
      Bool indicating if events of the class were consumed
      See Also:
    • MULTI_SELECT_PCMODE

      protected static final int MULTI_SELECT_PCMODE
      See Also:
    • PC_MODES

      protected final PCMode[] PC_MODES
    • anchorTop

      protected int anchorTop
      The offset from the top of the screen to be updated on init, so that it's not hardcoded "height / 6" everywhere... >.>
    • pcLeft

      protected int pcLeft
      The locations of the corners of the PC.
    • pcRight

      protected int pcRight
      The locations of the corners of the PC.
    • pcTop

      protected int pcTop
      The locations of the corners of the PC.
    • pcBottom

      protected int pcBottom
      The locations of the corners of the PC.
    • storage

      protected PCStorage storage
    • boxNumber

      protected int boxNumber
    • prevBoxNumber

      protected int prevBoxNumber
    • pcModeIndex

      protected int pcModeIndex
    • pcMode

      protected PCMode pcMode
    • filter

      protected PCFilter filter
    • footerLeft

      protected int footerLeft
      The locations of the corners of the footer.
    • footerRight

      protected int footerRight
      The locations of the corners of the footer.
    • footerTop

      protected int footerTop
      The locations of the corners of the footer.
    • footerBottom

      protected int footerBottom
      The locations of the corners of the footer.
    • summaryScreen

      protected PokemonSummaryPCScreen summaryScreen
    • boxListScreen

      protected BoxListPCScreen boxListScreen
    • popups

      protected List<net.minecraft.client.gui.components.AbstractWidget> popups
    • pastActions

      protected Stack<RecordedAction> pastActions
      Action history to undo/redo
    • futureActions

      protected Stack<RecordedAction> futureActions
      Action history to undo/redo
  • Constructor Details

    • PokemonScreen

      public PokemonScreen(@Nullable StoragePosition start)
      Initializes the PC GUI at the given position (box) or last position.
  • Method Details

    • setPCMode

      public void setPCMode(int index)
    • setFilter

      public void setFilter(@Nullable PCFilter filter)
    • nextPCMode

      public void nextPCMode()
    • nextPCMode

      public void nextPCMode(boolean forward)
    • hasSelected

      protected boolean hasSelected()
    • updateStorage

      protected void updateStorage(PCStorage storage)
    • posIsInRectArea

      protected boolean posIsInRectArea(StoragePosition pos, StoragePosition areaStart, StoragePosition areaEnd)
      Returns:
      Whether a StoragePosition `pos` is included in the rectangle area formed by StoragePositions `areaStart` and `areaEnd`
    • isSelected

      protected boolean isSelected(StoragePosition position)
    • getStorage

      protected PokemonStorage getStorage(StoragePosition position)
    • getPokemon

      protected Pokemon getPokemon(StoragePosition position)
    • getSelectedPositions

      protected StoragePosition[] getSelectedPositions()
    • getPositionCoordinates

      protected com.mojang.datafixers.util.Pair<Integer,Integer> getPositionCoordinates(StoragePosition pos)
    • init

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

      protected int getFooterNumWidth()
    • getSlotAt

      public Pokemon getSlotAt(int x, int y)
      Gets the Pokémon at the specified location.
      Parameters:
      x - The x coordinate of the location.
      y - The y coordinate of the location.
      Returns:
      The Pokémon at the location, or null if there is no Pokémon at the location.
    • getPosAt

      public StoragePosition getPosAt(double x, double y)
      Gets the PC or footer position at the specified location.
      Parameters:
      x - The x coordinate of the location.
      y - The y coordinate of the location.
      Returns:
      The PC or footer position at the location, or null if the location is outside the GUI.
    • getFooterPosAt

      protected StoragePosition getFooterPosAt(double x, double y)
      Gets the footer position at the specified location.
      Parameters:
      x - The x coordinate of the location.
      y - The y coordinate of the location.
      Returns:
      The footer position at the location, or null if the location is outside the footer.
    • getPCPosAt

      protected StoragePosition getPCPosAt(double x, double y)
      Gets the PC position at the specified location.
      Parameters:
      x - The x coordinate of the location.
      y - The y coordinate of the location.
      Returns:
      The PC position at the location, or null if the location is outside the PC.
    • getFooterAt

      protected Pokemon getFooterAt(double x, double y)
      Gets the Pokémon at the specified location in the footer.
      Parameters:
      x - The x coordinate of the location.
      y - The y coordinate of the location.
      Returns:
      The Pokémon at the footer location, or null if the location is outside the footer.
    • getFooterAt

      protected Pokemon getFooterAt(int index)
      Gets the Pokémon at the specified location in the footer.
      Parameters:
      index - The index of the footer location.
      Returns:
      The Pokémon at the footer location.
    • getPCAt

      protected Pokemon getPCAt(int x, int y)
      Gets the Pokémon at the specified location in the PC.
      Parameters:
      x - The x coordinate of the location.
      y - The y coordinate of the location.
      Returns:
      The Pokémon at the PC location, or null if the location is outside the PC.
    • mouseClicked

      public boolean mouseClicked(double mouseX, double mouseY, int mouseButton)
      Specified by:
      mouseClicked in interface net.minecraft.client.gui.components.events.ContainerEventHandler
      Specified by:
      mouseClicked in interface net.minecraft.client.gui.components.events.GuiEventListener
    • mouseReleased

      public boolean mouseReleased(double mouseX, double mouseY, int mouseButton)
      Specified by:
      mouseReleased in interface net.minecraft.client.gui.components.events.ContainerEventHandler
      Specified by:
      mouseReleased in interface net.minecraft.client.gui.components.events.GuiEventListener
    • 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
    • addPopup

      public net.minecraft.client.gui.components.AbstractWidget addPopup(net.minecraft.client.gui.components.AbstractWidget w)
    • removePopup

      public void removePopup(net.minecraft.client.gui.components.AbstractWidget w)
    • clearSelected

      public void clearSelected()
    • clearPopups

      public void clearPopups()
    • tryToSwap

      protected boolean tryToSwap(PokemonStorage from, StoragePosition fromPosition, PokemonStorage to, StoragePosition toPosition)
    • quickDepositOrWithdraw

      protected boolean quickDepositOrWithdraw(StoragePosition position)
    • canMoveMultiple

      protected boolean canMoveMultiple(PokemonStorage from, @Nullable List<com.mojang.datafixers.util.Pair<StoragePosition,StoragePosition>> positions, PokemonStorage to, StoragePosition toEnd)
    • tryToMoveMultiple

      @Nullable protected List<com.mojang.datafixers.util.Pair<StoragePosition,StoragePosition>> tryToMoveMultiple(PokemonStorage from, @Nullable List<com.mojang.datafixers.util.Pair<StoragePosition,StoragePosition>> positions, PokemonStorage to, StoragePosition toEnd)
      Returns:
      List of PreviousPosition-NewPosition pairs of the Positions that got swapped
    • tryToMoveMultiple

      @Nullable protected List<com.mojang.datafixers.util.Pair<StoragePosition,StoragePosition>> tryToMoveMultiple(PokemonStorage from, @Nullable ArrayList<com.mojang.datafixers.util.Pair<StoragePosition,StoragePosition>> positions, int toBoxIndex)
    • newPokeChecker

      protected void newPokeChecker(int x, int y, Pokemon[] pokemon)
    • onClose

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

      @Nullable protected Color boxPreviewColor(int boxNumber)
    • drawBox

      protected void drawBox(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY)
    • drawFooter

      protected void drawFooter(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY)
    • drawFooterBackground

      protected void drawFooterBackground(net.minecraft.client.gui.GuiGraphics graphics)
    • drawPopups

      protected void drawPopups(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTicks)
    • drawHover

      protected void drawHover(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY)
    • drawCursor

      protected void drawCursor(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY)
    • sort

      public void sort(PCSortingLogic compareFn, boolean ascending)
    • sort

      public void sort(PCSortingLogic compareFn, boolean ascending, boolean sortEntirePc)
      Parameters:
      compareFn - The compare function. When comparing a and b,
      if result > 0: sort a after b
      if result < 0: sort a before b
      if result == 0: original order is maintained
    • undoSort

      public boolean undoSort(List<StoragePosition> positionsBefore, List<StoragePosition> positionsAfter)
    • redoSort

      public boolean redoSort(List<StoragePosition> positionsBefore, List<StoragePosition> positionsAfter)
    • loadHistory

      public void loadHistory()
    • saveHistory

      public void saveHistory()
    • done

      public void done(RecordedAction action)
    • undo

      public void undo()
    • redo

      public void redo()
    • clearFuture

      public void clearFuture()