Skip to content

Commit bf6979e

Browse files
committed
Cleanup dynamic sounds patch, bump eviction time to 5 minutes
1 parent 803aaba commit bf6979e

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

common/src/main/java/org/embeddedt/modernfix/common/mixin/perf/dynamic_sounds/SoundBufferLibraryMixin.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@ public abstract class SoundBufferLibraryMixin {
2424
private static final boolean debugDynamicSoundLoading = Boolean.getBoolean("modernfix.debugDynamicSoundLoading");
2525

2626
@Shadow @Final @Mutable
27-
private Map<ResourceLocation, CompletableFuture<SoundBuffer>> cache =
28-
CacheBuilder.newBuilder()
29-
.expireAfterAccess(DynamicSoundHelpers.MAX_SOUND_LIFETIME_SECS, TimeUnit.SECONDS)
30-
// Excessive use of type hinting due to it assuming Object as the broadest correct type
31-
.<ResourceLocation, CompletableFuture<SoundBuffer>>removalListener(this::onSoundRemoval)
32-
.<ResourceLocation, CompletableFuture<SoundBuffer>>build()
33-
.asMap();
27+
private Map<ResourceLocation, CompletableFuture<SoundBuffer>> cache = CacheBuilder.newBuilder()
28+
.expireAfterAccess(DynamicSoundHelpers.MAX_SOUND_LIFETIME_SECS, TimeUnit.SECONDS)
29+
// Excessive use of type hinting due to it assuming Object as the broadest correct type
30+
.<ResourceLocation, CompletableFuture<SoundBuffer>>removalListener(this::onSoundRemoval)
31+
.build()
32+
.asMap();
3433

3534
private <K extends ResourceLocation, V extends CompletableFuture<SoundBuffer>> void onSoundRemoval(RemovalNotification<K, V> notification) {
3635
notification.getValue().thenAccept(SoundBuffer::discardAlBuffer);

common/src/main/java/org/embeddedt/modernfix/dynamicresources/DynamicSoundHelpers.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ public class DynamicSoundHelpers {
44
/**
55
* The duration until a sound is eligible for eviction if unused.
66
*/
7-
public static final int MAX_SOUND_LIFETIME_SECS = 120;
7+
public static final int MAX_SOUND_LIFETIME_SECS = 300;
88
}

0 commit comments

Comments
 (0)