Class McItem
java.lang.Object
com.shanebeestudios.nms.api.world.item.McItem
Wrapper for Minecraft Item
Provides easy-to-use mapped methods for Items
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck if this item can always be eatenfloatGet the damage amount of this itemnet.minecraft.world.item.ItemgetItem()Get the Minecraft Item of this wrapperintGet the nutrition if this is a food itemgetRarity(@Nullable net.minecraft.world.item.ItemStack itemStack) Get the Rarity of an ItemfloatGet the saturation modifier if this is a food item@Nullable McTiergetTier()Get theTierfrom a Tiered ItembooleanCheck if Item is complexbooleanisEdible()Check if this item is ediblebooleanCheck if this item can be instantly eatenbooleanCheck if this item is fire-resistantbooleanisMeat()Check if this item is a meat productstatic McItemwrap(net.minecraft.world.item.Item item) Wrap an Item for easy to use methods
-
Method Details
-
wrap
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
Get theTierfrom 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 itemOnly works on Sword and Digger (axe, hoe, pickaxe, shovel) items
- Returns:
- Damage amount if applicable else 0
-
getRarity
Get the Rarity of an ItemRarity 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
-