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
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue