Class ArtifactItem

java.lang.Object
net.minecraft.world.item.Item
com.binaris.wizardry.api.content.item.ArtifactItem
All Implemented Interfaces:
net.minecraft.world.flag.FeatureElement, net.minecraft.world.level.ItemLike, net.minecraftforge.common.extensions.IForgeItem
Direct Known Subclasses:
AccessoriesArtifactItem, CuriosArtifactItem

public class ArtifactItem extends net.minecraft.world.item.Item
Base class for artifact items. Artifacts are special items that provide passive effects when being on the player's hotbar or in an accessory (check AccessoriesArtifactItem in the Accessories integration module).

Artifacts can have an associated IArtifactEffect which defines what effects they provide. These effects are triggered by various events, such as ticking, the player being hurt, or spell casting. Static methods are provided to handle these events and apply the effects of all equipped artifacts. These effects are optional; an artifact can be created without one.

See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    This is used for filtering only

    Nested classes/interfaces inherited from class net.minecraft.world.item.Item

    net.minecraft.world.item.Item.Properties
  • Field Summary

    Fields inherited from class net.minecraft.world.item.Item

    BASE_ATTACK_DAMAGE_UUID, BASE_ATTACK_SPEED_UUID, BY_BLOCK, canRepair, EAT_DURATION, MAX_BAR_WIDTH, MAX_STACK_SIZE

    Fields inherited from interface net.minecraft.world.flag.FeatureElement

    FILTERED_REGISTRIES
  • Constructor Summary

    Constructors
    Constructor
    Description
    ArtifactItem(net.minecraft.world.item.Rarity rarity)
     
    ArtifactItem(net.minecraft.world.item.Rarity rarity, @Nullable IArtifactEffect effect)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    appendHoverText(@NotNull net.minecraft.world.item.ItemStack stack, @Nullable net.minecraft.world.level.Level level, @NotNull List<net.minecraft.network.chat.Component> list, @NotNull net.minecraft.world.item.TooltipFlag isAdvanced)
     
    @Nullable IArtifactEffect
     
    static void
    Called when the player is responsible for hurting an entity (if player carries the artifact in their hotbar or accessories) to apply the artifact's effect.
    static void
    Called when the player is responsible for killing an entity (if player carries the artifact in their hotbar or accessories) to apply the artifact's effect.
    static void
    Called when the player is hurt (if player carries the artifact in their hotbar or accessories) to apply the artifact's effect.
    static void
    Called after a spell is cast (if player carries the artifact in their hotbar or accessories) to apply the artifact's effect.
    static void
    Called before a spell is cast (if player carries the artifact in their hotbar or accessories) to apply the artifact's effect.
    static void
    Called every tick (if player carries the artifact in their hotbar or accessories) to apply the artifact's effect.

    Methods inherited from class net.minecraft.world.item.Item

    asItem, builtInRegistryHolder, byBlock, byId, canAttackBlock, canBeDepleted, canBeHurtBy, canFitInsideContainerItems, finishUsingItem, getBarColor, getBarWidth, getCraftingRemainingItem, getDefaultAttributeModifiers, getDefaultInstance, getDescription, getDescriptionId, getDescriptionId, getDestroySpeed, getDrinkingSound, getEatingSound, getEnchantmentValue, getFoodProperties, getId, getMaxDamage, getMaxStackSize, getName, getOrCreateDescriptionId, getPlayerPOVHitResult, getRarity, getRenderPropertiesInternal, getTooltipImage, getUseAnimation, getUseDuration, hasCraftingRemainingItem, hurtEnemy, initializeClient, interactLivingEntity, inventoryTick, isBarVisible, isComplex, isCorrectToolForDrops, isEdible, isEnchantable, isFireResistant, isFoil, isRepairable, isValidRepairItem, mineBlock, onCraftedBy, onDestroyed, onUseTick, overrideOtherStackedOnMe, overrideStackedOnOther, releaseUsing, requiredFeatures, shouldOverrideMultiplayerNbt, toString, use, useOn, useOnRelease, verifyTagAfterLoad

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface net.minecraft.world.flag.FeatureElement

    isEnabled

    Methods inherited from interface net.minecraftforge.common.extensions.IForgeItem

    canApplyAtEnchantingTable, canContinueUsing, canDisableShield, canElytraFly, canEquip, canGrindstoneRepair, canPerformAction, canWalkOnPowderedSnow, createEntity, damageItem, doesSneakBypassUse, elytraFlightTick, getAllEnchantments, getArmorTexture, getAttributeModifiers, getBurnTime, getCraftingRemainingItem, getCreatorModId, getDamage, getDefaultTooltipHideFlags, getEnchantmentLevel, getEnchantmentValue, getEntityLifespan, getEquipmentSlot, getFoodProperties, getHighlightTip, getMaxDamage, getMaxStackSize, getShareTag, getSweepHitBox, getXpRepairRatio, hasCraftingRemainingItem, hasCustomEntity, initCapabilities, isBookEnchantable, isCorrectToolForDrops, isDamageable, isDamaged, isEnderMask, isNotReplaceableByPickAction, isPiglinCurrency, makesPiglinsNeutral, onArmorTick, onBlockStartBreak, onDestroyed, onDroppedByPlayer, onEntityItemUpdate, onEntitySwing, onHorseArmorTick, onInventoryTick, onItemUseFirst, onLeftClickEntity, onStopUsing, readShareTag, setDamage, shouldCauseBlockBreakReset, shouldCauseReequipAnimation
  • Constructor Details

    • ArtifactItem

      public ArtifactItem(net.minecraft.world.item.Rarity rarity)
    • ArtifactItem

      public ArtifactItem(net.minecraft.world.item.Rarity rarity, @Nullable @Nullable IArtifactEffect effect)
  • Method Details

    • onTick

      public static void onTick(EBLivingTick event)
      Called every tick (if player carries the artifact in their hotbar or accessories) to apply the artifact's effect. This method helps to check all equipped artifacts and call their respective effects onTick method, so we don't have to register each artifact individually.

      This event won't be calling artifacts that doesn't have any effect associated with them.

      Parameters:
      event - The living tick event.
    • onHurtEntity

      public static void onHurtEntity(EBLivingHurtEvent event)
      Called when the player is responsible for hurting an entity (if player carries the artifact in their hotbar or accessories) to apply the artifact's effect. This method helps to check all equipped artifacts and call their respective effects onHurtEntity method, so we don't have to register each artifact individually.

      This event won't be calling artifacts that doesn't have any effect associated with them.

      Parameters:
      event - The living hurt event.
    • onPlayerHurt

      public static void onPlayerHurt(EBLivingHurtEvent event)
      Called when the player is hurt (if player carries the artifact in their hotbar or accessories) to apply the artifact's effect. This method helps to check all equipped artifacts and call their respective effects onPlayerHurt method, so we don't have to register each artifact individually.

      This event won't be calling artifacts that don't have any effect associated with them.

      Parameters:
      event - The living hurt event.
    • onKillEntity

      public static void onKillEntity(EBLivingDeathEvent event)
      Called when the player is responsible for killing an entity (if player carries the artifact in their hotbar or accessories) to apply the artifact's effect.
    • onSpellPreCast

      public static void onSpellPreCast(SpellCastEvent.Pre event)
      Called before a spell is cast (if player carries the artifact in their hotbar or accessories) to apply the artifact's effect. This method helps to check all equipped artifacts and call their respective effects onSpellPreCast method, so we don't have to register each artifact individually.

      This event won't be calling artifacts that doesn't have any effect associated with them.

      Parameters:
      event - The spell cast pre-event.
    • onSpellPostCast

      public static void onSpellPostCast(SpellCastEvent.Post event)
      Called after a spell is cast (if player carries the artifact in their hotbar or accessories) to apply the artifact's effect. This method helps to check all equipped artifacts and call their respective effects onSpellPostCast method, so we don't have to register each artifact individually.

      This event won't be calling artifacts that don't have any effect associated with them.

      Parameters:
      event - The spell cast post-event.
    • appendHoverText

      public void appendHoverText(@NotNull @NotNull net.minecraft.world.item.ItemStack stack, @Nullable @Nullable net.minecraft.world.level.Level level, @NotNull @NotNull List<net.minecraft.network.chat.Component> list, @NotNull @NotNull net.minecraft.world.item.TooltipFlag isAdvanced)
      Overrides:
      appendHoverText in class net.minecraft.world.item.Item
    • getEffect

      @Nullable public @Nullable IArtifactEffect getEffect()