This commit is contained in:
kawaiizenbo 2023-06-08 10:45:40 -07:00
parent f90a15a48f
commit 6e7d77dea3
11 changed files with 35 additions and 35 deletions

View file

@ -1,6 +1,6 @@
package me.kawaiizenbo.moonlight.module.settings;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
@ -18,10 +18,10 @@ public class BooleanSetting extends Setting
public void render(MatrixStack matrices, int x, int y, int mouseX, int mouseY)
{
super.render(matrices, x, y, mouseX, mouseY);
DrawableHelper.drawTextWithShadow(matrices, textRenderer, Text.literal(name), x+2, y+8, 0xFFFFFF);
DrawableHelper.fill(matrices, x+175, y+7, x+185, y+17, 0xFFFFFFFF);
DrawableHelper.fill(matrices, x+176, y+8, x+184, y+16, 0xFF222222);
DrawableHelper.fill(matrices, x+177, y+9, x+183, y+15, value ? 0xFF55FFFF : 0xFF222222);
DrawContext.drawTextWithShadow(matrices, textRenderer, Text.literal(name), x+2, y+8, 0xFFFFFF);
DrawContext.fill(matrices, x+175, y+7, x+185, y+17, 0xFFFFFFFF);
DrawContext.fill(matrices, x+176, y+8, x+184, y+16, 0xFF222222);
DrawContext.fill(matrices, x+177, y+9, x+183, y+15, value ? 0xFF55FFFF : 0xFF222222);
}
@Override

View file

@ -1,6 +1,6 @@
package me.kawaiizenbo.moonlight.module.settings;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
@ -26,16 +26,16 @@ public class ColorSetting extends Setting
public void render(MatrixStack matrices, int x, int y, int mouseX, int mouseY)
{
super.render(matrices, x, y, mouseX, mouseY);
DrawableHelper.drawTextWithShadow(matrices, textRenderer, Text.literal(name), x+2, y+2, 0xFFFFFF);
DrawContext.drawTextWithShadow(matrices, textRenderer, Text.literal(name), x+2, y+2, 0xFFFFFF);
int redDisplayStartColor = ((255&0x0ff)<<24)|((0&0x0ff)<<16)|((g&0x0ff)<<8)|(b&0x0ff);
int redDisplayEndColor = ((255&0x0ff)<<24)|((255&0x0ff)<<16)|((g&0x0ff)<<8)|(b&0x0ff);
int greenDisplayStartColor = ((255&0x0ff)<<24)|((r&0x0ff)<<16)|((0&0x0ff)<<8)|(b&0x0ff);
int greenDisplayEndColor = ((255&0x0ff)<<24)|((r&0x0ff)<<16)|((255&0x0ff)<<8)|(b&0x0ff);
int blueDisplayStartColor = ((255&0x0ff)<<24)|((r&0x0ff)<<16)|((g&0x0ff)<<8)|(0&0x0ff);
int blueDisplayEndColor = ((255&0x0ff)<<24)|((r&0x0ff)<<16)|((g&0x0ff)<<8)|(255&0x0ff);
DrawableHelper.fillGradient(matrices, x+80, y+2, x+92, y+62, redDisplayEndColor, redDisplayStartColor, 0);
DrawableHelper.fillGradient(matrices, x+95, y+2, x+107, y+62, greenDisplayEndColor, greenDisplayStartColor, 0);
DrawableHelper.fillGradient(matrices, x+110, y+2, x+122, y+62, blueDisplayEndColor, blueDisplayStartColor, 0);
DrawContext.fillGradient(matrices, x+80, y+2, x+92, y+62, redDisplayEndColor, redDisplayStartColor, 0);
DrawContext.fillGradient(matrices, x+95, y+2, x+107, y+62, greenDisplayEndColor, greenDisplayStartColor, 0);
DrawContext.fillGradient(matrices, x+110, y+2, x+122, y+62, blueDisplayEndColor, blueDisplayStartColor, 0);
textRenderer.drawWithShadow(matrices, Text.literal("Red: " + r), x+130, y+10, 0xFFFFFFFF);
textRenderer.drawWithShadow(matrices, Text.literal("Green: " + g), x+130, y+26, 0xFFFFFFFF);
textRenderer.drawWithShadow(matrices, Text.literal("Blue: " + b), x+130, y+42, 0xFFFFFFFF);

View file

@ -1,7 +1,7 @@
package me.kawaiizenbo.moonlight.module.settings;
import me.kawaiizenbo.moonlight.util.MathUtils;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
@ -26,7 +26,7 @@ public class DoubleSetting extends Setting
public void render(MatrixStack matrices, int x, int y, int mouseX, int mouseY)
{
super.render(matrices, x, y, mouseX, mouseY);
DrawableHelper.drawTextWithShadow(matrices, textRenderer, Text.literal(name), x+2, y+2, 0xFFFFFF);
DrawContext.drawTextWithShadow(matrices, textRenderer, Text.literal(name), x+2, y+2, 0xFFFFFF);
double diff = Math.min(100, Math.max(0, (mouseX - x)/1.9));
if (sliding)
@ -43,11 +43,11 @@ public class DoubleSetting extends Setting
}
String valueString = ""+MathUtils.round(value, roundingPlace);
DrawableHelper.drawTextWithShadow(matrices, textRenderer, Text.literal(valueString), (x+190)-textRenderer.getWidth(valueString), y+2, 0xFFFFFF);
DrawableHelper.fill(matrices, x+2, y+16, x+190, y+18, 0xFF666666);
DrawContext.drawTextWithShadow(matrices, textRenderer, Text.literal(valueString), (x+190)-textRenderer.getWidth(valueString), y+2, 0xFFFFFF);
DrawContext.fill(matrices, x+2, y+16, x+190, y+18, 0xFF666666);
int scaledValue = (int)((value/max)*190);
DrawableHelper.fill(matrices, x+2, y+16, (x+2)+scaledValue, y+18, 0xFF55FFFF);
DrawableHelper.fill(matrices, x+2+(scaledValue-1), y+14, x+2+(scaledValue+1), y+20, 0xFFFFFFFF);
DrawContext.fill(matrices, x+2, y+16, (x+2)+scaledValue, y+18, 0xFF55FFFF);
DrawContext.fill(matrices, x+2+(scaledValue-1), y+14, x+2+(scaledValue+1), y+20, 0xFFFFFFFF);
}
@Override

View file

@ -2,7 +2,7 @@ package me.kawaiizenbo.moonlight.module.settings;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.util.math.MatrixStack;
public class Setting
@ -16,7 +16,7 @@ public class Setting
{
this.x = x;
this.y = y;
DrawableHelper.fill(matrices, x, y, x+192, y+height, hovered(mouseX, mouseY) ? 0xFF444444: 0xFF222222);
DrawContext.fill(matrices, x, y, x+192, y+height, hovered(mouseX, mouseY) ? 0xFF444444: 0xFF222222);
}