WolfSoundVariant .java

net.minecraft.world.entity.animal.wolf.WolfSoundVariant (record): members: adultSounds, babySounds, getWolfSoundVariantCodec, WolfSoundSet, growlSound.

net.minecraft.world.entity.animal.wolfrecord52 linescommon2.5 KB

API Surface (2)

record WolfSoundVariant(WolfSoundVariant.WolfSoundSet adultSounds, WolfSoundVariant.WolfSoundSet babySounds)
record WolfSoundSet(Holder<SoundEvent> ambientSound, Holder<SoundEvent> deathSound, Holder<SoundEvent> growlSound, Holder<SoundEvent> hurtSound, Holder<SoundEvent> pantSound, Holder<SoundEvent> whineSound, Holder<SoundEvent> stepSound)

Fields & Constants (10)

DIRECT_CODEC
NETWORK_CODEC
CODEC
STREAM_CODEC
ambientSound
deathSound
growlSound
hurtSound
pantSound
whineSound

String literals (9)

"adult_sounds"
"baby_sounds"
"ambient_sound"
"death_sound"
"growl_sound"
"hurt_sound"
"pant_sound"
"whine_sound"
"step_sound"

Code Graph: Dependencies (7)

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

Full Source

WolfSoundVariant.java52 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.entity.animal.wolf;
2
3
import com.mojang.serialization.Codec;
4
import com.mojang.serialization.codecs.RecordCodecBuilder;
5
import net.minecraft.core.Holder;
6
import net.minecraft.core.registries.Registries;
7
import net.minecraft.core.registries.codec.RegistryCodecs;
8
import net.minecraft.network.RegistryFriendlyByteBuf;
9
import net.minecraft.network.codec.ByteBufCodecs;
10
import net.minecraft.network.codec.StreamCodec;
11
import net.minecraft.sounds.SoundEvent;
12
13
public record WolfSoundVariant(WolfSoundVariant.WolfSoundSet adultSounds, WolfSoundVariant.WolfSoundSet babySounds) {
14
	public static final Codec<WolfSoundVariant> DIRECT_CODEC = getWolfSoundVariantCodec();
15
	public static final Codec<WolfSoundVariant> NETWORK_CODEC = getWolfSoundVariantCodec();
16
	public static final Codec<Holder<WolfSoundVariant>> CODEC = RegistryCodecs.holder(Registries.WOLF_SOUND_VARIANT);
17
	public static final StreamCodec<RegistryFriendlyByteBuf, Holder<WolfSoundVariant>> STREAM_CODEC = ByteBufCodecs.holderRegistry(Registries.WOLF_SOUND_VARIANT);
18
19
	private static Codec<WolfSoundVariant> getWolfSoundVariantCodec() {
20
		return RecordCodecBuilder.create(
21
			i -> i.group(
22
					WolfSoundVariant.WolfSoundSet.CODEC.fieldOf("adult_sounds").forGetter(WolfSoundVariant::adultSounds),
23
					WolfSoundVariant.WolfSoundSet.CODEC.fieldOf("baby_sounds").forGetter(WolfSoundVariant::babySounds)
24
				)
25
				.apply(i, WolfSoundVariant::new)
26
		);
27
	}
28
29
	public record WolfSoundSet(
30
		Holder<SoundEvent> ambientSound,
31
		Holder<SoundEvent> deathSound,
32
		Holder<SoundEvent> growlSound,
33
		Holder<SoundEvent> hurtSound,
34
		Holder<SoundEvent> pantSound,
35
		Holder<SoundEvent> whineSound,
36
		Holder<SoundEvent> stepSound
37
	) {
38
		public static final Codec<WolfSoundVariant.WolfSoundSet> CODEC = RecordCodecBuilder.create(
39
			i -> i.group(
40
					SoundEvent.CODEC.fieldOf("ambient_sound").forGetter(WolfSoundVariant.WolfSoundSet::ambientSound),
41
					SoundEvent.CODEC.fieldOf("death_sound").forGetter(WolfSoundVariant.WolfSoundSet::deathSound),
42
					SoundEvent.CODEC.fieldOf("growl_sound").forGetter(WolfSoundVariant.WolfSoundSet::growlSound),
43
					SoundEvent.CODEC.fieldOf("hurt_sound").forGetter(WolfSoundVariant.WolfSoundSet::hurtSound),
44
					SoundEvent.CODEC.fieldOf("pant_sound").forGetter(WolfSoundVariant.WolfSoundSet::pantSound),
45
					SoundEvent.CODEC.fieldOf("whine_sound").forGetter(WolfSoundVariant.WolfSoundSet::whineSound),
46
					SoundEvent.CODEC.fieldOf("step_sound").forGetter(WolfSoundVariant.WolfSoundSet::stepSound)
47
				)
48
				.apply(i, WolfSoundVariant.WolfSoundSet::new)
49
		);
50
	}
51
}
52

Decompiled Minecraft 26.3 source of WolfSoundVariant (net/minecraft/world/entity/animal/wolf/WolfSoundVariant.java) with Mojang official mappings, stored verbatim on the site.