Class UpgradableItemUtils
java.lang.Object
me.desht.pneumaticcraft.common.util.UpgradableItemUtils
Some helper methods to manage items which can store upgrades (Pneumatic Armor, Drones...)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddUpgradeInformation(net.minecraft.world.item.ItemStack iStack, List<net.minecraft.network.chat.Component> textList, net.minecraft.world.item.TooltipFlag flag) Add a standardized tooltip listing the installed upgrades in the given item.static intgetUpgradeCount(net.minecraft.world.item.ItemStack stack, PNCUpgrade upgrade) Get the installed count for the given upgrade.getUpgradeList(net.minecraft.world.item.ItemStack stack, PNCUpgrade... upgradeList) Get the installed count for the given upgrades.static Map<PNCUpgrade,Integer> getUpgrades(net.minecraft.world.item.ItemStack stack) Retrieves the upgrades currently installed on the given itemstack.static booleanhasCreativeUpgrade(net.minecraft.world.item.ItemStack stack) static voidsetUpgrades(net.minecraft.world.item.ItemStack stack, net.minecraftforge.items.ItemStackHandler handler) Store a collection of upgrades into an item stack.
-
Field Details
-
NBT_CREATIVE
- See Also:
-
NBT_UPGRADE_TAG
- See Also:
-
UPGRADE_INV_SIZE
public static final int UPGRADE_INV_SIZE- See Also:
-
-
Constructor Details
-
UpgradableItemUtils
public UpgradableItemUtils()
-
-
Method Details
-
addUpgradeInformation
public static void addUpgradeInformation(net.minecraft.world.item.ItemStack iStack, List<net.minecraft.network.chat.Component> textList, net.minecraft.world.item.TooltipFlag flag) Add a standardized tooltip listing the installed upgrades in the given item.- Parameters:
iStack- the itemtextList- list of text to append tooltip tooflag- tooltip flag
-
setUpgrades
public static void setUpgrades(net.minecraft.world.item.ItemStack stack, net.minecraftforge.items.ItemStackHandler handler) Store a collection of upgrades into an item stack. This should be only be used for items; don't use it to manage saved upgrades on a dropped block which has serialized upgrade data.- Parameters:
stack- the stackhandler- an ItemStackHandler holding upgrade items
-
getUpgrades
Retrieves the upgrades currently installed on the given itemstack. Upgrade tiers are taken into account, e.g. a single tier 5 upgrade will have a count of 5.- Parameters:
stack- the itemstack to check- Returns:
- a map of upgrade->count
-
getUpgradeCount
Get the installed count for the given upgrade. Tiered upgrades count as multiple, e.g. one Tier 5 upgrade will return a result of 5 if queried for.- Parameters:
stack- the itemstack to checkupgrade- the upgrade to check for- Returns:
- number of upgrades installed
-
getUpgradeList
public static List<Integer> getUpgradeList(net.minecraft.world.item.ItemStack stack, PNCUpgrade... upgradeList) Get the installed count for the given upgrades. Tiered upgrades count as multiple, e.g. one Tier 5 upgrade will return a result of 5 if queried for.- Parameters:
stack- the itemstack to checkupgradeList- the upgrades to check for- Returns:
- number of upgrades installed, in the same order as the upgrades which were passed to the method
-
hasCreativeUpgrade
public static boolean hasCreativeUpgrade(net.minecraft.world.item.ItemStack stack)
-