Начинающий
- Статус
- Оффлайн
- Регистрация
- 8 Мар 2024
- Сообщения
- 844
- Реакции
- 3
- Выберите загрузчик игры
- OptiFine
Перед прочтением основного контента ниже, пожалуйста, обратите внимание на обновление внутри секции Майна на нашем форуме. У нас появились:
- бесплатные читы для Майнкрафт — любое использование на свой страх и риск;
- маркетплейс Майнкрафт — абсолютно любая коммерция, связанная с игрой, за исключением продажи читов (аккаунты, предоставления услуг, поиск кодеров читов и так далее);
- приватные читы для Minecraft — в этом разделе только платные хаки для игры, покупайте группу "Продавец" и выставляйте на продажу свой софт;
- обсуждения и гайды — всё тот же раздел с вопросами, но теперь модернизированный: поиск нужных хаков, пати с игроками-читерами и другая полезная информация.
Спасибо!
(класс рендера фонта):
public static final Color aqua = new Color(0x55FFFF);
public static final Color light_purple = new Color(0xFF55FF);
public static final Color yellow = new Color(0xFFFF55);
public static final Color white = new Color(0xFFFFFF);
private float drawStyledComponent(Matrix4f matrix4f, ITextComponent textComponent, ItemStack stack, float f, float f2, int n) {
if (textComponent == null) {
return 0.0f;
}
Style style = textComponent.getStyle();
//пот
Color rarity = switch (stack.getRarity()) {
case COMMON -> white;
case UNCOMMON -> yellow;
case RARE -> aqua;
case EPIC -> light_purple;
};
int defaultColor = style.getColor() == null ? rarity.getRGB() : ColorUtils.setAlpha(-16777216, n) | ColorUtils.setAlpha(style.getColor().getColor(), n);
int currentColor = defaultColor;
String text = textComponent.getSiblings().isEmpty()
? textComponent.getString()
: textComponent.getUnformattedComponentText();
char[] chars = text.toCharArray();
for (int i = 0; i < chars.length; ++i) {
char currentChar = chars[i];
if (currentChar == '§' && i + 1 < chars.length) {
char formatChar = Character.toLowerCase(chars[i + 1]);
TextFormatting format = TextFormatting.fromFormattingCode(formatChar);
if (format != null) {
if (format.isColor()) {
currentColor = 0xFF000000 | format.getColor();
} else if (format == TextFormatting.RESET) {
currentColor = defaultColor;
}
++i;
continue;
}
}
Glyph glyph = this.locateGlyph(currentChar);
if (glyph != null && /*модер пи^^^*/ glyph.value() != ' ') {
ResourceLocation texture = glyph.owner().bindToTexture;
DrawEntry drawEntry = new DrawEntry(f, f2, currentColor, glyph);
this.GLYPH_PAGE_CACHE.computeIfAbsent(texture, k -> new ObjectArrayList<>()).add(drawEntry);
}
if (glyph != null) {
f += (float)glyph.width();
}
}
if (!textComponent.getSiblings().isEmpty()) {
for (ITextComponent sibling : textComponent.getSiblings()) {
f = this.drawStyledComponent(matrix4f, sibling, stack, f, f2, n);
}
}
return f;
}
тутор как юзать:
Fonts.getSize(14, Fonts.Type.MEDIUM).drawStringItem(
event.getMatrixStack(),
displayComponent,
stack,/* ItemStack stack = itemEntity.getItem();*/
screenPos.x - totalWidth / 2.0f - 1.0f,
screenPos.y,
0xFFFFFFFF
);
надеюсь этот шедевр будет в пасте под именем монотон)