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.
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.client.gui.screens.Screen
net.minecraft.client.gui.screens.Screen.NarratableSearchResult
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
The offset from the top of the screen to be updated on init, so that it's not hardcoded "height / 6" everywhere...protected BoxListPCScreen
protected int
static final boolean
Bool indicating if events of the class were consumedprotected PCFilter
protected int
The locations of the corners of the footer.protected int
The locations of the corners of the footer.protected int
The locations of the corners of the footer.protected int
The locations of the corners of the footer.protected Stack<RecordedAction>
Action history to undo/redoprotected static final int
protected static final int
protected static final int
protected Stack<RecordedAction>
Action history to undo/redoprotected final PCMode[]
static final int
The number of Pokémon that can fit along the height of the PC GUI.static final int
The number of Pokémon that can fit along the width of the GUI.protected int
The locations of the corners of the PC.protected int
The locations of the corners of the PC.protected PCMode
protected int
protected int
The locations of the corners of the PC.protected int
The locations of the corners of the PC.protected List<net.minecraft.client.gui.components.AbstractWidget>
protected int
protected static final int
The height of an individual Pokémon slot.protected static final int
The width of an individual Pokémon slot.protected PCStorage
protected PokemonSummaryPCScreen
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
ConstructorDescriptionPokemonScreen
(StoragePosition start) Initializes the PC GUI at the given position (box) or last position. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.client.gui.components.AbstractWidget
addPopup
(net.minecraft.client.gui.components.AbstractWidget w) protected Color
boxPreviewColor
(int boxNumber) protected boolean
canMoveMultiple
(PokemonStorage from, List<com.mojang.datafixers.util.Pair<StoragePosition, StoragePosition>> positions, PokemonStorage to, StoragePosition toEnd) void
void
void
void
done
(RecordedAction action) protected void
drawBox
(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY) protected void
drawCursor
(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY) protected void
drawFooter
(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY) protected void
drawFooterBackground
(net.minecraft.client.gui.GuiGraphics graphics) protected void
drawHover
(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY) protected void
drawPopups
(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTicks) protected Pokemon
getFooterAt
(double x, double y) Gets the Pokémon at the specified location in the footer.protected Pokemon
getFooterAt
(int index) Gets the Pokémon at the specified location in the footer.protected int
protected StoragePosition
getFooterPosAt
(double x, double y) Gets the footer position at the specified location.protected Pokemon
getPCAt
(int x, int y) Gets the Pokémon at the specified location in the PC.protected StoragePosition
getPCPosAt
(double x, double y) Gets the PC position at the specified location.protected Pokemon
getPokemon
(StoragePosition position) getPosAt
(double x, double y) Gets the PC or footer position at the specified location.protected StoragePosition[]
getSlotAt
(int x, int y) Gets the Pokémon at the specified location.protected PokemonStorage
getStorage
(StoragePosition position) protected boolean
void
init()
protected boolean
isSelected
(StoragePosition position) boolean
keyPressed
(int keyCode, int scanCode, int modifiers) void
boolean
mouseClicked
(double mouseX, double mouseY, int mouseButton) boolean
mouseReleased
(double mouseX, double mouseY, int mouseButton) protected void
newPokeChecker
(int x, int y, Pokemon[] pokemon) void
void
nextPCMode
(boolean forward) void
onClose()
protected boolean
posIsInRectArea
(StoragePosition pos, StoragePosition areaStart, StoragePosition areaEnd) protected boolean
quickDepositOrWithdraw
(StoragePosition position) void
redo()
boolean
redoSort
(List<StoragePosition> positionsBefore, List<StoragePosition> positionsAfter) void
removePopup
(net.minecraft.client.gui.components.AbstractWidget w) void
void
void
setPCMode
(int index) void
sort
(PCSortingLogic compareFn, boolean ascending) void
sort
(PCSortingLogic compareFn, boolean ascending, boolean sortEntirePc) protected List<com.mojang.datafixers.util.Pair<StoragePosition,
StoragePosition>> tryToMoveMultiple
(PokemonStorage from, ArrayList<com.mojang.datafixers.util.Pair<StoragePosition, StoragePosition>> positions, int toBoxIndex) protected List<com.mojang.datafixers.util.Pair<StoragePosition,
StoragePosition>> tryToMoveMultiple
(PokemonStorage from, List<com.mojang.datafixers.util.Pair<StoragePosition, StoragePosition>> positions, PokemonStorage to, StoragePosition toEnd) protected boolean
tryToSwap
(PokemonStorage from, StoragePosition fromPosition, PokemonStorage to, StoragePosition toPosition) void
undo()
boolean
undoSort
(List<StoragePosition> positionsBefore, List<StoragePosition> positionsAfter) protected void
updateStorage
(PCStorage storage) 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, insertText, isCopy, isCut, isMouseOver, isPaste, isPauseScreen, isSelectAll, isValidCharacterForName, narrationEnabled, onFilesDrop, openLink, rebuildWidgets, removed, removeWidget, render, renderBackground, renderDirtBackground, renderTransparentBackground, renderWithTooltip, repositionElements, resize, runNarration, scheduleNarration, setInitialFocus, setTooltipForNextRenderPass, setTooltipForNextRenderPass, setTooltipForNextRenderPass, setTooltipForNextRenderPass, shouldCloseOnEsc, shouldNarrateNavigation, shouldRunNarration, suppressNarration, tick, 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, mouseDragged, mouseScrolled, 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
-
SLOT_WIDTH
protected static final int SLOT_WIDTHThe width of an individual Pokémon slot.- See Also:
-
SLOT_HEIGHT
protected static final int SLOT_HEIGHTThe height of an individual Pokémon slot.- See Also:
-
PC_NUM_WIDTH
public static final int PC_NUM_WIDTHThe number of Pokémon that can fit along the width of the GUI.- See Also:
-
PC_NUM_HEIGHT
public static final int PC_NUM_HEIGHTThe 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_FLAGBool indicating if events of the class were consumed- See Also:
-
MULTI_SELECT_PCMODE
protected static final int MULTI_SELECT_PCMODE- See Also:
-
PC_MODES
-
anchorTop
protected int anchorTopThe offset from the top of the screen to be updated on init, so that it's not hardcoded "height / 6" everywhere... >.> -
pcLeft
protected int pcLeftThe locations of the corners of the PC. -
pcRight
protected int pcRightThe locations of the corners of the PC. -
pcTop
protected int pcTopThe locations of the corners of the PC. -
pcBottom
protected int pcBottomThe locations of the corners of the PC. -
storage
-
boxNumber
protected int boxNumber -
prevBoxNumber
protected int prevBoxNumber -
pcModeIndex
protected int pcModeIndex -
pcMode
-
filter
-
summaryScreen
-
boxListScreen
-
popups
-
pastActions
Action history to undo/redo -
futureActions
Action history to undo/redo
-
-
Constructor Details
-
PokemonScreen
Initializes the PC GUI at the given position (box) or last position.
-
-
Method Details
-
setPCMode
public void setPCMode(int index) -
setFilter
-
nextPCMode
public void nextPCMode() -
nextPCMode
public void nextPCMode(boolean forward) -
hasSelected
protected boolean hasSelected() -
updateStorage
-
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
-
getStorage
-
getPokemon
-
getSelectedPositions
-
getPositionCoordinates
protected com.mojang.datafixers.util.Pair<Integer,Integer> getPositionCoordinates(StoragePosition pos) -
init
public void init()- Overrides:
init
in classnet.minecraft.client.gui.screens.Screen
-
getSlotAt
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
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.
-
getPCPosAt
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.
-
getPCAt
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 interfacenet.minecraft.client.gui.components.events.ContainerEventHandler
- Specified by:
mouseClicked
in interfacenet.minecraft.client.gui.components.events.GuiEventListener
-
mouseReleased
public boolean mouseReleased(double mouseX, double mouseY, int mouseButton) - Specified by:
mouseReleased
in interfacenet.minecraft.client.gui.components.events.ContainerEventHandler
- Specified by:
mouseReleased
in interfacenet.minecraft.client.gui.components.events.GuiEventListener
-
keyPressed
public boolean keyPressed(int keyCode, int scanCode, int modifiers) - Specified by:
keyPressed
in interfacenet.minecraft.client.gui.components.events.ContainerEventHandler
- Specified by:
keyPressed
in interfacenet.minecraft.client.gui.components.events.GuiEventListener
- Overrides:
keyPressed
in classnet.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
-
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
-
onClose
public void onClose()- Overrides:
onClose
in classnet.minecraft.client.gui.screens.Screen
-
boxPreviewColor
-
drawBox
protected void drawBox(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY) -
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
-
sort
- 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
-
undo
public void undo() -
redo
public void redo() -
clearFuture
public void clearFuture()
-