Record Class BlocksAttacks
java.lang.Object
java.lang.Record
net.minecraft.world.item.component.BlocksAttacks
public record BlocksAttacks(float blockDelaySeconds, float disableCooldownScale, List<BlocksAttacks.DamageReduction> damageReductions, BlocksAttacks.ItemDamageFunction itemDamage, Optional<TagKey<DamageType>> bypassedBy, Optional<Holder<SoundEvent>> blockSound, Optional<Holder<SoundEvent>> disableSound)
extends Record
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic final record -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final floatThe field for theblockDelaySecondsrecord component.private final Optional<Holder<SoundEvent>> The field for theblockSoundrecord component.private final Optional<TagKey<DamageType>> The field for thebypassedByrecord component.static final com.mojang.serialization.Codec<BlocksAttacks> private final List<BlocksAttacks.DamageReduction> The field for thedamageReductionsrecord component.private final floatThe field for thedisableCooldownScalerecord component.private final Optional<Holder<SoundEvent>> The field for thedisableSoundrecord component.private final BlocksAttacks.ItemDamageFunctionThe field for theitemDamagerecord component.static final StreamCodec<RegistryFriendlyByteBuf, BlocksAttacks> -
Constructor Summary
ConstructorsConstructorDescriptionBlocksAttacks(float blockDelaySeconds, float disableCooldownScale, List<BlocksAttacks.DamageReduction> damageReductions, BlocksAttacks.ItemDamageFunction itemDamage, Optional<TagKey<DamageType>> bypassedBy, Optional<Holder<SoundEvent>> blockSound, Optional<Holder<SoundEvent>> disableSound) Creates an instance of aBlocksAttacksrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfloatReturns the value of theblockDelaySecondsrecord component.intReturns the value of theblockSoundrecord component.Returns the value of thebypassedByrecord component.Returns the value of thedamageReductionsrecord component.voiddisable(ServerLevel level, LivingEntity user, float baseSeconds, ItemStack blockingWith) private intdisableBlockingForTicks(float baseSeconds) floatReturns the value of thedisableCooldownScalerecord component.Returns the value of thedisableSoundrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.voidhurtBlockingItem(Level level, ItemStack item, LivingEntity user, InteractionHand hand, float damage) voidhurtBlockingItem(Level level, ItemStack item, LivingEntity user, InteractionHand hand, float damage, int fixedDamage) Returns the value of theitemDamagerecord component.voidonBlocked(ServerLevel level, LivingEntity user) floatresolveBlockedDamage(DamageSource source, float dealtDamage, double angle) final StringtoString()Returns a string representation of this record class.
-
Field Details
-
blockDelaySeconds
private final float blockDelaySecondsThe field for theblockDelaySecondsrecord component. -
disableCooldownScale
private final float disableCooldownScaleThe field for thedisableCooldownScalerecord component. -
damageReductions
The field for thedamageReductionsrecord component. -
itemDamage
The field for theitemDamagerecord component. -
bypassedBy
The field for thebypassedByrecord component. -
blockSound
The field for theblockSoundrecord component. -
disableSound
The field for thedisableSoundrecord component. -
CODEC
-
STREAM_CODEC
-
-
Constructor Details
-
BlocksAttacks
public BlocksAttacks(float blockDelaySeconds, float disableCooldownScale, List<BlocksAttacks.DamageReduction> damageReductions, BlocksAttacks.ItemDamageFunction itemDamage, Optional<TagKey<DamageType>> bypassedBy, Optional<Holder<SoundEvent>> blockSound, Optional<Holder<SoundEvent>> disableSound) Creates an instance of aBlocksAttacksrecord class.- Parameters:
blockDelaySeconds- the value for theblockDelaySecondsrecord componentdisableCooldownScale- the value for thedisableCooldownScalerecord componentdamageReductions- the value for thedamageReductionsrecord componentitemDamage- the value for theitemDamagerecord componentbypassedBy- the value for thebypassedByrecord componentblockSound- the value for theblockSoundrecord componentdisableSound- the value for thedisableSoundrecord component
-
-
Method Details
-
onBlocked
-
disable
public void disable(ServerLevel level, LivingEntity user, float baseSeconds, ItemStack blockingWith) -
hurtBlockingItem
public void hurtBlockingItem(Level level, ItemStack item, LivingEntity user, InteractionHand hand, float damage) -
hurtBlockingItem
public void hurtBlockingItem(Level level, ItemStack item, LivingEntity user, InteractionHand hand, float damage, int fixedDamage) -
disableBlockingForTicks
private int disableBlockingForTicks(float baseSeconds) -
blockDelayTicks
public int blockDelayTicks() -
resolveBlockedDamage
-
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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
blockDelaySeconds
public float blockDelaySeconds()Returns the value of theblockDelaySecondsrecord component.- Returns:
- the value of the
blockDelaySecondsrecord component
-
disableCooldownScale
public float disableCooldownScale()Returns the value of thedisableCooldownScalerecord component.- Returns:
- the value of the
disableCooldownScalerecord component
-
damageReductions
Returns the value of thedamageReductionsrecord component.- Returns:
- the value of the
damageReductionsrecord component
-
itemDamage
Returns the value of theitemDamagerecord component.- Returns:
- the value of the
itemDamagerecord component
-
bypassedBy
Returns the value of thebypassedByrecord component.- Returns:
- the value of the
bypassedByrecord component
-
blockSound
Returns the value of theblockSoundrecord component.- Returns:
- the value of the
blockSoundrecord component
-
disableSound
Returns the value of thedisableSoundrecord component.- Returns:
- the value of the
disableSoundrecord component
-