Class WizardArmorItem
java.lang.Object
net.minecraft.world.item.Item
net.minecraft.world.item.ArmorItem
com.binaris.wizardry.content.item.armor.WizardArmorItem
- All Implemented Interfaces:
ICustomAttributesItem,ICustomDamageItem,IElementValue,IManaItem,IWorkbenchItem,net.fabricmc.fabric.api.item.v1.FabricItem,net.minecraft.world.flag.FeatureElement,net.minecraft.world.item.Equipable,net.minecraft.world.item.Vanishable,net.minecraft.world.level.ItemLike
- Direct Known Subclasses:
BattleMageArmorItem,SageArmorItem,WarlockArmorItem
public class WizardArmorItem
extends net.minecraft.world.item.ArmorItem
implements IManaItem, ICustomDamageItem, IWorkbenchItem, IElementValue, ICustomAttributesItem
Base class for all wizard armor items in Electroblob's Wizardry Redux.
This provides the mana storage, full armor checking and helper methods to apply new SpellModifiers and set
bonuses depending on your armor type. Subclasses of this class will have the deletion of the entity attributes (Protection),
spell modifiers and full set bonus if mana is 0 in any of the armor pieces.
To create a new armor via addon, extend this class and override the relevant hooks:
effectTick(net.minecraft.world.item.ItemStack, net.minecraft.world.entity.LivingEntity, net.minecraft.world.level.Level)— passive effect applied every tick when wearing the full setapplyModifiers(net.minecraft.world.entity.LivingEntity, com.binaris.wizardry.api.content.spell.internal.SpellModifiers, com.binaris.wizardry.content.item.armor.WizardArmorItem, com.binaris.wizardry.api.content.spell.Spell)— spell modifiers applied when wearing the full setappendHoverText(net.minecraft.world.item.ItemStack, net.minecraft.world.level.Level, java.util.List<net.minecraft.network.chat.Component>, net.minecraft.world.item.TooltipFlag)- tooltip lines shown for the item
-
Nested Class Summary
Nested classes/interfaces inherited from class net.minecraft.world.item.ArmorItem
net.minecraft.world.item.ArmorItem.TypeNested 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.ArmorItem
DISPENSE_ITEM_BEHAVIOR, knockbackResistance, material, typeFields inherited from class net.minecraft.world.item.Item
BASE_ATTACK_DAMAGE_UUID, BASE_ATTACK_SPEED_UUID, BY_BLOCK, EAT_DURATION, MAX_BAR_WIDTH, MAX_STACK_SIZEFields inherited from interface net.minecraft.world.flag.FeatureElement
FILTERED_REGISTRIES -
Constructor Summary
ConstructorsConstructorDescriptionWizardArmorItem(WizardArmorType material, net.minecraft.world.item.ArmorItem.Type type, Element element) WizardArmorItem(net.minecraft.world.item.ArmorItem.Type type, Element element) -
Method Summary
Modifier and TypeMethodDescriptionvoidappendHoverText(@NotNull net.minecraft.world.item.ItemStack stack, net.minecraft.world.level.Level world, @NotNull List<net.minecraft.network.chat.Component> tooltip, @NotNull net.minecraft.world.item.TooltipFlag advanced) voidapplyModifiers(net.minecraft.world.entity.LivingEntity entity, SpellModifiers modifiers, WizardArmorItem armor, Spell spell) Hook for applying additionalSpellModifierswhen the caster is wearing the full armor set with mana.net.minecraft.world.item.ItemStackapplyUpgrade(@Nullable net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack stack, net.minecraft.world.item.ItemStack upgrade) booleancanBreak(net.minecraft.world.item.ItemStack stack) used to control whether the item can be broken or if it should stay at 0 durabilitystatic voidcollectArmorModifiers(net.minecraft.world.entity.player.Player caster, Spell spell, SpellModifiers out) voideffectTick(net.minecraft.world.item.ItemStack stack, net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.level.Level level) Called everyinventoryTickwhen the entity is wearing the full armor set and all pieces have mana.intgetBarColor(@NotNull net.minecraft.world.item.ItemStack stack) com.google.common.collect.Multimap<net.minecraft.world.entity.ai.attributes.Attribute,net.minecraft.world.entity.ai.attributes.AttributeModifier> getCustomAttributes(net.minecraft.world.item.ItemStack stack, net.minecraft.world.entity.EquipmentSlot slot) Gets the element associated with this item.intgetMana(net.minecraft.world.item.ItemStack stack) intgetManaCapacity(net.minecraft.world.item.ItemStack stack) @NotNull net.minecraft.network.chat.ComponentgetName(@NotNull net.minecraft.world.item.ItemStack stack) intgetSpellSlotCount(net.minecraft.world.item.ItemStack stack) voidinventoryTick(@NotNull net.minecraft.world.item.ItemStack stack, @NotNull net.minecraft.world.level.Level level, @NotNull net.minecraft.world.entity.Entity entity, int slotId, boolean isSelected) booleanisValidRepairItem(@NotNull net.minecraft.world.item.ItemStack toRepair, @NotNull net.minecraft.world.item.ItemStack repair) booleanonApplyButtonPressed(net.minecraft.world.entity.player.Player player, net.minecraft.world.inventory.Slot centre, net.minecraft.world.inventory.Slot crystals, net.minecraft.world.inventory.Slot upgrade, net.minecraft.world.inventory.Slot[] spellBooks) static voidonSpellPreCast(SpellCastEvent.Pre event) voidsetCustomDamage(net.minecraft.world.item.ItemStack stack, int damage) exposing a new way to control when and how damage is setvoidsetMana(net.minecraft.world.item.ItemStack stack, int mana) booleanshowTooltip(net.minecraft.world.item.ItemStack stack) booleanDetermines if this item is valid for use in a receptacle.Methods inherited from class net.minecraft.world.item.ArmorItem
dispenseArmor, getDefaultAttributeModifiers, getDefense, getEnchantmentValue, getEquipmentSlot, getEquipSound, getMaterial, getToughness, getType, useMethods inherited from class net.minecraft.world.item.Item
asItem, builtInRegistryHolder, byBlock, byId, canAttackBlock, canBeDepleted, canBeHurtBy, canFitInsideContainerItems, finishUsingItem, getBarWidth, getCraftingRemainingItem, getDefaultInstance, getDescription, getDescriptionId, getDescriptionId, getDestroySpeed, getDrinkingSound, getEatingSound, getFoodProperties, getId, getMaxDamage, getMaxStackSize, getOrCreateDescriptionId, getPlayerPOVHitResult, getRarity, getTooltipImage, getUseAnimation, getUseDuration, hasCraftingRemainingItem, hurtEnemy, interactLivingEntity, isBarVisible, isComplex, isCorrectToolForDrops, isEdible, isEnchantable, isFireResistant, isFoil, mineBlock, onCraftedBy, onDestroyed, onUseTick, overrideOtherStackedOnMe, overrideStackedOnOther, releaseUsing, requiredFeatures, shouldOverrideMultiplayerNbt, toString, 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.item.Equipable
swapWithEquipmentSlotMethods inherited from interface net.fabricmc.fabric.api.item.v1.FabricItem
allowContinuingBlockBreaking, allowNbtUpdateAnimation, getAttributeModifiers, getRecipeRemainder, isSuitableForMethods inherited from interface net.minecraft.world.flag.FeatureElement
isEnabledMethods inherited from interface com.binaris.wizardry.api.content.item.ICustomDamageItem
getCustomMaxDamageMethods inherited from interface com.binaris.wizardry.api.content.item.IManaItem
consumeMana, getFullness, isManaEmpty, isManaFull, rechargeMana, showManaInWorkbenchMethods inherited from interface com.binaris.wizardry.api.content.item.IWorkbenchItem
canPlace, isClearable, onClearButtonPressed
-
Constructor Details
-
WizardArmorItem
public WizardArmorItem(WizardArmorType material, net.minecraft.world.item.ArmorItem.Type type, Element element) -
WizardArmorItem
-
-
Method Details
-
effectTick
public void effectTick(net.minecraft.world.item.ItemStack stack, net.minecraft.world.entity.LivingEntity entity, net.minecraft.world.level.Level level) Called everyinventoryTickwhen the entity is wearing the full armor set and all pieces have mana. In case you want to apply a specific effect without the full set check overrideinventoryTickinstead.- Parameters:
stack- the armor item stackentity- the entity wearing the armorlevel- the current level (world)
-
applyModifiers
public void applyModifiers(net.minecraft.world.entity.LivingEntity entity, SpellModifiers modifiers, WizardArmorItem armor, Spell spell) Hook for applying additionalSpellModifierswhen the caster is wearing the full armor set with mana. Called fromapplySpellModifiers(net.minecraft.world.entity.LivingEntity, com.binaris.wizardry.content.item.armor.WizardArmorItem, com.binaris.wizardry.api.content.spell.Spell, com.binaris.wizardry.api.content.spell.internal.SpellModifiers)after base modifiers (elemental cost reduction, cooldown reduction) have already been applied.- Parameters:
entity- the entity casting the spellmodifiers- the modifiers being built, modify this in placearmor- the specific armor piece triggering this callspell- the spell being cast
-
appendHoverText
public void appendHoverText(@NotNull @NotNull net.minecraft.world.item.ItemStack stack, net.minecraft.world.level.Level world, @NotNull @NotNull List<net.minecraft.network.chat.Component> tooltip, @NotNull @NotNull net.minecraft.world.item.TooltipFlag advanced) - Overrides:
appendHoverTextin classnet.minecraft.world.item.Item
-
inventoryTick
public void inventoryTick(@NotNull @NotNull net.minecraft.world.item.ItemStack stack, @NotNull @NotNull net.minecraft.world.level.Level level, @NotNull @NotNull net.minecraft.world.entity.Entity entity, int slotId, boolean isSelected) - Overrides:
inventoryTickin classnet.minecraft.world.item.Item
-
onSpellPreCast
-
collectArmorModifiers
public static void collectArmorModifiers(net.minecraft.world.entity.player.Player caster, Spell spell, SpellModifiers out) -
applyUpgrade
public net.minecraft.world.item.ItemStack applyUpgrade(@Nullable @Nullable net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack stack, net.minecraft.world.item.ItemStack upgrade) - Specified by:
applyUpgradein interfaceIWorkbenchItem
-
onApplyButtonPressed
public boolean onApplyButtonPressed(net.minecraft.world.entity.player.Player player, net.minecraft.world.inventory.Slot centre, net.minecraft.world.inventory.Slot crystals, net.minecraft.world.inventory.Slot upgrade, net.minecraft.world.inventory.Slot[] spellBooks) - Specified by:
onApplyButtonPressedin interfaceIWorkbenchItem
-
setCustomDamage
public void setCustomDamage(net.minecraft.world.item.ItemStack stack, int damage) Description copied from interface:ICustomDamageItemexposing a new way to control when and how damage is set- Specified by:
setCustomDamagein interfaceICustomDamageItem
-
canBreak
public boolean canBreak(net.minecraft.world.item.ItemStack stack) Description copied from interface:ICustomDamageItemused to control whether the item can be broken or if it should stay at 0 durability- Specified by:
canBreakin interfaceICustomDamageItem
-
getName
@NotNull public @NotNull net.minecraft.network.chat.Component getName(@NotNull @NotNull net.minecraft.world.item.ItemStack stack) - Overrides:
getNamein classnet.minecraft.world.item.Item
-
getWizardArmorType
-
getElement
Description copied from interface:IElementValueGets the element associated with this item.- Specified by:
getElementin interfaceIElementValue- Returns:
- The element of the item.
-
validForReceptacle
public boolean validForReceptacle()Description copied from interface:IElementValueDetermines if this item is valid for use in a receptacle.- Specified by:
validForReceptaclein interfaceIElementValue- Returns:
- true if the item can be used in a receptacle, false otherwise.
-
getBarColor
public int getBarColor(@NotNull @NotNull net.minecraft.world.item.ItemStack stack) - Overrides:
getBarColorin classnet.minecraft.world.item.Item
-
getMana
public int getMana(net.minecraft.world.item.ItemStack stack) -
setMana
public void setMana(net.minecraft.world.item.ItemStack stack, int mana) -
getManaCapacity
public int getManaCapacity(net.minecraft.world.item.ItemStack stack) - Specified by:
getManaCapacityin interfaceIManaItem
-
getSpellSlotCount
public int getSpellSlotCount(net.minecraft.world.item.ItemStack stack) - Specified by:
getSpellSlotCountin interfaceIWorkbenchItem
-
showTooltip
public boolean showTooltip(net.minecraft.world.item.ItemStack stack) - Specified by:
showTooltipin interfaceIWorkbenchItem
-
isValidRepairItem
public boolean isValidRepairItem(@NotNull @NotNull net.minecraft.world.item.ItemStack toRepair, @NotNull @NotNull net.minecraft.world.item.ItemStack repair) - Overrides:
isValidRepairItemin classnet.minecraft.world.item.ArmorItem
-
getCustomAttributes
public com.google.common.collect.Multimap<net.minecraft.world.entity.ai.attributes.Attribute,net.minecraft.world.entity.ai.attributes.AttributeModifier> getCustomAttributes(net.minecraft.world.item.ItemStack stack, net.minecraft.world.entity.EquipmentSlot slot) - Specified by:
getCustomAttributesin interfaceICustomAttributesItem
-