Record Class UseCooldown
java.lang.Object
java.lang.Record
net.minecraft.world.item.component.UseCooldown
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<UseCooldown> private final Optional<Identifier> The field for thecooldownGrouprecord component.private final floatThe field for thesecondsrecord component.static final StreamCodec<RegistryFriendlyByteBuf, UseCooldown> -
Constructor Summary
ConstructorsConstructorDescriptionUseCooldown(float seconds) UseCooldown(float seconds, Optional<Identifier> cooldownGroup) Creates an instance of aUseCooldownrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(ItemStack stack, LivingEntity user) Returns the value of thecooldownGrouprecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.floatseconds()Returns the value of thesecondsrecord component.intticks()final StringtoString()Returns a string representation of this record class.
-
Field Details
-
seconds
private final float secondsThe field for thesecondsrecord component. -
cooldownGroup
The field for thecooldownGrouprecord component. -
CODEC
-
STREAM_CODEC
-
-
Constructor Details
-
UseCooldown
public UseCooldown(float seconds) -
UseCooldown
Creates an instance of aUseCooldownrecord class.- Parameters:
seconds- the value for thesecondsrecord componentcooldownGroup- the value for thecooldownGrouprecord component
-
-
Method Details
-
ticks
public int ticks() -
apply
-
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. -
seconds
public float seconds()Returns the value of thesecondsrecord component.- Returns:
- the value of the
secondsrecord component
-
cooldownGroup
Returns the value of thecooldownGrouprecord component.- Returns:
- the value of the
cooldownGrouprecord component
-