- 103
- 2
- 2
Айди звука регистрируется
Sounds.JSON находится в src\main\resources\assets\differentthings
в JSON написано
При возпроизведении звука с помощью
worldIn.playSound((EntityPlayer)null, playerIn.posX, playerIn.posY, playerIn.posZ, Sounds.test, SoundCategory.PLAYERS, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
Выдаёт в консоли "Unable to play unknown soundEvent: differentthings:bashkiriya"
Что я не так сделал?
Код:
package com.alexincube.differentthings;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
public class Sounds
{
public static SoundEvent test;
public static void registerSounds()
{
test = registerSound("bashkiriya");
}
private static SoundEvent registerSound(String name)
{
ResourceLocation location = new ResourceLocation("differentthings", name);
SoundEvent event = new SoundEvent(location);
event.setRegistryName(name);
ForgeRegistries.SOUND_EVENTS.register(event);
return event;
}
}
в JSON написано
Код:
{
"bashkiriya":
{
"category":"record",
"sounds":
[
{
"name":"differentthings:sounds/block/bashkiriya",
"stream":true
}
]
}
}
При возпроизведении звука с помощью
worldIn.playSound((EntityPlayer)null, playerIn.posX, playerIn.posY, playerIn.posZ, Sounds.test, SoundCategory.PLAYERS, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
Выдаёт в консоли "Unable to play unknown soundEvent: differentthings:bashkiriya"
Что я не так сделал?