Skip to content

Commit

Permalink
Fix Gliby's Voice Chat crashing on modern Java (#386)
Browse files Browse the repository at this point in the history
* Use rfg.deobf directly in dependencies

* Fix Gliby's Voice Chat crashing on modern Java

Removes Thread.stop usage from GVC, as that method has been deprecated and then made to crash in newer Java versions.
The mod was already doing a clean shutdown of the threads, there's no need to also force-kill them.

---------

Co-authored-by: ah-OOG-ah <75745146+ah-OOG-ah@users.noreply.github.com>
Co-authored-by: Martin Robertz <dream-master@gmx.net>
  • Loading branch information
3 people authored Jul 8, 2024
1 parent 6bad750 commit 31126c3
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 12 deletions.
25 changes: 13 additions & 12 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,34 +27,35 @@ dependencies {
transformedModCompileOnly("com.github.GTNewHorizons:MrTJPCore:1.2.1:dev") // Do not update, fixed afterwards
transformedModCompileOnly("com.github.GTNewHorizons:Railcraft:9.15.8:dev") { exclude group: "thaumcraft", module: "Thaumcraft" }
transformedModCompileOnly("com.github.GTNewHorizons:TinkersConstruct:1.12.4-GTNH:dev")
transformedModCompileOnly(deobfCurse("bibliocraft-228027:2423369"))
transformedModCompileOnly(rfg.deobf("curse.maven:bibliocraft-228027:2423369"))
transformedModCompileOnly("curse.maven:biomes-o-plenty-220318:2499612")
transformedModCompileOnly("curse.maven:cofh-core-69162:2388751")
transformedModCompileOnly("curse.maven:minefactory-reloaded-66672:2277486")
transformedModCompileOnly(deobfCurse('damage-indicators-mod-59489:2692129'))
transformedModCompileOnly(rfg.deobf('curse.maven:damage-indicators-mod-59489:2692129'))
transformedModCompileOnly("curse.maven:extra-utilities-225561:2264384")
transformedModCompileOnly(deobfCurse("extratic-72728:2299292"))
transformedModCompileOnly(deobfCurse("journeymap-32274:4500658"))
transformedModCompileOnly(rfg.deobf("curse.maven:extratic-72728:2299292"))
transformedModCompileOnly(rfg.deobf("curse.maven:journeymap-32274:4500658"))
transformedModCompileOnly(deobf('https://dist.creeper.host/ichun/filespg/PortalGun-4.0.0-beta-6.jar'))
transformedModCompileOnly("curse.maven:travellers-gear-224440:2262113")
transformedModCompileOnly(deobfCurse("witchery-69673:2234410"))
transformedModCompileOnly(deobfCurse("ztones-224369:2223720"))
transformedModCompileOnly(rfg.deobf("curse.maven:witchery-69673:2234410"))
transformedModCompileOnly(rfg.deobf("curse.maven:ztones-224369:2223720"))
transformedModCompileOnly("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev")
transformedModCompileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev")
transformedModCompileOnly(rfg.deobf("curse.maven:glibys-voice-chat-225110:2301492"))

transformedModCompileOnly(deobfCurse("automagy-222153:2285272"))
transformedModCompileOnly(rfg.deobf("curse.maven:automagy-222153:2285272"))
transformedModCompileOnly("com.github.GTNewHorizons:Galacticraft:3.1.5-GTNH:dev")
transformedModCompileOnly("curse.maven:minechem-368422:2905830")
transformedModCompileOnly("curse.maven:thermal-dynamics-227443:2388756")
transformedModCompileOnly("curse.maven:thermal-expansion-69163:2388759")
transformedModCompileOnly(deobfCurse("projecte-226410:2340786"))
transformedModCompileOnly(deobfCurse("better-hud-286066:2523840"))
transformedModCompileOnly(rfg.deobf("curse.maven:projecte-226410:2340786"))
transformedModCompileOnly(rfg.deobf("curse.maven:better-hud-286066:2523840"))
transformedModCompileOnly("curse.maven:immersive-engineering-231951:2299019")
// Contains an outdated copy of thaumcraft api that breaks class loading at runtime
transformedModCompileOnly(deobfCurse("pams-harvest-the-nether-231262:2241397"))
transformedModCompileOnly(deobfCurse("the-lord-of-the-rings-mod-legacy-423748:4091561"))
transformedModCompileOnly(rfg.deobf("curse.maven:pams-harvest-the-nether-231262:2241397"))
transformedModCompileOnly(rfg.deobf("curse.maven:the-lord-of-the-rings-mod-legacy-423748:4091561"))
transformedModCompileOnly(deobfNotch("https://mediafiles.forgecdn.net/files/2462/146/mod_voxelMap_1.7.0b_for_1.7.10.litemod"))
transformedModCompileOnly(deobfCurse("xaeros-world-map-317780:4716737"))
transformedModCompileOnly(rfg.deobf("curse.maven:xaeros-world-map-317780:4716737"))
transformedModCompileOnly(deobf("https://forum.industrial-craft.net/core/attachment/4316-advancedsolarpanel-1-7-10-3-5-1-jar/"))

runtimeOnly(deobf("https://github.com/makamys/CoreTweaks/releases/download/0.3.3.2/CoreTweaks-1.7.10-0.3.3.2+nomixin.jar"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,13 @@ public class FixesConfig {
@Config.RequiresMcRestart
public static boolean fixTimeCommandWithGC;

// Gliby's Voice Chat

@Config.Comment("Fix Gliby's voice chat not shutting down its thread cleanly")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean fixGlibysVoiceChatThreadStop;

// Hunger Overhaul

@Config.Comment("Fix Hunger Overhaul low stat effects")
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,18 @@ public enum Mixins {
.setApplyIf(() -> FixesConfig.fixExtraUtilitiesLastMilleniumCreatures)
.addTargetedMod(TargetedMod.EXTRA_UTILITIES)),

// Gliby's Voice Chat
FIX_GLIBYS_VC_THREAD_SHUTDOWN_CLIENT(
new Builder("Fix Gliby's voice chat not shutting down its client thread cleanly")
.addMixinClasses("glibysvoicechat.MixinClientNetwork").setPhase(Phase.LATE).setSide(Side.CLIENT)
.setApplyIf(() -> FixesConfig.fixGlibysVoiceChatThreadStop)
.addTargetedMod(TargetedMod.GLIBYS_VOICE_CHAT)),
FIX_GLIBYS_VC_THREAD_SHUTDOWN_SERVER(
new Builder("Fix Gliby's voice chat not shutting down its server thread cleanly")
.addMixinClasses("glibysvoicechat.MixinVoiceChatServer").setPhase(Phase.LATE).setSide(Side.BOTH)
.setApplyIf(() -> FixesConfig.fixGlibysVoiceChatThreadStop)
.addTargetedMod(TargetedMod.GLIBYS_VOICE_CHAT)),

// PortalGun
PORTALGUN_FIX_URLS(new Builder("Fix URLs used to download the sound pack")
.addMixinClasses("portalgun.MixinThreadDownloadResources").addTargetedMod(TargetedMod.PORTAL_GUN)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public enum TargetedMod {
EXTRA_UTILITIES("ExtraUtilities", null, "ExtraUtilities"),
FASTCRAFT("FastCraft", "fastcraft.Tweaker"),
GALACTICRAFT_CORE("GalacticraftCore", "micdoodle8.mods.galacticraft.core.asm.GCLoadingPlugin", "GalacticraftCore"),
GLIBYS_VOICE_CHAT("Gliby's Voice Chat Mod", null, "gvc"),
GT5U("GregTech5u", null, "gregtech"), // Also matches GT6.
GT6("GregTech6", "gregtech.asm.GT_ASM", "gregapi"), // Can be used to exclude GT6 from the GT5U target.
GTNHLIB("GTNHLib", "com.gtnewhorizon.gtnhlib.core.GTNHLibCore", "gtnhlib"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.mitchej123.hodgepodge.mixins.late.glibysvoicechat;

import net.gliby.voicechat.client.networking.ClientNetwork;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(ClientNetwork.class)
public class MixinClientNetwork {

@Redirect(
method = "stopClientNetwork",
at = @At(value = "INVOKE", target = "Ljava/lang/Thread;stop()V"),
remap = false)
void hodgepodge$stopClientThread(Thread instance) {
// A manual shutdown signal was already sent earlier, and Thread.stop crashes on newer Java versions
// Force into daemon mode to allow a clean shutdown to happen.
instance.setDaemon(true);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.mitchej123.hodgepodge.mixins.late.glibysvoicechat;

import net.gliby.voicechat.common.VoiceChatServer;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(VoiceChatServer.class)
public class MixinVoiceChatServer {

@Redirect(method = "stop", at = @At(value = "INVOKE", target = "Ljava/lang/Thread;stop()V"), remap = false)
void hodgepodge$stopServerThread(Thread instance) {
// A manual shutdown signal was already sent earlier, and Thread.stop crashes on newer Java versions
// Force into daemon mode to allow a clean shutdown to happen.
instance.setDaemon(true);
}
}

0 comments on commit 31126c3

Please sign in to comment.