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 ClassesModifier and TypeClassDescriptionstatic enumAn enum of accessory slots.static classBuilder for creating effects.static enumAn 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_SIZEFields inherited from interface net.minecraft.world.flag.FeatureElement
FILTERED_REGISTRIES -
Constructor Summary
ConstructorsConstructorDescriptionAccessoryItem(net.minecraft.world.item.Item.Properties properties, AccessoryItem.AccessorySlot slot, AccessoryItem.EffectBuilder effectBuilder) AccessoryItems provide various effects when equipped. -
Method Summary
Modifier and TypeMethodDescriptionMap<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>getSlot()Map<net.minecraft.world.entity.ai.attributes.AttributeModifier,net.minecraft.world.entity.ai.attributes.Attribute> static booleanisAccessoryActive(net.minecraft.world.entity.player.Player player, AccessoryItem item) Check if the specified accessory is active for the player.booleanisActive(net.minecraft.world.entity.player.Player player) Check if this accessory is active.booleanisActive(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, 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.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- thePropertiesfor the itemslot- theAccessorySlotthe item belongs toeffectBuilder- theEffectBuilderfor the item
-
-
Method Details
-
getSlot
-
getEffects
-
getEffectScalingType
-
getStandardAttributeModifiers
public Map<net.minecraft.world.entity.ai.attributes.AttributeModifier,net.minecraft.world.entity.ai.attributes.Attribute> getStandardAttributeModifiers() -
getDynamicAttributeModifiers
-
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- thePlayerto checkstack- theItemStackof 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 asisActive(Player, ItemStack). It is not sensitive with multiple of the same accessory in the player's inventory.- Parameters:
player- thePlayerto 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 toisActive(Player). If IWCB is installed and the Curios plugin is registered, it will defer to IWCB.- Parameters:
player- thePlayerto checkitem- theAccessoryItemto check- Returns:
- true if the accessory is active, false otherwise
-