Class ItemStackHelper

java.lang.Object
net.darkhax.bookshelf.api.util.ItemStackHelper

public final class ItemStackHelper extends Object
This class contains static helper methods for working with ItemStacks.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    appendLore(net.minecraft.world.item.ItemStack stack, net.minecraft.network.chat.Component... lines)
     
    static boolean
    areStacksContentsEquivalent(net.minecraft.world.item.ItemStack first, net.minecraft.world.item.ItemStack second)
     
    static boolean
    areStacksEquivalent(net.minecraft.world.item.ItemStack first, net.minecraft.world.item.ItemStack second)
     
    static boolean
    areStacksEquivalent(net.minecraft.world.item.ItemStack first, net.minecraft.world.item.ItemStack second, boolean ignoreTags)
     
    static double
    getAttackDamage(net.minecraft.world.item.ItemStack stack)
    Calculates the attack damage for an ItemStack when used to attack an unspecified mob.
    static double
    getAttackDamage(net.minecraft.world.item.ItemStack stack, net.minecraft.world.entity.Entity target)
    Calculates the attack damage for an ItemStack when used to attack a specific entity.
    static double
    getAttackDamage(net.minecraft.world.item.ItemStack stack, net.minecraft.world.entity.MobType targetType)
    Calculates the attack damage for an ItemStack after accounting for bonus damage modifiers such as attribute modifiers and enchantments.
    static net.minecraft.world.item.ItemStack[]
    getTabItems(net.minecraft.world.item.CreativeModeTab tab)
     
    static void
    setLore(net.minecraft.world.item.ItemStack stack, net.minecraft.network.chat.Component... lines)
     

    Methods inherited from class java.lang.Object

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

    • ItemStackHelper

      public ItemStackHelper()
  • Method Details

    • getAttackDamage

      public static double getAttackDamage(net.minecraft.world.item.ItemStack stack)
      Calculates the attack damage for an ItemStack when used to attack an unspecified mob. This will include bonus damage sources such as modifiers and enchantments.
      Parameters:
      stack - The ItemStack to calculate the damage value of.
      Returns:
      The attack damage for an ItemStack with bonus damage modifiers applied.
    • getAttackDamage

      public static double getAttackDamage(net.minecraft.world.item.ItemStack stack, net.minecraft.world.entity.Entity target)
      Calculates the attack damage for an ItemStack when used to attack a specific entity. This will include bonus damage sources such as attribute modifiers and enchantments.
      Parameters:
      stack - The ItemStack to calculate the damage value of.
      target - The target entity being attacked.
      Returns:
      The attack damage for an ItemStack with bonus damage modifiers applied.
    • getAttackDamage

      public static double getAttackDamage(net.minecraft.world.item.ItemStack stack, net.minecraft.world.entity.MobType targetType)
      Calculates the attack damage for an ItemStack after accounting for bonus damage modifiers such as attribute modifiers and enchantments.
      Parameters:
      stack - The ItemStack to calculate the damage value of.
      targetType - The type of mob being attacked. Used for some enchantment calculations.
      Returns:
      The attack damage for an ItemStack with bonus damage modifiers applied.
    • getTabItems

      public static net.minecraft.world.item.ItemStack[] getTabItems(net.minecraft.world.item.CreativeModeTab tab)
    • areStacksEquivalent

      public static boolean areStacksEquivalent(net.minecraft.world.item.ItemStack first, net.minecraft.world.item.ItemStack second)
    • areStacksContentsEquivalent

      public static boolean areStacksContentsEquivalent(net.minecraft.world.item.ItemStack first, net.minecraft.world.item.ItemStack second)
    • areStacksEquivalent

      public static boolean areStacksEquivalent(net.minecraft.world.item.ItemStack first, net.minecraft.world.item.ItemStack second, boolean ignoreTags)
    • setLore

      public static void setLore(net.minecraft.world.item.ItemStack stack, net.minecraft.network.chat.Component... lines)
    • appendLore

      public static void appendLore(net.minecraft.world.item.ItemStack stack, net.minecraft.network.chat.Component... lines)