AmbientSounds .java

net.minecraft.world.attribute.AmbientSounds (record): members: loop, mood, additions, LEGACY_CAVE_SETTINGS, EMPTY, CODEC. strings: "loop", "mood".

net.minecraft.world.attributerecord23 linescommon1.1 KB

API Surface (1)

record AmbientSounds(Optional<Holder<SoundEvent>> loop, Optional<AmbientMoodSettings> mood, List<AmbientAdditionsSettings> additions)

Fields & Constants (3)

EMPTY
LEGACY_CAVE_SETTINGS
CODEC

String literals (3)

"loop"
"mood"
"additions"

Code Graph: Dependencies (5)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

AmbientSounds.java23 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.attribute;
2
3
import com.mojang.serialization.Codec;
4
import com.mojang.serialization.codecs.RecordCodecBuilder;
5
import java.util.List;
6
import java.util.Optional;
7
import net.minecraft.core.Holder;
8
import net.minecraft.sounds.SoundEvent;
9
import net.minecraft.util.ExtraCodecs;
10
11
public record AmbientSounds(Optional<Holder<SoundEvent>> loop, Optional<AmbientMoodSettings> mood, List<AmbientAdditionsSettings> additions) {
12
	public static final AmbientSounds EMPTY = new AmbientSounds(Optional.empty(), Optional.empty(), List.of());
13
	public static final AmbientSounds LEGACY_CAVE_SETTINGS = new AmbientSounds(Optional.empty(), Optional.of(AmbientMoodSettings.LEGACY_CAVE_SETTINGS), List.of());
14
	public static final Codec<AmbientSounds> CODEC = RecordCodecBuilder.create(
15
		i -> i.group(
16
				SoundEvent.CODEC.optionalFieldOf("loop").forGetter(AmbientSounds::loop),
17
				AmbientMoodSettings.CODEC.optionalFieldOf("mood").forGetter(AmbientSounds::mood),
18
				ExtraCodecs.compactListCodec(AmbientAdditionsSettings.CODEC).optionalFieldOf("additions", List.of()).forGetter(AmbientSounds::additions)
19
			)
20
			.apply(i, AmbientSounds::new)
21
	);
22
}
23

Decompiled Minecraft 26.3 source of AmbientSounds (net/minecraft/world/attribute/AmbientSounds.java) with Mojang official mappings, stored verbatim on the site.