Record Class InstrumentComponent
java.lang.Object
java.lang.Record
net.minecraft.world.item.component.InstrumentComponent
- All Implemented Interfaces:
TooltipProvider
public record InstrumentComponent(EitherHolder<Instrument> instrument)
extends Record
implements TooltipProvider
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<InstrumentComponent> private final EitherHolder<Instrument> The field for theinstrumentrecord component.static final StreamCodec<RegistryFriendlyByteBuf, InstrumentComponent> -
Constructor Summary
ConstructorsConstructorDescriptionInstrumentComponent(Holder<Instrument> p_399918_) InstrumentComponent(ResourceKey<Instrument> p_399945_) Deprecated.InstrumentComponent(EitherHolder<Instrument> instrument) Creates an instance of aInstrumentComponentrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToTooltip(Item.TooltipContext p_400063_, Consumer<Component> p_399614_, TooltipFlag p_399577_, DataComponentGetter p_399984_) 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.unwrap(HolderLookup.Provider pRegistries)
-
Field Details
-
instrument
The field for theinstrumentrecord component. -
CODEC
-
STREAM_CODEC
-
-
Constructor Details
-
InstrumentComponent
-
InstrumentComponent
Deprecated. -
InstrumentComponent
Creates an instance of aInstrumentComponentrecord class.- Parameters:
instrument- the value for theinstrumentrecord component
-
-
Method Details
-
addToTooltip
public void addToTooltip(Item.TooltipContext p_400063_, Consumer<Component> p_399614_, TooltipFlag p_399577_, DataComponentGetter p_399984_) - Specified by:
addToTooltipin interfaceTooltipProvider
-
unwrap
-
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 withObjects::equals(Object,Object). -
instrument
Returns the value of theinstrumentrecord component.- Returns:
- the value of the
instrumentrecord component
-