Package com.binaris.wizardry.cca.stack
Class ImbuementEnchantDataHolder
java.lang.Object
dev.onyxstudios.cca.api.v3.item.ItemComponent
com.binaris.wizardry.cca.stack.ImbuementEnchantDataHolder
- All Implemented Interfaces:
ImbuementEnchantData,dev.onyxstudios.cca.api.v3.component.Component,dev.onyxstudios.cca.api.v3.item.ItemTagInvalidationListener
public class ImbuementEnchantDataHolder
extends dev.onyxstudios.cca.api.v3.item.ItemComponent
implements ImbuementEnchantData
-
Field Summary
Fields inherited from class dev.onyxstudios.cca.api.v3.item.ItemComponent
stack -
Constructor Summary
Constructors -
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.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.Methods inherited from class dev.onyxstudios.cca.api.v3.item.ItemComponent
equals, getBoolean, getCompound, getDouble, getFloat, getInt, getKeys, getList, getList, getLong, getOrCreateRootTag, getRootTag, getRootTagKey, getString, getTag, getTag, getTag, getUuid, hashCode, hasTag, hasTag, hasTag, onTagInvalidated, putBoolean, putCompound, putDouble, putFloat, putInt, putList, putLong, putString, putUuid, readFromNbt, remove, wrapFactory, writeToNbtMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.binaris.wizardry.api.content.data.ImbuementEnchantData
getRemainingTime
-
Constructor Details
-
ImbuementEnchantDataHolder
public ImbuementEnchantDataHolder(net.minecraft.world.item.ItemStack stack)
-
-
Method Details
-
addImbuement
public void addImbuement(net.minecraft.world.item.enchantment.Enchantment enchant, long expireTime) Description copied from interface:ImbuementEnchantDataAdds a temporary enchantment with expiration time. This only adds tracking; the actual enchantment should be applied to the item separately.- Specified by:
addImbuementin interfaceImbuementEnchantData- Parameters:
enchant- the Enchantment to track as temporaryexpireTime- the absolute game time when this enchantment expires
-
getImbuements
Description copied from interface:ImbuementEnchantDataGets all temporary enchantments and their expiration times. Returns a map of enchantment location -> expiration time- Specified by:
getImbuementsin interfaceImbuementEnchantData- Returns:
- map of enchantment ResourceLocations to expiration times
-
removeImbuement
public void removeImbuement(net.minecraft.world.item.enchantment.Enchantment enchant) Description copied from interface:ImbuementEnchantDataRemoves a temporary enchantment from tracking.- Specified by:
removeImbuementin interfaceImbuementEnchantData- Parameters:
enchant- the enchantment to remove
-
isImbuement
public boolean isImbuement(net.minecraft.world.item.enchantment.Enchantment enchant) Description copied from interface:ImbuementEnchantDataChecks if an enchantment is tracked as temporary.- Specified by:
isImbuementin interfaceImbuementEnchantData- Parameters:
enchant- the Enchantment to check- Returns:
- true if the enchantment is temporary
-
getExpirationTime
public long getExpirationTime(net.minecraft.world.item.enchantment.Enchantment enchantment) Description copied from interface:ImbuementEnchantDataGets the expiration time for a specific enchantment.- Specified by:
getExpirationTimein interfaceImbuementEnchantData- Parameters:
enchantment- the enchantment- Returns:
- the expiration time in game ticks, or -1 if not found
-