public interface DynamicAttributeTool
Modifier and Type | Field and Description |
---|---|
static Multimap<net.minecraft.entity.attribute.EntityAttribute,net.minecraft.entity.attribute.EntityAttributeModifier> |
EMPTY |
Modifier and Type | Method and Description |
---|---|
default Multimap<net.minecraft.entity.attribute.EntityAttribute,net.minecraft.entity.attribute.EntityAttributeModifier> |
getDynamicModifiers(net.minecraft.entity.EquipmentSlot slot,
net.minecraft.item.ItemStack stack,
@Nullable net.minecraft.entity.LivingEntity user)
Add modifiers for any
EntityAttributes your item should give when equipped, based on the stack. |
default int |
getMiningLevel(net.minecraft.item.ItemStack stack,
@Nullable net.minecraft.entity.LivingEntity user)
Deprecated.
Use
getMiningLevel(Tag, BlockState, ItemStack, LivingEntity) to detect tag and block. |
default int |
getMiningLevel(net.minecraft.tag.Tag<net.minecraft.item.Item> tag,
net.minecraft.block.BlockState state,
net.minecraft.item.ItemStack stack,
@Nullable net.minecraft.entity.LivingEntity user)
Determines the mining level of the passed stack, which is used for calculating what blocks this tool is allowed to break.
|
default float |
getMiningSpeedMultiplier(net.minecraft.item.ItemStack stack,
@Nullable net.minecraft.entity.LivingEntity user)
Deprecated.
Use
getMiningSpeedMultiplier(Tag, BlockState, ItemStack, LivingEntity) to detect tag and block. |
default float |
getMiningSpeedMultiplier(net.minecraft.tag.Tag<net.minecraft.item.Item> tag,
net.minecraft.block.BlockState state,
net.minecraft.item.ItemStack stack,
@Nullable net.minecraft.entity.LivingEntity user)
Determines the mining speed multiplier of the passed stack, which is one factor in overall mining speed.
|
default float |
postProcessMiningSpeed(net.minecraft.tag.Tag<net.minecraft.item.Item> tag,
net.minecraft.block.BlockState state,
net.minecraft.item.ItemStack stack,
@Nullable net.minecraft.entity.LivingEntity user,
float currentSpeed,
boolean isEffective)
Post process the mining speed, this takes place after the mining speed has been calculated.
|
static final Multimap<net.minecraft.entity.attribute.EntityAttribute,net.minecraft.entity.attribute.EntityAttributeModifier> EMPTY
@Deprecated default int getMiningLevel(net.minecraft.item.ItemStack stack, @Nullable @Nullable net.minecraft.entity.LivingEntity user)
getMiningLevel(Tag, BlockState, ItemStack, LivingEntity)
to detect tag and block.stack
- The item stack being used to mine the blockuser
- The current user of the tool, or null if there isn't anydefault int getMiningLevel(net.minecraft.tag.Tag<net.minecraft.item.Item> tag, net.minecraft.block.BlockState state, net.minecraft.item.ItemStack stack, @Nullable @Nullable net.minecraft.entity.LivingEntity user)
tag
- The tool tag the item stack is being compared tostate
- The block to minestack
- The item stack being used to mine the blockuser
- The current user of the tool, or null if there isn't any@Deprecated default float getMiningSpeedMultiplier(net.minecraft.item.ItemStack stack, @Nullable @Nullable net.minecraft.entity.LivingEntity user)
getMiningSpeedMultiplier(Tag, BlockState, ItemStack, LivingEntity)
to detect tag and block.stack
- The item stack being used to mine the blockuser
- The current user of the tool, or null if there isn't anydefault float getMiningSpeedMultiplier(net.minecraft.tag.Tag<net.minecraft.item.Item> tag, net.minecraft.block.BlockState state, net.minecraft.item.ItemStack stack, @Nullable @Nullable net.minecraft.entity.LivingEntity user)
tag
- The tool tag the item stack is being compared tostate
- The block to minestack
- The item stack being used to mine the blockuser
- The current user of the tool, or null if there isn't anydefault float postProcessMiningSpeed(net.minecraft.tag.Tag<net.minecraft.item.Item> tag, net.minecraft.block.BlockState state, net.minecraft.item.ItemStack stack, @Nullable @Nullable net.minecraft.entity.LivingEntity user, float currentSpeed, boolean isEffective)
This allows bypassing the regular computation formula.
tag
- The tool tag the item stack is handled bystate
- The block to minestack
- The item stack being used to mine the blockuser
- The current user of the tool, or null if there isn't anycurrentSpeed
- The mining speed before post processisEffective
- whether the tool has been handleddefault Multimap<net.minecraft.entity.attribute.EntityAttribute,net.minecraft.entity.attribute.EntityAttributeModifier> getDynamicModifiers(net.minecraft.entity.EquipmentSlot slot, net.minecraft.item.ItemStack stack, @Nullable @Nullable net.minecraft.entity.LivingEntity user)
EntityAttributes
your item should give when equipped, based on the stack.
Appends to either attribute modifier NBT or the result from Item.getAttributeModifiers(EquipmentSlot)
.
slot
- The equipment slot this item is equipped in.stack
- The stack that's equipped.user
- The current user of the tool, or none if there isn't anyEMPTY
.