public interface IArmorUpgradeHandler<T extends IArmorExtensionData>
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.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
UPGRADE_PREFIX
Used for translation keys and keybind naming
|
| Modifier and Type | Method and Description |
|---|---|
default java.util.function.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.
|
net.minecraft.inventory.EquipmentSlotType |
getEquipmentSlot()
Get the armor slot that this upgrade handler is attached to.
|
net.minecraft.util.ResourceLocation |
getID()
Get a unique ID for this upgrade handler.
|
float |
getIdleAirUsage(ICommonArmorHandler armorHandler)
Returns the usage in mL/tick when this upgrade handler is enabled.
|
int |
getIndex()
Used internally for quick lookup.
|
default int |
getMaxInstallableUpgrades(EnumUpgrade upgrade)
Get the maximum number of the given upgrade which may be installed.
|
default float |
getMinimumPressure()
Get the minimum armor pressure for this renderer to operate; the armor piece pressure must be greater
than this.
|
EnumUpgrade[] |
getRequiredUpgrades()
Return the upgrades that are required to be in the armor piece to enable this module.
|
static java.lang.String |
getStringKey(net.minecraft.util.ResourceLocation id)
Source of truth for all translation keys and keybind names.
|
default java.lang.String |
getTranslationKey()
Get a translation key for this upgrade, for text display purposes.
|
default void |
onDataFieldUpdated(ICommonArmorHandler commonArmorHandler,
java.lang.String tagName,
net.minecraft.nbt.INBT 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 toggle 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
|
static final java.lang.String UPGRADE_PREFIX
net.minecraft.util.ResourceLocation getID()
int getIndex()
getID() for a unique identifier.void setIndex(int index)
index - the internal numeric index for this upgradeEnumUpgrade[] getRequiredUpgrades()
default int getMaxInstallableUpgrades(EnumUpgrade upgrade)
upgrade - an upgradefloat getIdleAirUsage(ICommonArmorHandler armorHandler)
armorHandler - the armor handler object (can be used to get upgrades, etc.)default float getMinimumPressure()
net.minecraft.inventory.EquipmentSlotType getEquipmentSlot()
default java.lang.String getTranslationKey()
default void tick(ICommonArmorHandler commonArmorHandler, boolean enabled)
commonArmorHandler - the armor handler objectenabled - true if the upgrade is currently enabled, false otherwisedefault void onInit(ICommonArmorHandler commonArmorHandler)
commonArmorHandler - the armor handler objectdefault void onToggle(ICommonArmorHandler commonArmorHandler, boolean newState)
commonArmorHandler - the armor handler objectnewState - the new state of the upgradedefault void onShutdown(ICommonArmorHandler commonArmorHandler)
commonArmorHandler - the armor handler objectdefault void onDataFieldUpdated(ICommonArmorHandler commonArmorHandler, java.lang.String tagName, net.minecraft.nbt.INBT inbt)
commonArmorHandler - the armor handler objecttagName - the NBT tag nameinbt - the NBT data@Nonnull default java.util.function.Supplier<T> extensionData()
IArmorExtensionData. This data will be stored
in the common armor handler for the player, and can be retrieved with
ICommonArmorHandler.getExtensionData(IArmorUpgradeHandler).static java.lang.String getStringKey(net.minecraft.util.ResourceLocation id)
id - the upgrade ID, as returned by getID()