So all I want to do is add a sound to the registry but for some reason it's not working. This is what I did:
public class SoundRegistrator
{
public static final SoundEvent BOND;
static {
BOND = addSoundsToRegistry("bond");
}
private static SoundEvent addSoundsToRegistry(String soundId) {
ResourceLocation shotSoundLocation = new ResourceLocation("pokalert", soundId);
SoundEvent soundEvent = new SoundEvent(shotSoundLocation);
soundEvent.setRegistryName(shotSoundLocation);
return soundEvent;
}
}
public class SoundRegisterListener
{
@SubscribeEvent(priority = EventPriority.NORMAL, receiveCanceled = true)
public void registerSOundEvents(RegistryEvent.Register<SoundEvent> event) {
event.getRegistry().registerAll(SoundRegistrator.BOND);
}
}
EntityPlayer player = Minecraft.getMinecraft().player;
EntityPlayerSP sp = (EntityPlayerSP)player;
ResourceLocation location = new ResourceLocation("pokalert", "bond");
SoundEvent sevent = new SoundEvent(location);
sp.playSound(sevent, 5.0f, 5.0f);
{
"bond": {
"category": "player",
"sounds": [{ "name": "pokalert:bond.ogg", "stream": true }]
}
}