Record Class BlocksAttacks.ItemDamageFunction
java.lang.Object
java.lang.Record
net.minecraft.world.item.component.BlocksAttacks.ItemDamageFunction
- Enclosing class:
BlocksAttacks
public static record BlocksAttacks.ItemDamageFunction(float threshold, float base, float factor)
extends Record
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final floatThe field for thebaserecord component.static final com.mojang.serialization.Codec<BlocksAttacks.ItemDamageFunction> static final BlocksAttacks.ItemDamageFunctionprivate final floatThe field for thefactorrecord component.static final StreamCodec<io.netty.buffer.ByteBuf, BlocksAttacks.ItemDamageFunction> private final floatThe field for thethresholdrecord component. -
Constructor Summary
ConstructorsConstructorDescriptionItemDamageFunction(float threshold, float base, float factor) Creates an instance of aItemDamageFunctionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintapply(float dealtDamage) floatbase()Returns the value of thebaserecord component.final booleanIndicates whether some other object is "equal to" this one.floatfactor()Returns the value of thefactorrecord component.final inthashCode()Returns a hash code value for this object.floatReturns the value of thethresholdrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
threshold
private final float thresholdThe field for thethresholdrecord component. -
base
private final float baseThe field for thebaserecord component. -
factor
private final float factorThe field for thefactorrecord component. -
CODEC
-
STREAM_CODEC
public static final StreamCodec<io.netty.buffer.ByteBuf, BlocksAttacks.ItemDamageFunction> STREAM_CODEC -
DEFAULT
-
-
Constructor Details
-
ItemDamageFunction
public ItemDamageFunction(float threshold, float base, float factor) Creates an instance of aItemDamageFunctionrecord class.- Parameters:
threshold- the value for thethresholdrecord componentbase- the value for thebaserecord componentfactor- the value for thefactorrecord component
-
-
Method Details
-
apply
public int apply(float dealtDamage) -
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 with thecomparemethod from their corresponding wrapper classes. -
threshold
public float threshold()Returns the value of thethresholdrecord component.- Returns:
- the value of the
thresholdrecord component
-
base
public float base()Returns the value of thebaserecord component.- Returns:
- the value of the
baserecord component
-
factor
public float factor()Returns the value of thefactorrecord component.- Returns:
- the value of the
factorrecord component
-