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

public class McItem extends Object
Wrapper for Minecraft Item

Provides easy-to-use mapped methods for Items

  • Method Details

    • wrap

      public static McItem wrap(net.minecraft.world.item.Item item)
      Wrap an Item for easy to use methods
      Parameters:
      item - Item to wrap
      Returns:
      Wrapped item
    • getItem

      public net.minecraft.world.item.Item getItem()
      Get the Minecraft Item of this wrapper
      Returns:
      Minecraft Item
    • getTier

      @Nullable public @Nullable McTier getTier()
      Get the Tier from a Tiered Item
      Returns:
      Tier of Item
    • isEdible

      public boolean isEdible()
      Check if this item is edible
      Returns:
      whether this item is edible
    • canAlwaysEat

      public boolean canAlwaysEat()
      Check if this item can always be eaten
      Returns:
      True if can always eat else false
    • getNutrition

      public int getNutrition()
      Get the nutrition if this is a food item
      Returns:
      Nutrition if food item else 0
    • getSaturationModifier

      public float getSaturationModifier()
      Get the saturation modifier if this is a food item
      Returns:
      Saturation modifier if food item else 0
    • isMeat

      public boolean isMeat()
      Check if this item is a meat product
      Returns:
      True if meat product else false
    • isFastFood

      public boolean isFastFood()
      Check if this item can be instantly eaten
      Returns:
      True if can instantly eat else false
    • isFireResistant

      public boolean isFireResistant()
      Check if this item is fire-resistant
      Returns:
      True if fire-resistant else false
    • isComplex

      public boolean isComplex()
      Check if Item is complex
      Returns:
      True if complex else false
    • getDamage

      public float getDamage()
      Get the damage amount of this item

      Only works on Sword and Digger (axe, hoe, pickaxe, shovel) items

      Returns:
      Damage amount if applicable else 0
    • getRarity

      public McItem.Rarity getRarity(@Nullable @Nullable net.minecraft.world.item.ItemStack itemStack)
      Get the Rarity of an Item

      Rarity returns different if the ItemStack is enchanted. If you leave the ItemStack null, it may not give you the correct result.

      Parameters:
      itemStack - ItemStack to check against (enchantments matter) (can be null)
      Returns:
      Rarity of item