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
FieldsModifier and TypeFieldDescriptionprotected intThe offset from the top of the screen to be updated on init, so that it's not hardcoded "height / 6" everywhere...protected BoxListPCScreenprotected intstatic final booleanBool indicating if events of the class were consumedprotected PCFilterprotected intThe locations of the corners of the footer.protected intThe locations of the corners of the footer.protected intThe locations of the corners of the footer.protected intThe locations of the corners of the footer.protected Stack<RecordedAction> Action history to undo/redoprotected static final intprotected static final intprotected static final intprotected Stack<RecordedAction> Action history to undo/redoprotected final PCMode[]static final intThe number of Pokémon that can fit along the height of the PC GUI.static final intThe number of Pokémon that can fit along the width of the GUI.protected intThe locations of the corners of the PC.protected intThe locations of the corners of the PC.protected PCModeprotected intprotected intThe locations of the corners of the PC.protected intThe locations of the corners of the PC.protected List<net.minecraft.client.gui.components.AbstractWidget> protected intprotected static final intThe height of an individual Pokémon slot.protected static final intThe width of an individual Pokémon slot.protected PCStorageprotected PokemonSummaryPCScreenFields 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
ConstructorsConstructorDescriptionPokemonScreen(StoragePosition start) Initializes the PC GUI at the given position (box) or last position. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.client.gui.components.AbstractWidgetaddPopup(net.minecraft.client.gui.components.AbstractWidget w) protected ColorboxPreviewColor(int boxNumber) protected booleancanMoveMultiple(PokemonStorage from, List<com.mojang.datafixers.util.Pair<StoragePosition, StoragePosition>> positions, PokemonStorage to, StoragePosition toEnd) voidvoidvoidvoiddone(RecordedAction action) protected voiddrawBox(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY) protected voiddrawCursor(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY) protected voiddrawFooter(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY) protected voiddrawFooterBackground(net.minecraft.client.gui.GuiGraphics graphics) protected voiddrawHover(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY) protected voiddrawPopups(net.minecraft.client.gui.GuiGraphics graphics, int mouseX, int mouseY, float partialTicks) protected PokemongetFooterAt(double x, double y) Gets the Pokémon at the specified location in the footer.protected PokemongetFooterAt(int index) Gets the Pokémon at the specified location in the footer.protected intprotected StoragePositiongetFooterPosAt(double x, double y) Gets the footer position at the specified location.protected PokemongetPCAt(int x, int y) Gets the Pokémon at the specified location in the PC.protected StoragePositiongetPCPosAt(double x, double y) Gets the PC position at the specified location.protected PokemongetPokemon(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 PokemonStoragegetStorage(StoragePosition position) protected booleanvoidinit()protected booleanisSelected(StoragePosition position) booleankeyPressed(int keyCode, int scanCode, int modifiers) voidbooleanmouseClicked(double mouseX, double mouseY, int mouseButton) booleanmouseReleased(double mouseX, double mouseY, int mouseButton) protected voidnewPokeChecker(int x, int y, Pokemon[] pokemon) voidvoidnextPCMode(boolean forward) voidonClose()protected booleanposIsInRectArea(StoragePosition pos, StoragePosition areaStart, StoragePosition areaEnd) protected booleanquickDepositOrWithdraw(StoragePosition position) voidredo()booleanredoSort(List<StoragePosition> positionsBefore, List<StoragePosition> positionsAfter) voidremovePopup(net.minecraft.client.gui.components.AbstractWidget w) voidvoidvoidsetPCMode(int index) voidsort(PCSortingLogic compareFn, boolean ascending) voidsort(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 booleantryToSwap(PokemonStorage from, StoragePosition fromPosition, PokemonStorage to, StoragePosition toPosition) voidundo()booleanundoSort(List<StoragePosition> positionsBefore, List<StoragePosition> positionsAfter) protected voidupdateStorage(PCStorage storage) 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, isPauseScreen, isSelectAll, isValidCharacterForName, onFilesDrop, rebuildWidgets, removed, removeWidget, render, renderBackground, renderBlurredBackground, renderMenuBackground, 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, mouseDragged, mouseScrolled, 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
-
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:
initin 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:
mouseClickedin interfacenet.minecraft.client.gui.components.events.ContainerEventHandler- Specified by:
mouseClickedin interfacenet.minecraft.client.gui.components.events.GuiEventListener
-
mouseReleased
public boolean mouseReleased(double mouseX, double mouseY, int mouseButton) - Specified by:
mouseReleasedin interfacenet.minecraft.client.gui.components.events.ContainerEventHandler- Specified by:
mouseReleasedin interfacenet.minecraft.client.gui.components.events.GuiEventListener
-
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
-
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:
onClosein 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 invalid input: '<' 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()
-