Interface ImbuementEnchantData

All Known Implementing Classes:
ImbuementEnchantDataHolder

public interface ImbuementEnchantData
Interface for tracking temporary enchantments on items, such as those applied by imbuement spells.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addImbuement(net.minecraft.world.item.enchantment.Enchantment enchant, long expireTime)
    Adds a temporary enchantment with expiration time.
    long
    getExpirationTime(net.minecraft.world.item.enchantment.Enchantment enchantment)
    Gets the expiration time for a specific enchantment.
    Map<net.minecraft.resources.ResourceLocation,Long>
    Gets all temporary enchantments and their expiration times.
    default int
    getRemainingTime(net.minecraft.world.item.enchantment.Enchantment enchantment, long currentGameTime)
    Gets the remaining time for an enchantment in ticks.
    boolean
    isImbuement(net.minecraft.world.item.enchantment.Enchantment enchant)
    Checks if an enchantment is tracked as temporary.
    void
    removeImbuement(net.minecraft.world.item.enchantment.Enchantment enchant)
    Removes a temporary enchantment from tracking.
  • Method Details

    • addImbuement

      void addImbuement(net.minecraft.world.item.enchantment.Enchantment enchant, long expireTime)
      Adds a temporary enchantment with expiration time. This only adds tracking; the actual enchantment should be applied to the item separately.
      Parameters:
      enchant - the Enchantment to track as temporary
      expireTime - the absolute game time when this enchantment expires
    • getImbuements

      Map<net.minecraft.resources.ResourceLocation,Long> getImbuements()
      Gets all temporary enchantments and their expiration times. Returns a map of enchantment location -> expiration time
      Returns:
      map of enchantment ResourceLocations to expiration times
    • removeImbuement

      void removeImbuement(net.minecraft.world.item.enchantment.Enchantment enchant)
      Removes a temporary enchantment from tracking.
      Parameters:
      enchant - the enchantment to remove
    • isImbuement

      boolean isImbuement(net.minecraft.world.item.enchantment.Enchantment enchant)
      Checks if an enchantment is tracked as temporary.
      Parameters:
      enchant - the Enchantment to check
      Returns:
      true if the enchantment is temporary
    • getExpirationTime

      long getExpirationTime(net.minecraft.world.item.enchantment.Enchantment enchantment)
      Gets the expiration time for a specific enchantment.
      Parameters:
      enchantment - the enchantment
      Returns:
      the expiration time in game ticks, or -1 if not found
    • getRemainingTime

      default int getRemainingTime(net.minecraft.world.item.enchantment.Enchantment enchantment, long currentGameTime)
      Gets the remaining time for an enchantment in ticks.
      Parameters:
      enchantment - the enchantment
      currentGameTime - the current game time
      Returns:
      remaining ticks, or 0 if expired/not found