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

@ -4,9 +4,9 @@ org.gradle.parallel=true
# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.19.3
yarn_mappings=1.19.3+build.5
loader_version=0.14.17
minecraft_version=1.20
yarn_mappings=1.20+build.1
loader_version=0.14.21
# Mod Properties
mod_version = dev
@ -14,4 +14,4 @@ org.gradle.parallel=true
archives_base_name = moonlight
# Dependencies
fabric_version=0.75.1+1.19.3
fabric_version=0.83.0+1.20

View file

@ -10,7 +10,7 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
import me.kawaiizenbo.moonlight.command.CommandManager;
import me.kawaiizenbo.moonlight.util.ChatUtils;
import net.minecraft.network.ClientConnection;
import net.minecraft.network.Packet;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.c2s.play.ChatMessageC2SPacket;
@Mixin(ClientConnection.class)

View file

@ -11,7 +11,7 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.TitleScreen;
import net.minecraft.client.gui.widget.ButtonWidget;
@ -43,7 +43,7 @@ public abstract class TitleScreenMixin extends Screen
float g = this.doBackgroundFade ? MathHelper.clamp(f - 1.0F, 0.0F, 1.0F) : 1.0F;
int l = MathHelper.ceil(g * 255.0F) << 24;
DrawableHelper.drawStringWithShadow(matrices, this.textRenderer, Moonlight.clientTag + " " + Moonlight.versionTag, 2, 2, 16777215 | l);
DrawContext.drawTextWithShadow(matrices, this.textRenderer, Moonlight.clientTag + " " + Moonlight.versionTag, 2, 2, 16777215 | l);
}
@Inject(at = @At("TAIL"), method = "init")

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);
}

View file

@ -3,7 +3,7 @@ package me.kawaiizenbo.moonlight.ui;
import me.kawaiizenbo.moonlight.ui.clickgui.ClickGUIScreen;
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;
import net.minecraft.text.Text;
@ -23,8 +23,8 @@ public class TextButton
public void render(MatrixStack matrices, TextRenderer textRenderer, int mouseX, int mouseY)
{
width = textRenderer.getWidth(text);
DrawableHelper.fill(matrices, x-1, y-1, x + width + 1, y + 10, hovered(mouseX, mouseY) ? 0xFF444444 : 0xFF222222);
DrawableHelper.drawTextWithShadow(matrices, textRenderer, Text.literal(text), x, y, color);
DrawContext.fill(matrices, x-1, y-1, x + width + 1, y + 10, hovered(mouseX, mouseY) ? 0xFF444444 : 0xFF222222);
DrawContext.drawTextWithShadow(matrices, textRenderer, Text.literal(text), x, y, color);
}
public boolean hovered(int mouseX, int mouseY)

View file

@ -3,7 +3,7 @@ package me.kawaiizenbo.moonlight.ui.clickgui;
import me.kawaiizenbo.moonlight.module.Module_;
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 ModuleButton
@ -24,7 +24,7 @@ public class ModuleButton
public void render(MatrixStack matrices, int mouseX, int mouseY)
{
TextRenderer textRenderer = mc.textRenderer;
DrawableHelper.fill(matrices, x, y, x + width, y + height, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222);
DrawContext.fill(matrices, x, y, x + width, y + height, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222);
textRenderer.draw(matrices, module.name, x+3, y+3, module.enabled ? 0x55FFFF : 0xFFFFFF);
}

View file

@ -4,7 +4,7 @@ import me.kawaiizenbo.moonlight.module.Module_;
import me.kawaiizenbo.moonlight.module.settings.Setting;
import me.kawaiizenbo.moonlight.ui.TextButton;
import me.kawaiizenbo.moonlight.util.ColorUtils;
import net.minecraft.client.gui.DrawableHelper;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
@ -24,9 +24,9 @@ public class SettingsScreen extends Screen
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta)
{
this.renderBackground(matrices);
DrawableHelper.fill(matrices, (width/2)-112, (height/2)-96, (width/2)+112, (height/2)+96, 0xFF222222);
DrawableHelper.drawCenteredText(matrices, textRenderer, module.name, width/2, (height/2)-88, 0xFFFFFF);
DrawableHelper.drawTextWithShadow(matrices, textRenderer, Text.literal(module.description), (width/2)-104, (height/2)-72, 0xFFFFFF);
DrawContext.fill(matrices, (width/2)-112, (height/2)-96, (width/2)+112, (height/2)+96, 0xFF222222);
DrawContext.drawCenteredTextWithShadow(matrices, textRenderer, module.name, width/2, (height/2)-88, 0xFFFFFF);
DrawContext.drawTextWithShadow(matrices, textRenderer, Text.literal(module.description), (width/2)-104, (height/2)-72, 0xFFFFFF);
backButton = new TextButton(ColorUtils.underline + "< Back", (width/2)-104, (height/2)-88, 0xFFFFFF);
backButton.render(matrices, textRenderer, mouseX, mouseY);
int yOffset = (height/2)-56;

View file

@ -1,2 +1,2 @@
accessWidener v1 named
accessible method net/minecraft/client/gui/DrawableHelper fillGradient (Lnet/minecraft/client/util/math/MatrixStack;IIIIIII)V
accessible method net/minecraft/client/gui/DrawContext fillGradient (IIIIIII)V