Interface IArmorUpgradeClientHandler<T extends IArmorUpgradeHandler<?>>
- All Known Implementing Classes:
AirConClientHandler,BlockTrackerClientHandler,ChargingClientHandler,ChestplateLauncherClientHandler,CoordTrackClientHandler,CoreComponentsClientHandler,DroneDebugClientHandler,ElytraClientHandler,EnderVisorClientHandler,EntityTrackerClientHandler,HackClientHandler,IArmorUpgradeClientHandler.AbstractHandler,IArmorUpgradeClientHandler.SimpleToggleableHandler,JetBootsClientHandler,JumpBoostClientHandler,KickClientHandler,MagnetClientHandler,NightVisionClientHandler,ReachDistanceClientHandler,ScubaClientHandler,SearchClientHandler,SpeedBoostClientHandler,StepAssistClientHandler,StompClientHandler
IArmorUpgradeClientHandler.AbstractHandler or IArmorUpgradeClientHandler.SimpleToggleableHandler rather than implement this interface directly.
Register an instance of this via IPneumaticHelmetRegistry.registerRenderHandler(IArmorUpgradeHandler, IArmorUpgradeClientHandler).
You will need a corresponding IArmorUpgradeHandler object; there is a 1-1 relationship.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classConvenience class which allows a reference to the common upgrade handler to be passed in and retrieved.static classConvenience class for simple toggleable armor features with no additional settings. -
Method Summary
Modifier and TypeMethodDescriptiondefault IGuiAnimatedStatYou can return aIGuiAnimatedStathere, which the HUD Handler will pick up and render.Get the common handler corresponding to this client handler.default StatPanelLayoutReturn the default screen layout for this upgrade's stat panel, if it has one.getGuiOptionsPage(IGuiScreen screen) When you have some configurable options for your upgrade handler, return a new instance of anIOptionPage.default net.minecraft.resources.ResourceLocationgetID()Convenience method to get this client handler's ID, which is always the same as the corresponding common handler's ID.default Optional<net.minecraft.client.KeyMapping>Get the default keybinding for toggling this upgrade on/off.default StringGet the keybind category for this upgrade.default StringGet the keybind category for any sub-keybinds.default Collection<net.minecraft.resources.ResourceLocation>Get all the sub-keybinds for this upgrade handler.default Optional<net.minecraft.client.KeyMapping>Get the keybind used to trigger this upgrade's action, if any.default voidThis is called when aModConfigEventis received for the mod.default booleanIs this upgrade toggleable, i.e.default voidCalled when the screen resolution has changed.default voidonTriggered(ICommonArmorHandler armorHandler) Called when the registered triggered keybind (if any) is pressed.voidrender2D(com.mojang.blaze3d.vertex.PoseStack matrixStack, float partialTicks, boolean armorPieceHasPressure) Called in the 2D render stage (via the ForgeIIngameOverlaysystem).voidrender3D(com.mojang.blaze3d.vertex.PoseStack matrixStack, net.minecraft.client.renderer.MultiBufferSource buffer, float partialTicks) Called in the 3D render stage (viaRenderLevelLastEvent)voidreset()Called when (re-)equipping the armor piece.default voidWhen called this should save the settings to config.default voidsetOverlayColor(int color) Called when the player alters their eyepiece color in the Pneumatic Armor GUI "Colors..." screen to re-color any stat this client handler displays.voidtickClient(ICommonArmorHandler armorHandler) Deprecated, for removal: This API element is subject to removal in a future version.default voidtickClient(ICommonArmorHandler armorHandler, boolean isEnabled) This method is called every client tick, and should be used to update clientside logic for armor upgrades.
-
Method Details
-
getCommonHandler
T getCommonHandler()Get the common handler corresponding to this client handler. There is always a one-to-one mapping between common and client handlers. -
getID
default net.minecraft.resources.ResourceLocation getID()Convenience method to get this client handler's ID, which is always the same as the corresponding common handler's ID. Do not override this method!- Returns:
- the handler ID
-
initConfig
default void initConfig()This is called when aModConfigEventis received for the mod. -
saveToConfig
default void saveToConfig()When called this should save the settings to config. -
tickClient
Deprecated, for removal: This API element is subject to removal in a future version.overridetickClient(ICommonArmorHandler, boolean)insteadThis method is called every client tick, and should be used to update clientside logic for armor upgrades. UnlikeIArmorUpgradeHandler.tick(ICommonArmorHandler, boolean), this method is only called for upgrades which are actually enabled (or not toggleable).- Parameters:
armorHandler- common armor handler for the player wearing this armor piece
-
tickClient
This method is called every client tick, and should be used to update clientside logic for armor upgrades.- Parameters:
armorHandler- common armor handler for the player wearing this armor pieceisEnabled- true if the upgrade is currently enabled, false otherwise
-
render3D
void render3D(com.mojang.blaze3d.vertex.PoseStack matrixStack, net.minecraft.client.renderer.MultiBufferSource buffer, float partialTicks) Called in the 3D render stage (viaRenderLevelLastEvent)- Parameters:
matrixStack- the matrix stackbuffer- the render type bufferpartialTicks- partial ticks since last world tick
-
render2D
void render2D(com.mojang.blaze3d.vertex.PoseStack matrixStack, float partialTicks, boolean armorPieceHasPressure) Called in the 2D render stage (via the ForgeIIngameOverlaysystem).- Parameters:
matrixStack- the matrix stackpartialTicks- partial ticks since last world tickarmorPieceHasPressure- true if the armor piece actually has any pressure
-
getAnimatedStat
You can return aIGuiAnimatedStathere, which the HUD Handler will pick up and render. It also automatically opens and closes the stat window as necessary.IPneumaticHelmetRegistry.makeHUDStatPanel(Component, ItemStack, IArmorUpgradeClientHandler)is a useful method for creating a panel.The recommended way to handle this is to have a
IGuiAnimatedStatfield in your client upgrade handler, and lazy-init that in this method, also resetting the field to null inonResolutionChanged().- Returns:
- the animated stat, or null if this upgrade doesn't use/require a stat window
-
getDefaultStatLayout
Return the default screen layout for this upgrade's stat panel, if it has one. Note that the position is easily modifiable by the player using the "Move Screen..." button in the upgrade's GUI.If your handler doesn't have a stat panel (i.e.
getAnimatedStat()returns null), you don't need to override this. If it does have a panel, it's recommended to override this with a reasonable default position.- Returns:
- the default position
-
reset
void reset()Called when (re-)equipping the armor piece. Use this to clear any client-side state information held by the upgrade handler and initialise it to a known state. -
getGuiOptionsPage
When you have some configurable options for your upgrade handler, return a new instance of anIOptionPage. When you do so, it will automatically get picked up by the armor GUI handler, and a button for the upgrade will be displayed in the main armor GUI.- Parameters:
screen- an instance of the gui Screen object- Returns:
- an options page, or null if the upgrade does not have an options page
-
onResolutionChanged
default void onResolutionChanged()Called when the screen resolution has changed. Primarily intended to allow render handlers to recalculate stat positions. -
isToggleable
default boolean isToggleable()Is this upgrade toggleable, i.e. can it be switched on & off? Toggleable upgrades will have a checkbox in their GUI page with a possible associated keybinding. Non-toggleable upgrades generally have a bindable hotkey to trigger a one-off action (e.g. hacking, chestplate launcher...). The default return value for this method is true, which is the most common case. Override to return false for non-toggleable upgrades.- Returns:
- true if the upgrade is toggleable, false otherwise
-
getInitialKeyBinding
Get the default keybinding for toggling this upgrade on/off. By default, an unbound key binding will be registered for the upgrade, so it appears in the vanilla Config -> Controls screen with no binding. Note that only toggles are added here; keybinds for non-toggleable upgrade which trigger specific actions (e.g. the Chestplate Launcher or Drone Debugging key) need to be registered explicitly.Do not override this default implementation. Non-toggleable upgrades return
Optional.empty()by default.- Returns:
- the default key binding for this upgrade
-
getSubKeybinds
Get all the sub-keybinds for this upgrade handler. The ID's of any checkboxes which toggle a sub-feature of this upgrade (e.g. the various Block Tracker categories, or the Jet Boots builder mode) need to be returned here so a key binding can be registered for them.The ID's returned here are the same as those passed to
IPneumaticHelmetRegistry.makeKeybindingCheckBox(ResourceLocation, int, int, int, Consumer).- Returns:
- a collection of ID's
-
getTriggerKeyBinding
Get the keybind used to trigger this upgrade's action, if any. This is distinct from the toggle keybind (which switches an upgrade on or off); the trigger keybind triggers an action, e.g. Hacking, Pneumatic Kick...- Returns:
- an optional keybinding name
-
onTriggered
Called when the registered triggered keybind (if any) is pressed.- Parameters:
armorHandler- the client-side common armor handler object for the player
-
getKeybindCategory
Get the keybind category for this upgrade. By default, this is the same as the default category for all PneumaticCraft keybinds.- Returns:
- a keybind category ID
-
getSubKeybindCategory
Get the keybind category for any sub-keybinds. By default, this is the same as the default category for all PneumaticCraft keybinds.- Returns:
- a keybind category ID
-
setOverlayColor
default void setOverlayColor(int color) Called when the player alters their eyepiece color in the Pneumatic Armor GUI "Colors..." screen to re-color any stat this client handler displays. The default implementation works for most cases, but if your handler displays extra stats (like the Entity or Block tracker does), override this method to re-color them too.- Parameters:
color- the new color for the stat display, as chosen by the player
-
tickClient(ICommonArmorHandler, boolean)instead