Skip to content

Commit

Permalink
Fix the vanilla method to open chat links not working for every OS
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexdoru authored and mitchej123 committed Oct 18, 2024
1 parent d8488b1 commit 7b12b54
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/com/mitchej123/hodgepodge/Hodgepodge.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
version = Hodgepodge.VERSION,
name = Hodgepodge.NAME,
dependencies = "required-after:gtnhmixins@[2.0.1,);" + "required-after:unimixins@[0.0.14,);"
+ "required-after:gtnhlib@[0.2.2,);",
+ "required-after:gtnhlib@[0.5.15,);",
guiFactory = "com.mitchej123.hodgepodge.config.gui.HodgepodgeGuiConfigFactory")
public class Hodgepodge {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,11 @@ public class FixesConfig {
@Config.RequiresMcRestart
public static boolean fixGameSettingsArrayOutOfBounds;

@Config.Comment("Fix the vanilla method to open chat links not working for every OS")
@Config.DefaultBoolean(true)
@Config.RequiresMcRestart
public static boolean fixChatOpenLink;

/* ====== Minecraft fixes end ===== */

// affecting multiple mods
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,10 @@ public enum Mixins {
.addMixinClasses("minecraft.MixinWorldServer_LimitUpdateRecursion")
.setApplyIf(() -> FixesConfig.limitRecursiveBlockUpdateDepth >= 0)),

FIX_CHAT_OPEN_LINK(new Builder("Fix the vanilla method to open chat links not working for every OS")
.setPhase(Phase.EARLY).setSide(Side.CLIENT).addTargetedMod(TargetedMod.VANILLA)
.addMixinClasses("minecraft.MixinGuiChat_OpenLinks").setApplyIf(() -> FixesConfig.fixChatOpenLink)),

// Ic2 adjustments
IC2_UNPROTECTED_GET_BLOCK_FIX(new Builder("IC2 Kinetic Fix").setPhase(Phase.EARLY).setSide(Side.BOTH)
.addMixinClasses("ic2.MixinIc2WaterKinetic").setApplyIf(() -> FixesConfig.fixIc2UnprotectedGetBlock)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.mitchej123.hodgepodge.mixins.early.minecraft;

import java.net.URI;

import net.minecraft.client.gui.GuiChat;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;

import com.gtnewhorizon.gtnhlib.util.FilesUtil;

@Mixin(GuiChat.class)
public class MixinGuiChat_OpenLinks {

/**
* @author Alexdoru
* @reason The Vanilla method doesn't work on some OS
*/
@Overwrite
private void func_146407_a(URI uri) {
FilesUtil.openUri(uri);
}

}

0 comments on commit 7b12b54

Please sign in to comment.