Начинающий
- Статус
- Оффлайн
- Регистрация
- 5 Дек 2025
- Сообщения
- 29
- Реакции
- 0
- Выберите загрузчик игры
- Fabric
Худ наклипан за 30 минут, мб комуто подойдет вроде +- норм кроме инвентаря и нотивок
dw -
UPD:
забыл залить вам пару утилиток, ловите:
dw -
Пожалуйста, авторизуйтесь для просмотра ссылки.
UPD:
забыл залить вам пару утилиток, ловите:
SigmaMathUtil:
package kronex.fun.other.utils.math;
import com.mojang.blaze3d.systems.RenderSystem;
import lombok.experimental.UtilityClass;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.RenderTickCounter;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.*;
import org.joml.Vector3d;
import java.util.concurrent.ThreadLocalRandom;
import static net.minecraft.util.math.MathHelper.*;
@UtilityClass
public class SigmaMathUtil {
private final MinecraftClient mc = MinecraftClient.getInstance();
public double PI2 = Math.PI * 2;
public boolean isHovered(double mouseX, double mouseY, double x, double y, double width, double height) {
return mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + height;
}
public double computeGcd() {
return (Math.pow(mc.options.getMouseSensitivity().getValue() * 0.6 + 0.2, 3.0)) * 1.2;
}
public int getRandom(int min, int max) {
return (int) getRandom((float) min, (float) max + 1);
}
public float getRandom(float min, float max) {
return (float) getRandom(min, (double) max);
}
public double getRandom(double min, double max) {
if (min == max) {
return min;
} else {
if (min > max) {
double d = min;
min = max;
max = d;
}
return ThreadLocalRandom.current().nextDouble(min, max);
}
}
public void scale(MatrixStack stack, float x, float y, float scale, Runnable data) {
if (scale != 1) {
float scale2 = 0.5F + scale / 2;
stack.push();
stack.translate(x, y, 0);
stack.scale(scale2, scale2, 1);
stack.translate(-x, -y, 0);
setAlpha(scale, data);
stack.pop();
} else {
data.run();
}
}
public void scale(MatrixStack stack, float x, float y, float scaleX, float scaleY, Runnable data) {
float sumScale = scaleX * scaleY;
if (sumScale != 1) {
stack.push();
stack.translate(x, y, 0);
stack.scale(scaleX, scaleY, 1);
stack.translate(-x, -y, 0);
setAlpha(sumScale, data);
stack.pop();
} else {
data.run();
}
}
public float blinking(double speed, float f) {
float red = (float) (System.currentTimeMillis() % speed / (speed / f));
if (red > f / 2) red = f - red;
return red;
}
public float textScrolling(float textWidth) {
int speed = (int) (textWidth * 75);
return (float) MathHelper.clamp((System.currentTimeMillis() % speed * Math.PI / speed), 0, 1) * textWidth;
}
public void setAlpha(float alpha, Runnable data) {
setColor(1.0F, 1.0F, 1.0F, alpha, data);
}
public void setColor(float red, float green, float blue, float alpha, Runnable data) {
RenderSystem.setShaderColor(MathHelper.clamp(red,0,1), MathHelper.clamp(green,0,1), MathHelper.clamp(blue,0,1), MathHelper.clamp(alpha,0,1));
data.run();
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
}
public double round(double num, double increment) {
double rounded = Math.round(num / increment) * increment;
return Math.round(rounded * 100.0) / 100.0;
}
public int floorNearestMulN(int x, int n) {
return n * (int) Math.floor((double) x / (double) n);
}
public int getRed(int hex) {
return hex >> 16 & 255;
}
public int getGreen(int hex) {
return hex >> 8 & 255;
}
public int getBlue(int hex) {
return hex & 255;
}
public int getAlpha(int hex) {
return hex >> 24 & 255;
}
public int applyOpacity(int color, float opacity) {
return ColorHelper.getArgb((int) (getAlpha(color) * opacity / 255), getRed(color), getGreen(color), getBlue(color));
}
public Vec3d cosSin(int i, int size, double width) {
int index = Math.min(i, size);
float cos = (float) (Math.cos(index * SigmaMathUtil.PI2 / size) * width);
float sin = (float) (-Math.sin(index * SigmaMathUtil.PI2 / size) * width);
return new Vec3d(cos, 0, sin);
}
public double absSinAnimation(double input) {
return Math.abs(1 + Math.sin(input)) / 2;
}
public Vector3d interpolate(Vector3d prevPos, Vector3d pos) {
RenderTickCounter tickCounter = mc.getRenderTickCounter();
return new Vector3d(lerp(tickCounter.getTickDelta(false), prevPos.x, pos.x), lerp(tickCounter.getTickDelta(false), prevPos.y, pos.y), lerp(tickCounter.getTickDelta(false), prevPos.z, pos.z));
}
public Vec3d interpolate(Vec3d prevPos, Vec3d pos) {
RenderTickCounter tickCounter = mc.getRenderTickCounter();
return new Vec3d(lerp(tickCounter.getTickDelta(false), prevPos.x, pos.x), lerp(tickCounter.getTickDelta(false), prevPos.y, pos.y), lerp(tickCounter.getTickDelta(false), prevPos.z, pos.z));
}
public Vec3d interpolate(Entity entity) {
if (entity == null) return Vec3d.ZERO;
return new Vec3d(interpolate(entity.prevX, entity.getX()), interpolate(entity.prevY, entity.getY()), interpolate(entity.prevZ, entity.getZ()));
}
public float interpolate(float prev, float orig) {
return lerp(mc.getRenderTickCounter().getTickDelta(false), prev, orig);
}
public double interpolate(double prev, double orig) {
return lerp(mc.getRenderTickCounter().getTickDelta(false), prev, orig);
}
public int interpolateSmooth(double smooth, int prev, int orig) {
return (int) lerp(mc.getRenderTickCounter().getLastDuration() / smooth, prev, orig);
}
public float interpolateSmooth(double smooth, float prev, float orig) {
return (float) lerp(mc.getRenderTickCounter().getLastDuration() / smooth, prev, orig);
}
public double interpolateSmooth(double smooth, double prev, double orig) {
return lerp(mc.getRenderTickCounter().getLastDuration() / smooth, prev, orig);
}
}
HudColorutility:
package kronex.fun.other.utils.display.color;
import it.unimi.dsi.fastutil.chars.Char2IntArrayMap;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.experimental.UtilityClass;
import net.minecraft.util.math.MathHelper;
import org.joml.Vector4i;
import kronex.fun.other.utils.theme.ThemeManager;
import java.awt.*;
import java.util.concurrent.*;
import java.util.regex.Pattern;
@Getter
@UtilityClass
public class HudColorutility {
private final long CACHE_EXPIRATION_TIME = 60 * 1000;
private final ConcurrentHashMap<ColorKey, CacheEntry> colorCache = new ConcurrentHashMap<>();
private final ScheduledExecutorService cacheCleaner = Executors.newScheduledThreadPool(1);
private final DelayQueue<CacheEntry> cleanupQueue = new DelayQueue<>();
public static final Pattern FORMATTING_CODE_PATTERN = Pattern.compile("(?i)§[0-9a-f-or]");
public Char2IntArrayMap colorCodes = new Char2IntArrayMap() {{
put('0', 0x000000);
put('1', 0x0000AA);
put('2', 0x00AA00);
put('3', 0x00AAAA);
put('4', 0xAA0000);
put('5', 0xAA00AA);
put('6', 0xFFAA00);
put('7', 0xAAAAAA);
put('8', 0x555555);
put('9', 0x5555FF);
put('A', 0x55FF55);
put('B', 0x55FFFF);
put('C', 0xFF5555);
put('D', 0xFF55FF);
put('E', 0xFFFF55);
put('F', 0xFFFFFF);
}};
static {
cacheCleaner.scheduleWithFixedDelay(() -> {
CacheEntry entry = cleanupQueue.poll();
while (entry != null) {
if (entry.isExpired()) {
colorCache.remove(entry.getKey());
}
entry = cleanupQueue.poll();
}
}, 0, 1, TimeUnit.SECONDS);
}
public final int RED = getColor(255, 0, 0);
public final int GREEN = getColor(0, 255, 0);
public final int BLUE = getColor(0, 0, 255);
public final int YELLOW = getColor(255, 255, 0);
public final int WHITE = getColor(255);
public final int BLACK = getColor(0);
public final int HALF_BLACK = getColor(0,0.5F);
public final int LIGHT_RED = getColor(255, 85, 85);
public int red(int c) {return (c >> 16) & 0xFF;}
public int green(int c) {
return (c >> 8) & 0xFF;
}
public int blue(int c) {
return c & 0xFF;
}
public int alpha(int c) {
return (c >> 24) & 0xFF;
}
public float redf(int c) {
return red(c) / 255.0f;
}
public float greenf(int c) {
return green(c) / 255.0f;
}
public float bluef(int c) {
return blue(c) / 255.0f;
}
public float alphaf(int c) {
return alpha(c) / 255.0f;
}
public int[] getRGBA(int c) {
return new int[]{red(c), green(c), blue(c), alpha(c)};
}
public int[] getRGB(int c) {
return new int[]{red(c), green(c), blue(c)};
}
public float[] getRGBAf(int c) {
return new float[]{redf(c), greenf(c), bluef(c), alphaf(c)};
}
public float[] getRGBf(int c) {
return new float[]{redf(c), greenf(c), bluef(c)};
}
public int getColor(float red, float green, float blue, float alpha) {
return getColor(Math.round(red * 255), Math.round(green * 255), Math.round(blue * 255), Math.round(alpha * 255));
}
public int getColor(int red, int green, int blue, float alpha) {
return getColor(red, green, blue, Math.round(alpha * 255));
}
public int getColor(float red, float green, float blue) {
return getColor(red, green, blue, 1.0F);
}
public int getColor(int brightness, int alpha) {
return getColor(brightness, brightness, brightness, alpha);
}
public int getColor(int brightness, float alpha) {
return getColor(brightness, Math.round(alpha * 255));
}
public int getColor(int brightness) {
return getColor(brightness, brightness, brightness);
}
public int replAlpha(int color, int alpha) {
return getColor(red(color), green(color), blue(color), alpha);
}
public int replAlpha(int color, float alpha) {
return getColor(red(color), green(color), blue(color), alpha);
}
public int multAlpha(int color, float percent01) {
return getColor(red(color), green(color), blue(color), Math.round(alpha(color) * percent01));
}
public int multColor(int colorStart, int colorEnd, float progress) {
return getColor(Math.round(red(colorStart) * (redf(colorEnd) * progress)), Math.round(green(colorStart) * (greenf(colorEnd) * progress)),
Math.round(blue(colorStart) * (bluef(colorEnd) * progress)), Math.round(alpha(colorStart) * (alphaf(colorEnd) * progress)));
}
public int multRed(int colorStart, int colorEnd, float progress) {
return getColor(Math.round(red(colorStart) * (redf(colorEnd) * progress)), Math.round(green(colorStart) * (greenf(colorEnd) * progress)),
Math.round(blue(colorStart) * (bluef(colorEnd) * progress)), Math.round(alpha(colorStart) * (alphaf(colorEnd) * progress)));
}
public int multDark(int color, float percent01) {
return getColor(
Math.round(red(color) * percent01),
Math.round(green(color) * percent01),
Math.round(blue(color) * percent01),
alpha(color)
);
}
public int multBright(int color, float percent01) {
return getColor(
Math.min(255, Math.round(red(color) / percent01)),
Math.min(255, Math.round(green(color) / percent01)),
Math.min(255, Math.round(blue(color) / percent01)),
alpha(color)
);
}
public int overCol(int color1, int color2, float percent01) {
final float percent = MathHelper.clamp(percent01, 0F, 1F);
return getColor(
MathHelper.lerp(percent, red(color1), red(color2)),
MathHelper.lerp(percent, green(color1), green(color2)),
MathHelper.lerp(percent, blue(color1), blue(color2)),
MathHelper.lerp(percent, alpha(color1), alpha(color2))
);
}
public Vector4i multRedAndAlpha(Vector4i color, float red, float alpha) {
return new Vector4i(multRedAndAlpha(color.x, red, alpha), multRedAndAlpha(color.y, red, alpha), multRedAndAlpha(color.w, red, alpha), multRedAndAlpha(color.z, red, alpha));
}
public int multRedAndAlpha(int color, float red, float alpha) {
return getColor(red(color),Math.min(255, Math.round(green(color) / red)), Math.min(255, Math.round(blue(color) / red)), Math.round(alpha(color) * alpha));
}
public int multRed(int color, float percent01) {
return getColor(red(color),Math.min(255, Math.round(green(color) / percent01)), Math.min(255, Math.round(blue(color) / percent01)), alpha(color));
}
public int multGreen(int color, float percent01) {
return getColor(Math.min(255, Math.round(green(color) / percent01)), green(color), Math.min(255, Math.round(blue(color) / percent01)), alpha(color));
}
public int[] genGradientForText(int color1, int color2, int length) {
int[] gradient = new int[length];
for (int i = 0; i < length; i++) {
float pc = (float) i / (length - 1);
gradient[i] = overCol(color1, color2, pc);
}
return gradient;
}
public int rainbow(int speed, int index, float saturation, float brightness, float opacity) {
int angle = (int) ((System.currentTimeMillis() / speed + index) % 360);
float hue = angle / 360f;
int color = Color.HSBtoRGB(hue, saturation, brightness);
return getColor(red(color), green(color), blue(color), Math.round(opacity * 255));
}
public int fade(int speed, int index, int first, int second) {
int angle = (int) ((System.currentTimeMillis() / speed + index) % 360);
angle = angle >= 180 ? 360 - angle : angle;
return overCol(first, second, angle / 180f);
}
public int fade(int index) {
Color clientColor = new Color(getClientColor());
return fade(8, index, clientColor.brighter().getRGB(), clientColor.darker().getRGB());
}
public Vector4i roundClientColor(float alpha) {
return new Vector4i(
HudColorutility.multAlpha(HudColorutility.fade(270), alpha),
HudColorutility.multAlpha(HudColorutility.fade(0), alpha),
HudColorutility.multAlpha(HudColorutility.fade(180), alpha),
HudColorutility.multAlpha(HudColorutility.fade(90), alpha)
);
}
public int getColor(int red, int green, int blue, int alpha) {
ColorKey key = new ColorKey(red, green, blue, alpha);
CacheEntry cacheEntry = colorCache.computeIfAbsent(key, k -> {
CacheEntry newEntry = new CacheEntry(k, computeColor(red, green, blue, alpha), CACHE_EXPIRATION_TIME);
cleanupQueue.offer(newEntry);
return newEntry;
});
return cacheEntry.getColor();
}
public int getColor(int red, int green, int blue) {
return getColor(red, green, blue, 255);
}
private int computeColor(int red, int green, int blue, int alpha) {
return ((MathHelper.clamp(alpha, 0, 255) << 24) |
(MathHelper.clamp(red, 0, 255) << 16) |
(MathHelper.clamp(green, 0, 255) << 8) |
MathHelper.clamp(blue, 0, 255));
}
private String generateKey(int red, int green, int blue, int alpha) {
return red + "," + green + "," + blue + "," + alpha;
}
public String formatting(int color) {
return "⏏" + color + "⏏";
}
@Getter
@RequiredArgsConstructor
@EqualsAndHashCode
private static class ColorKey {
final int red, green, blue, alpha;
}
@Getter
private static class CacheEntry implements Delayed {
private final ColorKey key;
private final int color;
private final long expirationTime;
CacheEntry(ColorKey key, int color, long ttl) {
this.key = key;
this.color = color;
this.expirationTime = System.currentTimeMillis() + ttl;
}
@Override
public long getDelay(TimeUnit unit) {
long delay = expirationTime - System.currentTimeMillis();
return unit.convert(delay, TimeUnit.MILLISECONDS);
}
@Override
public int compareTo(Delayed other) {
if (other instanceof CacheEntry) {
return Long.compare(this.expirationTime, ((CacheEntry) other).expirationTime);
}
return 0;
}
public boolean isExpired() {
return System.currentTimeMillis() > expirationTime;
}
}
public String removeFormatting(String text) {
return text == null || text.isEmpty() ? null : FORMATTING_CODE_PATTERN.matcher(text).replaceAll("");
}
public int getMainGuiColor() {
if (!ThemeManager.advancedSettings.isValue() || !ThemeManager.backgroundGuiEnabled.isValue()) {
return 0xFF111114;
}
return ThemeManager.BackgroundGui.getColor() | 0xFF000000;
}
public int getGuiRectColor(float alpha) {return multAlpha(new Color(0x1A1A1F).getRGB(),alpha);}
public int getGuiRectColor2(float alpha) {return multAlpha(new Color(0x1E1E26).getRGB(),alpha);}
public int getRect(float alpha) {
if (!ThemeManager.advancedSettings.isValue() || !ThemeManager.backgroundGuiEnabled.isValue()) {
return 0xFF111114;
}
return ThemeManager.BackgroundGui.getColor() | 0xFF000000;
}
public Vector4i getRectGradient(float topAlpha, float bottomAlpha) {
int baseColor;
if (!ThemeManager.advancedSettings.isValue() || !ThemeManager.backgroundGuiEnabled.isValue()) {
baseColor = 0xFF111114;
} else {
baseColor = ThemeManager.BackgroundGui.getColor() | 0xFF000000;
}
// Делаем верх темнее, низ светлее
return new Vector4i(baseColor, baseColor, baseColor, baseColor);
}
public int getRectDarker(float alpha) {
if (!ThemeManager.advancedSettings.isValue() || !ThemeManager.backgroundSettingsEnabled.isValue()) {
return 0xFF1B1B1E;
}
return ThemeManager.BackgroundSettings.getColor() | 0xFF000000;
}
public Vector4i getRectDarkerGradient(float topAlpha, float bottomAlpha) {
int baseColor;
if (!ThemeManager.advancedSettings.isValue() || !ThemeManager.backgroundSettingsEnabled.isValue()) {
baseColor = 0xFF1B1B1E;
} else {
baseColor = ThemeManager.BackgroundSettings.getColor() | 0xFF000000;
}
return new Vector4i(baseColor, baseColor, baseColor, baseColor);
}
public int getText(float alpha) {return multAlpha(getText(),alpha);}
public int getText() {
if (!ThemeManager.advancedSettings.isValue() || !ThemeManager.textColorEnabled.isValue()) {
return 0xFFFFFFFF;
}
return ThemeManager.textColor.getColor();
}
public int getIconColor() {
if (!ThemeManager.advancedSettings.isValue() || !ThemeManager.iconColorEnabled.isValue()) {
return getClientColor();
}
return ThemeManager.iconColor.getColor();
}
public int getIconColor(float alpha) {return multAlpha(getIconColor(), alpha);}
public int getClientColor() {
int c1 = ThemeManager.primaryColor.getColor();
if (!ThemeManager.secondColorEnabled.isValue()) {
return c1;
}
int c2 = ThemeManager.secondaryColor.getColor();
long time = System.currentTimeMillis();
float t = (float) ((Math.sin(time / 650.0) + 1.0) / 2.0);
return ColorAssist.interpolateColor(c1, c2, t);
}
public int getClientColor(float alpha) {
return multAlpha(getClientColor(),alpha);
}
public int getFriendColor() {
return new Color(0x55FF55).getRGB();
}
public int getOutline(float alpha, float bright) {return multBright(multAlpha(getOutline(),alpha),bright);}
public int getOutline(float alpha) {return multAlpha(getOutline(), alpha);}
public int getOutline() {
return new Color(0x373746).getRGB();
}
public int argb(int r, int g, int b, int a) {
return getColor(r, g, b, a);
}
}
Последнее редактирование: