CatSoundVariant .java

net.minecraft.world.entity.animal.feline.CatSoundVariant (record, 56 lines): members: adultSounds, babySounds, strayAmbientSound, begForFoodSound, codec.

net.minecraft.world.entity.animal.felinerecord56 linescommon2.7 KB

API Surface (2)

record CatSoundVariant(CatSoundVariant.CatSoundSet adultSounds, CatSoundVariant.CatSoundSet babySounds)
record CatSoundSet(Holder<SoundEvent> ambientSound, Holder<SoundEvent> strayAmbientSound, Holder<SoundEvent> hissSound, Holder<SoundEvent> hurtSound, Holder<SoundEvent> deathSound, Holder<SoundEvent> eatSound, Holder<SoundEvent> begForFoodSound, Holder<SoundEvent> purrSound, Holder<SoundEvent> purreowSound)

Fields & Constants (12)

DIRECT_CODEC
NETWORK_CODEC
CODEC
STREAM_CODEC
ambientSound
strayAmbientSound
hissSound
hurtSound
deathSound
eatSound
begForFoodSound
purrSound

String literals (11)

"adult_sounds"
"baby_sounds"
"ambient_sound"
"stray_ambient_sound"
"hiss_sound"
"hurt_sound"
"death_sound"
"eat_sound"
"beg_for_food_sound"
"purr_sound"
"purreow_sound"

Code Graph: Dependencies (7)

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

Full Source

CatSoundVariant.java56 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.world.entity.animal.feline;
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 CatSoundVariant(CatSoundVariant.CatSoundSet adultSounds, CatSoundVariant.CatSoundSet babySounds) {
14
	public static final Codec<CatSoundVariant> DIRECT_CODEC = codec();
15
	public static final Codec<CatSoundVariant> NETWORK_CODEC = codec();
16
	public static final Codec<Holder<CatSoundVariant>> CODEC = RegistryCodecs.holder(Registries.CAT_SOUND_VARIANT);
17
	public static final StreamCodec<RegistryFriendlyByteBuf, Holder<CatSoundVariant>> STREAM_CODEC = ByteBufCodecs.holderRegistry(Registries.CAT_SOUND_VARIANT);
18
19
	private static Codec<CatSoundVariant> codec() {
20
		return RecordCodecBuilder.create(
21
			i -> i.group(
22
					CatSoundVariant.CatSoundSet.CODEC.fieldOf("adult_sounds").forGetter(CatSoundVariant::adultSounds),
23
					CatSoundVariant.CatSoundSet.CODEC.fieldOf("baby_sounds").forGetter(CatSoundVariant::babySounds)
24
				)
25
				.apply(i, CatSoundVariant::new)
26
		);
27
	}
28
29
	public record CatSoundSet(
30
		Holder<SoundEvent> ambientSound,
31
		Holder<SoundEvent> strayAmbientSound,
32
		Holder<SoundEvent> hissSound,
33
		Holder<SoundEvent> hurtSound,
34
		Holder<SoundEvent> deathSound,
35
		Holder<SoundEvent> eatSound,
36
		Holder<SoundEvent> begForFoodSound,
37
		Holder<SoundEvent> purrSound,
38
		Holder<SoundEvent> purreowSound
39
	) {
40
		private static final Codec<CatSoundVariant.CatSoundSet> CODEC = RecordCodecBuilder.create(
41
			i -> i.group(
42
					SoundEvent.CODEC.fieldOf("ambient_sound").forGetter(CatSoundVariant.CatSoundSet::ambientSound),
43
					SoundEvent.CODEC.fieldOf("stray_ambient_sound").forGetter(CatSoundVariant.CatSoundSet::strayAmbientSound),
44
					SoundEvent.CODEC.fieldOf("hiss_sound").forGetter(CatSoundVariant.CatSoundSet::hissSound),
45
					SoundEvent.CODEC.fieldOf("hurt_sound").forGetter(CatSoundVariant.CatSoundSet::hurtSound),
46
					SoundEvent.CODEC.fieldOf("death_sound").forGetter(CatSoundVariant.CatSoundSet::deathSound),
47
					SoundEvent.CODEC.fieldOf("eat_sound").forGetter(CatSoundVariant.CatSoundSet::eatSound),
48
					SoundEvent.CODEC.fieldOf("beg_for_food_sound").forGetter(CatSoundVariant.CatSoundSet::begForFoodSound),
49
					SoundEvent.CODEC.fieldOf("purr_sound").forGetter(CatSoundVariant.CatSoundSet::purrSound),
50
					SoundEvent.CODEC.fieldOf("purreow_sound").forGetter(CatSoundVariant.CatSoundSet::purreowSound)
51
				)
52
				.apply(i, CatSoundVariant.CatSoundSet::new)
53
		);
54
	}
55
}
56

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