Record Class LodestoneSlotBasedEnchantmentAttributeEffect
java.lang.Object
java.lang.Record
team.lodestar.lodestone.modules.toolkit.enchanting.LodestoneSlotBasedEnchantmentAttributeEffect
- All Implemented Interfaces:
net.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect
public record LodestoneSlotBasedEnchantmentAttributeEffect(net.minecraft.resources.ResourceLocation id, net.minecraft.core.Holder<net.minecraft.world.entity.ai.attributes.Attribute> attribute, net.minecraft.world.item.enchantment.LevelBasedValue amount, net.minecraft.world.entity.ai.attributes.AttributeModifier.Operation operation)
extends Record
implements net.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<LodestoneSlotBasedEnchantmentAttributeEffect> -
Constructor Summary
ConstructorsConstructorDescriptionLodestoneSlotBasedEnchantmentAttributeEffect(net.minecraft.resources.ResourceLocation id, net.minecraft.core.Holder<net.minecraft.world.entity.ai.attributes.Attribute> attribute, net.minecraft.world.item.enchantment.LevelBasedValue amount, net.minecraft.world.entity.ai.attributes.AttributeModifier.Operation operation) Creates an instance of aLodestoneSlotBasedEnchantmentAttributeEffectrecord class. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.item.enchantment.LevelBasedValueamount()Returns the value of theamountrecord component.net.minecraft.core.Holder<net.minecraft.world.entity.ai.attributes.Attribute> Returns the value of theattributerecord component.com.mojang.serialization.MapCodec<LodestoneSlotBasedEnchantmentAttributeEffect> codec()final booleanIndicates whether some other object is "equal to" this one.net.minecraft.world.entity.ai.attributes.AttributeModifiergetModifier(int enchantmentLevel, net.minecraft.util.StringRepresentable slot) final inthashCode()Returns a hash code value for this object.net.minecraft.resources.ResourceLocationid()Returns the value of theidrecord component.static voidmodifyAttributes(net.neoforged.neoforge.event.ItemAttributeModifierEvent event) voidonChangedBlock(net.minecraft.server.level.ServerLevel level, int enchantmentLevel, net.minecraft.world.item.enchantment.EnchantedItemInUse item, net.minecraft.world.entity.Entity entity, net.minecraft.world.phys.Vec3 pos, boolean applyTransientEffects) voidonDeactivated(net.minecraft.world.item.enchantment.EnchantedItemInUse item, net.minecraft.world.entity.Entity entity, net.minecraft.world.phys.Vec3 pos, int enchantmentLevel) net.minecraft.world.entity.ai.attributes.AttributeModifier.OperationReturns the value of theoperationrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
CODEC
public static final com.mojang.serialization.MapCodec<LodestoneSlotBasedEnchantmentAttributeEffect> CODEC
-
-
Constructor Details
-
LodestoneSlotBasedEnchantmentAttributeEffect
public LodestoneSlotBasedEnchantmentAttributeEffect(net.minecraft.resources.ResourceLocation id, net.minecraft.core.Holder<net.minecraft.world.entity.ai.attributes.Attribute> attribute, net.minecraft.world.item.enchantment.LevelBasedValue amount, net.minecraft.world.entity.ai.attributes.AttributeModifier.Operation operation) Creates an instance of aLodestoneSlotBasedEnchantmentAttributeEffectrecord class.- Parameters:
id- the value for theidrecord componentattribute- the value for theattributerecord componentamount- the value for theamountrecord componentoperation- the value for theoperationrecord component
-
-
Method Details
-
modifyAttributes
public static void modifyAttributes(net.neoforged.neoforge.event.ItemAttributeModifierEvent event) -
getModifier
public net.minecraft.world.entity.ai.attributes.AttributeModifier getModifier(int enchantmentLevel, net.minecraft.util.StringRepresentable slot) -
onChangedBlock
public void onChangedBlock(net.minecraft.server.level.ServerLevel level, int enchantmentLevel, net.minecraft.world.item.enchantment.EnchantedItemInUse item, net.minecraft.world.entity.Entity entity, net.minecraft.world.phys.Vec3 pos, boolean applyTransientEffects) - Specified by:
onChangedBlockin interfacenet.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect
-
onDeactivated
public void onDeactivated(net.minecraft.world.item.enchantment.EnchantedItemInUse item, net.minecraft.world.entity.Entity entity, net.minecraft.world.phys.Vec3 pos, int enchantmentLevel) - Specified by:
onDeactivatedin interfacenet.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect
-
codec
- Specified by:
codecin interfacenet.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
id
public net.minecraft.resources.ResourceLocation id()Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
attribute
public net.minecraft.core.Holder<net.minecraft.world.entity.ai.attributes.Attribute> attribute()Returns the value of theattributerecord component.- Returns:
- the value of the
attributerecord component
-
amount
public net.minecraft.world.item.enchantment.LevelBasedValue amount()Returns the value of theamountrecord component.- Returns:
- the value of the
amountrecord component
-
operation
public net.minecraft.world.entity.ai.attributes.AttributeModifier.Operation operation()Returns the value of theoperationrecord component.- Returns:
- the value of the
operationrecord component
-