Skip to content

Commit

Permalink
Simplify SoundEngine access
Browse files Browse the repository at this point in the history
  • Loading branch information
LostLuma committed Dec 16, 2023
1 parent 9823168 commit 16db344
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/main/java/dynamic_fps/impl/DynamicFPSMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public static void handleStateChange(PowerState previous, PowerState current) {

for (var source : SoundSource.values()) {
if (before.volumeMultiplier(source) != config.volumeMultiplier(source)) {
minecraft.getSoundManager().dynamic_fps$updateVolume(source);
minecraft.getSoundManager().soundEngine.dynamic_fps$updateVolume(source);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/dynamic_fps/impl/mixin/SoundEngineMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@
import com.mojang.blaze3d.audio.Listener;

import dynamic_fps.impl.DynamicFPSMod;
import dynamic_fps.impl.util.duck.DuckSoundManager;
import dynamic_fps.impl.util.duck.DuckSoundEngine;
import net.minecraft.client.resources.sounds.SoundInstance;
import net.minecraft.client.sounds.ChannelAccess;
import net.minecraft.client.sounds.SoundEngine;
import net.minecraft.sounds.SoundSource;

@Mixin(SoundEngine.class)
public class SoundEngineMixin implements DuckSoundManager {
public class SoundEngineMixin implements DuckSoundEngine {
@Shadow
private boolean loaded;

Expand Down
21 changes: 0 additions & 21 deletions src/main/java/dynamic_fps/impl/mixin/SoundManagerMixin.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import net.minecraft.sounds.SoundSource;

public interface DuckSoundManager {
public interface DuckSoundEngine {
public default void dynamic_fps$updateVolume(SoundSource source) {
throw new RuntimeException("No implementation for dynamic_fps$updateVolume was found.");
}
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/dynamic_fps.accesswidener
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
accessWidener v2 named

accessible field com/mojang/blaze3d/platform/Window window J
accessible field net/minecraft/client/sounds/SoundManager soundEngine Lnet/minecraft/client/sounds/SoundEngine;
1 change: 0 additions & 1 deletion src/main/resources/dynamic_fps.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"MinecraftMixin",
"ScreenMixin",
"SoundEngineMixin",
"SoundManagerMixin",
"StatsScreenMixin",
"ToastComponentMixin",
"WindowMixin",
Expand Down
3 changes: 1 addition & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@
"loom:injected_interfaces": {
"net/minecraft/class_437": ["dynamic_fps/impl/util/duck/DuckScreen"],
"net/minecraft/class_425": ["dynamic_fps/impl/util/duck/DuckSplashOverlay"],
"net/minecraft/class_1140": ["dynamic_fps/impl/util/duck/DuckSoundManager"],
"net/minecraft/class_1144": ["dynamic_fps/impl/util/duck/DuckSoundManager"]
"net/minecraft/class_1140": ["dynamic_fps/impl/util/duck/DuckSoundEngine"]
},
"dynamic_fps": {
"optimized_screens": {
Expand Down

0 comments on commit 16db344

Please sign in to comment.