Record Class KineticWeapon.Condition
java.lang.Object
java.lang.Record
net.minecraft.world.item.component.KineticWeapon.Condition
- Enclosing class:
KineticWeapon
public static record KineticWeapon.Condition(int maxDurationTicks, float minSpeed, float minRelativeSpeed)
extends Record
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<KineticWeapon.Condition> private final intThe field for themaxDurationTicksrecord component.private final floatThe field for theminRelativeSpeedrecord component.private final floatThe field for theminSpeedrecord component.static final StreamCodec<io.netty.buffer.ByteBuf, KineticWeapon.Condition> -
Constructor Summary
ConstructorsConstructorDescriptionCondition(int maxDurationTicks, float minSpeed, float minRelativeSpeed) Creates an instance of aConditionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intReturns the value of themaxDurationTicksrecord component.floatReturns the value of theminRelativeSpeedrecord component.floatminSpeed()Returns the value of theminSpeedrecord component.static Optional<KineticWeapon.Condition> ofAttackerSpeed(int pMaxDurationTicks, float pMinSpeed) static Optional<KineticWeapon.Condition> ofRelativeSpeed(int pMaxDurationTicks, float pMinRelativeSpeed) booleantest(int pDuration, double pSpeed, double pRelativeSpeed, double pSpeedMultiplier) final StringtoString()Returns a string representation of this record class.
-
Field Details
-
maxDurationTicks
private final int maxDurationTicksThe field for themaxDurationTicksrecord component. -
minSpeed
private final float minSpeedThe field for theminSpeedrecord component. -
minRelativeSpeed
private final float minRelativeSpeedThe field for theminRelativeSpeedrecord component. -
CODEC
-
STREAM_CODEC
-
-
Constructor Details
-
Condition
public Condition(int maxDurationTicks, float minSpeed, float minRelativeSpeed) Creates an instance of aConditionrecord class.- Parameters:
maxDurationTicks- the value for themaxDurationTicksrecord componentminSpeed- the value for theminSpeedrecord componentminRelativeSpeed- the value for theminRelativeSpeedrecord component
-
-
Method Details
-
test
public boolean test(int pDuration, double pSpeed, double pRelativeSpeed, double pSpeedMultiplier) -
ofAttackerSpeed
public static Optional<KineticWeapon.Condition> ofAttackerSpeed(int pMaxDurationTicks, float pMinSpeed) -
ofRelativeSpeed
public static Optional<KineticWeapon.Condition> ofRelativeSpeed(int pMaxDurationTicks, float pMinRelativeSpeed) -
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 with '=='. -
maxDurationTicks
public int maxDurationTicks()Returns the value of themaxDurationTicksrecord component.- Returns:
- the value of the
maxDurationTicksrecord component
-
minSpeed
public float minSpeed()Returns the value of theminSpeedrecord component.- Returns:
- the value of the
minSpeedrecord component
-
minRelativeSpeed
public float minRelativeSpeed()Returns the value of theminRelativeSpeedrecord component.- Returns:
- the value of the
minRelativeSpeedrecord component
-