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<ResourceLocation> The field for thecooldownGrouprecord component.private final floatThe field for thesecondsrecord component.static final StreamCodec<RegistryFriendlyByteBuf, UseCooldown> -
Constructor Summary
ConstructorsConstructorDescriptionUseCooldown(float p_366808_) UseCooldown(float seconds, Optional<ResourceLocation> cooldownGroup) Creates an instance of aUseCooldownrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(ItemStack pStack, LivingEntity pEntity) 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 p_366808_) -
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
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 '=='. -
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
-