Подведи собственные итоги года совместно с YOUGAME и забери ценные призы! Перейти

Градиент в чате 1.16.5

  • Автор темы Автор темы hunt11
  • Дата начала Дата начала
Начинающий
Начинающий
Статус
Оффлайн
Регистрация
28 Сен 2022
Сообщения
11
Реакции
0
Всем привет, написал утилку на скорую руку для градиент чата в 1.16.5
Java:
Expand Collapse Copy
package fun.rich.utils.other;

import fun.rich.feature.impl.visuals.Hud;
import fun.rich.utils.render.ColorUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.util.text.*;

public class ChatUtils {

    public static void addChatMessage(String message) {
        String prefix = "pastaclient";
        IFormattableTextComponent end = new StringTextComponent("");
        end.append(new StringTextComponent("(").mergeStyle(new Style(new Color(-1),true,false,false,false,false,null,null,"",null)));
        for (int i = 0; i < prefix.length(); i++) {
            char c = prefix.charAt(i);
            IFormattableTextComponent txt = new StringTextComponent(""+c);
            Style a = new Style(new Color(Hud.getColor(i*10).getRGB()),true,false,false,false,false,null,null,"",null);
            txt=txt.mergeStyle(a);
            end.append(txt);
        }
        end.append(new StringTextComponent(") ").mergeStyle(new Style(new Color(-1),true,false,false,false,false,null,null,"",null)));
        Style a = new Style(new Color(-1),false,false,false,false,false,null,null,"",null);
        IFormattableTextComponent txt = new StringTextComponent(message);
        end=end.append((new StringTextComponent("-> "+message).setStyle(a)).mergeStyle(a));
        Minecraft.getInstance().ingameGUI.getChatGUI().printChatMessage(end);
    }
    public static void addChatMessage(String message,java.awt.Color from,java.awt.Color to) {

        String prefix = "pastaclient";
        IFormattableTextComponent end = new StringTextComponent("");
        end.append(new StringTextComponent("(").mergeStyle(new Style(new Color(-1),true,false,false,false,false,null,null,"",null)));
        for (int i = 0; i < prefix.length(); i++) {
            char c = prefix.charAt(i);
            IFormattableTextComponent txt = new StringTextComponent(""+c);
            Style a = new Style(new Color(ColorUtils.interpolateColorC(from,to,i).getRGB()),true,false,false,false,false,null,null,"",null);
            txt=txt.mergeStyle(a);
            end.append(txt);
        }
        end.append(new StringTextComponent(") ").mergeStyle(new Style(new Color(-1),true,false,false,false,false,null,null,"",null)));
        Style a = new Style(new Color(-1),false,false,false,false,false,null,null,"",null);
        IFormattableTextComponent txt = new StringTextComponent(message);
        end=end.append((new StringTextComponent("-> "+message).setStyle(a)).mergeStyle(a));
        Minecraft.getInstance().ingameGUI.getChatGUI().printChatMessage(end);
    }
}
 
Чё за параша? Проще в экспенсиве спастить и всё.
 
1699935222157.png
:fffuuu:
 
Всем привет, написал утилку на скорую руку для градиент чата в 1.16.5
Java:
Expand Collapse Copy
package fun.rich.utils.other;

import fun.rich.feature.impl.visuals.Hud;
import fun.rich.utils.render.ColorUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.util.text.*;

public class ChatUtils {

    public static void addChatMessage(String message) {
        String prefix = "pastaclient";
        IFormattableTextComponent end = new StringTextComponent("");
        end.append(new StringTextComponent("(").mergeStyle(new Style(new Color(-1),true,false,false,false,false,null,null,"",null)));
        for (int i = 0; i < prefix.length(); i++) {
            char c = prefix.charAt(i);
            IFormattableTextComponent txt = new StringTextComponent(""+c);
            Style a = new Style(new Color(Hud.getColor(i*10).getRGB()),true,false,false,false,false,null,null,"",null);
            txt=txt.mergeStyle(a);
            end.append(txt);
        }
        end.append(new StringTextComponent(") ").mergeStyle(new Style(new Color(-1),true,false,false,false,false,null,null,"",null)));
        Style a = new Style(new Color(-1),false,false,false,false,false,null,null,"",null);
        IFormattableTextComponent txt = new StringTextComponent(message);
        end=end.append((new StringTextComponent("-> "+message).setStyle(a)).mergeStyle(a));
        Minecraft.getInstance().ingameGUI.getChatGUI().printChatMessage(end);
    }
    public static void addChatMessage(String message,java.awt.Color from,java.awt.Color to) {

        String prefix = "pastaclient";
        IFormattableTextComponent end = new StringTextComponent("");
        end.append(new StringTextComponent("(").mergeStyle(new Style(new Color(-1),true,false,false,false,false,null,null,"",null)));
        for (int i = 0; i < prefix.length(); i++) {
            char c = prefix.charAt(i);
            IFormattableTextComponent txt = new StringTextComponent(""+c);
            Style a = new Style(new Color(ColorUtils.interpolateColorC(from,to,i).getRGB()),true,false,false,false,false,null,null,"",null);
            txt=txt.mergeStyle(a);
            end.append(txt);
        }
        end.append(new StringTextComponent(") ").mergeStyle(new Style(new Color(-1),true,false,false,false,false,null,null,"",null)));
        Style a = new Style(new Color(-1),false,false,false,false,false,null,null,"",null);
        IFormattableTextComponent txt = new StringTextComponent(message);
        end=end.append((new StringTextComponent("-> "+message).setStyle(a)).mergeStyle(a));
        Minecraft.getInstance().ingameGUI.getChatGUI().printChatMessage(end);
    }
}
так это с рича, зачем ты вреш нам? ((
 
Назад
Сверху Снизу