Interface IArmorUpgradeClientHandler<T extends IArmorUpgradeHandler<?>>

All Known Implementing Classes:
AirConClientHandler, BlockTrackerClientHandler, ChargingClientHandler, ChestplateLauncherClientHandler, CoordTrackClientHandler, CoreComponentsClientHandler, DroneDebugClientHandler, ElytraClientHandler, EnderVisorClientHandler, EntityTrackerClientHandler, FallProtectionClientHandler, HackClientHandler, IArmorUpgradeClientHandler.AbstractHandler, IArmorUpgradeClientHandler.SimpleToggleableHandler, JetBootsClientHandler, JumpBoostClientHandler, KickClientHandler, MagnetClientHandler, NightVisionClientHandler, ReachDistanceClientHandler, ScubaClientHandler, SearchClientHandler, SpeedBoostClientHandler, StepAssistClientHandler, StompClientHandler

public interface IArmorUpgradeClientHandler<T extends IArmorUpgradeHandler<?>>
Represents the client-specific part of an armor upgrade handler; provides methods for rendering, getting the configuration GUI page, reading/writing client-side configuration, and handling keybinds. It's recommended to extend IArmorUpgradeClientHandler.AbstractHandler or IArmorUpgradeClientHandler.SimpleToggleableHandler rather than implement this interface directly.

Register an instance of this via IClientArmorRegistry.registerUpgradeHandler(IArmorUpgradeHandler, IArmorUpgradeClientHandler). You will need a corresponding IArmorUpgradeHandler object; there is a 1-1 relationship.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static class 
    Convenience class which allows a reference to the common upgrade handler to be passed in and retrieved.
    static class 
    Convenience class for simple toggleable armor features with no additional settings.
  • Method Summary

    Modifier and Type
    Method
    Description
    You can return a IGuiAnimatedStat here, which the HUD Handler will pick up and render.
    Get the common handler corresponding to this client handler.
    Return the default screen layout for this upgrade's stat panel, if it has one.
    When you have some configurable options for your upgrade handler, return a new instance of an IOptionPage.
    default net.minecraft.resources.ResourceLocation
    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 String
    Get the keybind category for this upgrade.
    default String
    Get 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 void
    This is called when a ModConfigEvent is received for the mod.
    default boolean
    Is this upgrade enabled by default, i.e.
    default boolean
    isEnabledByDefault(String subModuleName)
    Is the given sub-feature of this upgrade enabled by default? (e.g.
    default boolean
    Is this upgrade toggleable, i.e.
    default void
    Called when the screen resolution has changed.
    default void
    Called when the registered triggered keybind (if any) is pressed.
    void
    render2D(net.minecraft.client.gui.GuiGraphics graphics, float partialTicks, boolean armorPieceHasPressure)
    Called in the 2D render stage (via Forge's IGuiOverlay system).
    void
    render3D(com.mojang.blaze3d.vertex.PoseStack matrixStack, net.minecraft.client.renderer.MultiBufferSource buffer, float partialTicks)
    Called in the 3D render stage (via RenderLevelStageEvent)
    void
    Called when (re-)equipping the armor piece.
    default void
    When called this should save the settings to config.
    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.
    void
    tickClient(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 a ModConfigEvent is received for the mod.
    • saveToConfig

      default void saveToConfig()
      When called this should save the settings to config.
    • tickClient

      void tickClient(ICommonArmorHandler armorHandler, boolean isEnabled)
      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 piece
      isEnabled - 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 (via RenderLevelStageEvent)
      Parameters:
      matrixStack - the matrix stack
      buffer - the render type buffer
      partialTicks - partial ticks since last world tick
    • render2D

      void render2D(net.minecraft.client.gui.GuiGraphics graphics, float partialTicks, boolean armorPieceHasPressure)
      Called in the 2D render stage (via Forge's IGuiOverlay system).
      Parameters:
      graphics - the matrix stack
      partialTicks - partial ticks since last world tick
      armorPieceHasPressure - true if the armor piece actually has any pressure
    • getAnimatedStat

      default IGuiAnimatedStat getAnimatedStat()
      You can return a IGuiAnimatedStat here, which the HUD Handler will pick up and render. It also automatically opens and closes the stat window as necessary.

      IClientArmorRegistry.makeHUDStatPanel(Component, ItemStack, IArmorUpgradeClientHandler) is a useful method for creating a panel.

      The recommended way to handle this is to have a IGuiAnimatedStat field in your client upgrade handler, and lazy-init that in this method, also resetting the field to null in onResolutionChanged().

      Returns:
      the animated stat, or null if this upgrade doesn't use/require a stat window
    • getDefaultStatLayout

      default StatPanelLayout 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

      IOptionPage getGuiOptionsPage(IGuiScreen screen)
      When you have some configurable options for your upgrade handler, return a new instance of an IOptionPage. 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

      default Optional<net.minecraft.client.KeyMapping> 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

      default Collection<net.minecraft.resources.ResourceLocation> 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 IClientArmorRegistry.makeKeybindingCheckBox(ResourceLocation, int, int, int, Consumer).

      Returns:
      a collection of ID's
    • getTriggerKeyBinding

      default Optional<net.minecraft.client.KeyMapping> 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

      default void onTriggered(ICommonArmorHandler armorHandler)
      Called when the registered triggered keybind (if any) is pressed.
      Parameters:
      armorHandler - the client-side common armor handler object for the player
    • getKeybindCategory

      default String 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

      default String 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
    • isEnabledByDefault

      default boolean isEnabledByDefault()
      Is this upgrade enabled by default, i.e. when the player first equips the armor and there's no value saved in ArmorFeatureStatus.json?
      Returns:
      whether the upgrade should be enabled by default
    • isEnabledByDefault

      default boolean isEnabledByDefault(String subModuleName)
      Is the given sub-feature of this upgrade enabled by default? (e.g. the various Block Tracker categories, or the Jet Boots builder mode)
      Parameters:
      subModuleName - name of the submodule name (by convention "{upgrade}.module.{subfeature}")
      Returns:
      whether the sub-feature should be enabled by default