Skip to content

Commit

Permalink
Add SoundEventConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Jun 19, 2024
1 parent ba5efa3 commit aef0f1f
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public class ConfigurableType {
public static final ConfigurableType LOOT_NUMBER_PROVIDER = new ConfigurableType(true, LootNumberProviderConfig.class, new ConfigurableTypeActionForge<>(), "loot_number_provider");
public static final ConfigurableType LOOT_NBT_PROVIDER = new ConfigurableType(true, LootNbtProviderConfig.class, new ConfigurableTypeActionForge<>(), "loot_nbt_provider");
public static final ConfigurableType LOOT_SCORE_PROVIDER = new ConfigurableType(true, LootScoreProviderConfig.class, new ConfigurableTypeActionForge<>(), "loot_score_provider");
public static final ConfigurableType SOUND_EVENT = new ConfigurableType(true, SoundEventConfig.class, new ConfigurableTypeActionForge<>(), "sound_event");

/**
* Dummy type, only used for configs that refer to nothing.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package org.cyclops.cyclopscore.config.extendedconfig;

import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.sounds.SoundEvent;
import org.cyclops.cyclopscore.config.ConfigurableType;
import org.cyclops.cyclopscore.init.ModBase;

import java.util.function.Function;

/**
* Config for sound events.
* @author rubensworks
* @see ExtendedConfig
*/
public abstract class SoundEventConfig extends ExtendedConfigForge<SoundEventConfig, SoundEvent>{

public SoundEventConfig(ModBase mod, String namedId, Function<SoundEventConfig, SoundEvent> elementConstructor) {
super(mod, namedId, elementConstructor);
}

@Override
public String getTranslationKey() {
return "sound_events." + getMod().getModId() + "." + getNamedId();
}

@Override
public ConfigurableType getConfigurableType() {
return ConfigurableType.SOUND_EVENT;
}

@Override
public Registry<? super SoundEvent> getRegistry() {
return BuiltInRegistries.SOUND_EVENT;
}
}

0 comments on commit aef0f1f

Please sign in to comment.