-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix wrapped chat lines missing colors (#246)
Fix wrapped chat lines missing colors
- Loading branch information
Showing
4 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/main/java/com/mitchej123/hodgepodge/mixins/early/minecraft/FontRendererAccessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.mitchej123.hodgepodge.mixins.early.minecraft; | ||
|
||
import net.minecraft.client.gui.FontRenderer; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Invoker; | ||
|
||
@Mixin(FontRenderer.class) | ||
public interface FontRendererAccessor { | ||
|
||
@Invoker("getFormatFromString") | ||
static String callGetFormatFromString(String s) { | ||
throw new IllegalStateException("Mixin stub invoked"); | ||
} | ||
|
||
} |
41 changes: 41 additions & 0 deletions
41
...va/com/mitchej123/hodgepodge/mixins/early/minecraft/MixinGuiNewChat_FixColorWrapping.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.mitchej123.hodgepodge.mixins.early.minecraft; | ||
|
||
import net.minecraft.client.gui.GuiNewChat; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Unique; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.ModifyVariable; | ||
|
||
@Mixin(GuiNewChat.class) | ||
public class MixinGuiNewChat_FixColorWrapping { | ||
|
||
@Unique | ||
private String hodgepodge$s1; | ||
|
||
@ModifyVariable( | ||
method = "func_146237_a", | ||
at = @At( | ||
value = "NEW", | ||
target = "(Ljava/lang/String;)Lnet/minecraft/util/ChatComponentText;", | ||
ordinal = 2, | ||
shift = At.Shift.BEFORE), | ||
name = "s1") | ||
private String hodgepodge$captureS1(String s1) { | ||
this.hodgepodge$s1 = s1; | ||
return s1; | ||
} | ||
|
||
@ModifyVariable( | ||
method = "func_146237_a", | ||
at = @At( | ||
value = "NEW", | ||
target = "(Ljava/lang/String;)Lnet/minecraft/util/ChatComponentText;", | ||
ordinal = 2, | ||
shift = At.Shift.BEFORE), | ||
name = "s2") | ||
private String hodgepodge$fixColorWrapping(String s2) { | ||
return FontRendererAccessor.callGetFormatFromString(this.hodgepodge$s1) + s2; | ||
} | ||
|
||
} |