Начинающий
- Статус
- Оффлайн
- Регистрация
- 15 Мар 2025
- Сообщения
- 341
- Реакции
- 2
- Выберите загрузчик игры
- Vanilla
- OptiFine
Заходим в класс Widget и меняем метод renderButton на:
без кастом шрифта:
ss:
muldark:
getCol:
Код:
private float btnDarkness = 0.4F;
public void renderButton(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
int i = this.getYImage(this.isHovered());
if (SelfDestruct.unhooked) {
Minecraft minecraft = Minecraft.getInstance();
FontRenderer fontrenderer = minecraft.fontRenderer;
minecraft.getTextureManager().bindTexture(WIDGETS_LOCATION);
RenderSystem.color4f(3.0F, 3.0F, 1.0F, this.alpha);
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderSystem.enableDepthTest();
this.blit(matrixStack, this.x, this.y, 0, 46 + i * 20, this.width / 2, this.height);
this.blit(matrixStack, this.x + this.width / 2, this.y, 200 - this.width / 2, 46 + i * 20, this.width / 2, this.height);
this.renderBg(matrixStack, minecraft, mouseX, mouseY);
int ss = this.active ? 16777215 : 10526880;
drawCenteredString(matrixStack, fontrenderer, this.getMessage(), this.x + this.width / 2, this.y + (this.height - 8) / 2, ss | MathHelp.ceil(this.alpha * 255.0F) << 24);
} else {
Minecraft minecraft = Minecraft.getInstance();
btnDarkness = (float) MathUtil.lerp(btnDarkness, this.isHovered ? 0.75F : 0.25F, 10);
int color = Theme.getColor(0);
float darkness = this.active ? btnDarkness : 0.2F;
int color1 = ColorUtil.muldark(color, darkness);
int color2 = ColorUtil.muldark(color, darkness);
int color3 = ColorUtil.muldark(color, darkness);
int color4 = ColorUtil.muldark(color, darkness);
RectUtilit.getInst().drawRoundedRectShadowed(matrixStack, this.x + 2, this.y + 2, this.x + this.width - 2, this.y + this.height - 2, 2, 5, color1, color2, color3, color4, true, true, false, true);
int ss = this.active ? 16777215 : 10526880;
SoftFonts.cur[16]. drawCenteredString(matrixStack, this.getMessage(), this.x + this.width / 2, this.y + (this.height - 4.5f) / 2, ss | MathHelp.ceil(this.alpha * 255.0F) << 24);
}
}
без кастом шрифта:
Код:
private float btnDarkness = 0.4F;
public void renderButton(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
int i = this.getYImage(this.isHovered());
if (SelfDestruct.unhooked) {
Minecraft minecraft = Minecraft.getInstance();
FontRenderer fontrenderer = minecraft.fontRenderer;
minecraft.getTextureManager().bindTexture(WIDGETS_LOCATION);
RenderSystem.color4f(3.0F, 3.0F, 1.0F, this.alpha);
RenderSystem.enableBlend();
RenderSystem.defaultBlendFunc();
RenderSystem.enableDepthTest();
this.blit(matrixStack, this.x, this.y, 0, 46 + i * 20, this.width / 2, this.height);
this.blit(matrixStack, this.x + this.width / 2, this.y, 200 - this.width / 2, 46 + i * 20, this.width / 2, this.height);
this.renderBg(matrixStack, minecraft, mouseX, mouseY);
int ss = this.active ? 16777215 : 10526880;
drawCenteredString(matrixStack, fontrenderer, this.getMessage(), this.x + this.width / 2, this.y + (this.height - 8) / 2, ss | MathHelp.ceil(this.alpha * 255.0F) << 24);
} else {
Minecraft minecraft = Minecraft.getInstance();
btnDarkness = (float) MathUtil.lerp(btnDarkness, this.isHovered ? 0.75F : 0.25F, 10);
int color = Theme.getColor(0);
float darkness = this.active ? btnDarkness : 0.2F;
int color1 = ColorUtil.muldark(color, darkness);
int color2 = ColorUtil.muldark(color, darkness);
int color3 = ColorUtil.muldark(color, darkness);
int color4 = ColorUtil.muldark(color, darkness);
RectUtilit.getInst().drawRoundedRectShadowed(matrixStack, this.x + 2, this.y + 2, this.x + this.width - 2, this.y + this.height - 2, 2, 5, color1, color2, color3, color4, true, true, false, true);
int ss = this.active ? 16777215 : 10526880;
drawCenteredString(matrixStack, fontrenderer, this.getMessage(), this.x + this.width / 2, this.y + (this.height - 8) / 2, ss | MathHelp.ceil(this.alpha * 255.0F) << 24);
}
}
ss:
muldark:
Код:
public static int muldark(int c, float brpc) {
return getCol((float) red(c) * brpc, (float) green(c) * brpc, (float) blue(c) * brpc, (float) alpha(c));
}
getCol:
Код:
public static int getCol(float r, float g, float b, float a) {
return new Color((int) r, (int) g, (int) b, (int) a).getRGB();
}