use of net.minecraft.util.SoundEvent in project Railcraft by Railcraft.
the class SoundHelper method playBlockSound.
//TODO: test
public static void playBlockSound(World world, BlockPos pos, SoundEvent sound, SoundCategory category, float volume, float pitch, IBlockState state) {
if (world != null && sound != null) {
ResourceLocation soundPath = ReflectionHelper.getPrivateValue(SoundEvent.class, sound, 1);
if (matchesSoundResource(soundPath, "override")) {
SoundType blockSound = SoundRegistry.getBlockSound(state, world, pos);
if (blockSound != null) {
SoundEvent newSound = matchSoundEvent(soundPath, blockSound);
playSound(world, null, pos, newSound, category, volume, pitch * blockSound.getPitch());
}
}
playSound(world, null, pos, sound, category, volume, pitch);
}
}
use of net.minecraft.util.SoundEvent in project VanillaTeleporter by dyeo.
the class ModSounds method registerSound.
private static SoundEvent registerSound(String name) {
ResourceLocation location = new ResourceLocation(TeleporterMod.MODID, name);
SoundEvent event = new SoundEvent(location);
SoundEvent.REGISTRY.register(size, location, event);
size++;
return event;
}
Aggregations