SoundCategory .java

net.minecraft.client.audio.SoundCategory (enum, 57 lines): members: MASTER, MUSIC, RECORDS, WEATHER, BLOCKS, MOBS, ANIMALS, PLAYERS, AMBIENT, categoryName.

net.minecraft.client.audioenum57 linesclient1.6 KB

API Surface (3)

String getCategoryName()
int getCategoryId()
SoundCategory getCategory(String name)

Fields & Constants (4)

NAME_CATEGORY_MAP
ID_CATEGORY_MAP
categoryName
categoryId

String literals (9)

"master"
"music"
"record"
"weather"
"block"
"hostile"
"neutral"
"player"
"ambient"

Full Source

SoundCategory.java57 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.client.audio;
2
3
import com.google.common.collect.Maps;
4
import java.util.Map;
5
6
public enum SoundCategory
7
{
8
    MASTER("master", 0),
9
    MUSIC("music", 1),
10
    RECORDS("record", 2),
11
    WEATHER("weather", 3),
12
    BLOCKS("block", 4),
13
    MOBS("hostile", 5),
14
    ANIMALS("neutral", 6),
15
    PLAYERS("player", 7),
16
    AMBIENT("ambient", 8);
17
18
    private static final Map<String, SoundCategory> NAME_CATEGORY_MAP = Maps.<String, SoundCategory>newHashMap();
19
    private static final Map<Integer, SoundCategory> ID_CATEGORY_MAP = Maps.<Integer, SoundCategory>newHashMap();
20
    private final String categoryName;
21
    private final int categoryId;
22
23
    private SoundCategory(String name, int id)
24
    {
25
        this.categoryName = name;
26
        this.categoryId = id;
27
    }
28
29
    public String getCategoryName()
30
    {
31
        return this.categoryName;
32
    }
33
34
    public int getCategoryId()
35
    {
36
        return this.categoryId;
37
    }
38
39
    public static SoundCategory getCategory(String name)
40
    {
41
        return (SoundCategory)NAME_CATEGORY_MAP.get(name);
42
    }
43
44
    static {
45
        for (SoundCategory soundcategory : values())
46
        {
47
            if (NAME_CATEGORY_MAP.containsKey(soundcategory.getCategoryName()) || ID_CATEGORY_MAP.containsKey(Integer.valueOf(soundcategory.getCategoryId())))
48
            {
49
                throw new Error("Clash in Sound Category ID & Name pools! Cannot insert " + soundcategory);
50
            }
51
52
            NAME_CATEGORY_MAP.put(soundcategory.getCategoryName(), soundcategory);
53
            ID_CATEGORY_MAP.put(Integer.valueOf(soundcategory.getCategoryId()), soundcategory);
54
        }
55
    }
56
}
57

Deobfuscated MCP 1.8.9 source of SoundCategory from Marcelektro/MavenMCP-1.8.9 (net/minecraft/client/audio/SoundCategory.java), stored verbatim.