fuck you matrixstack nobody ever liked you anyway
This commit is contained in:
		
							parent
							
								
									6e7d77dea3
								
							
						
					
					
						commit
						f41e477e28
					
				
					 15 changed files with 65 additions and 69 deletions
				
			
		| 
						 | 
				
			
			@ -1,6 +1,9 @@
 | 
			
		|||
package me.kawaiizenbo.moonlight;
 | 
			
		||||
 | 
			
		||||
import net.fabricmc.api.ModInitializer;
 | 
			
		||||
import net.minecraft.client.MinecraftClient;
 | 
			
		||||
import net.minecraft.client.gui.DrawContext;
 | 
			
		||||
 | 
			
		||||
import org.slf4j.Logger;
 | 
			
		||||
import org.slf4j.LoggerFactory;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -9,6 +12,7 @@ import me.kawaiizenbo.moonlight.util.ColorUtils;
 | 
			
		|||
public class Moonlight implements ModInitializer 
 | 
			
		||||
{
 | 
			
		||||
	public static final Moonlight INSTANCE = new Moonlight();
 | 
			
		||||
	public static final DrawContext drawCfontext = new DrawContext(MinecraftClient.getInstance(), null);
 | 
			
		||||
	public static final Logger LOGGER = LoggerFactory.getLogger("Moonlight");
 | 
			
		||||
	public static final String clientTag = ColorUtils.aqua + "Moonlight Meadows";
 | 
			
		||||
	public static final String versionTag = ColorUtils.magenta + "v0.dev";
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -8,8 +8,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
 | 
			
		|||
 | 
			
		||||
import me.kawaiizenbo.moonlight.module.ModuleManager;
 | 
			
		||||
import me.kawaiizenbo.moonlight.ui.HUD;
 | 
			
		||||
import net.minecraft.client.gui.DrawContext;
 | 
			
		||||
import net.minecraft.client.gui.hud.InGameHud;
 | 
			
		||||
import net.minecraft.client.util.math.MatrixStack;
 | 
			
		||||
 | 
			
		||||
@Mixin(InGameHud.class)
 | 
			
		||||
public class InGameHudMixin {
 | 
			
		||||
| 
						 | 
				
			
			@ -18,9 +18,9 @@ public class InGameHudMixin {
 | 
			
		|||
    @Shadow private int scaledHeight;
 | 
			
		||||
    
 | 
			
		||||
	@Inject(at = @At("TAIL"), method = "render") 
 | 
			
		||||
	public void onRender (MatrixStack matrices, float tickDelta, CallbackInfo info) 
 | 
			
		||||
	public void onRender (DrawContext drawContext, float tickDelta, CallbackInfo info) 
 | 
			
		||||
    {
 | 
			
		||||
		if (ModuleManager.INSTANCE.getModuleByName("HUD").enabled) HUD.INSTANCE.renderHUD(matrices, scaledWidth, scaledHeight);
 | 
			
		||||
		if (ModuleManager.INSTANCE.getModuleByName("HUD").enabled) HUD.INSTANCE.renderHUD(drawContext, scaledWidth, scaledHeight);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,7 +15,6 @@ 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;
 | 
			
		||||
import net.minecraft.client.util.math.MatrixStack;
 | 
			
		||||
import net.minecraft.text.Text;
 | 
			
		||||
import net.minecraft.util.Util;
 | 
			
		||||
import net.minecraft.util.math.MathHelper;
 | 
			
		||||
| 
						 | 
				
			
			@ -37,13 +36,13 @@ public abstract class TitleScreenMixin extends Screen
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    @Inject(at = @At("TAIL"), method = "render")
 | 
			
		||||
    private void clientTag(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo info) 
 | 
			
		||||
    private void clientTag(DrawContext drawContext, int mouseX, int mouseY, float delta, CallbackInfo info) 
 | 
			
		||||
    {
 | 
			
		||||
        float f = this.doBackgroundFade ? (Util.getMeasuringTimeMs() - this.backgroundFadeStart) / 1000.0F : 1.0F;
 | 
			
		||||
        float g = this.doBackgroundFade ? MathHelper.clamp(f - 1.0F, 0.0F, 1.0F) : 1.0F;
 | 
			
		||||
        int l = MathHelper.ceil(g * 255.0F) << 24;
 | 
			
		||||
 | 
			
		||||
        DrawContext.drawTextWithShadow(matrices, this.textRenderer, Moonlight.clientTag + " " + Moonlight.versionTag, 2, 2, 16777215 | l);
 | 
			
		||||
        drawContext.drawTextWithShadow(this.textRenderer, Moonlight.clientTag + " " + Moonlight.versionTag, 2, 2, 16777215 | l);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Inject(at = @At("TAIL"), method = "init")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,12 +17,12 @@ public class Step extends Module_
 | 
			
		|||
    @Override
 | 
			
		||||
    public void tick()
 | 
			
		||||
    {
 | 
			
		||||
        mc.player.stepHeight = (float)stepHeight.value;
 | 
			
		||||
        mc.player.setStepHeight((float)stepHeight.value);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void onDisable()
 | 
			
		||||
    {
 | 
			
		||||
        mc.player.stepHeight = 0.5f;
 | 
			
		||||
        mc.player.setStepHeight(0.5f);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,6 @@
 | 
			
		|||
package me.kawaiizenbo.moonlight.module.settings;
 | 
			
		||||
 | 
			
		||||
import net.minecraft.client.gui.DrawContext;
 | 
			
		||||
import net.minecraft.client.util.math.MatrixStack;
 | 
			
		||||
import net.minecraft.text.Text;
 | 
			
		||||
 | 
			
		||||
public class BooleanSetting extends Setting
 | 
			
		||||
| 
						 | 
				
			
			@ -15,13 +14,13 @@ public class BooleanSetting extends Setting
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void render(MatrixStack matrices, int x, int y, int mouseX, int mouseY) 
 | 
			
		||||
    public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY) 
 | 
			
		||||
    {
 | 
			
		||||
        super.render(matrices, x, y, mouseX, mouseY);
 | 
			
		||||
        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);
 | 
			
		||||
        super.render(drawContext, x, y, mouseX, mouseY);
 | 
			
		||||
        drawContext.drawTextWithShadow(textRenderer, Text.literal(name), x+2, y+8, 0xFFFFFF);
 | 
			
		||||
        drawContext.fill(x+175, y+7, x+185, y+17, 0xFFFFFFFF);
 | 
			
		||||
        drawContext.fill(x+176, y+8, x+184, y+16, 0xFF222222);
 | 
			
		||||
        drawContext.fill(x+177, y+9, x+183, y+15, value ? 0xFF55FFFF : 0xFF222222);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    @Override
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,6 @@
 | 
			
		|||
package me.kawaiizenbo.moonlight.module.settings;
 | 
			
		||||
 | 
			
		||||
import net.minecraft.client.gui.DrawContext;
 | 
			
		||||
import net.minecraft.client.util.math.MatrixStack;
 | 
			
		||||
import net.minecraft.text.Text;
 | 
			
		||||
 | 
			
		||||
public class ColorSetting extends Setting
 | 
			
		||||
| 
						 | 
				
			
			@ -23,21 +22,21 @@ public class ColorSetting extends Setting
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void render(MatrixStack matrices, int x, int y, int mouseX, int mouseY) 
 | 
			
		||||
    public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY) 
 | 
			
		||||
    {
 | 
			
		||||
        super.render(matrices, x, y, mouseX, mouseY);
 | 
			
		||||
        DrawContext.drawTextWithShadow(matrices, textRenderer, Text.literal(name), x+2, y+2, 0xFFFFFF);
 | 
			
		||||
        super.render(drawContext, x, y, mouseX, mouseY);
 | 
			
		||||
        drawContext.drawTextWithShadow(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);
 | 
			
		||||
        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);
 | 
			
		||||
        drawContext.fillGradient(x+80, y+2, x+92, y+62, redDisplayEndColor, redDisplayStartColor, 0);
 | 
			
		||||
        drawContext.fillGradient(x+95, y+2, x+107, y+62, greenDisplayEndColor, greenDisplayStartColor, 0);
 | 
			
		||||
        drawContext.fillGradient(x+110, y+2, x+122, y+62, blueDisplayEndColor, blueDisplayStartColor, 0);
 | 
			
		||||
        drawContext.drawTextWithShadow(textRenderer, Text.literal("Red: " + r), x+130, y+10, 0xFFFFFFFF);
 | 
			
		||||
        drawContext.drawTextWithShadow(textRenderer, Text.literal("Green: " + g), x+130, y+26, 0xFFFFFFFF);
 | 
			
		||||
        drawContext.drawTextWithShadow(textRenderer, Text.literal("Blue: " + b), x+130, y+42, 0xFFFFFFFF);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,7 +2,6 @@ package me.kawaiizenbo.moonlight.module.settings;
 | 
			
		|||
 | 
			
		||||
import me.kawaiizenbo.moonlight.util.MathUtils;
 | 
			
		||||
import net.minecraft.client.gui.DrawContext;
 | 
			
		||||
import net.minecraft.client.util.math.MatrixStack;
 | 
			
		||||
import net.minecraft.text.Text;
 | 
			
		||||
 | 
			
		||||
public class DoubleSetting extends Setting
 | 
			
		||||
| 
						 | 
				
			
			@ -23,10 +22,10 @@ public class DoubleSetting extends Setting
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void render(MatrixStack matrices, int x, int y, int mouseX, int mouseY) 
 | 
			
		||||
    public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY) 
 | 
			
		||||
    {
 | 
			
		||||
        super.render(matrices, x, y, mouseX, mouseY);
 | 
			
		||||
        DrawContext.drawTextWithShadow(matrices, textRenderer, Text.literal(name), x+2, y+2, 0xFFFFFF);
 | 
			
		||||
        super.render(drawContext, x, y, mouseX, mouseY);
 | 
			
		||||
        drawContext.drawTextWithShadow(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 +42,11 @@ public class DoubleSetting extends Setting
 | 
			
		|||
		}
 | 
			
		||||
 | 
			
		||||
        String valueString = ""+MathUtils.round(value, roundingPlace);
 | 
			
		||||
        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);
 | 
			
		||||
        drawContext.drawTextWithShadow(textRenderer, Text.literal(valueString), (x+190)-textRenderer.getWidth(valueString), y+2, 0xFFFFFF);
 | 
			
		||||
        drawContext.fill(x+2, y+16, x+190, y+18, 0xFF666666);
 | 
			
		||||
        int scaledValue = (int)((value/max)*190);
 | 
			
		||||
        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);
 | 
			
		||||
        drawContext.fill(x+2, y+16, (x+2)+scaledValue, y+18, 0xFF55FFFF);
 | 
			
		||||
        drawContext.fill(x+2+(scaledValue-1), y+14, x+2+(scaledValue+1), y+20, 0xFFFFFFFF);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,7 +3,6 @@ package me.kawaiizenbo.moonlight.module.settings;
 | 
			
		|||
import net.minecraft.client.MinecraftClient;
 | 
			
		||||
import net.minecraft.client.font.TextRenderer;
 | 
			
		||||
import net.minecraft.client.gui.DrawContext;
 | 
			
		||||
import net.minecraft.client.util.math.MatrixStack;
 | 
			
		||||
 | 
			
		||||
public class Setting 
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -12,11 +11,11 @@ public class Setting
 | 
			
		|||
    public int height = 24;
 | 
			
		||||
 | 
			
		||||
    int x = 0, y = 0;
 | 
			
		||||
    public void render(MatrixStack matrices, int x, int y, int mouseX, int mouseY)
 | 
			
		||||
    public void render(DrawContext drawContext, int x, int y, int mouseX, int mouseY)
 | 
			
		||||
    { 
 | 
			
		||||
        this.x = x;
 | 
			
		||||
        this.y = y;
 | 
			
		||||
        DrawContext.fill(matrices, x, y, x+192, y+height, hovered(mouseX, mouseY) ? 0xFF444444: 0xFF222222);
 | 
			
		||||
        drawContext.fill(x, y, x+192, y+height, hovered(mouseX, mouseY) ? 0xFF444444: 0xFF222222);
 | 
			
		||||
        
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,7 @@ import me.kawaiizenbo.moonlight.util.MathUtils;
 | 
			
		|||
 | 
			
		||||
import net.minecraft.client.MinecraftClient;
 | 
			
		||||
import net.minecraft.client.font.TextRenderer;
 | 
			
		||||
import net.minecraft.client.util.math.MatrixStack;
 | 
			
		||||
import net.minecraft.client.gui.DrawContext;
 | 
			
		||||
import net.minecraft.util.math.Vec3d;
 | 
			
		||||
 | 
			
		||||
public class HUD 
 | 
			
		||||
| 
						 | 
				
			
			@ -15,19 +15,19 @@ public class HUD
 | 
			
		|||
	private MinecraftClient mc = MinecraftClient.getInstance();
 | 
			
		||||
	TextRenderer textRenderer = mc.textRenderer;
 | 
			
		||||
 | 
			
		||||
    public void renderHUD(MatrixStack matrix, int scaledWidth, int scaledHeight)
 | 
			
		||||
    public void renderHUD(DrawContext drawContext, int scaledWidth, int scaledHeight)
 | 
			
		||||
    {
 | 
			
		||||
        // do not draw if F3 enabled
 | 
			
		||||
        if (mc.options.debugEnabled) return;
 | 
			
		||||
 | 
			
		||||
        // draw stats
 | 
			
		||||
        textRenderer.drawWithShadow(matrix, Moonlight.clientTag + " " + Moonlight.versionTag, 2, 2, 16777215);
 | 
			
		||||
		textRenderer.drawWithShadow(matrix, "FPS: " + ColorUtils.gray + mc.fpsDebugString.split(" ")[0], 2, 12, 0x55FFFF);
 | 
			
		||||
		textRenderer.drawWithShadow(matrix, "Ping: " + ColorUtils.gray + (mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()) == null ? 0 : mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()).getLatency()), 2, 22, 0x55FFFF);
 | 
			
		||||
		textRenderer.drawWithShadow(matrix, "Meters/s: " + ColorUtils.gray + MathUtils.round(moveSpeed(), 2), 2, scaledHeight - 20, 0x55FFFF);
 | 
			
		||||
        drawContext.drawTextWithShadow(textRenderer, Moonlight.clientTag + " " + Moonlight.versionTag, 2, 2, 16777215);
 | 
			
		||||
		drawContext.drawTextWithShadow(textRenderer, "FPS: " + ColorUtils.gray + mc.fpsDebugString.split(" ")[0], 2, 12, 0x55FFFF);
 | 
			
		||||
		drawContext.drawTextWithShadow(textRenderer, "Ping: " + ColorUtils.gray + (mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()) == null ? 0 : mc.getNetworkHandler().getPlayerListEntry(mc.player.getUuid()).getLatency()), 2, 22, 0x55FFFF);
 | 
			
		||||
		drawContext.drawTextWithShadow(textRenderer, "Meters/s: " + ColorUtils.gray + MathUtils.round(moveSpeed(), 2), 2, scaledHeight - 20, 0x55FFFF);
 | 
			
		||||
 | 
			
		||||
        // draw coordinates
 | 
			
		||||
        textRenderer.drawWithShadow(matrix, "X: " + ColorUtils.gray + MathUtils.round(mc.player.getX(), 1) + 
 | 
			
		||||
        drawContext.drawTextWithShadow(textRenderer, "X: " + ColorUtils.gray + MathUtils.round(mc.player.getX(), 1) + 
 | 
			
		||||
            ColorUtils.reset + " Y: " + ColorUtils.gray + MathUtils.round(mc.player.getY(), 1) + 
 | 
			
		||||
            ColorUtils.reset + " Z: " + ColorUtils.gray + MathUtils.round(mc.player.getZ(), 1), 2, scaledHeight - 10, 0x55FFFF);
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,7 +4,6 @@ import me.kawaiizenbo.moonlight.ui.clickgui.ClickGUIScreen;
 | 
			
		|||
import net.minecraft.client.MinecraftClient;
 | 
			
		||||
import net.minecraft.client.font.TextRenderer;
 | 
			
		||||
import net.minecraft.client.gui.DrawContext;
 | 
			
		||||
import net.minecraft.client.util.math.MatrixStack;
 | 
			
		||||
import net.minecraft.text.Text;
 | 
			
		||||
 | 
			
		||||
public class TextButton 
 | 
			
		||||
| 
						 | 
				
			
			@ -20,11 +19,11 @@ public class TextButton
 | 
			
		|||
        this.color = color;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void render(MatrixStack matrices, TextRenderer textRenderer, int mouseX, int mouseY)
 | 
			
		||||
    public void render(DrawContext drawContext, TextRenderer textRenderer, int mouseX, int mouseY)
 | 
			
		||||
    {
 | 
			
		||||
        width = textRenderer.getWidth(text);
 | 
			
		||||
        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);
 | 
			
		||||
        drawContext.fill(x-1, y-1, x + width + 1, y + 10, hovered(mouseX, mouseY) ? 0xFF444444 : 0xFF222222);
 | 
			
		||||
        drawContext.drawText(textRenderer, Text.literal(text), x, y, color, true);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean hovered(int mouseX, int mouseY) 
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,7 +1,7 @@
 | 
			
		|||
package me.kawaiizenbo.moonlight.ui.altmanager;
 | 
			
		||||
 | 
			
		||||
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;
 | 
			
		||||
 | 
			
		||||
public class AltManagerScreen extends Screen 
 | 
			
		||||
| 
						 | 
				
			
			@ -14,9 +14,9 @@ public class AltManagerScreen extends Screen
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void render(MatrixStack matrices, int mouseX, int mouseY, float delta)
 | 
			
		||||
    public void render(DrawContext drawContext, int mouseX, int mouseY, float delta)
 | 
			
		||||
    {
 | 
			
		||||
        renderBackgroundTexture(0);
 | 
			
		||||
        renderBackgroundTexture(drawContext);
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,8 +5,8 @@ import java.util.ArrayList;
 | 
			
		|||
import me.kawaiizenbo.moonlight.module.Category;
 | 
			
		||||
import me.kawaiizenbo.moonlight.module.ModuleManager;
 | 
			
		||||
import me.kawaiizenbo.moonlight.module.Module_;
 | 
			
		||||
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;
 | 
			
		||||
 | 
			
		||||
public class ClickGUIScreen extends Screen 
 | 
			
		||||
| 
						 | 
				
			
			@ -32,18 +32,18 @@ public class ClickGUIScreen extends Screen
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) 
 | 
			
		||||
	public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) 
 | 
			
		||||
	{
 | 
			
		||||
		this.renderBackground(matrices);
 | 
			
		||||
		this.renderBackground(drawContext);
 | 
			
		||||
		int categoryLabelXOffset = 10;
 | 
			
		||||
		for (Category category : Category.values())
 | 
			
		||||
		{
 | 
			
		||||
			textRenderer.draw(matrices, category.name, categoryLabelXOffset, 10, 0xFFFFFF);
 | 
			
		||||
			drawContext.drawText(textRenderer, category.name, categoryLabelXOffset, 10, 0xFFFFFF, false);
 | 
			
		||||
			categoryLabelXOffset += 70;
 | 
			
		||||
		}
 | 
			
		||||
		for (ModuleButton moduleButton : moduleButtons)
 | 
			
		||||
		{
 | 
			
		||||
			moduleButton.render(matrices, mouseX, mouseY);
 | 
			
		||||
			moduleButton.render(drawContext, mouseX, mouseY);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,7 +4,6 @@ import me.kawaiizenbo.moonlight.module.Module_;
 | 
			
		|||
import net.minecraft.client.MinecraftClient;
 | 
			
		||||
import net.minecraft.client.font.TextRenderer;
 | 
			
		||||
import net.minecraft.client.gui.DrawContext;
 | 
			
		||||
import net.minecraft.client.util.math.MatrixStack;
 | 
			
		||||
 | 
			
		||||
public class ModuleButton 
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -21,11 +20,11 @@ public class ModuleButton
 | 
			
		|||
		this.height = 14;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
    public void render(MatrixStack matrices, int mouseX, int mouseY) 
 | 
			
		||||
    public void render(DrawContext drawContext, int mouseX, int mouseY) 
 | 
			
		||||
    {
 | 
			
		||||
		TextRenderer textRenderer = mc.textRenderer;
 | 
			
		||||
		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);
 | 
			
		||||
		drawContext.fill(x, y, x + width, y + height, hovered(mouseX, mouseY) ? 0xFF333333 : 0xFF222222);
 | 
			
		||||
		drawContext.drawText(textRenderer, module.name, x+3, y+3, module.enabled ? 0x55FFFF : 0xFFFFFF, false);
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	public boolean hovered(int mouseX, int mouseY) 
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,7 +6,6 @@ import me.kawaiizenbo.moonlight.ui.TextButton;
 | 
			
		|||
import me.kawaiizenbo.moonlight.util.ColorUtils;
 | 
			
		||||
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;
 | 
			
		||||
 | 
			
		||||
public class SettingsScreen extends Screen 
 | 
			
		||||
| 
						 | 
				
			
			@ -21,18 +20,18 @@ public class SettingsScreen extends Screen
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
	public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) 
 | 
			
		||||
	public void render(DrawContext drawContext, int mouseX, int mouseY, float delta) 
 | 
			
		||||
	{
 | 
			
		||||
        this.renderBackground(matrices);
 | 
			
		||||
        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);
 | 
			
		||||
        this.renderBackground(drawContext);
 | 
			
		||||
        drawContext.fill((width/2)-112, (height/2)-96, (width/2)+112, (height/2)+96, 0xFF222222);
 | 
			
		||||
        drawContext.drawCenteredTextWithShadow(textRenderer, module.name, width/2, (height/2)-88, 0xFFFFFF);
 | 
			
		||||
        drawContext.drawTextWithShadow(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);
 | 
			
		||||
        backButton.render(drawContext, textRenderer, mouseX, mouseY);
 | 
			
		||||
		int yOffset = (height/2)-56;
 | 
			
		||||
		for (Setting setting : module.settings)
 | 
			
		||||
		{
 | 
			
		||||
			setting.render(matrices, (width/2)-96, yOffset, mouseX, mouseY);
 | 
			
		||||
			setting.render(drawContext, (width/2)-96, yOffset, mouseX, mouseY);
 | 
			
		||||
			yOffset += setting.height + 1;
 | 
			
		||||
		}
 | 
			
		||||
        // add keybind setting here eventually
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,9 +29,9 @@
 | 
			
		|||
  ],
 | 
			
		||||
 | 
			
		||||
  "depends": {
 | 
			
		||||
    "fabricloader": ">=0.14.10",
 | 
			
		||||
    "fabricloader": ">=0.14.21",
 | 
			
		||||
    "fabric-api": "*",
 | 
			
		||||
    "minecraft": "~1.19",
 | 
			
		||||
    "minecraft": "~1.20",
 | 
			
		||||
    "java": ">=17"
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue