Skip to content

Commit c51e914

Browse files
committed
Update AssetMover API
1 parent 92483ad commit c51e914

File tree

3 files changed

+21
-15
lines changed

3 files changed

+21
-15
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ repositories {
6666
dependencies {
6767
deobfCompile 'zone.rong:mixinbooter:7.0'
6868
deobfCompile 'curse.maven:had-enough-items-557549:4109510'
69-
deobfCompile 'com.cleanroommc:assetmover:2.1'
69+
deobfCompile 'com.cleanroommc:assetmover:2.4'
7070
}
7171

7272
mixin {

src/main/java/mod/acgaming/extrasounds/ExtraSounds.java

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import org.apache.logging.log4j.Logger;
55
import net.minecraftforge.fml.common.Loader;
66
import net.minecraftforge.fml.common.Mod;
7+
import net.minecraftforge.fml.common.event.FMLConstructionEvent;
78
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
89
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
910
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
@@ -30,13 +31,7 @@ public class ExtraSounds
3031
@Mod.EventHandler
3132
public void preInit(FMLPreInitializationEvent event)
3233
{
33-
if (Loader.isModLoaded("assetmover")) assetmover = true;
34-
else LOGGER.warn("AssetMover not detected, some sounds will be missing...");
35-
if (event.getSide() == Side.CLIENT)
36-
{
37-
ESSoundEventsClient.preInit();
38-
ESSoundManagerClient.preInit();
39-
}
34+
if (event.getSide() == Side.CLIENT) ESSoundManagerClient.preInit();
4035
ESSoundEvents.preInit();
4136
LOGGER.info("Extra Sounds pre-initialized");
4237
}
@@ -64,4 +59,20 @@ public void postInit(FMLPostInitializationEvent event)
6459
}
6560
LOGGER.info("Extra Sounds post-initialized");
6661
}
62+
63+
@Mod.EventHandler
64+
public void fmlConstruct(FMLConstructionEvent event)
65+
{
66+
try
67+
{
68+
Class.forName("com.cleanroommc.assetmover.AssetMoverAPI");
69+
assetmover = true;
70+
LOGGER.info("AssetMover detected, enabling compatibility...");
71+
}
72+
catch (ClassNotFoundException ignored)
73+
{
74+
LOGGER.warn("AssetMover not detected, some sounds will be missing...");
75+
}
76+
if (event.getSide() == Side.CLIENT) ESSoundEventsClient.getBackportedSounds();
77+
}
6778
}

src/main/java/mod/acgaming/extrasounds/sound/client/ESSoundEventsClient.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,6 @@
88

99
public class ESSoundEventsClient
1010
{
11-
public static void preInit()
12-
{
13-
if (ExtraSounds.assetmover) getBackportedSounds();
14-
}
15-
1611
public static void getBackportedSounds()
1712
{
1813
Map<String, String> backportMap = new Object2ObjectOpenHashMap<>();
@@ -94,8 +89,8 @@ public static void getBackportedSounds()
9489
backportMap.put("assets/minecraft/sounds/item/bonemeal/bonemeal4.ogg", "assets/extrasounds/sounds/item/bonemeal/bonemeal4.ogg");
9590
backportMap.put("assets/minecraft/sounds/item/bonemeal/bonemeal5.ogg", "assets/extrasounds/sounds/item/bonemeal/bonemeal5.ogg");
9691

97-
ExtraSounds.LOGGER.info("Downloading Minecraft 1.19.2 sounds, this could take a while...");
98-
AssetMoverAPI.fromMinecraft("1.19.2", backportMap);
92+
ExtraSounds.LOGGER.info("Downloading Minecraft 1.19.3 sounds, this could take a while...");
93+
AssetMoverAPI.fromMinecraft("1.19.3", backportMap);
9994
ExtraSounds.LOGGER.info("Downloading finished!");
10095
}
10196
}

0 commit comments

Comments
 (0)