Skip to content

Commit

Permalink
🎨 update forge
Browse files Browse the repository at this point in the history
  • Loading branch information
kitUIN committed Sep 30, 2024
1 parent d624ae3 commit a190392
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// ONLY forge-1.16.5
package io.github.kituin.chatimage.mixin;

import #Component#;
import #PlainTextContents#;
import net.minecraftforge.common.ForgeHooks;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(ForgeHooks.class)
public abstract class ForgeHooksMixin {

/**
* @author kitUIN
* @reason 禁止forge的url解析
*/
@Inject(method = "newChatWithLinks(Ljava/lang/String;Z)Lnet/minecraft/util/text/ITextComponent;",
at = @At("RETURN"), cancellable = true,remap = false)
private static void newChatWithLinks(String string, boolean allowMissingHeader, CallbackInfoReturnable<ITextComponent> cir){
System.out.println(string);
cir.setReturnValue(new StringTextComponent(string));
}

}
3 changes: 3 additions & 0 deletions forge/origin/src/main/resources/chatimage.mixins.json5
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
"FileDragMixin",
// IF >= forge-1.20
// "GuiGraphicsMixin",
// END IF
// IF forge-1.16.5
// "ForgeHooksMixin",
// END IF
"ScreenMixin"
],
Expand Down

0 comments on commit a190392

Please sign in to comment.