Record Class SoundEvent
java.lang.Object
java.lang.Record
net.minecraft.sounds.SoundEvent
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<Holder<SoundEvent>> static final com.mojang.serialization.Codec<SoundEvent> static final StreamCodec<io.netty.buffer.ByteBuf, SoundEvent> The field for thefixedRangerecord component.private final IdentifierThe field for thelocationrecord component.static final StreamCodec<RegistryFriendlyByteBuf, Holder<SoundEvent>> -
Constructor Summary
ConstructorsConstructorDescriptionSoundEvent(Identifier location, Optional<Float> fixedRange) Creates an instance of aSoundEventrecord class. -
Method Summary
Modifier and TypeMethodDescriptionprivate static SoundEventcreate(Identifier location, Optional<Float> range) static SoundEventcreateFixedRangeEvent(Identifier location, float range) static SoundEventcreateVariableRangeEvent(Identifier location) final booleanIndicates whether some other object is "equal to" this one.Returns the value of thefixedRangerecord component.floatgetRange(float volume) final inthashCode()Returns a hash code value for this object.location()Returns the value of thelocationrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
location
The field for thelocationrecord component. -
fixedRange
-
DIRECT_CODEC
-
CODEC
-
DIRECT_STREAM_CODEC
-
STREAM_CODEC
-
-
Constructor Details
-
SoundEvent
Creates an instance of aSoundEventrecord class.- Parameters:
location- the value for thelocationrecord componentfixedRange- the value for thefixedRangerecord component
-
-
Method Details
-
create
-
createVariableRangeEvent
-
createFixedRangeEvent
-
getRange
public float getRange(float volume) -
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). -
location
Returns the value of thelocationrecord component.- Returns:
- the value of the
locationrecord component
-
fixedRange
-