Cleanup dynamic sounds patch, bump eviction time to 5 minutes
This commit is contained in:
parent
803aaba204
commit
bf6979e45b
|
|
@ -24,13 +24,12 @@ public abstract class SoundBufferLibraryMixin {
|
||||||
private static final boolean debugDynamicSoundLoading = Boolean.getBoolean("modernfix.debugDynamicSoundLoading");
|
private static final boolean debugDynamicSoundLoading = Boolean.getBoolean("modernfix.debugDynamicSoundLoading");
|
||||||
|
|
||||||
@Shadow @Final @Mutable
|
@Shadow @Final @Mutable
|
||||||
private Map<ResourceLocation, CompletableFuture<SoundBuffer>> cache =
|
private Map<ResourceLocation, CompletableFuture<SoundBuffer>> cache = CacheBuilder.newBuilder()
|
||||||
CacheBuilder.newBuilder()
|
.expireAfterAccess(DynamicSoundHelpers.MAX_SOUND_LIFETIME_SECS, TimeUnit.SECONDS)
|
||||||
.expireAfterAccess(DynamicSoundHelpers.MAX_SOUND_LIFETIME_SECS, TimeUnit.SECONDS)
|
// Excessive use of type hinting due to it assuming Object as the broadest correct type
|
||||||
// Excessive use of type hinting due to it assuming Object as the broadest correct type
|
.<ResourceLocation, CompletableFuture<SoundBuffer>>removalListener(this::onSoundRemoval)
|
||||||
.<ResourceLocation, CompletableFuture<SoundBuffer>>removalListener(this::onSoundRemoval)
|
.build()
|
||||||
.<ResourceLocation, CompletableFuture<SoundBuffer>>build()
|
.asMap();
|
||||||
.asMap();
|
|
||||||
|
|
||||||
private <K extends ResourceLocation, V extends CompletableFuture<SoundBuffer>> void onSoundRemoval(RemovalNotification<K, V> notification) {
|
private <K extends ResourceLocation, V extends CompletableFuture<SoundBuffer>> void onSoundRemoval(RemovalNotification<K, V> notification) {
|
||||||
notification.getValue().thenAccept(SoundBuffer::discardAlBuffer);
|
notification.getValue().thenAccept(SoundBuffer::discardAlBuffer);
|
||||||
|
|
|
||||||
|
|
@ -4,5 +4,5 @@ public class DynamicSoundHelpers {
|
||||||
/**
|
/**
|
||||||
* The duration until a sound is eligible for eviction if unused.
|
* The duration until a sound is eligible for eviction if unused.
|
||||||
*/
|
*/
|
||||||
public static final int MAX_SOUND_LIFETIME_SECS = 120;
|
public static final int MAX_SOUND_LIFETIME_SECS = 300;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user