Interface SoundFilterProvider
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Says how a sound comes through to the listener; registered with
SoundFilters.register(SoundFilterProvider). It is asked about every
sound the game plays, music and the menus included (SoundContext.relative()), as it starts and as it moves.
It is asked on the sound thread, so it must be quick and read only state that is safe to read from there (an
immutable snapshot the game thread swaps in, for example).
SoundFilters.register(sound -> sound.source() == SoundSource.HOSTILE ? SoundFilter.muffled(0.5F) : SoundFilter.NONE);
SoundFilters.register(SoundFilterProvider.inWorld(position -> walls.filter(position)));
-
Method Summary
Modifier and TypeMethodDescriptionfilter(SoundContext sound) The filter for this sound, orSoundFilter.NONEto leave it be.static SoundFilterProviderinWorld(Function<net.minecraft.world.phys.Vec3, SoundFilter> filter) A provider for the sounds at a place in the world only, by their place; music and the menus are left be.
-
Method Details
-
filter
The filter for this sound, orSoundFilter.NONEto leave it be. -
inWorld
A provider for the sounds at a place in the world only, by their place; music and the menus are left be.
-