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 TypeMethodDescriptionfloataddAir(net.minecraft.world.entity.EquipmentSlot slot, int air) Add (or remove) air from the armor piece in the given slot.intgetAir(net.minecraft.world.entity.EquipmentSlot slot) Get the amount of air for the armor piece in the given equipment slot.floatgetArmorPressure(net.minecraft.world.entity.EquipmentSlot slot) Get the pressure for the armor piece in the given equipment slot.<T extends IArmorExtensionData>
TgetExtensionData(IArmorUpgradeHandler<T> handler) Get the per-player extension data for the given upgrade, if any.net.minecraft.world.entity.player.PlayerGet the player wearing this armorintgetSpeedFromUpgrades(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}intgetUpgradeCount(net.minecraft.world.entity.EquipmentSlot slot, PNCUpgrade upgrade) Get the number of the given upgrade installed in the given armor slotbooleanhasMinPressure(net.minecraft.world.entity.EquipmentSlot slot) Check that the armor in the given is above the minimum pressure limit to operatebooleanCheck if the armor master switch is enabled (i.e.booleanupgradeUsable(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
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
-
getAir
int getAir(net.minecraft.world.entity.EquipmentSlot slot) Get the amount of air for the armor piece in the given equipment slot.- Parameters:
slot- the equipment slot- Returns:
- air, in mL
-
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 slotair- 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
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 checkmustBeActive- if true, the handler must be currently active- Returns:
- true if the upgrade is usable right now, false otherwise
-
getExtensionData
Get the per-player extension data for the given upgrade, if any. SeeIArmorUpgradeHandler.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
-