Interface ICommonArmorHandler

All Known Implementing Classes:
CommonArmorHandler

public interface ICommonArmorHandler
Provides access to the current state of the Pneumatic Armor worn by a player. This object is passed as a parameter to some methods of IArmorUpgradeHandler and IArmorUpgradeClientHandler, and can also be directly retrieved via ICommonArmorRegistry.getCommonArmorHandler(Player).

You should avoid hanging on to instances of this across ticks, since it will become invalid if a player logs off or changes dimension.

  • Method Summary

    Modifier and Type
    Method
    Description
    float
    addAir(net.minecraft.world.entity.EquipmentSlot slot, int air)
    Add (or remove) air from the armor piece in the given slot.
    float
    getArmorPressure(net.minecraft.world.entity.EquipmentSlot slot)
    Get the pressure for the armor piece in the given equipment slot.
    <T extends IArmorExtensionData>
    T
    Get the per-player extension data for the given upgrade, if any.
    net.minecraft.world.entity.player.Player
    Get the player wearing this armor
    int
    getSpeedFromUpgrades(net.minecraft.world.entity.EquipmentSlot slot)
    Convenience method to get the speed boost for the given armor piece, which is 1 + {number_of_speed_upgrades}
    int
    getUpgradeCount(net.minecraft.world.entity.EquipmentSlot slot, PNCUpgrade upgrade)
    Get the number of the given upgrade installed in the given armor slot
    boolean
    hasMinPressure(net.minecraft.world.entity.EquipmentSlot slot)
    Check that the armor in the given is above the minimum pressure limit to operate
    boolean
    Check if the armor master switch is enabled (i.e.
    boolean
    upgradeUsable(IArmorUpgradeHandler<?> handler, boolean mustBeActive)
    Check if the given upgrade handler is actually usable right now.
  • Method Details

    • getPlayer

      net.minecraft.world.entity.player.Player getPlayer()
      Get the player wearing this armor
      Returns:
      the player
    • getUpgradeCount

      int getUpgradeCount(net.minecraft.world.entity.EquipmentSlot slot, PNCUpgrade upgrade)
      Get the number of the given upgrade installed in the given armor slot
      Parameters:
      slot - the equipment slot (must be one of HEAD, CHEST, LEGS or FEET)
      upgrade - the upgrade to query
      Returns:
      the number of upgrades installed
    • getSpeedFromUpgrades

      int getSpeedFromUpgrades(net.minecraft.world.entity.EquipmentSlot slot)
      Convenience method to get the speed boost for the given armor piece, which is 1 + {number_of_speed_upgrades}
      Parameters:
      slot - the equipment slot
      Returns:
      the speed boost
    • getArmorPressure

      float getArmorPressure(net.minecraft.world.entity.EquipmentSlot slot)
      Get the pressure for the armor piece in the given equipment slot.
      Parameters:
      slot - the equipment slot
      Returns:
      the pressure of the armor piece, in bar
    • hasMinPressure

      boolean hasMinPressure(net.minecraft.world.entity.EquipmentSlot slot)
      Check that the armor in the given is above the minimum pressure limit to operate
      Parameters:
      slot - the slot
      Returns:
      true if the armor piece can function, false if not
    • addAir

      float addAir(net.minecraft.world.entity.EquipmentSlot slot, int air)
      Add (or remove) air from the armor piece in the given slot.
      Parameters:
      slot - the slot
      air - amount to add (negative amounts remove air)
      Returns:
      the previous pressure for the armor piece
    • isArmorEnabled

      boolean isArmorEnabled()
      Check if the armor master switch is enabled (i.e. core components are active)
      Returns:
      true if enabled
    • upgradeUsable

      boolean upgradeUsable(IArmorUpgradeHandler<?> handler, boolean mustBeActive)
      Check if the given upgrade handler is actually usable right now. Validates that the upgrade is installed, and that the corresponding armor piece is initialized and has sufficient pressure.
      Parameters:
      handler - the upgrade handler to check
      mustBeActive - if true, the handler must be currently active
      Returns:
      true if the upgrade is usable right now, false otherwise
    • getExtensionData

      <T extends IArmorExtensionData> T getExtensionData(IArmorUpgradeHandler<T> handler)
      Get the per-player extension data for the given upgrade, if any. See IArmorUpgradeHandler.extensionData().
      Type Parameters:
      T - handler type
      Parameters:
      handler - the armor upgrade handler
      Returns:
      the extension, or null if there is none for this type of upgrade