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 TypeMethodDescriptionvoidaddImbuement(net.minecraft.world.item.enchantment.Enchantment enchant, long expireTime) Adds a temporary enchantment with expiration time.longgetExpirationTime(net.minecraft.world.item.enchantment.Enchantment enchantment) Gets the expiration time for a specific enchantment.Gets all temporary enchantments and their expiration times.default intgetRemainingTime(net.minecraft.world.item.enchantment.Enchantment enchantment, long currentGameTime) Gets the remaining time for an enchantment in ticks.booleanisImbuement(net.minecraft.world.item.enchantment.Enchantment enchant) Checks if an enchantment is tracked as temporary.voidremoveImbuement(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 temporaryexpireTime- the absolute game time when this enchantment expires
-
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 enchantmentcurrentGameTime- the current game time- Returns:
- remaining ticks, or 0 if expired/not found
-