- Выберите загрузчик игры
- OptiFine
хз щто писать по ссу все поймете.если будут ошибки @akvif.ss:
Пожалуйста, авторизуйтесь для просмотра ссылки.
package DickRecode.ui.display.impl;
import DickRecode.Dick;
import DickRecode.events.EventDisplay;
import DickRecode.events.EventUpdate;
import DickRecode.functions.impl.misc.FThelper;
import DickRecode.functions.impl.player.ItemBinds;
import DickRecode.ui.display.ElementRenderer;
import DickRecode.utils.drag.Dragging;
import DickRecode.utils.render.ColorUtils;
import DickRecode.utils.render.DisplayUtils;
import DickRecode.utils.render.font.Fonts;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.vector.Vector4f;
import com.mojang.blaze3d.matrix.MatrixStack;
import lombok.RequiredArgsConstructor;
import lombok.experimental.FieldDefaults;
import lombok.AccessLevel;
import org.lwjgl.glfw.GLFW;
import java.util.ArrayList;
import java.util.List;
@FieldDefaults(level = AccessLevel.PRIVATE)
@RequiredArgsConstructor
public class FTItemsRenderer implements ElementRenderer {
final Dragging drag;
private static class FTItem {
String name;
String bindKey;
ResourceLocation icon;
int bind;
FTItem(String name, int bind, ResourceLocation icon) {
this.name = name;
this.bind = bind;
this.icon = icon;
this.bindKey = bind == -1 ? "None" : getKeyName(bind);
}
}
private static String getKeyName(int key) {
if (key == -100) return "LMB";
if (key == -99) return "RMB";
if (key == -98) return "MMB";
if (key == -97) return "MB4";
if (key == -96) return "MB5";
if (key == -95) return "MB6";
if (key == -94) return "MB7";
if (key == -93) return "MB8";
switch (key) {
case GLFW.GLFW_KEY_SPACE: return "SPACE";
case GLFW.GLFW_KEY_0: return "0";
case GLFW.GLFW_KEY_1: return "1";
case GLFW.GLFW_KEY_2: return "2";
case GLFW.GLFW_KEY_3: return "3";
case GLFW.GLFW_KEY_4: return "4";
case GLFW.GLFW_KEY_5: return "5";
case GLFW.GLFW_KEY_6: return "6";
case GLFW.GLFW_KEY_7: return "7";
case GLFW.GLFW_KEY_8: return "8";
case GLFW.GLFW_KEY_9: return "9";
case GLFW.GLFW_KEY_ESCAPE: return "ESC";
case GLFW.GLFW_KEY_ENTER: return "ENTER";
case GLFW.GLFW_KEY_TAB: return "TAB";
case GLFW.GLFW_KEY_BACKSPACE: return "BSP";
case GLFW.GLFW_KEY_RIGHT: return "→";
case GLFW.GLFW_KEY_LEFT: return "←";
case GLFW.GLFW_KEY_DOWN: return "↓";
case GLFW.GLFW_KEY_UP: return "↑";
case GLFW.GLFW_KEY_LEFT_SHIFT: return "SHIFT";
case GLFW.GLFW_KEY_LEFT_CONTROL: return "CTRL";
case GLFW.GLFW_KEY_LEFT_ALT: return "ALT";
default:
if (key >= GLFW.GLFW_KEY_A && key <= GLFW.GLFW_KEY_Z) {
return String.valueOf((char) key);
}
return "?";
}
}
public void update(EventUpdate e) {}
@Override
public void render(EventDisplay eventDisplay) {
FThelper ftHelper = Dick.getInstance().getFunctionRegistry().getFThelper();
ItemBinds itemBinds = Dick.getInstance().getFunctionRegistry().getItemBinds();
boolean showFT = ftHelper != null && ftHelper.isState();
boolean showIB = itemBinds != null;
if (!showFT && !showIB) return;
MatrixStack ms = eventDisplay.getMatrixStack();
ResourceLocation potionIcon = new ResourceLocation("minecraft", "textures/item/splash_potion.png");
ResourceLocation enderEyeIcon = new ResourceLocation("minecraft", "textures/item/ender_eye.png");
ResourceLocation netheriteScrapIcon = new ResourceLocation("minecraft", "textures/item/netherite_scrap.png");
ResourceLocation snowballIcon = new ResourceLocation("minecraft", "textures/item/snowball.png");
ResourceLocation phantomMembraneIcon = new ResourceLocation("minecraft", "textures/item/phantom_membrane.png");
ResourceLocation driedKelpIcon = new ResourceLocation("minecraft", "textures/item/dried_kelp.png");
ResourceLocation sugarIcon = new ResourceLocation("minecraft", "textures/item/sugar.png");
ResourceLocation fireChargeIcon = new ResourceLocation("minecraft", "textures/item/fire_charge.png");
ResourceLocation fireworkRocketIcon = new ResourceLocation("minecraft", "textures/item/firework_rocket.png");
ResourceLocation shulkerBoxIcon = new ResourceLocation("minecraft", "textures/item/shulker_box.png");
ResourceLocation crossbowIcon = new ResourceLocation("minecraft", "textures/item/crossbow_arrow.png");
List<FTItem> items = new ArrayList<>();
if (showFT) {
items.add(new FTItem("Дезориентация", ftHelper.disorientationKey.get(), enderEyeIcon));
items.add(new FTItem("Трапка", ftHelper.trapKey.get(), netheriteScrapIcon));
items.add(new FTItem("Заморозка", ftHelper.zamorozkaKey.get(), snowballIcon));
items.add(new FTItem("Божья аура", ftHelper.bojkaKey.get(), phantomMembraneIcon));
items.add(new FTItem("Пласт", ftHelper.plastKey.get(), driedKelpIcon));
items.add(new FTItem("Явная пыль", ftHelper.blatantKey.get(), sugarIcon));
items.add(new FTItem("Огн. смерч", ftHelper.flameKey.get(), fireChargeIcon));
items.add(new FTItem("Святая вода", ftHelper.svatvodaKey.get(), potionIcon));
items.add(new FTItem("Хлопушка", ftHelper.xlopyshkaKey.get(), fireworkRocketIcon));
items.add(new FTItem("Шалкер", ftHelper.shulkerKey.get(), shulkerBoxIcon));
items.add(new FTItem("Арбалет", ftHelper.bowKey.get(), crossbowIcon));
items.add(new FTItem("Зелье гнева", ftHelper.gnevkaKey.get(), potionIcon));
items.add(new FTItem("Зелье пал.", ftHelper.paladinKey.get(), potionIcon));
items.add(new FTItem("Зелье асс.", ftHelper.assasinKey.get(), potionIcon));
items.add(new FTItem("Зелье рад.", ftHelper.radiaciaKey.get(), potionIcon));
items.add(new FTItem("Снотворное", ftHelper.snotvornoeKey.get(), potionIcon));
}
if (showIB) {
items.add(new FTItem("Дезориентация", itemBinds.desorientBind.get(), enderEyeIcon));
items.add(new FTItem("Трапка", itemBinds.trapBind.get(), netheriteScrapIcon));
items.add(new FTItem("Снежок", itemBinds.snowballBind.get(), snowballIcon));
items.add(new FTItem("Божья аура", itemBinds.bojkaBind.get(), phantomMembraneIcon));
items.add(new FTItem("Пласт", itemBinds.plateBind.get(), driedKelpIcon));
items.add(new FTItem("Явная пыль", itemBinds.dustBind.get(), sugarIcon));
items.add(new FTItem("Огн. смерч", itemBinds.fireBind.get(), fireChargeIcon));
items.add(new FTItem("Святая вода", itemBinds.svatvodaBind.get(), potionIcon));
items.add(new FTItem("Хлопушка", itemBinds.xlopushkaBind.get(), fireworkRocketIcon));
items.add(new FTItem("Шалкер", itemBinds.shulkerBind.get(), shulkerBoxIcon));
items.add(new FTItem("Арбалет", itemBinds.bowBind.get(), crossbowIcon));
items.add(new FTItem("Зелье гнева", itemBinds.gnevBind.get(), potionIcon));
items.add(new FTItem("Зелье пал.", itemBinds.paladinBind.get(), potionIcon));
items.add(new FTItem("Зелье асс.", itemBinds.assasinBind.get(), potionIcon));
items.add(new FTItem("Зелье рад.", itemBinds.radiaciaBind.get(), potionIcon));
items.add(new FTItem("Снотворное", itemBinds.snotvornoeBind.get(), potionIcon));
}
List<FTItem> boundItems = new ArrayList<>();
for (FTItem item : items) {
if (item.bind != -1) {
boundItems.add(item);
}
}
if (boundItems.isEmpty()) return;
float x = drag.getX();
float y = drag.getY();
float iconSize = 8;
float spacing = 3;
float padding = 2;
float currentX = x;
for (FTItem item : boundItems) {
String bindText = "Бинд:" + item.bindKey;
float textWidth = Fonts.sfbold.getWidth(bindText, 6);
float sepWidth = Fonts.sfbold.getWidth("|", 6);
float boxWidth = padding + iconSize + padding + sepWidth + padding + textWidth + padding;
float boxHeight = 12;
DisplayUtils.drawRoundedRect(currentX, y, boxWidth, boxHeight,
new Vector4f(3, 3, 3, 3),
ColorUtils.rgba(0, 0, 0, 180));
DisplayUtils.drawImage(item.icon,
currentX + padding,
y + (boxHeight - iconSize) / 2,
iconSize, iconSize, -1);
float textX = currentX + padding + iconSize + padding;
Fonts.sfbold.drawText(ms, "|",
textX,
y + (boxHeight - 6) / 2,
ColorUtils.rgb(100, 100, 100), 6);
Fonts.sfbold.drawText(ms, bindText,
textX + sepWidth + padding,
y + (boxHeight - 6) / 2,
ColorUtils.rgb(255, 255, 255), 6);
currentX += boxWidth + spacing;
}
float totalWidth = 0;
for (FTItem item : boundItems) {
String bindText = "Бинд:" + item.bindKey;
float textWidth = Fonts.sfbold.getWidth(bindText, 6);
float sepWidth = Fonts.sfbold.getWidth("|", 6);
float boxWidth = padding + iconSize + padding + sepWidth + padding + textWidth + padding;
totalWidth += boxWidth + spacing;
}
if (!boundItems.isEmpty()) totalWidth -= spacing;
drag.setWidth(totalWidth);
drag.setHeight(12);
}
}
//проверьте что в FunctionRegistry у вас не new FTHelper а fTHelper = new FTHelper или че там в экспе