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 thefixedRange
record component.private final ResourceLocation
The field for thelocation
record component.static final StreamCodec
<RegistryFriendlyByteBuf, Holder<SoundEvent>> -
Constructor Summary
ConstructorsConstructorDescriptionSoundEvent
(ResourceLocation location, Optional<Float> fixedRange) Creates an instance of aSoundEvent
record class. -
Method Summary
Modifier and TypeMethodDescriptionprivate static SoundEvent
create
(ResourceLocation p_263406_, Optional<Float> p_263346_) static SoundEvent
createFixedRangeEvent
(ResourceLocation p_263003_, float p_263029_) static SoundEvent
createVariableRangeEvent
(ResourceLocation p_262973_) final boolean
Indicates whether some other object is "equal to" this one.Returns the value of thefixedRange
record component.float
getRange
(float p_215669_) final int
hashCode()
Returns a hash code value for this object.location()
Returns the value of thelocation
record component.final String
toString()
Returns a string representation of this record class.
-
Field Details
-
location
The field for thelocation
record component. -
fixedRange
The field for thefixedRange
record component. -
DIRECT_CODEC
-
CODEC
-
DIRECT_STREAM_CODEC
-
STREAM_CODEC
-
-
Constructor Details
-
SoundEvent
Creates an instance of aSoundEvent
record class.- Parameters:
location
- the value for thelocation
record componentfixedRange
- the value for thefixedRange
record component
-
-
Method Details
-
create
-
createVariableRangeEvent
-
createFixedRangeEvent
-
getRange
public float getRange(float p_215669_) -
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 thelocation
record component.- Returns:
- the value of the
location
record component
-
fixedRange
Returns the value of thefixedRange
record component.- Returns:
- the value of the
fixedRange
record component
-