Package net.minecraft.sounds
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 ResourceLocationThe field for thelocationrecord component.static final StreamCodec<RegistryFriendlyByteBuf, Holder<SoundEvent>> -
Constructor Summary
ConstructorsConstructorDescriptionSoundEvent(ResourceLocation location, Optional<Float> fixedRange) Creates an instance of aSoundEventrecord class. -
Method Summary
Modifier and TypeMethodDescriptionprivate static SoundEventcreate(ResourceLocation p_263406_, Optional<Float> p_263346_) static SoundEventcreateFixedRangeEvent(ResourceLocation pLocation, float pRange) static SoundEventcreateVariableRangeEvent(ResourceLocation pLocation) final booleanIndicates whether some other object is "equal to" this one.Returns the value of thefixedRangerecord component.floatgetRange(float pVolume) 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
The field for thefixedRangerecord component. -
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 pVolume) -
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). -
location
Returns the value of thelocationrecord component.- Returns:
- the value of the
locationrecord component
-
fixedRange
Returns the value of thefixedRangerecord component.- Returns:
- the value of the
fixedRangerecord component
-