Class CommonArmorHandler
java.lang.Object
me.desht.pneumaticcraft.common.pneumatic_armor.CommonArmorHandler
- All Implemented Interfaces:
ICommonArmorHandler
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final floatstatic final float -
Method Summary
Modifier and TypeMethodDescriptionfloataddAir(net.minecraft.world.entity.EquipmentSlot slot, int airAmount) Add (or remove) air from the armor piece in the given 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.static CommonArmorHandlerstatic CommonArmorHandlergetHandlerForPlayer(net.minecraft.world.entity.player.Player player) floatgetIdleAirUsage(net.minecraft.world.entity.EquipmentSlot slot, boolean countDisabled) 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}intgetStartupTime(net.minecraft.world.entity.EquipmentSlot slot) intgetTicksSinceEquipped(net.minecraft.world.entity.EquipmentSlot slot) intgetUpgradeCount(net.minecraft.world.entity.EquipmentSlot slot, PNCUpgrade upgrade) Get the number of the given upgrade installed in the given armor slotintgetUpgradeCount(net.minecraft.world.entity.EquipmentSlot slot, PNCUpgrade upgrade, int max) booleanhasMinPressure(net.minecraft.world.entity.EquipmentSlot slot) Check that the armor in the given is above the minimum pressure limit to operatevoidinitArmorInventory(net.minecraft.world.entity.EquipmentSlot slot) Called on the first tick after the armor piece is equipped.voidbooleanCheck if the armor master switch is enabled (i.e.booleanisArmorReady(net.minecraft.world.entity.EquipmentSlot slot) booleanisUpgradeEnabled(net.minecraft.world.entity.EquipmentSlot slot, int featureIndex) booleanisUpgradeInserted(net.minecraft.world.entity.EquipmentSlot slot, int featureIndex) booleanisValid()voidsetUpgradeEnabled(net.minecraft.world.entity.EquipmentSlot slot, byte featureIndex, boolean state) voidtickArmorPiece(net.minecraft.world.entity.EquipmentSlot slot) booleanupgradeUsable(IArmorUpgradeHandler<?> upgrade, boolean mustBeActive) Check if the given upgrade handler is actually usable right now.
-
Field Details
-
CRITICAL_PRESSURE
public static final float CRITICAL_PRESSURE- See Also:
-
LOW_PRESSURE
public static final float LOW_PRESSURE- See Also:
-
-
Method Details
-
getHandlerForPlayer
public static CommonArmorHandler getHandlerForPlayer(net.minecraft.world.entity.player.Player player) -
getHandlerForPlayer
-
getExtensionData
Description copied from interface:ICommonArmorHandlerGet the per-player extension data for the given upgrade, if any. SeeIArmorUpgradeHandler.extensionData().- Specified by:
getExtensionDatain interfaceICommonArmorHandler- 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
-
tickArmorPiece
public void tickArmorPiece(net.minecraft.world.entity.EquipmentSlot slot) -
getIdleAirUsage
public float getIdleAirUsage(net.minecraft.world.entity.EquipmentSlot slot, boolean countDisabled) -
addAir
public float addAir(net.minecraft.world.entity.EquipmentSlot slot, int airAmount) Description copied from interface:ICommonArmorHandlerAdd (or remove) air from the armor piece in the given slot.- Specified by:
addAirin interfaceICommonArmorHandler- Parameters:
slot- the slotairAmount- amount to add (negative amounts remove air)- Returns:
- the previous pressure for the armor piece
-
initArmorInventory
public void initArmorInventory(net.minecraft.world.entity.EquipmentSlot slot) Called on the first tick after the armor piece is equipped. Scan the armor piece in the given slot, and record all installed upgrades for fast access later on. Upgrades can't be changed without removing and re-equipping the piece, so we can cache quite a lot of useful info.- Parameters:
slot- the equipment slot
-
getPlayer
public net.minecraft.world.entity.player.Player getPlayer()Description copied from interface:ICommonArmorHandlerGet the player wearing this armor- Specified by:
getPlayerin interfaceICommonArmorHandler- Returns:
- the player
-
getUpgradeCount
Description copied from interface:ICommonArmorHandlerGet the number of the given upgrade installed in the given armor slot- Specified by:
getUpgradeCountin interfaceICommonArmorHandler- 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
-
getUpgradeCount
public int getUpgradeCount(net.minecraft.world.entity.EquipmentSlot slot, PNCUpgrade upgrade, int max) -
isUpgradeInserted
public boolean isUpgradeInserted(net.minecraft.world.entity.EquipmentSlot slot, int featureIndex) -
isUpgradeEnabled
public boolean isUpgradeEnabled(net.minecraft.world.entity.EquipmentSlot slot, int featureIndex) -
setUpgradeEnabled
public void setUpgradeEnabled(net.minecraft.world.entity.EquipmentSlot slot, byte featureIndex, boolean state) -
getTicksSinceEquipped
public int getTicksSinceEquipped(net.minecraft.world.entity.EquipmentSlot slot) -
getSpeedFromUpgrades
public int getSpeedFromUpgrades(net.minecraft.world.entity.EquipmentSlot slot) Description copied from interface:ICommonArmorHandlerConvenience method to get the speed boost for the given armor piece, which is 1 + {number_of_speed_upgrades}- Specified by:
getSpeedFromUpgradesin interfaceICommonArmorHandler- Parameters:
slot- the equipment slot- Returns:
- the speed boost
-
getStartupTime
public int getStartupTime(net.minecraft.world.entity.EquipmentSlot slot) -
isArmorReady
public boolean isArmorReady(net.minecraft.world.entity.EquipmentSlot slot) -
getArmorPressure
public float getArmorPressure(net.minecraft.world.entity.EquipmentSlot slot) Description copied from interface:ICommonArmorHandlerGet the pressure for the armor piece in the given equipment slot.- Specified by:
getArmorPressurein interfaceICommonArmorHandler- Parameters:
slot- the equipment slot- Returns:
- the pressure of the armor piece, in bar
-
isArmorEnabled
public boolean isArmorEnabled()Description copied from interface:ICommonArmorHandlerCheck if the armor master switch is enabled (i.e. core components are active)- Specified by:
isArmorEnabledin interfaceICommonArmorHandler- Returns:
- true if enabled
-
isValid
public boolean isValid() -
invalidate
public void invalidate() -
hasMinPressure
public boolean hasMinPressure(net.minecraft.world.entity.EquipmentSlot slot) Description copied from interface:ICommonArmorHandlerCheck that the armor in the given is above the minimum pressure limit to operate- Specified by:
hasMinPressurein interfaceICommonArmorHandler- Parameters:
slot- the slot- Returns:
- true if the armor piece can function, false if not
-
upgradeUsable
Description copied from interface:ICommonArmorHandlerCheck 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.- Specified by:
upgradeUsablein interfaceICommonArmorHandler- Parameters:
upgrade- the upgrade handler to checkmustBeActive- if true, the handler must be currently active- Returns:
- true if the upgrade is usable right now, false otherwise
-