Package net.fabricmc.fabric.api.item.v1
Interface FabricItemStack
public interface FabricItemStack
Fabric-provided extensions for
ItemStack
.
This interface is automatically implemented on all item stacks via Mixin and interface injection.-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
canBeEnchantedWith
(RegistryEntry<Enchantment> enchantment, EnchantingContext context) Determines whether thisItemStack
can be enchanted with the givenEnchantment
.default ItemStack
Return a leftover item for use in recipes.
-
Method Details
-
getRecipeRemainder
Return a leftover item for use in recipes.See
FabricItem.getRecipeRemainder(ItemStack)
for a more in depth description.Stack-aware version of
Item.getRecipeRemainder()
.- Returns:
- the leftover item
-
canBeEnchantedWith
default boolean canBeEnchantedWith(RegistryEntry<Enchantment> enchantment, EnchantingContext context) Determines whether thisItemStack
can be enchanted with the givenEnchantment
.When checking whether an enchantment can be applied to an
ItemStack
, use this method instead ofEnchantment.isAcceptableItem(ItemStack)
orEnchantment.isPrimaryItem(ItemStack)
, with the appropriateEnchantingContext
.- Parameters:
enchantment
- the enchantment to checkcontext
- the context in which the enchantment is being checked- Returns:
- whether the enchantment is allowed to apply to the stack
- See Also:
-