Class McItemStack

java.lang.Object
com.shanebeestudios.nms.api.world.item.McItemStack

public class McItemStack extends Object
Wrapper for Minecraft ItemStack

Provides easy-to-use mapped methods for ItemStacks

  • Method Details

    • wrap

      @NotNull public static @NotNull McItemStack wrap(@NotNull @NotNull net.minecraft.world.item.ItemStack itemStack)
      Wrap an NMS ItemStack to use easy to use methods
      Parameters:
      itemStack - NMS ItemStack to wrap
      Returns:
      Wrapped ItemStack
    • wrap

      @NotNull public static @NotNull McItemStack wrap(@NotNull ItemStack bukkitItemStack)
      Wrap a Bukkit ItemStack to use easy to use methods
      Parameters:
      bukkitItemStack - Bukkit ItemStack to wrap
      Returns:
      Wrapped ItemStack
    • empty

      @NotNull public static @NotNull McItemStack empty()
      Get an empty ItemStack wrapped
      Returns:
      Wrapped empty ItemStack
    • getItemStack

      public net.minecraft.world.item.ItemStack getItemStack()
      Get Minecraft ItemStack of this wrapper
      Returns:
      ItemStack
    • getItemWrapper

      public McItem getItemWrapper()
      Get a wrapped version of the Item of this ItemStack
      Returns:
      Wrapped Item
    • getItem

      public net.minecraft.world.item.Item getItem()
      Get the Item of this ItemStack
      Returns:
      Item of this ItemStack
    • getDestroySpeed

      public float getDestroySpeed(Block bukkitBlock)
      Get the destroy speed of this item based on a specific Block
      Parameters:
      bukkitBlock - Block to test for speed
      Returns:
      Speed based on block
    • isDamageableItem

      public boolean isDamageableItem()
      Check if ItemStack is a damageable item
      Returns:
      True if damageable else false
    • getAsBukkitMirror

      public ItemStack getAsBukkitMirror()
      Get as a mirrored Bukkit ItemStack
      Returns:
      Mirrored Bukkit ItemStack
    • getAsBukkitCopy

      public ItemStack getAsBukkitCopy()
      Get as a copied Bukkit ItemStack
      Returns:
      Copied Bukkit ItemStack
    • getTooltipLinesAsStrings

      public List<String> getTooltipLinesAsStrings(Player player, boolean advanced)
      Get the lines of an ItemStack's tooltips as strings
      Parameters:
      player - Player holding Item
      advanced - Whether to show advanced tooltips or not
      Returns:
      List of strings for tooltips
    • getTooltipLines

      public List<net.kyori.adventure.text.Component> getTooltipLines(Player player, boolean advanced)
      Get the lines of an ItemStack's tooltips as Components
      Parameters:
      player - Player holding Item
      advanced - Whether to show advanced tooltips or not
      Returns:
      List of Components for tooltips