Interface IOptionPage
- All Known Implementing Classes:
AbstractSliderOptions,AirConditionerOptions,BlockTrackOptions,ChestplateLauncherOptions,CoordinateTrackerOptions,CoreComponentsOptions,DroneDebuggerOptions,EntityTrackOptions,HackOptions,IOptionPage.SimpleOptionPage,JetBootsOptions,JumpBoostOptions,KickOptions,NullOptions,SearchOptions,SpeedBoostOptions
public interface IOptionPage
An Option Page is the GUI object which holds the control widgets for a particular Pneumatic Armor upgrade. Create
and return an instance of this class in
IArmorUpgradeClientHandler.getGuiOptionsPage(IGuiScreen).
It is strongly recommended to extend the IOptionPage.SimpleOptionPage class rather than implement this interface directly.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classIOptionPage.SimpleOptionPage<T extends IArmorUpgradeClientHandler<?>>Convenience class for simple armor features with no additional settings. -
Method Summary
Modifier and TypeMethodDescriptionbooleanShould the "Settings" header be displayed?Get a reference to the IGuiScreen object.default Optional<IKeybindingButton>Get the keybinding button for this page, if any.net.minecraft.network.chat.MutableComponentThis text is used in the GUI button for this page.booleanCan this upgrade be toggled on & off? If true, a checkbox (with the ability to bind a key) will be automatically displayed in this upgrade's GUI.booleankeyPressed(int keyCode, int scanCode, int modifiers) Called byScreen.keyPressed(int, int, int)when a key is pressed.booleankeyReleased(int keyCode, int scanCode, int modifiers) Called byContainerEventHandler.keyReleased(int, int, int)when a key is released.booleanmouseClicked(double x, double y, int button) Called when mouse is clicked viaContainerEventHandler.mouseClicked(double, double, int)booleanmouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) Called when the mouse is dragged across the GUIbooleanmouseScrolled(double x, double y, double dir) Called when the mouse wheel is rolled.voidpopulateGui(IGuiScreen gui) Here you can initialize your buttons and stuff like with aScreen.voidrenderPost(com.mojang.blaze3d.vertex.PoseStack matrixStack, int x, int y, float partialTicks) Called immediately afterScreen.render(PoseStack, int, int, float)Here you can render additional things like text.voidrenderPre(com.mojang.blaze3d.vertex.PoseStack matrixStack, int x, int y, float partialTicks) Called immediately beforeScreen.render(PoseStack, int, int, float)default intY position from the "Setting" header.default voidtick()Called immediately afterScreen.tick()
-
Method Details
-
getGuiScreen
IGuiScreen getGuiScreen()Get a reference to the IGuiScreen object. You can use this to get the font renderer, for example.- Returns:
- the screen
-
getPageName
net.minecraft.network.chat.MutableComponent getPageName()This text is used in the GUI button for this page.- Returns:
- the page name
-
populateGui
Here you can initialize your buttons and stuff like with aScreen.- Parameters:
gui- the holding GUI
-
renderPre
void renderPre(com.mojang.blaze3d.vertex.PoseStack matrixStack, int x, int y, float partialTicks) Called immediately beforeScreen.render(PoseStack, int, int, float)- Parameters:
matrixStack- the matrix stackx- mouse Xy- mouse YpartialTicks- partial ticks since last world ticks
-
renderPost
void renderPost(com.mojang.blaze3d.vertex.PoseStack matrixStack, int x, int y, float partialTicks) Called immediately afterScreen.render(PoseStack, int, int, float)Here you can render additional things like text.- Parameters:
matrixStack- the matrix stackx- mouse Xy- mouse YpartialTicks- partial ticks since last world ticks
-
keyPressed
boolean keyPressed(int keyCode, int scanCode, int modifiers) Called byScreen.keyPressed(int, int, int)when a key is pressed.- Parameters:
keyCode- typed keycodescanCode- the scan code (rarely useful)modifiers- key modifiers- Returns:
- true if the event has been handled, false otherwise
-
keyReleased
boolean keyReleased(int keyCode, int scanCode, int modifiers) Called byContainerEventHandler.keyReleased(int, int, int)when a key is released.- Parameters:
keyCode- typed keycodescanCode- the scan code (rarely useful)modifiers- key modifiers- Returns:
- true if the event has been handled, false otherwise
-
mouseClicked
boolean mouseClicked(double x, double y, int button) Called when mouse is clicked viaContainerEventHandler.mouseClicked(double, double, int)- Parameters:
x- mouse Xy- mouse Ybutton- mouse button- Returns:
- true if the event has been handled, false otherwise
-
mouseScrolled
boolean mouseScrolled(double x, double y, double dir) Called when the mouse wheel is rolled.- Parameters:
x- mouse Xy- mouse Ydir- scroll direction- Returns:
- true if the event has been handled, false otherwise
-
mouseDragged
boolean mouseDragged(double mouseX, double mouseY, int button, double dragX, double dragY) Called when the mouse is dragged across the GUI- Parameters:
mouseX- mouse XmouseY- mouse Ybutton- mouse buttondragX- drag XdragY- drag Y- Returns:
- true if the event has been handled, false otherwise
-
isToggleable
boolean isToggleable()Can this upgrade be toggled on & off? If true, a checkbox (with the ability to bind a key) will be automatically displayed in this upgrade's GUI.- Returns:
- true if the upgrade is toggleable, false otherwise
-
displaySettingsHeader
boolean displaySettingsHeader()Should the "Settings" header be displayed?- Returns:
- true if the header should be displayed, false otherwise
-
settingsYposition
default int settingsYposition()Y position from the "Setting" header. The default is fine in most cases, but if your options page has many buttons (e.g. like the Block Tracker), you may wish to adjust this.- Returns:
- Y position, default 115
-
tick
default void tick()Called immediately afterScreen.tick() -
getKeybindingButton
Get the keybinding button for this page, if any. You can create a keybinding button withIClientArmorRegistry.makeKeybindingButton(int, KeyMapping).- Returns:
- the keybinding button, or
Optional.empty()if there isn't one
-