blob: 6e954448c9ac5f8bc0e0a6cae21c8cde2f0bd277 (
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
32
33
34
35
36
37
38
39
40
41
42
|
package rosegoldaddons.mixins;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import rosegoldaddons.Main;
import rosegoldaddons.utils.ChatUtils;
import java.util.Map;
@Mixin(value = FontRenderer.class, priority = 999)
public abstract class MixinRenderString {
@Shadow
protected abstract void renderStringAtPos(String text, boolean shadow);
@Inject(method = "renderStringAtPos", at = @At("HEAD"), cancellable = true)
private void renderString(String text, boolean shadow, CallbackInfo ci) {
if(Main.configFile.wydsi && text.contains("727")) {
ci.cancel();
renderStringAtPos(text.replace("727", "726"), shadow);
}
if (Main.init) {
for (Map.Entry<String, String> entry : Main.resp.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if (text.contains(key)) {
ci.cancel();
try {
renderStringAtPos(text.replaceAll(key, value).replace("&", "§"), shadow);
} catch (Exception e) {
ChatUtils.sendMessage(e.toString());
}
}
}
}
}
}
|