Search in sources :

Example 1 with LanternSoundType

use of org.lanternpowered.server.effect.sound.LanternSoundType in project LanternServer by LanternPowered.

the class SoundTypeRegistryModule method registerDefaults.

@Override
public void registerDefaults() {
    final Gson gson = new Gson();
    final JsonArray array = gson.fromJson(new BufferedReader(new InputStreamReader(SoundTypeRegistryModule.class.getResourceAsStream("/internal/sound_events.json"))), JsonArray.class);
    for (int i = 0; i < array.size(); i++) {
        final String name = array.get(i).getAsString();
        final String id = name.replaceAll("\\.", "_");
        register(new LanternSoundType("minecraft", id, name, i));
    }
}
Also used : JsonArray(com.google.gson.JsonArray) LanternSoundType(org.lanternpowered.server.effect.sound.LanternSoundType) InputStreamReader(java.io.InputStreamReader) BufferedReader(java.io.BufferedReader) Gson(com.google.gson.Gson)

Aggregations

Gson (com.google.gson.Gson)1 JsonArray (com.google.gson.JsonArray)1 BufferedReader (java.io.BufferedReader)1 InputStreamReader (java.io.InputStreamReader)1 LanternSoundType (org.lanternpowered.server.effect.sound.LanternSoundType)1