- Выберите загрузчик игры
- Fabric
Салам, югейм. Пока местные пастеры продолжают клепать дефолтные менюшки на квадратных майнкрафтовских кнопках и воровать код друг у друга, я решил закинуть вам реально годный код
Код:
package sosi.excody.implement.features.draggables;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.util.math.MatrixStack;
import sosi.excody.Main;
import sosi.excody.api.other.draggable.AbstractDraggable;
import sosi.excody.api.system.font.FontRenderer;
import sosi.excody.api.system.font.Fonts;
import sosi.excody.api.system.shape.ShapeProperties;
import sosi.excody.common.util.color.ColorUtil;
import sosi.excody.common.util.entity.PlayerIntersectionUtil;
import sosi.excody.common.util.math.MathUtil;
import sosi.excody.common.util.other.StringUtil;
import sosi.excody.modules.api.Module;
import sosi.excody.modules.impl.render.Hud;
import java.util.ArrayList;
import java.util.List;
public class HotKeys extends AbstractDraggable {
private List<Module> keysList = new ArrayList<>();
public HotKeys() {
super("Hot Keys", 300, 10, 80, 18, true);
}
[USER=1367676]@override[/USER]
public boolean visible() {
return !keysList.isEmpty() || PlayerIntersectionUtil.isChat(mc.currentScreen);
}
[USER=1367676]@override[/USER]
public void tick() {
keysList = Main.getInstance().getModuleProvider().getModules().stream()
.filter(module -> module.getAnimation().getOutput().floatValue() > 0.01f && module.getKey() != -1)
.toList();
}
//аааа чиго ля хакер как ти сюда папал
//Мы не читеры, мы просто любим побеждать
[USER=1367676]@override[/USER]
public void drawDraggable(DrawContext e) {
MatrixStack matrix = e.getMatrices();
FontRenderer fontHeader = Fonts.getSize(15, Fonts.Type.DEFAULT);
FontRenderer fontModule = Fonts.getSize(13, Fonts.Type.DEFAULT);
float x = getX();
float y = getY();
float headerHeight = 18F;
float rowHeight = 13F;
float padding = 6F;
float calculatedWidth = 80F;
float totalHeight = headerHeight;
for (Module module : keysList) {
float anim = module.getAnimation().getOutput().floatValue();
String bind = "[" + StringUtil.getBindName(module.getKey()) + "]";
float w = padding + fontModule.getStringWidth(module.getName()) + 12 + fontModule.getStringWidth(bind) + padding;
if (w > calculatedWidth) calculatedWidth = w;
totalHeight += rowHeight * anim;
}
final float finalMaxWidth = calculatedWidth;
setWidth((int) finalMaxWidth);
setHeight((int) totalHeight);
blurGlass.render(ShapeProperties.create(matrix, x, y, finalMaxWidth, totalHeight)
.round(4)
.softness(1)
.thickness(1.5F)
.outlineColor(ColorUtil.getOutline())
.color(ColorUtil.getRect(Hud.newHudAlpha.getValue()))
.build());
fontHeader.drawCenteredString(matrix, getName(), x + finalMaxWidth / 2F, y + 6F, ColorUtil.getText());
if (totalHeight > headerHeight + 2) {
blurGlass.render(ShapeProperties.create(matrix, x + 5, y + headerHeight, finalMaxWidth - 10, 0.5F)
.color(ColorUtil.multAlpha(ColorUtil.getOutline(), 0.4F))
.build());
}
float currentY = y + headerHeight + 2.5F;
for (Module module : keysList) {
float anim = module.getAnimation().getOutput().floatValue();
if (anim <= 0.01f) continue;
final float finalY = currentY;
final String bindText = "[" + StringUtil.getBindName(module.getKey()).toUpperCase() + "]";
matrix.push();
MathUtil.scale(matrix, x + finalMaxWidth / 2F, finalY + rowHeight / 2F, 1, anim, () -> {
fontModule.drawString(matrix, module.getName(), x + padding, finalY + 3F, ColorUtil.getText());
float bindWidth = fontModule.getStringWidth(bindText);
fontModule.drawString(matrix, bindText, x + finalMaxWidth - padding - bindWidth, finalY + 3F,
ColorUtil.multAlpha(ColorUtil.getText(), 0.6F));
});
matrix.pop();
currentY += rowHeight * anim;
}
}
}