Class AccessoryItem

java.lang.Object
net.minecraft.world.item.Item
tech.anonymoushacker1279.immersiveweapons.item.AccessoryItem
All Implemented Interfaces:
net.minecraft.world.flag.FeatureElement, net.minecraft.world.level.ItemLike, net.neoforged.neoforge.common.extensions.IItemExtension

public class AccessoryItem extends net.minecraft.world.item.Item
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
    An enum of accessory slots.
    static class 
    Builder for creating effects.
    static enum 
    An enum of accessory effects.

    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
    AccessoryItem(net.minecraft.world.item.Item.Properties properties, AccessoryItem.AccessorySlot slot, AccessoryItem.EffectBuilder effectBuilder)
    AccessoryItems provide various effects when equipped.
  • Method Summary

    Modifier and Type
    Method
    Description
    Map<Map<net.minecraft.world.entity.ai.attributes.AttributeModifier,net.minecraft.world.entity.ai.attributes.Attribute>,Double>
     
     
     
    static Map<net.minecraft.world.entity.ai.attributes.AttributeModifier,net.minecraft.world.entity.ai.attributes.Attribute>
    The global attribute modifier map contains all standard and dynamic modifiers for all registered accessories.
    List<net.minecraft.world.effect.MobEffectInstance>
     
     
    Map<net.minecraft.world.entity.ai.attributes.AttributeModifier,net.minecraft.world.entity.ai.attributes.Attribute>
     
    static boolean
    isAccessoryActive(net.minecraft.world.entity.player.Player player, AccessoryItem item)
    Check if the specified accessory is active for the player.
    boolean
    isActive(net.minecraft.world.entity.player.Player player)
    Check if this accessory is active.
    boolean
    isActive(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack stack)
    Check if this accessory is active.

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

    appendHoverText, 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.neoforged.neoforge.common.extensions.IItemExtension

    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, onItemUseFirst, onLeftClickEntity, onStopUsing, readShareTag, setDamage, shouldCauseBlockBreakReset, shouldCauseReequipAnimation
  • Constructor Details

    • AccessoryItem

      public AccessoryItem(net.minecraft.world.item.Item.Properties properties, AccessoryItem.AccessorySlot slot, AccessoryItem.EffectBuilder effectBuilder)
      AccessoryItems provide various effects when equipped. There are specific categories they may be placed in, and only one item from each category may be active at a time.
      Parameters:
      properties - the Properties for the item
      slot - the AccessorySlot the item belongs to
      effectBuilder - the EffectBuilder for the item
  • Method Details

    • getSlot

      public AccessoryItem.AccessorySlot getSlot()
    • getEffects

      public Map<AccessoryItem.EffectType,Double> getEffects()
    • getEffectScalingType

      public AccessoryItem.EffectBuilder.EffectScalingType getEffectScalingType()
    • getStandardAttributeModifiers

      public Map<net.minecraft.world.entity.ai.attributes.AttributeModifier,net.minecraft.world.entity.ai.attributes.Attribute> getStandardAttributeModifiers()
    • getDynamicAttributeModifiers

      public Map<Map<net.minecraft.world.entity.ai.attributes.AttributeModifier,net.minecraft.world.entity.ai.attributes.Attribute>,Double> getDynamicAttributeModifiers()
    • getMobEffects

      public List<net.minecraft.world.effect.MobEffectInstance> getMobEffects()
    • getGlobalAttributeModifierMap

      public static Map<net.minecraft.world.entity.ai.attributes.AttributeModifier,net.minecraft.world.entity.ai.attributes.Attribute> getGlobalAttributeModifierMap()
      The global attribute modifier map contains all standard and dynamic modifiers for all registered accessories.
      Returns:
      the global attribute modifier map
    • isActive

      public boolean isActive(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack stack)
      Check if this accessory is active. This should be used for effects that can stack, because it will ensure only one accessory of its type is active at a time. For non-stacking effects, isActive(Player) can be used.
      Parameters:
      player - the Player to check
      stack - the ItemStack of the accessory
      Returns:
      true if the accessory is active, false otherwise
    • isActive

      public boolean isActive(net.minecraft.world.entity.player.Player player)
      Check if this accessory is active. Note, this is not the same as isActive(Player, ItemStack). It is not sensitive with multiple of the same accessory in the player's inventory.
      Parameters:
      player - the Player to check
      Returns:
      true if the accessory is active, false otherwise
    • isAccessoryActive

      public static boolean isAccessoryActive(net.minecraft.world.entity.player.Player player, AccessoryItem item)
      Check if the specified accessory is active for the player. By default, this refers back to isActive(Player). If IWCB is installed and the Curios plugin is registered, it will defer to IWCB.
      Parameters:
      player - the Player to check
      item - the AccessoryItem to check
      Returns:
      true if the accessory is active, false otherwise