Record Class InstrumentComponent
java.lang.Object
java.lang.Record
net.minecraft.world.item.component.InstrumentComponent
- All Implemented Interfaces:
TooltipProvider
public record InstrumentComponent(Holder<Instrument> instrument)
extends Record
implements TooltipProvider
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<InstrumentComponent> private final Holder<Instrument> The field for theinstrumentrecord component.static final StreamCodec<RegistryFriendlyByteBuf, InstrumentComponent> -
Constructor Summary
ConstructorsConstructorDescriptionInstrumentComponent(Holder<Instrument> instrument) Creates an instance of aInstrumentComponentrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToTooltip(Item.TooltipContext context, Consumer<Component> consumer, TooltipFlag flag, DataComponentGetter components) final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of theinstrumentrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
instrument
The field for theinstrumentrecord component. -
CODEC
-
STREAM_CODEC
-
-
Constructor Details
-
InstrumentComponent
Creates an instance of aInstrumentComponentrecord class.- Parameters:
instrument- the value for theinstrumentrecord component
-
-
Method Details
-
addToTooltip
public void addToTooltip(Item.TooltipContext context, Consumer<Component> consumer, TooltipFlag flag, DataComponentGetter components) - Specified by:
addToTooltipin interfaceTooltipProvider
-
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 withObjects::equals(Object,Object). -
instrument
Returns the value of theinstrumentrecord component.- Returns:
- the value of the
instrumentrecord component
-