Record Class InvulnerabilityFrameModifierEffect
java.lang.Object
java.lang.Record
johnsmith.enchantmentcore.api.enchantment.effect.InvulnerabilityFrameModifierEffect
- Record Components:
amount- TheLevelBasedValuespecifying the number of ticks to add to (or subtract from) the target'sinvulnerableTime.
- All Implemented Interfaces:
net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect, net.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect
public record InvulnerabilityFrameModifierEffect(net.minecraft.world.item.enchantment.LevelBasedValue amount)
extends Record
implements net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect
An
EnchantmentEntityEffect that modifies a target entity's post-hit invulnerability timer
(Entity.invulnerableTime), clamping the resulting value to a minimum of 0 ticks.
Negative values reduce invulnerability frames (allowing rapid consecutive hits), while positive values extend invulnerability duration.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringJSON field key for the invulnerability tick offset.static final com.mojang.serialization.MapCodec<InvulnerabilityFrameModifierEffect> MapCodec for serializing and deserializingInvulnerabilityFrameModifierEffectinstances from JSON.static final StringRegistry path identifier for this entity effect.static final LevelBasedKeyProviderSupplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation. -
Constructor Summary
ConstructorsConstructorDescriptionInvulnerabilityFrameModifierEffect(net.minecraft.world.item.enchantment.LevelBasedValue amount) Creates an instance of aInvulnerabilityFrameModifierEffectrecord class. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.item.enchantment.LevelBasedValueamount()Returns the value of theamountrecord component.voidapply(net.minecraft.server.level.ServerLevel level, int enchantmentLevel, net.minecraft.world.item.enchantment.EnchantedItemInUse itemInUse, net.minecraft.world.entity.Entity target, net.minecraft.world.phys.Vec3 origin) Adjusts the target entity'sEntity.invulnerableTimeby the evaluated tick delta.com.mojang.serialization.MapCodec<? extends net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect> codec()final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.Methods inherited from interface net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect
onChangedBlockMethods inherited from interface net.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect
onDeactivated
-
Field Details
-
AMOUNT
-
KEY
-
KEY_PROVIDER
Supplies the JSON property keys holdingLevelBasedValuedefinitions for data transformation. -
CODEC
MapCodec for serializing and deserializingInvulnerabilityFrameModifierEffectinstances from JSON.
-
-
Constructor Details
-
InvulnerabilityFrameModifierEffect
public InvulnerabilityFrameModifierEffect(net.minecraft.world.item.enchantment.LevelBasedValue amount) Creates an instance of aInvulnerabilityFrameModifierEffectrecord class.- Parameters:
amount- the value for theamountrecord component
-
-
Method Details
-
apply
public void apply(net.minecraft.server.level.ServerLevel level, int enchantmentLevel, net.minecraft.world.item.enchantment.EnchantedItemInUse itemInUse, net.minecraft.world.entity.Entity target, net.minecraft.world.phys.Vec3 origin) Adjusts the target entity'sEntity.invulnerableTimeby the evaluated tick delta.- Specified by:
applyin interfacenet.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect- Parameters:
level- The server level in which the effect is triggered.enchantmentLevel- The level of the source enchantment.itemInUse- The context of the enchanted item in use.target- The entity whose invulnerability timer is modified.origin- The origin position vector of the trigger.
-
codec
public com.mojang.serialization.MapCodec<? extends net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect> codec()- Specified by:
codecin interfacenet.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect- Specified by:
codecin interfacenet.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect
-
toString
-
hashCode
-
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). -
amount
-