Interface IArmorUpgradeHandler<T extends IArmorExtensionData>

All Known Implementing Classes:
AirConHandler, BaseArmorUpgradeHandler, BlockTrackerHandler, ChargingHandler, ChestplateLauncherHandler, CoordTrackerHandler, CoreComponentsHandler, DroneDebugHandler, ElytraHandler, EnderVisorHandler, EntityTrackerHandler, HackHandler, JetBootsHandler, JumpBoostHandler, KickHandler, MagnetHandler, NightVisionHandler, ReachDistanceHandler, ScubaHandler, SearchHandler, SpeedBoostHandler, StepAssistHandler, StompHandler

public interface IArmorUpgradeHandler<T extends IArmorExtensionData>
Represents the common part of a Pneumatic Armor upgrade handler. Singleton implementations of this are present on both client and server. See IArmorUpgradeClientHandler for the client-side handler (which has a one-to-one mapping to this). It is recommended to extend BaseArmorUpgradeHandler rather than implement this interface directly.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Used for translation keys and keybind naming
  • Method Summary

    Modifier and Type
    Method
    Description
    default Supplier<T>
    Set up player-specific extension data for this armor upgrade; since armor upgrade handlers are singleton objects, any player-specific data needs to be stored separately.
    net.minecraft.world.entity.EquipmentSlot
    Get the armor slot that this upgrade handler is attached to.
    net.minecraft.resources.ResourceLocation
    Get a unique ID for this upgrade handler.
    float
    Returns the usage in mL/tick when this upgrade handler is enabled.
    int
    Used internally for quick lookup.
    default int
    Get the maximum number of the given upgrade which may be installed.
    default float
    Get the minimum armor pressure for this renderer to operate; the armor piece pressure must be greater than this.
    Return the upgrades that are required to be in the armor piece to enable this module.
    static String
    getStringKey(net.minecraft.resources.ResourceLocation id)
    Source of truth for all translation keys and keybind names.
    default String
    Get a translation key for this upgrade, for text display purposes.
    default void
    onDataFieldUpdated(ICommonArmorHandler commonArmorHandler, String tagName, net.minecraft.nbt.Tag inbt)
    Called on both client and server when some NBT data is changed in this upgrade's armor itemstack.
    default void
    onInit(ICommonArmorHandler commonArmorHandler)
    Called when the armor is initialising and this upgrade is installed.
    default void
    onShutdown(ICommonArmorHandler commonArmorHandler)
    Called when the armor is removed; carry out any necessary shutdown tasks here
    default void
    onToggle(ICommonArmorHandler commonArmorHandler, boolean newState)
    Called when an upgrade is toggled on/off by the player
    void
    setIndex(int index)
    Used internally for quick lookup.
    default void
    tick(ICommonArmorHandler commonArmorHandler, boolean enabled)
    Called every tick for a player when this upgrade is installed in their armor
  • Field Details

  • Method Details

    • getID

      net.minecraft.resources.ResourceLocation getID()
      Get a unique ID for this upgrade handler.
      Returns:
      a unique resource location
    • getIndex

      int getIndex()
      Used internally for quick lookup. Don't use this directly; use getID() for a unique identifier.
      Returns:
      the internal numeric index for this upgrade
    • setIndex

      void setIndex(int index)
      Used internally for quick lookup. Set once when this upgrade is registered; do not attempt to change this!
      Parameters:
      index - the internal numeric index for this upgrade
    • getRequiredUpgrades

      PNCUpgrade[] getRequiredUpgrades()
      Return the upgrades that are required to be in the armor piece to enable this module.
      Returns:
      an array of required upgrades
    • getMaxInstallableUpgrades

      default int getMaxInstallableUpgrades(PNCUpgrade upgrade)
      Get the maximum number of the given upgrade which may be installed.
      Parameters:
      upgrade - an upgrade
      Returns:
      the maximum installable amount of this upgrade
    • getIdleAirUsage

      float getIdleAirUsage(ICommonArmorHandler armorHandler)
      Returns the usage in mL/tick when this upgrade handler is enabled. Note this is constant usage just from the upgrade being switched on, and does not take into account air used when some action is taken, e.g. flying with the Jet Boots upgrade is not included here, but air used by the Entity Tracker upgrade is included.
      Parameters:
      armorHandler - the armor handler object (can be used to get upgrades, etc.)
      Returns:
      usage in mL/tick
    • getMinimumPressure

      default float getMinimumPressure()
      Get the minimum armor pressure for this renderer to operate; the armor piece pressure must be greater than this. Most components require any pressure >0.0 bar. Return any negative value for the component to always render regardless of pressure.
      Returns:
      the minimum required pressure
    • getEquipmentSlot

      net.minecraft.world.entity.EquipmentSlot getEquipmentSlot()
      Get the armor slot that this upgrade handler is attached to.
      Returns:
      the armor slot
    • getTranslationKey

      default String getTranslationKey()
      Get a translation key for this upgrade, for text display purposes.
      Returns:
      a translation key
    • tick

      default void tick(ICommonArmorHandler commonArmorHandler, boolean enabled)
      Called every tick for a player when this upgrade is installed in their armor
      Parameters:
      commonArmorHandler - the armor handler object
      enabled - true if the upgrade is currently enabled, false otherwise
    • onInit

      default void onInit(ICommonArmorHandler commonArmorHandler)
      Called when the armor is initialising and this upgrade is installed.
      Parameters:
      commonArmorHandler - the armor handler object
    • onToggle

      default void onToggle(ICommonArmorHandler commonArmorHandler, boolean newState)
      Called when an upgrade is toggled on/off by the player
      Parameters:
      commonArmorHandler - the armor handler object
      newState - the new state of the upgrade
    • onShutdown

      default void onShutdown(ICommonArmorHandler commonArmorHandler)
      Called when the armor is removed; carry out any necessary shutdown tasks here
      Parameters:
      commonArmorHandler - the armor handler object
    • onDataFieldUpdated

      default void onDataFieldUpdated(ICommonArmorHandler commonArmorHandler, String tagName, net.minecraft.nbt.Tag inbt)
      Called on both client and server when some NBT data is changed in this upgrade's armor itemstack. Can be used to cache heavily-accessed NBT data for performance reasons.
      Parameters:
      commonArmorHandler - the armor handler object
      tagName - the NBT tag name
      inbt - the NBT data
    • extensionData

      @Nonnull default Supplier<T> extensionData()
      Set up player-specific extension data for this armor upgrade; since armor upgrade handlers are singleton objects, any player-specific data needs to be stored separately. If your handler needs this (most don't), override this method to return a supplier of a new instance of some class that implements IArmorExtensionData. This data will be stored in the common armor handler for the player, and can be retrieved with ICommonArmorHandler.getExtensionData(IArmorUpgradeHandler).
      Returns:
      a supplier for the extension data for this upgrade & player; supply null if there is none
    • getStringKey

      static String getStringKey(net.minecraft.resources.ResourceLocation id)
      Source of truth for all translation keys and keybind names. Standard "pneumaticcraft.armor.upgrade" prefix, followed by a resource location ID, where the ID is converted to a string. ID's from the "pneumaticcraft" namespace use just the resource location's path, while ID's from other namespaces include the namespace. E.g.:
      • "pneumaticcraft:block_tracker" -> "pneumaticcraft.armor.upgrade.block_tracker"
      • "pneumaticcraft:block_tracker.module.energy" -> "pneumaticcraft.armor.upgrade.block_tracker.module.energy"
      • "mod2:other_upgrade" -> "pneumaticcraft.armor.upgrade.mod2.other_upgrade"
      Parameters:
      id - the upgrade ID, as returned by getID()
      Returns:
      a dot-separated string key, suitable for a translation key or keybind name