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,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