Search in sources :

Example 1 with RaiderType

use of com.minecolonies.api.entity.mobs.RaiderType in project minecolonies by Minecolonies.

the class DefaultSoundProvider method run.

@Override
public void run(@NotNull final DirectoryCache cache) throws IOException {
    sounds = new JsonObject();
    final List<String> defaultMaleSounds = new ArrayList<>();
    defaultMaleSounds.add("minecolonies:mob/citizen/male/say1");
    defaultMaleSounds.add("minecolonies:mob/citizen/male/say2");
    defaultMaleSounds.add("minecolonies:mob/citizen/male/say3");
    final List<String> defaultFemaleSounds = new ArrayList<>();
    defaultFemaleSounds.add("minecolonies:mob/citizen/female/say1");
    defaultFemaleSounds.add("minecolonies:mob/citizen/female/say2");
    defaultFemaleSounds.add("minecolonies:mob/citizen/female/say3");
    final List<String> childSounds = new ArrayList<>();
    childSounds.add("minecolonies:mob/citizen/child/laugh1");
    childSounds.add("minecolonies:mob/citizen/child/laugh2");
    for (final JobEntry job : IJobRegistry.getInstance().getValues()) {
        if (job.getRegistryName().getNamespace().equals(Constants.MOD_ID) && !job.getRegistryName().getPath().equals("placeholder")) {
            for (final EventType soundEvents : EventType.values()) {
                sounds.add("mob." + job.getRegistryName().getPath() + ".male." + soundEvents.name().toLowerCase(Locale.US), createSoundJson("neutral", getDefaultProperties(), defaultMaleSounds));
                sounds.add("mob." + job.getRegistryName().getPath() + ".female." + soundEvents.name().toLowerCase(Locale.US), createSoundJson("neutral", getDefaultProperties(), defaultFemaleSounds));
            }
        }
    }
    for (final EventType soundEvents : EventType.values()) {
        sounds.add("mob.citizen.male." + soundEvents.name().toLowerCase(Locale.US), createSoundJson("neutral", getDefaultProperties(), defaultMaleSounds));
        sounds.add("mob.citizen.female." + soundEvents.name().toLowerCase(Locale.US), createSoundJson("neutral", getDefaultProperties(), defaultFemaleSounds));
    }
    for (final EventType soundEvents : EventType.values()) {
        sounds.add("mob.child.male." + soundEvents.name().toLowerCase(Locale.US), createSoundJson("neutral", getDefaultProperties(), childSounds));
        sounds.add("mob.child.female." + soundEvents.name().toLowerCase(Locale.US), createSoundJson("neutral", getDefaultProperties(), childSounds));
    }
    for (final RaiderType type : RaiderType.values()) {
        sounds.add("mob." + type.name().toLowerCase(Locale.US) + ".death", createSoundJson("hostile", getDefaultProperties(), ImmutableList.of("minecolonies:mob/barbarian/death")));
        sounds.add("mob." + type.name().toLowerCase(Locale.US) + ".say", createSoundJson("hostile", getDefaultProperties(), ImmutableList.of("minecolonies:mob/barbarian/say")));
        sounds.add("mob." + type.name().toLowerCase(Locale.US) + ".hurt", createSoundJson("hostile", getDefaultProperties(), ImmutableList.of("minecolonies:mob/barbarian/hurt1", "minecolonies:mob/barbarian/hurt2", "minecolonies:mob/barbarian/hurt3", "minecolonies:mob/barbarian/hurt4")));
    }
    sounds.add("mob.citizen.snore", createSoundJson("neutral", getDefaultProperties(), ImmutableList.of("minecolonies:mob/citizen/snore")));
    JsonObject tavernProperties = getDefaultProperties();
    tavernProperties.addProperty("attenuation_distance", 23);
    tavernProperties.addProperty("stream", true);
    tavernProperties.addProperty("comment", "Credits to Darren Curtis - Fireside Tales");
    sounds.add("tile.tavern.tavern_theme", createSoundJson("music", tavernProperties, ImmutableList.of("minecolonies:tile/tavern/tavern_theme")));
    sounds.add("mob.mercenary.attack", createSoundJson("neutral", getDefaultProperties(), ImmutableList.of("minecolonies:mob/mercenary/attack/attack1", "minecolonies:mob/mercenary/attack/attack2", "minecolonies:mob/mercenary/attack/attack3", "minecolonies:mob/mercenary/attack/attack4")));
    sounds.add("mob.mercenary.celebrate", createSoundJson("neutral", getDefaultProperties(), ImmutableList.of("minecolonies:mob/mercenary/celebrate/celebrate1")));
    sounds.add("mob.mercenary.die", createSoundJson("neutral", getDefaultProperties(), ImmutableList.of("minecolonies:mob/mercenary/die/death1", "minecolonies:mob/mercenary/die/death2")));
    sounds.add("mob.mercenary.hurt", createSoundJson("neutral", getDefaultProperties(), ImmutableList.of("minecolonies:mob/mercenary/hurt/hurt1", "minecolonies:mob/mercenary/hurt/hurt2", "minecolonies:mob/mercenary/hurt/hurt3")));
    sounds.add("mob.mercenary.say", createSoundJson("neutral", getDefaultProperties(), ImmutableList.of("minecolonies:mob/mercenary/say/say1", "minecolonies:mob/mercenary/say/say2", "minecolonies:mob/mercenary/say/say3")));
    sounds.add("mob.mercenary.step", createSoundJson("neutral", getDefaultProperties(), ImmutableList.of("minecolonies:mob/mercenary/step/step1", "minecolonies:mob/mercenary/step/step2", "minecolonies:mob/mercenary/step/step3", "minecolonies:mob/mercenary/step/step4")));
    add("record", false, "raid.raid_alert", "raid.raid_alert_early", "raid.raid_won", "raid.raid_won_early");
    add("music", true, "raid.desert.desert_raid", "raid.desert.desert_raid_warning", "raid.desert.desert_raid_victory", "raid.amazon.amazon_raid");
    final Path savePath = generator.getOutputFolder().resolve(DataGeneratorConstants.ASSETS_DIR).resolve("sounds.json");
    IDataProvider.save(DataGeneratorConstants.GSON, cache, sounds, savePath);
}
Also used : JobEntry(com.minecolonies.api.colony.jobs.registry.JobEntry) Path(java.nio.file.Path) EventType(com.minecolonies.api.sounds.EventType) RaiderType(com.minecolonies.api.entity.mobs.RaiderType) ArrayList(java.util.ArrayList) JsonObject(com.google.gson.JsonObject)

Example 2 with RaiderType

use of com.minecolonies.api.entity.mobs.RaiderType in project minecolonies by Minecolonies.

the class ModSoundEvents method registerSounds.

/**
 * Register the {@link SoundEvent}s.
 *
 * @param registry the registry to register at.
 */
public static void registerSounds(final IForgeRegistry<SoundEvent> registry) {
    for (final JobEntry job : IJobRegistry.getInstance().getValues()) {
        if (job.getRegistryName().getNamespace().equals(Constants.MOD_ID) && !job.getRegistryName().getPath().equals("placeholder")) {
            final Map<EventType, Tuple<SoundEvent, SoundEvent>> map = new HashMap<>();
            for (final EventType soundEvents : EventType.values()) {
                final SoundEvent maleSoundEvent = ModSoundEvents.getSoundID("mob." + job.getRegistryName().getPath() + ".male." + soundEvents.name().toLowerCase(Locale.US));
                final SoundEvent femaleSoundEvent = ModSoundEvents.getSoundID("mob." + job.getRegistryName().getPath() + ".female." + soundEvents.name().toLowerCase(Locale.US));
                registry.register(maleSoundEvent);
                registry.register(femaleSoundEvent);
                map.put(soundEvents, new Tuple<>(maleSoundEvent, femaleSoundEvent));
            }
            CITIZEN_SOUND_EVENTS.put(job.getRegistryName().getPath(), map);
        }
    }
    final Map<EventType, Tuple<SoundEvent, SoundEvent>> citizenMap = new HashMap<>();
    for (final EventType soundEvents : EventType.values()) {
        final SoundEvent maleSoundEvent = ModSoundEvents.getSoundID("mob.citizen.male." + soundEvents.name().toLowerCase(Locale.US));
        final SoundEvent femaleSoundEvent = ModSoundEvents.getSoundID("mob.citizen.female." + soundEvents.name().toLowerCase(Locale.US));
        registry.register(maleSoundEvent);
        registry.register(femaleSoundEvent);
        citizenMap.put(soundEvents, new Tuple<>(maleSoundEvent, femaleSoundEvent));
    }
    CITIZEN_SOUND_EVENTS.put("citizen", citizenMap);
    final Map<EventType, Tuple<SoundEvent, SoundEvent>> childMap = new HashMap<>();
    for (final EventType soundEvents : EventType.values()) {
        final SoundEvent maleSoundEvent = ModSoundEvents.getSoundID("mob.child.male." + soundEvents.name().toLowerCase(Locale.US));
        final SoundEvent femaleSoundEvent = ModSoundEvents.getSoundID("mob.child.female." + soundEvents.name().toLowerCase(Locale.US));
        registry.register(maleSoundEvent);
        registry.register(femaleSoundEvent);
        childMap.put(soundEvents, new Tuple<>(maleSoundEvent, femaleSoundEvent));
    }
    CITIZEN_SOUND_EVENTS.put("child", childMap);
    registry.register(TavernSounds.tavernTheme);
    for (final RaiderType raiderType : RaiderType.values()) {
        final SoundEvent raiderHurt = ModSoundEvents.getSoundID("mob." + raiderType.name().toLowerCase(Locale.US) + ".hurt");
        final SoundEvent raiderDeath = ModSoundEvents.getSoundID("mob." + raiderType.name().toLowerCase(Locale.US) + ".death");
        final SoundEvent raiderSay = ModSoundEvents.getSoundID("mob." + raiderType.name().toLowerCase(Locale.US) + ".say");
        registry.register(raiderHurt);
        registry.register(raiderDeath);
        registry.register(raiderSay);
        final Map<RaiderSounds.RaiderSoundTypes, SoundEvent> sounds = new HashMap<>();
        sounds.put(RaiderSounds.RaiderSoundTypes.HURT, raiderHurt);
        sounds.put(RaiderSounds.RaiderSoundTypes.DEATH, raiderDeath);
        sounds.put(RaiderSounds.RaiderSoundTypes.SAY, raiderSay);
        RaiderSounds.raiderSounds.put(raiderType, sounds);
    }
    registry.register(RaidSounds.WARNING);
    registry.register(RaidSounds.WARNING_EARLY);
    registry.register(RaidSounds.VICTORY);
    registry.register(RaidSounds.VICTORY_EARLY);
    registry.register(RaidSounds.AMAZON_RAID);
    registry.register(RaidSounds.DESERT_RAID);
    registry.register(RaidSounds.DESERT_RAID_WARNING);
    registry.register(MercenarySounds.mercenaryAttack);
    registry.register(MercenarySounds.mercenaryCelebrate);
    registry.register(MercenarySounds.mercenaryDie);
    registry.register(MercenarySounds.mercenaryHurt);
    registry.register(MercenarySounds.mercenarySay);
    registry.register(MercenarySounds.mercenaryStep);
}
Also used : JobEntry(com.minecolonies.api.colony.jobs.registry.JobEntry) SoundEvent(net.minecraft.util.SoundEvent) HashMap(java.util.HashMap) RaiderType(com.minecolonies.api.entity.mobs.RaiderType) Tuple(com.minecolonies.api.util.Tuple)

Example 3 with RaiderType

use of com.minecolonies.api.entity.mobs.RaiderType in project minecolonies by ldtteam.

the class ModSoundEvents method registerSounds.

/**
 * Register the {@link SoundEvent}s.
 *
 * @param registry the registry to register at.
 */
public static void registerSounds(final IForgeRegistry<SoundEvent> registry) {
    for (final JobEntry job : IJobRegistry.getInstance().getValues()) {
        if (job.getRegistryName().getNamespace().equals(Constants.MOD_ID) && !job.getRegistryName().getPath().equals("placeholder")) {
            final Map<EventType, Tuple<SoundEvent, SoundEvent>> map = new HashMap<>();
            for (final EventType soundEvents : EventType.values()) {
                final SoundEvent maleSoundEvent = ModSoundEvents.getSoundID("mob." + job.getRegistryName().getPath() + ".male." + soundEvents.name().toLowerCase(Locale.US));
                final SoundEvent femaleSoundEvent = ModSoundEvents.getSoundID("mob." + job.getRegistryName().getPath() + ".female." + soundEvents.name().toLowerCase(Locale.US));
                registry.register(maleSoundEvent);
                registry.register(femaleSoundEvent);
                map.put(soundEvents, new Tuple<>(maleSoundEvent, femaleSoundEvent));
            }
            CITIZEN_SOUND_EVENTS.put(job.getRegistryName().getPath(), map);
        }
    }
    final Map<EventType, Tuple<SoundEvent, SoundEvent>> citizenMap = new HashMap<>();
    for (final EventType soundEvents : EventType.values()) {
        final SoundEvent maleSoundEvent = ModSoundEvents.getSoundID("mob.citizen.male." + soundEvents.name().toLowerCase(Locale.US));
        final SoundEvent femaleSoundEvent = ModSoundEvents.getSoundID("mob.citizen.female." + soundEvents.name().toLowerCase(Locale.US));
        registry.register(maleSoundEvent);
        registry.register(femaleSoundEvent);
        citizenMap.put(soundEvents, new Tuple<>(maleSoundEvent, femaleSoundEvent));
    }
    CITIZEN_SOUND_EVENTS.put("citizen", citizenMap);
    final Map<EventType, Tuple<SoundEvent, SoundEvent>> childMap = new HashMap<>();
    for (final EventType soundEvents : EventType.values()) {
        final SoundEvent maleSoundEvent = ModSoundEvents.getSoundID("mob.child.male." + soundEvents.name().toLowerCase(Locale.US));
        final SoundEvent femaleSoundEvent = ModSoundEvents.getSoundID("mob.child.female." + soundEvents.name().toLowerCase(Locale.US));
        registry.register(maleSoundEvent);
        registry.register(femaleSoundEvent);
        childMap.put(soundEvents, new Tuple<>(maleSoundEvent, femaleSoundEvent));
    }
    CITIZEN_SOUND_EVENTS.put("child", childMap);
    registry.register(TavernSounds.tavernTheme);
    for (final RaiderType raiderType : RaiderType.values()) {
        final SoundEvent raiderHurt = ModSoundEvents.getSoundID("mob." + raiderType.name().toLowerCase(Locale.US) + ".hurt");
        final SoundEvent raiderDeath = ModSoundEvents.getSoundID("mob." + raiderType.name().toLowerCase(Locale.US) + ".death");
        final SoundEvent raiderSay = ModSoundEvents.getSoundID("mob." + raiderType.name().toLowerCase(Locale.US) + ".say");
        registry.register(raiderHurt);
        registry.register(raiderDeath);
        registry.register(raiderSay);
        final Map<RaiderSounds.RaiderSoundTypes, SoundEvent> sounds = new HashMap<>();
        sounds.put(RaiderSounds.RaiderSoundTypes.HURT, raiderHurt);
        sounds.put(RaiderSounds.RaiderSoundTypes.DEATH, raiderDeath);
        sounds.put(RaiderSounds.RaiderSoundTypes.SAY, raiderSay);
        RaiderSounds.raiderSounds.put(raiderType, sounds);
    }
    registry.register(RaidSounds.WARNING);
    registry.register(RaidSounds.WARNING_EARLY);
    registry.register(RaidSounds.VICTORY);
    registry.register(RaidSounds.VICTORY_EARLY);
    registry.register(RaidSounds.AMAZON_RAID);
    registry.register(RaidSounds.DESERT_RAID);
    registry.register(RaidSounds.DESERT_RAID_WARNING);
    registry.register(MercenarySounds.mercenaryAttack);
    registry.register(MercenarySounds.mercenaryCelebrate);
    registry.register(MercenarySounds.mercenaryDie);
    registry.register(MercenarySounds.mercenaryHurt);
    registry.register(MercenarySounds.mercenarySay);
    registry.register(MercenarySounds.mercenaryStep);
}
Also used : JobEntry(com.minecolonies.api.colony.jobs.registry.JobEntry) SoundEvent(net.minecraft.util.SoundEvent) HashMap(java.util.HashMap) RaiderType(com.minecolonies.api.entity.mobs.RaiderType) Tuple(com.minecolonies.api.util.Tuple)

Example 4 with RaiderType

use of com.minecolonies.api.entity.mobs.RaiderType in project minecolonies by ldtteam.

the class DefaultSoundProvider method run.

@Override
public void run(@NotNull final DirectoryCache cache) throws IOException {
    sounds = new JsonObject();
    final List<String> defaultMaleSounds = new ArrayList<>();
    defaultMaleSounds.add("minecolonies:mob/citizen/male/say1");
    defaultMaleSounds.add("minecolonies:mob/citizen/male/say2");
    defaultMaleSounds.add("minecolonies:mob/citizen/male/say3");
    final List<String> defaultFemaleSounds = new ArrayList<>();
    defaultFemaleSounds.add("minecolonies:mob/citizen/female/say1");
    defaultFemaleSounds.add("minecolonies:mob/citizen/female/say2");
    defaultFemaleSounds.add("minecolonies:mob/citizen/female/say3");
    final List<String> childSounds = new ArrayList<>();
    childSounds.add("minecolonies:mob/citizen/child/laugh1");
    childSounds.add("minecolonies:mob/citizen/child/laugh2");
    for (final JobEntry job : IJobRegistry.getInstance().getValues()) {
        if (job.getRegistryName().getNamespace().equals(Constants.MOD_ID) && !job.getRegistryName().getPath().equals("placeholder")) {
            for (final EventType soundEvents : EventType.values()) {
                sounds.add("mob." + job.getRegistryName().getPath() + ".male." + soundEvents.name().toLowerCase(Locale.US), createSoundJson("neutral", getDefaultProperties(), defaultMaleSounds));
                sounds.add("mob." + job.getRegistryName().getPath() + ".female." + soundEvents.name().toLowerCase(Locale.US), createSoundJson("neutral", getDefaultProperties(), defaultFemaleSounds));
            }
        }
    }
    for (final EventType soundEvents : EventType.values()) {
        sounds.add("mob.citizen.male." + soundEvents.name().toLowerCase(Locale.US), createSoundJson("neutral", getDefaultProperties(), defaultMaleSounds));
        sounds.add("mob.citizen.female." + soundEvents.name().toLowerCase(Locale.US), createSoundJson("neutral", getDefaultProperties(), defaultFemaleSounds));
    }
    for (final EventType soundEvents : EventType.values()) {
        sounds.add("mob.child.male." + soundEvents.name().toLowerCase(Locale.US), createSoundJson("neutral", getDefaultProperties(), childSounds));
        sounds.add("mob.child.female." + soundEvents.name().toLowerCase(Locale.US), createSoundJson("neutral", getDefaultProperties(), childSounds));
    }
    for (final RaiderType type : RaiderType.values()) {
        sounds.add("mob." + type.name().toLowerCase(Locale.US) + ".death", createSoundJson("hostile", getDefaultProperties(), ImmutableList.of("minecolonies:mob/barbarian/death")));
        sounds.add("mob." + type.name().toLowerCase(Locale.US) + ".say", createSoundJson("hostile", getDefaultProperties(), ImmutableList.of("minecolonies:mob/barbarian/say")));
        sounds.add("mob." + type.name().toLowerCase(Locale.US) + ".hurt", createSoundJson("hostile", getDefaultProperties(), ImmutableList.of("minecolonies:mob/barbarian/hurt1", "minecolonies:mob/barbarian/hurt2", "minecolonies:mob/barbarian/hurt3", "minecolonies:mob/barbarian/hurt4")));
    }
    sounds.add("mob.citizen.snore", createSoundJson("neutral", getDefaultProperties(), ImmutableList.of("minecolonies:mob/citizen/snore")));
    JsonObject tavernProperties = getDefaultProperties();
    tavernProperties.addProperty("attenuation_distance", 23);
    tavernProperties.addProperty("stream", true);
    tavernProperties.addProperty("comment", "Credits to Darren Curtis - Fireside Tales");
    sounds.add("tile.tavern.tavern_theme", createSoundJson("music", tavernProperties, ImmutableList.of("minecolonies:tile/tavern/tavern_theme")));
    sounds.add("mob.mercenary.attack", createSoundJson("neutral", getDefaultProperties(), ImmutableList.of("minecolonies:mob/mercenary/attack/attack1", "minecolonies:mob/mercenary/attack/attack2", "minecolonies:mob/mercenary/attack/attack3", "minecolonies:mob/mercenary/attack/attack4")));
    sounds.add("mob.mercenary.celebrate", createSoundJson("neutral", getDefaultProperties(), ImmutableList.of("minecolonies:mob/mercenary/celebrate/celebrate1")));
    sounds.add("mob.mercenary.die", createSoundJson("neutral", getDefaultProperties(), ImmutableList.of("minecolonies:mob/mercenary/die/death1", "minecolonies:mob/mercenary/die/death2")));
    sounds.add("mob.mercenary.hurt", createSoundJson("neutral", getDefaultProperties(), ImmutableList.of("minecolonies:mob/mercenary/hurt/hurt1", "minecolonies:mob/mercenary/hurt/hurt2", "minecolonies:mob/mercenary/hurt/hurt3")));
    sounds.add("mob.mercenary.say", createSoundJson("neutral", getDefaultProperties(), ImmutableList.of("minecolonies:mob/mercenary/say/say1", "minecolonies:mob/mercenary/say/say2", "minecolonies:mob/mercenary/say/say3")));
    sounds.add("mob.mercenary.step", createSoundJson("neutral", getDefaultProperties(), ImmutableList.of("minecolonies:mob/mercenary/step/step1", "minecolonies:mob/mercenary/step/step2", "minecolonies:mob/mercenary/step/step3", "minecolonies:mob/mercenary/step/step4")));
    add("record", false, "raid.raid_alert", "raid.raid_alert_early", "raid.raid_won", "raid.raid_won_early");
    add("music", true, "raid.desert.desert_raid", "raid.desert.desert_raid_warning", "raid.desert.desert_raid_victory", "raid.amazon.amazon_raid");
    final Path savePath = generator.getOutputFolder().resolve(DataGeneratorConstants.ASSETS_DIR).resolve("sounds.json");
    IDataProvider.save(DataGeneratorConstants.GSON, cache, sounds, savePath);
}
Also used : JobEntry(com.minecolonies.api.colony.jobs.registry.JobEntry) Path(java.nio.file.Path) EventType(com.minecolonies.api.sounds.EventType) RaiderType(com.minecolonies.api.entity.mobs.RaiderType) ArrayList(java.util.ArrayList) JsonObject(com.google.gson.JsonObject)

Aggregations

JobEntry (com.minecolonies.api.colony.jobs.registry.JobEntry)4 RaiderType (com.minecolonies.api.entity.mobs.RaiderType)4 JsonObject (com.google.gson.JsonObject)2 EventType (com.minecolonies.api.sounds.EventType)2 Tuple (com.minecolonies.api.util.Tuple)2 Path (java.nio.file.Path)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 SoundEvent (net.minecraft.util.SoundEvent)2