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 theinstrument
record 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 aInstrumentComponent
record class. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addToTooltip
(Item.TooltipContext p_400063_, Consumer<Component> p_399614_, TooltipFlag p_399577_, DataComponentGetter p_399984_) final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.Returns the value of theinstrument
record component.final String
toString()
Returns a string representation of this record class.unwrap
(HolderLookup.Provider p_399530_)
-
Field Details
-
instrument
The field for theinstrument
record component. -
CODEC
-
STREAM_CODEC
-
-
Constructor Details
-
InstrumentComponent
-
InstrumentComponent
Deprecated. -
InstrumentComponent
Creates an instance of aInstrumentComponent
record class.- Parameters:
instrument
- the value for theinstrument
record component
-
-
Method Details
-
addToTooltip
public void addToTooltip(Item.TooltipContext p_400063_, Consumer<Component> p_399614_, TooltipFlag p_399577_, DataComponentGetter p_399984_) - Specified by:
addToTooltip
in 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 theinstrument
record component.- Returns:
- the value of the
instrument
record component
-