Record Class Fireworks
java.lang.Object
java.lang.Record
net.minecraft.world.item.component.Fireworks
- All Implemented Interfaces:
TooltipProvider
public record Fireworks(int flightDuration, List<FireworkExplosion> explosions)
extends Record
implements TooltipProvider
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<Fireworks> private final List<FireworkExplosion> The field for theexplosionsrecord component.private final intThe field for theflightDurationrecord component.static final intstatic final StreamCodec<io.netty.buffer.ByteBuf, Fireworks> -
Constructor Summary
ConstructorsConstructorDescriptionFireworks(int flightDuration, List<FireworkExplosion> explosions) Creates an instance of aFireworksrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToTooltip(Item.TooltipContext p_341156_, Consumer<Component> p_331099_, TooltipFlag p_330997_) final booleanIndicates whether some other object is "equal to" this one.Returns the value of theexplosionsrecord component.intReturns the value of theflightDurationrecord component.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
flightDuration
private final int flightDurationThe field for theflightDurationrecord component. -
explosions
The field for theexplosionsrecord component. -
MAX_EXPLOSIONS
public static final int MAX_EXPLOSIONS- See Also:
-
CODEC
-
STREAM_CODEC
-
-
Constructor Details
-
Fireworks
Creates an instance of aFireworksrecord class.- Parameters:
flightDuration- the value for theflightDurationrecord componentexplosions- the value for theexplosionsrecord component
-
-
Method Details
-
addToTooltip
public void addToTooltip(Item.TooltipContext p_341156_, Consumer<Component> p_331099_, TooltipFlag p_330997_) - Specified by:
addToTooltipin interfaceTooltipProvider
-
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 '=='. -
flightDuration
public int flightDuration()Returns the value of theflightDurationrecord component.- Returns:
- the value of the
flightDurationrecord component
-
explosions
Returns the value of theexplosionsrecord component.- Returns:
- the value of the
explosionsrecord component
-