aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/rosegoldaddons/mixins/MixinRenderString.java
blob: 4db798b520af051d8e7e0dce0714c67eae30e09f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package rosegoldaddons.mixins;

import net.minecraft.client.gui.FontRenderer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import rosegoldaddons.Main;

import java.util.Map;

@Mixin(FontRenderer.class)
public abstract class MixinRenderString {

    @ModifyVariable(method = "renderString", at = @At(value = "FIELD"))
    private String replaceName(String text) {
        if(Main.configFile.wydsi && text.contains("727")) {
            text = text.replace("727", "726");
        }
        if (Main.init) {
            for (Map.Entry<String, String> entry : Main.resp.entrySet()) {
                String key = entry.getKey();
                String value = entry.getValue();

                if (text.contains(key) && !text.contains(value)) {
                    text = text.replace(key, value)+"§r";
                }
            }
        }
        return text;
    }
}