Package net.minecraft.world.item
Record Class Instrument
java.lang.Object
java.lang.Record
net.minecraft.world.item.Instrument
public record Instrument(Holder<SoundEvent> soundEvent, int useDuration, float range)
extends Record
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<Instrument>private final floatThe field for therangerecord component.private final Holder<SoundEvent>The field for thesoundEventrecord component.private final intThe field for theuseDurationrecord component.
- 
Constructor SummaryConstructorsConstructorDescriptionInstrument(Holder<SoundEvent> soundEvent, int useDuration, float range) Creates an instance of aInstrumentrecord class.
- 
Method SummaryModifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.floatrange()Returns the value of therangerecord component.Returns the value of thesoundEventrecord component.final StringtoString()Returns a string representation of this record class.intReturns the value of theuseDurationrecord component.
- 
Field Details- 
soundEventThe field for thesoundEventrecord component.
- 
useDurationprivate final int useDurationThe field for theuseDurationrecord component.
- 
rangeprivate final float rangeThe field for therangerecord component.
- 
CODEC
 
- 
- 
Constructor Details- 
InstrumentCreates an instance of aInstrumentrecord class.- Parameters:
- soundEvent- the value for the- soundEventrecord component
- useDuration- the value for the- useDurationrecord component
- range- the value for the- rangerecord component
 
 
- 
- 
Method Details- 
toStringReturns 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.
- 
hashCodepublic 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.
- 
equalsIndicates 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 '=='.
- 
soundEventReturns the value of thesoundEventrecord component.- Returns:
- the value of the soundEventrecord component
 
- 
useDurationpublic int useDuration()Returns the value of theuseDurationrecord component.- Returns:
- the value of the useDurationrecord component
 
- 
rangepublic float range()Returns the value of therangerecord component.- Returns:
- the value of the rangerecord component
 
 
-