Class ArtifactItem
- All Implemented Interfaces:
net.minecraft.world.flag.FeatureElement,net.minecraft.world.level.ItemLike,net.minecraftforge.common.extensions.IForgeItem
- Direct Known Subclasses:
AccessoriesArtifactItem,CuriosArtifactItem
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 ClassesNested 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_SIZEFields inherited from interface net.minecraft.world.flag.FeatureElement
FILTERED_REGISTRIES -
Constructor Summary
ConstructorsConstructorDescriptionArtifactItem(net.minecraft.world.item.Rarity rarity) ArtifactItem(net.minecraft.world.item.Rarity rarity, @Nullable IArtifactEffect effect) -
Method Summary
Modifier and TypeMethodDescriptionvoidappendHoverText(@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 IArtifactEffectstatic voidonHurtEntity(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.static voidonKillEntity(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.static voidonPlayerHurt(EBLivingHurtEvent event) Called when the player is hurt (if player carries the artifact in their hotbar or accessories) to apply the artifact's effect.static voidCalled after a spell is cast (if player carries the artifact in their hotbar or accessories) to apply the artifact's effect.static voidonSpellPreCast(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.static voidonTick(EBLivingTick event) 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, verifyTagAfterLoadMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.world.flag.FeatureElement
isEnabledMethods 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
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 effectsonTickmethod, 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
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 effectsonHurtEntitymethod, 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
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 effectsonPlayerHurtmethod, 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
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
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 effectsonSpellPreCastmethod, 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
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 effectsonSpellPostCastmethod, 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:
appendHoverTextin classnet.minecraft.world.item.Item
-
getEffect
-