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 record
static final record
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final float
The field for theblockDelaySeconds
record component.private final Optional
<Holder<SoundEvent>> The field for theblockSound
record component.private final Optional
<TagKey<DamageType>> The field for thebypassedBy
record component.static final com.mojang.serialization.Codec
<BlocksAttacks> private final List
<BlocksAttacks.DamageReduction> The field for thedamageReductions
record component.private final float
The field for thedisableCooldownScale
record component.private final Optional
<Holder<SoundEvent>> The field for thedisableSound
record component.private final BlocksAttacks.ItemDamageFunction
The field for theitemDamage
record 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 aBlocksAttacks
record class. -
Method Summary
Modifier and TypeMethodDescriptionfloat
Returns the value of theblockDelaySeconds
record component.int
Returns the value of theblockSound
record component.Returns the value of thebypassedBy
record component.Returns the value of thedamageReductions
record component.void
disable
(ServerLevel pLevel, LivingEntity pEntity, float pDuration, ItemStack pStack) private int
disableBlockingForTicks
(float pDuration) float
Returns the value of thedisableCooldownScale
record component.Returns the value of thedisableSound
record component.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.void
hurtBlockingItem
(Level pLevel, ItemStack pStack, LivingEntity pEntity, InteractionHand pHand, float pDamage) void
hurtBlockingItem
(Level pLevel, ItemStack pStack, LivingEntity pEntity, InteractionHand pHand, float pDamage, int fixedDamage) Returns the value of theitemDamage
record component.void
onBlocked
(ServerLevel pLevel, LivingEntity pEntity) float
resolveBlockedDamage
(DamageSource pDamageSource, float pDamageAmount, double pHorizontalAngle) final String
toString()
Returns a string representation of this record class.
-
Field Details
-
blockDelaySeconds
private final float blockDelaySecondsThe field for theblockDelaySeconds
record component. -
disableCooldownScale
private final float disableCooldownScaleThe field for thedisableCooldownScale
record component. -
damageReductions
The field for thedamageReductions
record component. -
itemDamage
The field for theitemDamage
record component. -
bypassedBy
The field for thebypassedBy
record component. -
blockSound
The field for theblockSound
record component. -
disableSound
The field for thedisableSound
record 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 aBlocksAttacks
record class.- Parameters:
blockDelaySeconds
- the value for theblockDelaySeconds
record componentdisableCooldownScale
- the value for thedisableCooldownScale
record componentdamageReductions
- the value for thedamageReductions
record componentitemDamage
- the value for theitemDamage
record componentbypassedBy
- the value for thebypassedBy
record componentblockSound
- the value for theblockSound
record componentdisableSound
- the value for thedisableSound
record component
-
-
Method Details
-
onBlocked
-
disable
-
hurtBlockingItem
public void hurtBlockingItem(Level pLevel, ItemStack pStack, LivingEntity pEntity, InteractionHand pHand, float pDamage) -
hurtBlockingItem
public void hurtBlockingItem(Level pLevel, ItemStack pStack, LivingEntity pEntity, InteractionHand pHand, float pDamage, int fixedDamage) -
disableBlockingForTicks
private int disableBlockingForTicks(float pDuration) -
blockDelayTicks
public int blockDelayTicks() -
resolveBlockedDamage
public float resolveBlockedDamage(DamageSource pDamageSource, float pDamageAmount, double pHorizontalAngle) -
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. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
blockDelaySeconds
public float blockDelaySeconds()Returns the value of theblockDelaySeconds
record component.- Returns:
- the value of the
blockDelaySeconds
record component
-
disableCooldownScale
public float disableCooldownScale()Returns the value of thedisableCooldownScale
record component.- Returns:
- the value of the
disableCooldownScale
record component
-
damageReductions
Returns the value of thedamageReductions
record component.- Returns:
- the value of the
damageReductions
record component
-
itemDamage
Returns the value of theitemDamage
record component.- Returns:
- the value of the
itemDamage
record component
-
bypassedBy
Returns the value of thebypassedBy
record component.- Returns:
- the value of the
bypassedBy
record component
-
blockSound
Returns the value of theblockSound
record component.- Returns:
- the value of the
blockSound
record component
-
disableSound
Returns the value of thedisableSound
record component.- Returns:
- the value of the
disableSound
record component
-