Skip to content

Commit 5b7a94e

Browse files
committed
Fixed an issue with updating from the Original IMP Mod
1 parent d0aadb1 commit 5b7a94e

File tree

3 files changed

+51
-5
lines changed

3 files changed

+51
-5
lines changed

common/src/main/java/dev/felnull/imp/IMPConfig.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ public class IMPConfig implements ConfigData {
2424
public boolean useYoutubeDownloader = true;
2525

2626
@ConfigEntry.Category("client")
27-
public String relayServerURL = "https://raw.githubusercontent.com/TeamFelnull/IamMusicPlayer/master/relay_server.json";
27+
public String relayServerURL =
28+
"https://raw.githubusercontent.com/TeamFelnull/IamMusicPlayer/master/relay_server.json";
2829

2930
@ConfigEntry.Category("client")
30-
public String lavaPlayerNativesURL = "https://raw.githubusercontent.com/Mod-Sauce/test_lavaplayer_IMP/refs/heads/main/lavaplayer/natives_link.json";
31+
public String lavaPlayerNativesURL =
32+
"https://raw.githubusercontent.com/Mod-Sauce/test_lavaplayer_IMP/refs/heads/main/lavaplayer/natives_link.json";
3133

3234
@ConfigEntry.Category("client")
3335
public boolean hideDisplaySprite = false;
@@ -56,4 +58,8 @@ public class IMPConfig implements ConfigData {
5658

5759
@ConfigEntry.Category("debug")
5860
public boolean showSpeakerRange = false;
61+
62+
@ConfigEntry.Category("internal")
63+
@ConfigEntry.Gui.Excluded
64+
public String configVersion = "1";
5965
}

common/src/main/java/dev/felnull/imp/IamMusicPlayer.java

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,16 @@
1818
import me.shedaniel.autoconfig.serializer.Toml4jConfigSerializer;
1919

2020
public class IamMusicPlayer {
21-
public static final IMPConfig CONFIG = AutoConfig.register(IMPConfig.class, Toml4jConfigSerializer::new).getConfig();
21+
22+
public static final IMPConfig CONFIG = AutoConfig.register(
23+
IMPConfig.class,
24+
Toml4jConfigSerializer::new
25+
).getConfig();
2226
public static final String MODID = "iammusicplayer";
23-
private static final Supplier<String> MODNAME = Suppliers.memoize(() -> Platform.getMod(MODID).getName());
27+
public static final String CONFIG_VERSION = "1";
28+
private static final Supplier<String> MODNAME = Suppliers.memoize(() ->
29+
Platform.getMod(MODID).getName()
30+
);
2431

2532
public static void init() {
2633
IMPPackets.init();
@@ -36,6 +43,39 @@ public static void init() {
3643
CommonHandler.init();
3744
}
3845

46+
private static void checkAndResetConfig() {
47+
if (
48+
CONFIG.configVersion == null ||
49+
CONFIG.configVersion.isEmpty() ||
50+
!CONFIG.configVersion.equals(CONFIG_VERSION)
51+
) {
52+
// Reset all config values to defaults
53+
CONFIG.volume = 1f;
54+
CONFIG.maxPlayCont = 8;
55+
CONFIG.spatial = true;
56+
CONFIG.sampleRate = 44100;
57+
CONFIG.useYoutubeDownloader = true;
58+
CONFIG.relayServerURL =
59+
"https://raw.githubusercontent.com/TeamFelnull/IamMusicPlayer/master/relay_server.json";
60+
CONFIG.lavaPlayerNativesURL =
61+
"https://raw.githubusercontent.com/Mod-Sauce/test_lavaplayer_IMP/refs/heads/main/lavaplayer/natives_link.json";
62+
CONFIG.hideDisplaySprite = false;
63+
CONFIG.hideDecorativeAntenna = false;
64+
CONFIG.maxWaitTime = 1000 * 10;
65+
CONFIG.retryTime = 1000 * 3;
66+
CONFIG.dropItemRing = true;
67+
CONFIG.soundPhysicsRemasteredIntegration = true;
68+
CONFIG.showMusicLines = false;
69+
CONFIG.showSpeakerRange = false;
70+
71+
// Update config version
72+
CONFIG.configVersion = CONFIG_VERSION;
73+
74+
// Save the config
75+
AutoConfig.getConfigHolder(IMPConfig.class).save();
76+
}
77+
}
78+
3979
public static void setup() {
4080
IMPVillagerProfessions.setup();
4181
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ support_versions=1.19.2
66
#Mod
77
archives_base_name=iammusicplayer
88
mod_display_name=IamMusicPlayer
9-
mod_version=3.20.2-1.19.2
9+
mod_version=3.20.3-1.19.2
1010
enabled_platforms=fabric,forge
1111
#Dependencies
1212
architectury_version=6.6.92

0 commit comments

Comments
 (0)