Class Upgrades

java.lang.Object
appeng.api.upgrades.Upgrades

public final class Upgrades extends Object
Manages available upgrades for AE machines, parts and items.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    add(net.minecraft.world.level.ItemLike upgradeCard, net.minecraft.world.level.ItemLike upgradableObject, int maxSupported)
    Same as add(ItemLike, ItemLike, int, String), but without a tooltip group.
    static void
    add(net.minecraft.world.level.ItemLike upgradeCard, net.minecraft.world.level.ItemLike upgradableObject, int maxSupported, @Nullable String tooltipGroup)
    Associates an upgrade card item with an upgradable object and registers the maximum number of this upgrade that the upgradable object supports.
    static net.minecraft.world.item.Item
    createUpgradeCardItem(net.minecraft.world.item.Item.Properties p)
    Creates a new upgrade item which can be used to receive automated tooltips and allow custom upgrades to be added to AE2's toolbelt in the network tool.
    static int
    Returns a cumulative energy multiplier based on the amount of "energy cards" fitted onto a tool.
    static int
    getMaxInstallable(net.minecraft.world.level.ItemLike card, net.minecraft.world.level.ItemLike upgradableItem)
    Returns how many of the given item can be installed in the given upgradable item.
    static List<net.minecraft.network.chat.Component>
    getTooltipLinesForCard(net.minecraft.world.level.ItemLike card)
    Gets a list of lines describing where an upgrade card can be used.
    static List<net.minecraft.network.chat.Component>
    getTooltipLinesForMachine(net.minecraft.world.level.ItemLike upgradableItemLike)
    Gets a list of tooltip lines describing which upgrades and how many of each are supported by a given upgradable item.
    static boolean
    isUpgradeCardItem(net.minecraft.world.item.ItemStack stack)
    Checks if the given item stack uses an item created using createUpgradeCardItem(net.minecraft.world.item.Item.Properties).
    static boolean
    isUpgradeCardItem(net.minecraft.world.level.ItemLike card)
    Checks if the given item is an upgrade card for *any* other object.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • add

      public static void add(net.minecraft.world.level.ItemLike upgradeCard, net.minecraft.world.level.ItemLike upgradableObject, int maxSupported)
      Same as add(ItemLike, ItemLike, int, String), but without a tooltip group.
    • add

      public static void add(net.minecraft.world.level.ItemLike upgradeCard, net.minecraft.world.level.ItemLike upgradableObject, int maxSupported, @Nullable @Nullable String tooltipGroup)
      Associates an upgrade card item with an upgradable object and registers the maximum number of this upgrade that the upgradable object supports.
      Parameters:
      tooltipGroup - If not null, the upgradable object will be shown using this translation key in the tooltip of the upgrade card, grouped together with all other upgradable objects using the same translation key.
    • getMaxInstallable

      public static int getMaxInstallable(net.minecraft.world.level.ItemLike card, net.minecraft.world.level.ItemLike upgradableItem)
      Returns how many of the given item can be installed in the given upgradable item. Returns 0 if none are allowed.
    • getEnergyCardMultiplier

      public static int getEnergyCardMultiplier(IUpgradeInventory upgrades)
      Returns a cumulative energy multiplier based on the amount of "energy cards" fitted onto a tool. Returns 0 if no such cards exist within the tool's upgrade inventory.
    • createUpgradeCardItem

      public static net.minecraft.world.item.Item createUpgradeCardItem(net.minecraft.world.item.Item.Properties p)
      Creates a new upgrade item which can be used to receive automated tooltips and allow custom upgrades to be added to AE2's toolbelt in the network tool.
    • isUpgradeCardItem

      public static boolean isUpgradeCardItem(net.minecraft.world.level.ItemLike card)
      Checks if the given item is an upgrade card for *any* other object.
    • isUpgradeCardItem

      public static boolean isUpgradeCardItem(net.minecraft.world.item.ItemStack stack)
      Checks if the given item stack uses an item created using createUpgradeCardItem(net.minecraft.world.item.Item.Properties).
      See Also:
    • getTooltipLinesForCard

      public static List<net.minecraft.network.chat.Component> getTooltipLinesForCard(net.minecraft.world.level.ItemLike card)
      Gets a list of lines describing where an upgrade card can be used.
    • getTooltipLinesForMachine

      public static List<net.minecraft.network.chat.Component> getTooltipLinesForMachine(net.minecraft.world.level.ItemLike upgradableItemLike)
      Gets a list of tooltip lines describing which upgrades and how many of each are supported by a given upgradable item. Returns an empty list if there are no upgrades available for this item.