1
0
Fork 0
mirror of https://github.com/Miasmusa/Shadow.git synced 2025-04-01 23:19:41 -04:00
This commit is contained in:
Saturn5Vfive 2022-04-22 03:29:43 -05:00
commit c699e381d7
39 changed files with 633 additions and 228 deletions

View file

@ -11,6 +11,7 @@ repositories {
name = "meteor-maven"
url = "https://maven.meteordev.org"
}
mavenCentral()
}
sourceCompatibility = JavaVersion.VERSION_17
@ -36,7 +37,17 @@ dependencies {
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
// modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"
Set<String> apiModules = [
"fabric-api-base",
"fabric-item-groups-v0",
"fabric-resource-loader-v0"
]
// Add each module as a dependency
apiModules.forEach {
include(modImplementation(fabricApi.module(it, project.fabric_api_version)))
}
// modImplementation ("net.fabricmc.fabric-api:fabric-resource-loader:0.1.0")
compileOnly 'org.projectlombok:lombok:1.18.22'
@ -101,4 +112,4 @@ publishing {
// uncomment to publish to the local maven
// mavenLocal()
}
}
}

View file

@ -11,4 +11,4 @@ maven_group = net.shadow.client
archives_base_name = shadow
#Dependencies
fabric_api_version = 0.44.0+1.18
fabric_api_version = 0.51.1+1.18.2

View file

@ -14,6 +14,7 @@ import net.shadow.client.feature.command.CommandRegistry;
import net.shadow.client.feature.gui.FastTickable;
import net.shadow.client.feature.gui.notifications.NotificationRenderer;
import net.shadow.client.feature.gui.screen.HomeScreen;
import net.shadow.client.feature.itemMenu.ItemGroupRegistry;
import net.shadow.client.feature.module.Module;
import net.shadow.client.feature.module.ModuleRegistry;
import net.shadow.client.helper.Rotations;
@ -46,16 +47,7 @@ public class ShadowMain implements ModInitializer {
public static final Logger LOGGER = LogManager.getLogger();
public static final MinecraftClient client = MinecraftClient.getInstance();
public static final File BASE = new File(MinecraftClient.getInstance().runDirectory, "shadow");
public static long lastScreenChange = System.currentTimeMillis();
public static ShadowMain INSTANCE;
public static Thread MODULE_FTTICKER;
public static Thread FAST_TICKER;
private static final String REPORT_WEBHOOK_URL = "https://discord.com/api/webhooks/965552777453502474/z6HSQvGos82UzCh7g5N6921GMf4aUChrnKnajcqM5XV2RVXZ6eBPtysaJLxYEAmqt211";
public static void log(Level level, String message) {
LOGGER.log(level, "[" + MOD_NAME + "] " + message);
}
private static final boolean isDevMode = Util.make(() -> {
try {
File execF = new File(HomeScreen.class.getProtectionDomain().getCodeSource().getLocation().toURI());
@ -65,6 +57,14 @@ public class ShadowMain implements ModInitializer {
return true;
}
});
public static long lastScreenChange = System.currentTimeMillis();
public static ShadowMain INSTANCE;
public static Thread MODULE_FTTICKER;
public static Thread FAST_TICKER;
public static void log(Level level, String message) {
LOGGER.log(level, "[" + MOD_NAME + "] " + message);
}
public static boolean isDev() {
return isDevMode;
@ -78,7 +78,7 @@ public class ShadowMain implements ModInitializer {
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss dd/MM/yyyy");
String fmt = sdf.format(System.currentTimeMillis());
try {
Utils.sendDiscordFile(REPORT_WEBHOOK_URL,String.format("Crash report submitted by **%s** (**%s**) at `%s` (h\\\\:m\\\\:s d/m/y) <@&965396880286707732>", client.getSession().getUsername(), client.getSession().getUuid(),fmt),"crash.txt",reportData.getBytes(StandardCharsets.UTF_8));
Utils.sendDiscordFile(REPORT_WEBHOOK_URL, String.format("Crash report submitted by **%s** (**%s**) at `%s` (h\\\\:m\\\\:s d/m/y) <@&965396880286707732>", client.getSession().getUsername(), client.getSession().getUuid(), fmt), "crash.txt", reportData.getBytes(StandardCharsets.UTF_8));
} catch (Exception e) {
e.printStackTrace();
}
@ -102,6 +102,8 @@ public class ShadowMain implements ModInitializer {
ConfigManager.loadState();
ItemGroupRegistry.init();
log(Level.INFO, "Done initializing");
}

View file

@ -54,7 +54,7 @@ public abstract class Command extends Utils.Logging {
public ExamplesEntry getExampleArguments() {
return null;
}
public record ExamplesEntry(String... examples) {}
protected void validateArgumentsLength(String[] args, int requiredLength, String message) throws CommandException {
if (args.length < requiredLength)
throw new CommandException("Invalid number of arguments: " + requiredLength + " arguments required", message);
@ -63,4 +63,7 @@ public abstract class Command extends Utils.Logging {
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return new PossibleArgument(null);
}
public record ExamplesEntry(String... examples) {
}
}

View file

@ -12,6 +12,7 @@ import net.shadow.client.feature.command.argument.PlayerFromNameArgumentParser;
import net.shadow.client.feature.command.coloring.ArgumentType;
import net.shadow.client.feature.command.coloring.PossibleArgument;
import net.shadow.client.feature.command.coloring.StaticArgumentServer;
import net.shadow.client.feature.command.examples.ExampleServer;
import net.shadow.client.feature.command.exception.CommandException;
import java.util.Objects;
@ -26,6 +27,10 @@ public class Crash extends Command {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.STRING, Objects.requireNonNull(ShadowMain.client.world).getPlayers().stream().map(abstractClientPlayerEntity -> abstractClientPlayerEntity.getGameProfile().getName()).toList().toArray(String[]::new)));
}
@Override
public ExamplesEntry getExampleArguments() {
return ExampleServer.getPlayerNames();
}
@Override
public void onExecute(String[] args) throws CommandException {

View file

@ -22,6 +22,7 @@ import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.coloring.ArgumentType;
import net.shadow.client.feature.command.coloring.PossibleArgument;
import net.shadow.client.feature.command.coloring.StaticArgumentServer;
import net.shadow.client.feature.command.examples.ExampleServer;
import net.shadow.client.feature.command.exception.CommandException;
import net.shadow.client.helper.event.EventListener;
import net.shadow.client.helper.event.EventType;
@ -45,6 +46,11 @@ public class Find extends Command {
Events.registerEventHandlerClass(this);
}
@Override
public ExamplesEntry getExampleArguments() {
return ExampleServer.getPlayerNames();
}
@EventListener(type = EventType.PACKET_RECEIVE)
void pRecv(PacketEvent pe) {
if (!pendingBook) {

View file

@ -31,11 +31,6 @@ public class ForEach extends Command {
String partial;
boolean recieving;
@Override
public ExamplesEntry getExampleArguments() {
return new ExamplesEntry("player 1000 /msg %s you stink", "tab 10 /kick %s Server wipe", "tab 0 /ban %s MOLED LLLLL");
}
public ForEach() {
super("ForEach", "Do something for each player", "forEach", "for", "fe");
Events.registerEventHandler(EventType.PACKET_RECEIVE, event -> {
@ -55,6 +50,11 @@ public class ForEach extends Command {
});
}
@Override
public ExamplesEntry getExampleArguments() {
return new ExamplesEntry("player 1000 /msg %s you stink", "tab 10 /kick %s Server wipe", "tab 0 /ban %s MOLED LLLLL");
}
@Override
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.STRING, "player", "tab"), new PossibleArgument(ArgumentType.NUMBER, "(delay)"), new PossibleArgument(ArgumentType.NUMBER, "(message)"));

View file

@ -23,10 +23,12 @@ public class ForceOP extends Command {
public ForceOP() {
super("ForceOP", "Edit command blocks on paper 1.14 - 1.17", "forceop", "editcmd");
}
@Override
public ExamplesEntry getExampleArguments() {
return new ExamplesEntry("say hello", "tp @e 0 0 0");
}
@Override
public void onExecute(String[] args) throws CommandException {
validateArgumentsLength(args, 1, "Provide command");

View file

@ -39,7 +39,7 @@ public class Help extends Command {
}
@Override
public void onExecute(String[] args) throws CommandException{
public void onExecute(String[] args) throws CommandException {
if (args.length == 0) {
message("All commands and their description");
for (Command command : CommandRegistry.getCommands()) {
@ -49,11 +49,11 @@ public class Help extends Command {
} else {
String s = args[0];
Command c = CommandRegistry.getByAlias(s);
if (c == null) error("Command \""+s+"\" was not found");
if (c == null) error("Command \"" + s + "\" was not found");
else {
message("Command "+c.getName());
message("Command " + c.getName());
message0(c.getDescription(), Color.GRAY);
message0("Aliases: "+String.join(", ",c.getAliases()), Color.GRAY);
message0("Aliases: " + String.join(", ", c.getAliases()), Color.GRAY);
message("");
ExamplesEntry e = c.getExampleArguments();
if (e == null) {
@ -62,8 +62,8 @@ public class Help extends Command {
message("Examples:");
String prefix = ModuleRegistry.getByClass(ClientSettings.class).getPrefix().getValue();
for (String example : e.examples()) {
String mEx = prefix+c.getAliases()[0]+" "+example;
message(" - "+mEx);
String mEx = prefix + c.getAliases()[0] + " " + example;
message(" - " + mEx);
}
}
}

View file

@ -154,7 +154,7 @@ public class ServerCrash extends Command {
}
case "lag2" -> {
for(int i = 0; i < 255; i++){
for (int i = 0; i < 255; i++) {
client.player.networkHandler.sendPacket(new RequestCommandCompletionsC2SPacket(0, "/"));
}
Notification.create(2000, "Server Crash", Notification.Type.SUCCESS, "Sent Quick Lag Crash");

View file

@ -4,7 +4,6 @@
package net.shadow.client.feature.command.impl;
import io.netty.util.internal.shaded.org.jctools.util.UnsafeAccess;
import net.shadow.client.feature.command.Command;
public class Test extends Command {
@ -14,6 +13,6 @@ public class Test extends Command {
@Override
public void onExecute(String[] args) {
UnsafeAccess.UNSAFE.throwException(new ClassFormatError("AMONG US SUSSY!!!"));
success("jooj");
}
}

View file

@ -0,0 +1,11 @@
/*
* Copyright (c) Shadow client, 0x150, Saturn5VFive 2022. All rights reserved.
*/
package net.shadow.client.feature.gui;
public interface HasSpecialCursor {
long getCursor();
boolean shouldApplyCustomCursor();
}

View file

@ -67,7 +67,7 @@ public class AddonManagerScreen extends ClientScreen implements FastTickable {
@Override
protected void init() {
reInitViewers();
RoundButton openFolder = new RoundButton(RoundButton.STANDARD,5,5,100,20,"Open folder", () -> {
RoundButton openFolder = new RoundButton(RoundButton.STANDARD, 5, 5, 100, 20, "Open folder", () -> {
Util.getOperatingSystem().open(AddonManager.ADDON_DIRECTORY);
});
this.addDrawableChild(openFolder);

View file

@ -83,7 +83,7 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
final FontAdapter title = FontRenderers.getCustomSize(40);
final AtomicBoolean isLoggingIn = new AtomicBoolean(false);
AltContainer selectedAlt;
ThemedButton add, exit, remove, tags, login, session, censorMail;
net.shadow.client.feature.gui.widget.RoundButton add, exit, remove, tags, login, session, censorMail;
RoundTextFieldWidget search;
boolean censorEmail = true;
double scroll = 0;
@ -188,16 +188,16 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
void toggleCensor() {
censorEmail = !censorEmail;
censorMail.text = censorEmail ? "Show email" : "Hide email";
censorMail.setText(censorEmail ? "Show email" : "Hide email");
}
@Override
protected void init() {
search = new RoundTextFieldWidget(width - 200 - 5 - 100 - 5 - 60 - 5 - 20 - getPadding(), 10 + title.getMarginHeight() / 2d - 20 / 2d, 200, 20, "Search");
addDrawableChild(search);
censorMail = new ThemedButton(width - 100 - 5 - 60 - 5 - 20 - getPadding(), 10 + title.getMarginHeight() / 2d - 20 / 2d, 100, 20, "Show email", this::toggleCensor);
add = new ThemedButton(width - 60 - 5 - 20 - getPadding(), 10 + title.getMarginHeight() / 2d - 20 / 2d, 60, 20, "Add", () -> client.setScreen(new AddScreenOverlay(this)));
exit = new ThemedButton(width - 20 - getPadding(), 10 + title.getMarginHeight() / 2d - 20 / 2d, 20, 20, "X", this::close);
censorMail = new net.shadow.client.feature.gui.widget.RoundButton(net.shadow.client.feature.gui.widget.RoundButton.STANDARD, width - 100 - 5 - 60 - 5 - 20 - getPadding(), 10 + title.getMarginHeight() / 2d - 20 / 2d, 100, 20, "Show email", this::toggleCensor);
add = new net.shadow.client.feature.gui.widget.RoundButton(net.shadow.client.feature.gui.widget.RoundButton.STANDARD, width - 60 - 5 - 20 - getPadding(), 10 + title.getMarginHeight() / 2d - 20 / 2d, 60, 20, "Add", () -> client.setScreen(new AddScreenOverlay(this)));
exit = new net.shadow.client.feature.gui.widget.RoundButton(net.shadow.client.feature.gui.widget.RoundButton.STANDARD, width - 20 - getPadding(), 10 + title.getMarginHeight() / 2d - 20 / 2d, 20, 20, "X", this::close);
double padding = 5;
double widRHeight = 64 + padding * 2;
@ -207,15 +207,23 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
double fromX = width - (leftWidth + getPadding());
double texDim = widRHeight - padding * 2;
double buttonWidth = (toX - (fromX + texDim + padding * 2)) / 3d - padding / 4d;
login = new ThemedButton(fromX + texDim + padding * 2, toY - 20 - padding, buttonWidth - padding, 20, "Login", this::login);
remove = new ThemedButton(fromX + texDim + padding * 2 + buttonWidth + padding / 2d, toY - 20 - padding, buttonWidth - padding, 20, "Remove", this::remove);
tags = new ThemedButton(fromX + texDim + padding * 2 + buttonWidth + padding / 2d + buttonWidth + padding / 2d, toY - 20 - padding, buttonWidth - padding, 20, "Tags", this::editTags);
login = new net.shadow.client.feature.gui.widget.RoundButton(net.shadow.client.feature.gui.widget.RoundButton.STANDARD, fromX + texDim + padding * 2, toY - 20 - padding, buttonWidth - padding, 20, "Login", this::login);
remove = new net.shadow.client.feature.gui.widget.RoundButton(net.shadow.client.feature.gui.widget.RoundButton.STANDARD, fromX + texDim + padding * 2 + buttonWidth + padding / 2d, toY - 20 - padding, buttonWidth - padding, 20, "Remove", this::remove);
tags = new net.shadow.client.feature.gui.widget.RoundButton(net.shadow.client.feature.gui.widget.RoundButton.STANDARD, fromX + texDim + padding * 2 + buttonWidth + padding / 2d + buttonWidth + padding / 2d, toY - 20 - padding, buttonWidth - padding, 20, "Tags", this::editTags);
toY = height - getPadding();
buttonWidth = toX - fromX - padding * 3 - texDim;
session = new ThemedButton(fromX + texDim + padding * 2, toY - 20 - padding, buttonWidth, 20, "Session", () -> {
session = new net.shadow.client.feature.gui.widget.RoundButton(net.shadow.client.feature.gui.widget.RoundButton.STANDARD, fromX + texDim + padding * 2, toY - 20 - padding, buttonWidth, 20, "Session", () -> {
Objects.requireNonNull(client).setScreen(new SessionEditor(this, ShadowMain.client.getSession())); // this is not a session stealer
});
addDrawableChild(censorMail);
addDrawableChild(add);
addDrawableChild(exit);
addDrawableChild(login);
addDrawableChild(remove);
addDrawableChild(tags);
addDrawableChild(session);
}
void editTags() {
@ -283,13 +291,6 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
for (AltContainer alt : getAlts()) {
alt.tickAnim();
}
censorMail.tickAnim();
add.tickAnim();
exit.tickAnim();
remove.tickAnim();
login.tickAnim();
tags.tickAnim();
session.tickAnim();
scrollSmooth = Transitions.transition(scrollSmooth, scroll, 7, 0);
}
@ -312,9 +313,6 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
Renderer.R2D.renderQuad(stack, bg, 0, 0, width, height);
title.drawString(stack, "Shadow", 10, 10, 0xFFFFFF, false);
titleSmall.drawString(stack, "Alt manager", 10 + title.getStringWidth("Shadow") + 5, 10 + title.getMarginHeight() - titleSmall.getMarginHeight() - 1, 0xFFFFFF, false);
censorMail.render(stack, mouseX, mouseY);
add.render(stack, mouseX, mouseY);
exit.render(stack, mouseX, mouseY);
ClipStack.globalInstance.addWindow(stack, new Rectangle(getPadding() - 5, getHeaderHeight(), getPadding() + (width - (getPadding() + leftWidth + getPadding() * 2)) + 5, height));
//Renderer.R2D.beginScissor(stack, getPadding(), getHeaderHeight(), getPadding() + (width - (getPadding() + leftWidth + getPadding() * 2)), height);
@ -350,7 +348,12 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
double toY = fromY + widRHeight;
Renderer.R2D.renderRoundedQuad(stack, pillColor, fromX, fromY, toX, toY, 5, 20);
if (selectedAlt != null) {
boolean vis = selectedAlt != null;
remove.setVisible(vis);
login.setVisible(vis);
tags.setVisible(vis);
if (vis) {
double texDim = widRHeight - padding * 2;
RenderSystem.enableBlend();
@ -389,9 +392,6 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
prop.cfr.drawString(stack, prop.name, (float) (fromX + padding + texDim + padding), propsOffset, prop.color, false);
propsOffset += prop.cfr.getMarginHeight();
}
remove.render(stack, mouseX, mouseY);
login.render(stack, mouseX, mouseY);
tags.render(stack, mouseX, mouseY);
}
toY = height - getPadding();
@ -430,7 +430,6 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
prop.cfr.drawString(stack, prop.name, (float) (fromX + padding + texDim + padding), propsOffset, prop.color, false);
propsOffset += prop.cfr.getMarginHeight();
}
session.render(stack, mouseX, mouseY);
super.renderInternal(stack, mouseX, mouseY, delta);
}
@ -439,95 +438,86 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
public boolean mouseClicked(double mouseX, double mouseY, int button) {
Rectangle rBounds = new Rectangle(getPadding(), getHeaderHeight(), getPadding() + (width - (getPadding() + leftWidth + getPadding() * 2)), height);
censorMail.clicked(mouseX, mouseY);
if (isLoggingIn.get()) {
return false;
}
add.clicked(mouseX, mouseY);
exit.clicked(mouseX, mouseY);
if (this.selectedAlt != null) {
login.clicked(mouseX, mouseY);
tags.clicked(mouseX, mouseY);
remove.clicked(mouseX, mouseY);
}
session.clicked(mouseX, mouseY);
boolean a = super.mouseClicked(mouseX, mouseY, button);
if (a) return true;
if (mouseX >= rBounds.getX() && mouseX <= rBounds.getX1() && mouseY >= rBounds.getY() && mouseY <= rBounds.getY1()) {
for (AltContainer alt : getAlts()) {
alt.clicked(mouseX, mouseY + scrollSmooth);
}
}
return super.mouseClicked(mouseX, mouseY, button);
return false;
}
static class ThemedButton {
final Runnable onPress;
final double width;
final double height;
String text;
double x;
double y;
double animProgress = 0;
boolean isHovered = false;
boolean enabled = true;
public ThemedButton(double x, double y, double w, double h, String t, Runnable a) {
this.onPress = a;
this.x = x;
this.y = y;
this.width = w;
this.height = h;
this.text = t;
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public void tickAnim() {
double d = 0.04;
if (!isHovered) {
d *= -1;
}
animProgress += d;
animProgress = MathHelper.clamp(animProgress, 0, 1);
}
double easeInOutQuint(double x) {
return x < 0.5 ? 16 * x * x * x * x * x : 1 - Math.pow(-2 * x + 2, 5) / 2;
}
boolean inBounds(double cx, double cy) {
return cx >= x && cx < x + width && cy >= y && cy < y + height;
}
public void render(MatrixStack matrices, double mx, double my) {
isHovered = inBounds(mx, my) && isEnabled();
matrices.push();
matrices.translate(x + width / 2d, y + height / 2d, 0);
float animProgress = (float) easeInOutQuint(this.animProgress);
matrices.scale(MathHelper.lerp(animProgress, 1f, 0.95f), MathHelper.lerp(animProgress, 1f, 0.95f), 1f);
double originX = -width / 2d;
double originY = -height / 2d;
Renderer.R2D.renderRoundedQuad(matrices, widgetColor, originX, originY, width / 2d, height / 2d, 5, 20);
FontRenderers.getRenderer().drawString(matrices, text, -(FontRenderers.getRenderer().getStringWidth(text)) / 2f, -FontRenderers.getRenderer()
.getMarginHeight() / 2f, isEnabled() ? 0xFFFFFF : 0xAAAAAA, false);
matrices.pop();
}
public void clicked(double mx, double my) {
if (inBounds(mx, my) && isEnabled()) {
onPress.run();
}
}
}
// static class RoundButton {
// final Runnable onPress;
// final double width;
// final double height;
// String text;
// double x;
// double y;
// double animProgress = 0;
// boolean isHovered = false;
// boolean enabled = true;
//
//
// public RoundButton(double x, double y, double w, double h, String t, Runnable a) {
// this.onPress = a;
// this.x = x;
// this.y = y;
// this.width = w;
// this.height = h;
// this.text = t;
// }
//
// public boolean isEnabled() {
// return enabled;
// }
//
// public void setEnabled(boolean enabled) {
// this.enabled = enabled;
// }
//
// public void tickAnim() {
// double d = 0.04;
// if (!isHovered) {
// d *= -1;
// }
// animProgress += d;
// animProgress = MathHelper.clamp(animProgress, 0, 1);
//
// }
//
// double easeInOutQuint(double x) {
// return x < 0.5 ? 16 * x * x * x * x * x : 1 - Math.pow(-2 * x + 2, 5) / 2;
// }
//
// boolean inBounds(double cx, double cy) {
// return cx >= x && cx < x + width && cy >= y && cy < y + height;
// }
//
// public void render(MatrixStack matrices, double mx, double my) {
// isHovered = inBounds(mx, my) && isEnabled();
// matrices.push();
// matrices.translate(x + width / 2d, y + height / 2d, 0);
// float animProgress = (float) easeInOutQuint(this.animProgress);
// matrices.scale(MathHelper.lerp(animProgress, 1f, 0.95f), MathHelper.lerp(animProgress, 1f, 0.95f), 1f);
// double originX = -width / 2d;
// double originY = -height / 2d;
// Renderer.R2D.renderRoundedQuad(matrices, widgetColor, originX, originY, width / 2d, height / 2d, 5, 20);
// FontRenderers.getRenderer().drawString(matrices, text, -(FontRenderers.getRenderer().getStringWidth(text)) / 2f, -FontRenderers.getRenderer()
// .getMarginHeight() / 2f, isEnabled() ? 0xFFFFFF : 0xAAAAAA, false);
// matrices.pop();
// }
//
// public void clicked(double mx, double my) {
// if (inBounds(mx, my) && isEnabled()) {
// onPress.run();
// }
// }
// }
static class AltStorage {
final String email;
@ -558,7 +548,7 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
final double padding = 5;
final FontAdapter title = FontRenderers.getCustomSize(40);
RoundTextFieldWidget access, name, uuid;
RoundButton save;
net.shadow.client.feature.gui.widget.RoundButton save;
public SessionEditor(ClientScreen parent, Session s) {
super(MSAAFramebuffer.MAX_SAMPLES);
@ -568,7 +558,7 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
@Override
protected void init() {
RoundButton exit = new RoundButton(widgetColor, width - 20 - 5, 5, 20, 20, "X", () -> Objects.requireNonNull(client).setScreen(parent));
net.shadow.client.feature.gui.widget.RoundButton exit = new net.shadow.client.feature.gui.widget.RoundButton(widgetColor, width - 20 - 5, 5, 20, 20, "X", () -> Objects.requireNonNull(client).setScreen(parent));
addDrawableChild(exit);
double y = height / 2d - widgetHei / 2d + padding + title.getMarginHeight() + FontRenderers.getRenderer().getMarginHeight() + padding;
RoundTextFieldWidget accessToken = new RoundTextFieldWidget(width / 2d - (widgetWid - padding * 2) / 2d, y, widgetWid - padding * 2, 20, "Access token");
@ -580,7 +570,7 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
RoundTextFieldWidget uuid = new RoundTextFieldWidget(width / 2d - (widgetWid - padding * 2) / 2d, y, widgetWid - padding * 2, 20, "UUID");
uuid.setText(session.getUuid());
y += uuid.getHeight() + padding;
RoundButton save = new RoundButton(widgetColor, width / 2d - (widgetWid - padding * 2) / 2d, y, widgetWid - padding * 2, 20, "Save", () -> {
net.shadow.client.feature.gui.widget.RoundButton save = new net.shadow.client.feature.gui.widget.RoundButton(widgetColor, width / 2d - (widgetWid - padding * 2) / 2d, y, widgetWid - padding * 2, 20, "Save", () -> {
SessionAccessor sa = (SessionAccessor) session;
sa.setUsername(username.get());
sa.setAccessToken(accessToken.get());
@ -645,11 +635,11 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
}
class TagEditor extends ClientScreen implements FastTickable {
final List<ThemedButton> tags = new ArrayList<>();
final List<RoundButton> tags = new ArrayList<>();
final double widgetWidth = 300;
final Screen parent;
RoundTextFieldWidget tagName;
RoundButton add;
net.shadow.client.feature.gui.widget.RoundButton add;
double widgetHeight = 0;
double widgetStartX, widgetStartY;
@ -660,16 +650,16 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
@Override
public void onFastTick() {
for (ThemedButton tag : tags) {
tag.tickAnim();
for (RoundButton tag : tags) {
tag.onFastTick();
}
add.onFastTick();
}
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
for (ThemedButton tag : new ArrayList<>(tags)) {
tag.clicked(mouseX, mouseY);
for (RoundButton tag : new ArrayList<>(tags)) {
tag.mouseClicked(mouseX, mouseY, button);
}
tagName.mouseClicked(mouseX, mouseY, button);
add.mouseClicked(mouseX, mouseY, button);
@ -690,7 +680,7 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
@Override
protected void init() {
RoundButton exit = new RoundButton(RoundButton.STANDARD, width - 20 - 5, 5, 20, 20, "X", this::close);
net.shadow.client.feature.gui.widget.RoundButton exit = new net.shadow.client.feature.gui.widget.RoundButton(net.shadow.client.feature.gui.widget.RoundButton.STANDARD, width - 20 - 5, 5, 20, 20, "X", this::close);
addDrawableChild(exit);
this.tags.clear();
String tags = selectedAlt.storage.tags;
@ -708,7 +698,7 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
xOffset = 5;
yOffset += FontRenderers.getRenderer().getMarginHeight() + 4 + 2;
}
ThemedButton inst = new ThemedButton(xOffset, yOffset, width, FontRenderers.getRenderer().getMarginHeight() + 4, s, () -> {
RoundButton inst = new net.shadow.client.feature.gui.widget.RoundButton(net.shadow.client.feature.gui.widget.RoundButton.STANDARD, xOffset, yOffset, width, FontRenderers.getRenderer().getMarginHeight() + 4, s, () -> {
parsedTags.remove(s);
selectedAlt.storage.tags = String.join(",", parsedTags);
init();
@ -718,7 +708,7 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
}
double yBase = parsedTags.isEmpty() ? 0 : yOffset + FontRenderers.getRenderer().getMarginHeight() + 4 + padding;
tagName = new RoundTextFieldWidget(5, yBase, widgetWidth - 60 - padding * 3, widgetsHeight, "Tag name");
add = new RoundButton(RoundButton.STANDARD, tagName.getX() + tagName.getWidth() + padding, yBase, 60, widgetsHeight, "Add", () -> {
add = new net.shadow.client.feature.gui.widget.RoundButton(net.shadow.client.feature.gui.widget.RoundButton.STANDARD, tagName.getX() + tagName.getWidth() + padding, yBase, 60, widgetsHeight, "Add", () -> {
if (tagName.get().isEmpty()) {
return;
}
@ -733,9 +723,9 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
widgetStartY = height / 2d - widgetHeight / 2d;
double widgetStartY = this.widgetStartY + padding;
for (ThemedButton tag : this.tags) {
tag.x += widgetStartX;
tag.y += widgetStartY;
for (RoundButton tag : this.tags) {
tag.setX(tag.getX() + widgetStartX);
tag.setY(tag.getY() + widgetStartY);
}
tagName.setX(tagName.getX() + widgetStartX);
tagName.setY(tagName.getY() + widgetStartY);
@ -755,8 +745,8 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
}
Renderer.R2D.renderQuad(stack, backgroundOverlay, 0, 0, width, height);
Renderer.R2D.renderRoundedQuad(stack, overlayBackground, widgetStartX, widgetStartY, widgetStartX + widgetWidth, widgetStartY + widgetHeight, 5, 20);
for (ThemedButton tag : tags) {
tag.render(stack, mouseX, mouseY);
for (RoundButton tag : tags) {
tag.render(stack, mouseX, mouseY, delta);
}
tagName.render(stack, mouseX, mouseY, delta);
add.render(stack, mouseX, mouseY, delta);
@ -768,14 +758,14 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
static final double widgetWid = 200;
static int accountTypeI = 0;
static double widgetHei = 0;
final List<ThemedButton> buttons = new ArrayList<>();
final List<RoundButton> buttons = new ArrayList<>();
final ClientScreen parent;
final double padding = 5;
final FontAdapter title = FontRenderers.getCustomSize(40);
RoundTextFieldWidget email;
RoundTextFieldWidget passwd;
ThemedButton type;
ThemedButton add;
RoundButton type;
RoundButton add;
public AddScreenOverlay(ClientScreen parent) {
super(MSAAFramebuffer.MAX_SAMPLES);
@ -784,12 +774,12 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
@Override
protected void init() {
ThemedButton exit = new ThemedButton(width - 20 - 5, 5, 20, 20, "X", () -> Objects.requireNonNull(client).setScreen(parent));
RoundButton exit = new net.shadow.client.feature.gui.widget.RoundButton(net.shadow.client.feature.gui.widget.RoundButton.STANDARD, width - 20 - 5, 5, 20, 20, "X", () -> Objects.requireNonNull(client).setScreen(parent));
buttons.add(exit);
email = new RoundTextFieldWidget(width / 2d - (widgetWid - padding * 2) / 2d, height / 2d - widgetHei / 2d + padding, widgetWid - padding * 2, 20, "E-Mail or username");
passwd = new RoundTextFieldWidget(width / 2d - (widgetWid - padding * 2) / 2d, height / 2d - widgetHei / 2d + padding * 2 + 20, widgetWid - padding * 2, 20, "Password");
type = new ThemedButton(0, 0, widgetWid / 2d - padding * 1.5, 20, "Type: " + AccountType.values()[accountTypeI].s, this::cycle);
add = new ThemedButton(0, 0, widgetWid / 2d - padding * 1.5, 20, "Add", this::add);
type = new net.shadow.client.feature.gui.widget.RoundButton(net.shadow.client.feature.gui.widget.RoundButton.STANDARD, 0, 0, widgetWid / 2d - padding * 1.5, 20, "Type: " + AccountType.values()[accountTypeI].s, this::cycle);
add = new net.shadow.client.feature.gui.widget.RoundButton(net.shadow.client.feature.gui.widget.RoundButton.STANDARD, 0, 0, widgetWid / 2d - padding * 1.5, 20, "Add", this::add);
}
void add() {
@ -814,27 +804,27 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
if (accountTypeI >= AccountType.values().length) {
accountTypeI = 0;
}
type.text = "Type: " + AccountType.values()[accountTypeI].s;
type.setText("Type: " + AccountType.values()[accountTypeI].s);
}
@Override
public void onFastTick() {
for (ThemedButton button : buttons) {
button.tickAnim();
for (RoundButton button : buttons) {
button.onFastTick();
}
type.tickAnim();
add.tickAnim();
type.onFastTick();
add.onFastTick();
}
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
for (ThemedButton themedButton : buttons) {
themedButton.clicked(mouseX, mouseY);
for (RoundButton themedButton : buttons) {
themedButton.mouseClicked(mouseX, mouseY, button);
}
email.mouseClicked(mouseX, mouseY, button);
passwd.mouseClicked(mouseX, mouseY, button);
type.clicked(mouseX, mouseY);
add.clicked(mouseX, mouseY);
type.mouseClicked(mouseX, mouseY, button);
add.mouseClicked(mouseX, mouseY, button);
return super.mouseClicked(mouseX, mouseY, button);
}
@ -845,8 +835,8 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
}
Renderer.R2D.renderQuad(stack, backgroundOverlay, 0, 0, width, height);
for (ThemedButton button : buttons) {
button.render(stack, mouseX, mouseY);
for (RoundButton button : buttons) {
button.render(stack, mouseX, mouseY, delta);
}
double centerX = width / 2d;
double centerY = height / 2d;
@ -865,15 +855,15 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
passwd.setY(originY + padding + title.getMarginHeight() + FontRenderers.getRenderer().getMarginHeight() + padding + email.getHeight() + padding);
passwd.setWidth(widgetWid - padding * 2);
passwd.render(stack, mouseX, mouseY, 0);
type.x = originX + padding;
type.y = originY + padding + title.getMarginHeight() + FontRenderers.getRenderer().getMarginHeight() + padding + email.getHeight() + padding + passwd.getHeight() + padding;
type.render(stack, mouseX, mouseY);
add.x = originX + padding + type.width + padding;
add.y = originY + padding + title.getMarginHeight() + FontRenderers.getRenderer().getMarginHeight() + padding + email.getHeight() + padding + passwd.getHeight() + padding;
type.setX(originX + padding);
type.setY(originY + padding + title.getMarginHeight() + FontRenderers.getRenderer().getMarginHeight() + padding + email.getHeight() + padding + passwd.getHeight() + padding);
type.render(stack, mouseX, mouseY, delta);
add.setX(originX + padding + type.getWidth() + padding);
add.setY(originY + padding + title.getMarginHeight() + FontRenderers.getRenderer().getMarginHeight() + padding + email.getHeight() + padding + passwd.getHeight() + padding);
add.setEnabled(isAddApplicable());
add.render(stack, mouseX, mouseY);
add.render(stack, mouseX, mouseY, delta);
widgetHei = padding + title.getMarginHeight() + FontRenderers.getRenderer()
.getMarginHeight() + padding + email.getHeight() + padding + passwd.getHeight() + padding + type.height + padding;
.getMarginHeight() + padding + email.getHeight() + padding + passwd.getHeight() + padding + type.getHeight() + padding;
stack.pop();
}
@ -1075,7 +1065,7 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
float h = FontRenderers.getRenderer().getMarginHeight();
float pad = 2;
w += pad * 2;
Renderer.R2D.renderRoundedQuad(stack, RoundButton.STANDARD, originX + padding + texWidth + padding + xOff, originY + getHeight() - h - pad * 2 - padding, originX + padding + texWidth + padding + xOff + w, originY + getHeight() - padding, 5, 10);
Renderer.R2D.renderRoundedQuad(stack, net.shadow.client.feature.gui.widget.RoundButton.STANDARD, originX + padding + texWidth + padding + xOff, originY + getHeight() - h - pad * 2 - padding, originX + padding + texWidth + padding + xOff + w, originY + getHeight() - padding, 5, 10);
FontRenderers.getRenderer()
.drawString(stack, v, originX + padding + texWidth + padding + xOff + pad, originY + getHeight() - pad - FontRenderers.getRenderer().getMarginHeight() - padding, 0xFFFFFF);
xOff += w + 2;
@ -1094,4 +1084,4 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
}
}
}
}

View file

@ -4,6 +4,8 @@
package net.shadow.client.feature.gui.widget;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.gui.Drawable;
import net.minecraft.client.gui.Element;
import net.minecraft.client.gui.Selectable;
@ -12,12 +14,14 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.MathHelper;
import net.shadow.client.feature.gui.DoesMSAA;
import net.shadow.client.feature.gui.FastTickable;
import net.shadow.client.feature.gui.HasSpecialCursor;
import net.shadow.client.helper.font.FontRenderers;
import net.shadow.client.helper.render.Cursor;
import net.shadow.client.helper.render.Renderer;
import java.awt.Color;
public class RoundButton implements Element, Drawable, Selectable, FastTickable, DoesMSAA {
public class RoundButton implements Element, Drawable, Selectable, FastTickable, DoesMSAA, HasSpecialCursor {
public static final Color STANDARD = new Color(40, 40, 40);
@ -28,6 +32,9 @@ public class RoundButton implements Element, Drawable, Selectable, FastTickable,
double animProgress = 0;
boolean isHovered = false;
boolean enabled = true;
@Setter
@Getter
boolean visible = true;
public RoundButton(Color color, double x, double y, double w, double h, String t, Runnable a) {
this.onPress = a;
@ -39,6 +46,16 @@ public class RoundButton implements Element, Drawable, Selectable, FastTickable,
this.color = color;
}
@Override
public long getCursor() {
return Cursor.CLICK;
}
@Override
public boolean shouldApplyCustomCursor() {
return isHovered;
}
public void setText(String text) {
this.text = text;
}
@ -104,6 +121,7 @@ public class RoundButton implements Element, Drawable, Selectable, FastTickable,
@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
isHovered = inBounds(mouseX, mouseY) && isEnabled();
if (!isVisible()) return;
matrices.push();
matrices.translate(x + width / 2d, y + height / 2d, 0);
float animProgress = (float) easeInOutQuint(this.animProgress);
@ -129,6 +147,7 @@ public class RoundButton implements Element, Drawable, Selectable, FastTickable,
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
if (!isVisible()) return false;
if (inBounds(mouseX, mouseY) && isEnabled() && button == 0) {
onPress.run();
return true;

View file

@ -13,8 +13,10 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.MathHelper;
import net.shadow.client.ShadowMain;
import net.shadow.client.feature.gui.DoesMSAA;
import net.shadow.client.feature.gui.HasSpecialCursor;
import net.shadow.client.helper.font.FontRenderers;
import net.shadow.client.helper.render.ClipStack;
import net.shadow.client.helper.render.Cursor;
import net.shadow.client.helper.render.Rectangle;
import net.shadow.client.helper.render.Renderer;
import org.apache.commons.lang3.SystemUtils;
@ -22,7 +24,7 @@ import org.lwjgl.glfw.GLFW;
import java.awt.Color;
public class RoundTextFieldWidget implements Element, Drawable, Selectable, DoesMSAA {
public class RoundTextFieldWidget implements Element, Drawable, Selectable, DoesMSAA, HasSpecialCursor {
protected final String suggestion;
public Runnable changeListener = () -> {
};
@ -42,6 +44,16 @@ public class RoundTextFieldWidget implements Element, Drawable, Selectable, Does
this.suggestion = text;
}
@Override
public boolean shouldApplyCustomCursor() {
return mouseOver;
}
@Override
public long getCursor() {
return Cursor.TEXT_EDIT;
}
protected double maxTextWidth() {
return width - pad() * 2 - 1;
}

View file

@ -0,0 +1,67 @@
/*
* Copyright (c) Shadow client, 0x150, Saturn5VFive 2022. All rights reserved.
*/
package net.shadow.client.feature.itemMenu;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.util.Identifier;
import net.minecraft.util.Util;
import net.minecraft.util.registry.Registry;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Base64;
import java.util.List;
public class ItemGroupRegistry {
public static List<ShadItemGroupEntry> groups = Util.make(() -> {
List<ShadItemGroupEntry> entries = new ArrayList<>();
entries.add(new ShadItemGroupEntry(new ShadItemGroup("Exploits", new ItemStack(Items.ARMOR_STAND)), "exploit"));
entries.add(new ShadItemGroupEntry(new ShadItemGroup("Grief", new ItemStack(Items.TNT)), "grief"));
entries.add(new ShadItemGroupEntry(new ShadItemGroup("Special", new ItemStack(Items.STRUCTURE_VOID)), "special"));
return entries;
});
public static void addItem(String id, ItemStack stack) {
ShadItemGroupEntry se = groups.stream().filter(shadItemGroupEntry -> shadItemGroupEntry.id.equals(id)).findFirst().orElseThrow();
se.group.addItem(stack);
}
public static void addItem(String id, Item item, String nbt) {
ShadItemGroupEntry se = groups.stream().filter(shadItemGroupEntry -> shadItemGroupEntry.id.equals(id)).findFirst().orElseThrow();
se.group.addItem(item, nbt);
}
public static void init() {
initExploits();
}
// COURTESY OF SATURNS SHITTY CODE, CONVERTED WITH A CODEGEN
// DO NOT COMPLAIN ABOUT THIS
static void initExploits() {
try {
InputStream is = ItemGroupRegistry.class.getClassLoader().getResourceAsStream("itemRegistry.txt");
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
String line;
while ((line = reader.readLine()) != null) {
String[] split = line.split(";");
String gid = split[0];
String iid = split[1];
Item i = Registry.ITEM.get(new Identifier(iid));
String nbt = new String(Base64.getDecoder().decode(split[2]));
addItem(gid, i, nbt);
}
is.close();
} catch (Exception e) {
e.printStackTrace();
}
}
record ShadItemGroupEntry(ShadItemGroup group, String id) {
}
}

View file

@ -0,0 +1,58 @@
/*
* Copyright (c) Shadow client, 0x150, Saturn5VFive 2022. All rights reserved.
*/
package net.shadow.client.feature.itemMenu;
import lombok.Getter;
import net.fabricmc.fabric.impl.item.group.ItemGroupExtensions;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
import net.minecraft.util.collection.DefaultedList;
import net.shadow.client.helper.util.Utils;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
public class ShadItemGroup {
@Getter
String nameS;
@Getter
ItemStack icon;
Text name;
@Getter
List<ItemStack> items = new CopyOnWriteArrayList<>();
public ShadItemGroup(String name, ItemStack icon) {
this.nameS = name;
this.name = Text.of(name);
this.icon = icon;
((ItemGroupExtensions) ItemGroup.BUILDING_BLOCKS).fabric_expandArray();
new ItemGroup(ItemGroup.GROUPS.length - 1, "shadow." + name) {
@Override
public ItemStack createIcon() {
return icon;
}
@Override
public void appendStacks(DefaultedList<ItemStack> stacks) {
stacks.addAll(ShadItemGroup.this.getItems());
}
@Override
public Text getDisplayName() {
return ShadItemGroup.this.name;
}
};
}
public void addItem(ItemStack stack) {
items.add(stack);
}
public void addItem(Item type, String nbt) {
addItem(Utils.generateItemStackWithMeta(nbt, type));
}
}

View file

@ -175,6 +175,7 @@ public class ModuleRegistry {
}
reloadInProgress.set(false);
}
public static void init() {
try {
initInner();
@ -183,10 +184,12 @@ public class ModuleRegistry {
System.exit(1);
}
}
private static void registerModule(Module module) {
ShadowMain.log(Level.INFO, "Initialized "+module.getName());
ShadowMain.log(Level.INFO, "Initialized " + module.getName());
vanillaModules.add(module);
}
private static void initInner() {
if (initialized.get()) return;
initialized.set(true);

View file

@ -218,7 +218,6 @@ public class CarpetBomb extends Module {
Renderer.R2D.renderQuad(translated, Color.RED, -.5, -10, .5, 10);
Renderer.R2D.renderQuad(translated, Color.RED, -10, -.5, 10, .5);
translated.pop();
});
}
}

View file

@ -11,18 +11,19 @@ import net.shadow.client.feature.module.ModuleType;
public class MoreChatHistory extends Module {
DoubleSetting size = this.config.create(new DoubleSetting.Builder(300)
.name("Size")
.description("How big the new chat history should be allowed to get (vanilla is 100)")
.min(10)
.max(1000)
.precision(0)
.get());
.name("Size")
.description("How big the new chat history should be allowed to get (vanilla is 100)")
.min(10)
.max(1000)
.precision(0)
.get());
public MoreChatHistory() {
super("MoreChatHistory", "Allows you to change the size of the chat history", ModuleType.MISC);
}
public int getHistSize() {
return (int) (size.getValue()+0);
return (int) (size.getValue() + 0);
}
@Override

View file

@ -9,6 +9,7 @@ import net.shadow.client.ShadowMain;
import net.shadow.client.feature.module.Module;
import net.shadow.client.feature.module.ModuleType;
import net.shadow.client.feature.module.NoNotificationDefault;
import org.lwjgl.glfw.GLFW;
@NoNotificationDefault
public class ClickGUI extends Module {
@ -16,6 +17,7 @@ public class ClickGUI extends Module {
public ClickGUI() {
super("ClickGUI", "A visual manager for all modules", ModuleType.RENDER);
this.keybind.accept(GLFW.GLFW_KEY_RIGHT_SHIFT + "");
}
@Override

View file

@ -5,17 +5,21 @@
package net.shadow.client.feature.module.impl.render;
import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.network.PlayerListEntry;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.GameMode;
import net.shadow.client.feature.module.Module;
import net.shadow.client.feature.module.ModuleType;
import net.shadow.client.helper.font.FontRenderers;
import net.shadow.client.helper.font.adapter.FontAdapter;
import net.shadow.client.helper.render.Renderer;
import net.shadow.client.helper.util.Utils;
import java.awt.Color;
import java.util.Comparator;
import static net.shadow.client.feature.module.impl.render.TargetHud.GREEN;
import static net.shadow.client.feature.module.impl.render.TargetHud.RED;
@ -38,32 +42,62 @@ public class NameTags extends Module {
public void render(MatrixStack stack, AbstractClientPlayerEntity entity, Text text) {
String t = text.getString();
double healthHeight = 2;
double labelHeight = 2 + FontRenderers.getRenderer().getFontHeight() + 2 + healthHeight + 2;
Vec3d headPos = Utils.getInterpolatedEntityPosition(entity).add(0, entity.getHeight() * 2 + 0.3, 0);
Vec3d headPos = Utils.getInterpolatedEntityPosition(entity).add(0, entity.getHeight() + 0.3, 0);
Vec3d a = Renderer.R2D.getScreenSpaceCoordinate(headPos, stack);
if (Renderer.R2D.isOnScreen(a)) {
Utils.TickManager.runOnNextRender(() -> {
MatrixStack stack1 = Renderer.R3D.getEmptyMatrixStack();
Vec3d actual = new Vec3d(a.x, a.y - labelHeight, a.z);
float fontWidth = FontRenderers.getRenderer().getStringWidth(t) + 1 + 4;
float width = fontWidth;
width = Math.max(width, 60);
Renderer.R2D.renderRoundedQuad(stack1, new Color(0, 0, 0, 200), actual.x - width / 2d, actual.y, actual.x + width / 2d, actual.y + labelHeight, 3, 20);
// FontRenderers.getNormal().drawCenteredString(stack,t,actual.x,actual.y+2,0xFFFFFF);
FontRenderers.getRenderer().drawString(stack1, t, actual.x - fontWidth / 2d + 2, actual.y + 2, 0xFFFFFF);
Renderer.R2D.renderRoundedQuad(stack1, new Color(60, 60, 60, 255), actual.x - width / 2d + 2, actual.y + labelHeight - 2 - healthHeight, actual.x + width / 2d - 2, actual.y + labelHeight - 2, healthHeight / 2d, 10);
float health = entity.getHealth();
float maxHealth = entity.getMaxHealth();
float healthPer = health / maxHealth;
healthPer = MathHelper.clamp(healthPer, 0, 1);
double drawTo = MathHelper.lerp(healthPer, actual.x - width / 2d + 2 + healthHeight, actual.x + width / 2d - 2);
Color MID_END = Renderer.Util.lerp(GREEN, RED, healthPer);
Renderer.R2D.renderRoundedQuad(stack1, MID_END, actual.x - width / 2d + 2, actual.y + labelHeight - 2 - healthHeight, drawTo, actual.y + labelHeight - 2, healthHeight / 2d, 10);
drawInternal(a, t, entity);
});
}
}
GameMode getGamemode(AbstractClientPlayerEntity p) {
PlayerListEntry ple = client.getNetworkHandler().getPlayerListEntry(p.getUuid());
if (ple == null) return null;
return ple.getGameMode();
}
void drawInternal(Vec3d screenPos, String text, AbstractClientPlayerEntity entity) {
FontAdapter nameDrawer = FontRenderers.getRenderer();
FontAdapter infoDrawer = FontRenderers.getCustomSize(12);
double healthHeight = 2;
double labelHeight = 2 + nameDrawer.getFontHeight() + infoDrawer.getFontHeight() + 2 + healthHeight + 2;
int ping = -1;
GameMode gamemode = null;
PlayerListEntry ple = client.getNetworkHandler().getPlayerListEntry(entity.getUuid());
if (ple != null) {
gamemode = ple.getGameMode();
ping = ple.getLatency();
}
String pingStr = (ping == 0 ? "?" : ping) + " ms";
String gmString = "§cBot";
if (gamemode != null) switch (gamemode) {
case ADVENTURE -> gmString = "Adventure";
case CREATIVE -> gmString = "Creative";
case SURVIVAL -> gmString = "Survival";
case SPECTATOR -> gmString = "Spectator";
}
MatrixStack stack1 = Renderer.R3D.getEmptyMatrixStack();
Vec3d actual = new Vec3d(screenPos.x, screenPos.y - labelHeight, screenPos.z);
float fontWidth = nameDrawer.getStringWidth(text) + 4;
float width = fontWidth;
width = Math.max(width, 70);
Renderer.R2D.renderRoundedQuad(stack1, new Color(0, 0, 5, 200), actual.x - width / 2d, actual.y, actual.x + width / 2d, actual.y + labelHeight, 3, 20);
nameDrawer.drawString(stack1, text, actual.x - fontWidth / 2d + 2, actual.y + 2, 0xFFFFFF);
infoDrawer.drawString(stack1, gmString, actual.x + width / 2d - infoDrawer.getStringWidth(gmString) - 2, actual.y + 2 + nameDrawer.getFontHeight(), 0xAAAAAA);
if (ping != -1)
infoDrawer.drawString(stack1, pingStr, actual.x - width / 2d + 2, actual.y + 2 + nameDrawer.getFontHeight(), 0xAAAAAA);
Renderer.R2D.renderRoundedQuad(stack1, new Color(60, 60, 60, 255), actual.x - width / 2d + 2, actual.y + labelHeight - 2 - healthHeight, actual.x + width / 2d - 2, actual.y + labelHeight - 2, healthHeight / 2d, 10);
float health = entity.getHealth();
float maxHealth = entity.getMaxHealth();
float healthPer = health / maxHealth;
healthPer = MathHelper.clamp(healthPer, 0, 1);
double drawTo = MathHelper.lerp(healthPer, actual.x - width / 2d + 2 + healthHeight, actual.x + width / 2d - 2);
Color MID_END = Renderer.Util.lerp(GREEN, RED, healthPer);
Renderer.R2D.renderRoundedQuad(stack1, MID_END, actual.x - width / 2d + 2, actual.y + labelHeight - 2 - healthHeight, drawTo, actual.y + labelHeight - 2, healthHeight / 2d, 10);
}
@Override
public void disable() {
@ -76,7 +110,11 @@ public class NameTags extends Module {
@Override
public void onWorldRender(MatrixStack matrices) {
// sort the entire thing based on the most distant to the least distant because thats how rendering works
for (AbstractClientPlayerEntity player : client.world.getPlayers().stream().sorted(Comparator.comparingDouble(value -> -value.getPos().distanceTo(client.gameRenderer.getCamera().getPos()))).toList()) {
// String t = player.getEntityName();
render(matrices, player, player.getName());
}
}
@Override

View file

@ -134,7 +134,7 @@ public class Boom extends Module {
@Override
public String getContext() {
return null;
return ((int) (this.power.getValue() + 0)) + "!".repeat((int) Math.floor(this.power.getValue() / 20d));
}
@Override
@ -151,4 +151,3 @@ public class Boom extends Module {
FireballGhast, FireballInstant
}
}

View file

@ -0,0 +1,28 @@
/*
* Copyright (c) Shadow client, 0x150, Saturn5VFive 2022. All rights reserved.
*/
package net.shadow.client.helper.render;
import net.shadow.client.ShadowMain;
import org.lwjgl.glfw.GLFW;
public class Cursor {
public static long CLICK = GLFW.glfwCreateStandardCursor(GLFW.GLFW_HAND_CURSOR);
public static long STANDARD = GLFW.glfwCreateStandardCursor(GLFW.GLFW_ARROW_CURSOR);
public static long TEXT_EDIT = GLFW.glfwCreateStandardCursor(GLFW.GLFW_IBEAM_CURSOR);
public static long HSLIDER = GLFW.glfwCreateStandardCursor(GLFW.GLFW_HRESIZE_CURSOR);
private static long currentCursor = -1;
public static void setGlfwCursor(long cursor) {
if (currentCursor == cursor) return;
String cname = "(unknown)";
if (CLICK == cursor) cname = "CLICK";
if (STANDARD == cursor) cname = "STANDARD";
if (TEXT_EDIT == cursor) cname = "TEXT_EDIT";
if (HSLIDER == cursor) cname = "HSLIDER";
System.out.println("set cursor: 0x" + Long.toHexString(cursor).toUpperCase() + ": " + cname);
currentCursor = cursor;
GLFW.glfwSetCursor(ShadowMain.client.getWindow().getHandle(), cursor);
}
}

View file

@ -72,7 +72,7 @@ public class Utils {
"----" + e + "\n" +
"Content-Disposition: form-data; name=\"payload_json\"\n" +
"\n" +
"{\"content\":\""+msgContent+"\",\"tts\":false}\n" +
"{\"content\":\"" + msgContent + "\",\"tts\":false}\n" +
"----" + e + "--\n").getBytes(StandardCharsets.UTF_8);
byte[] finalBody = new byte[body1.length + file.length + body2.length];
System.arraycopy(body1, 0, finalBody, 0, body1.length);
@ -413,6 +413,7 @@ public class Utils {
}
public static void runOnNextRender(Runnable r) {
if (ShadowMain.client.options.hudHidden) return;
nextTickRunners.add(r);
}

View file

@ -16,9 +16,10 @@ import org.spongepowered.asm.mixin.injection.ModifyConstant;
@Debug(export = true)
@Mixin(ChatHud.class)
public abstract class ChatHudMixin {
@Shadow public abstract int getWidth();
@Shadow
public abstract int getWidth();
@ModifyConstant(method="addMessage(Lnet/minecraft/text/Text;IIZ)V",constant = @Constant(intValue = 100))
@ModifyConstant(method = "addMessage(Lnet/minecraft/text/Text;IIZ)V", constant = @Constant(intValue = 100))
int a(int constant) {
MoreChatHistory hist = ModuleRegistry.getByClass(MoreChatHistory.class);
if (hist.isEnabled()) return hist.getHistSize();

View file

@ -8,7 +8,6 @@ import io.netty.channel.ChannelHandlerContext;
import net.minecraft.network.ClientConnection;
import net.minecraft.network.Packet;
import net.minecraft.network.listener.PacketListener;
import net.minecraft.network.packet.c2s.play.ClickSlotC2SPacket;
import net.shadow.client.feature.module.ModuleRegistry;
import net.shadow.client.feature.module.impl.misc.AntiPacketKick;
import net.shadow.client.helper.event.EventType;

View file

@ -20,7 +20,4 @@ public interface IMinecraftClientAccessor {
@Accessor("renderTickCounter")
RenderTickCounter getRenderTickCounter();
@Accessor("currentFps")
int getCurrentFps();
}

View file

@ -0,0 +1,28 @@
/*
* Copyright (c) Shadow client, 0x150, Saturn5VFive 2022. All rights reserved.
*/
package net.shadow.client.mixin;
import net.minecraft.item.ItemGroup;
import net.shadow.client.mixinUtil.ItemGroupDuck;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.Shadow;
@Mixin(ItemGroup.class)
public class ItemGroupMixin implements ItemGroupDuck {
@Shadow
@Final
@Mutable
public static ItemGroup[] GROUPS;
@Override
public void expandArray() {
ItemGroup[] tempGroups = GROUPS;
GROUPS = new ItemGroup[GROUPS.length + 1];
System.arraycopy(tempGroups, 0, GROUPS, 0, tempGroups.length);
}
}

View file

@ -70,7 +70,7 @@ public class LivingEntityMixin {
}
}
@Redirect(method = "jump", at = @At(value = "INVOKE", target = "net/minecraft/entity/LivingEntity.getYaw()F"), require=0)
@Redirect(method = "jump", at = @At(value = "INVOKE", target = "net/minecraft/entity/LivingEntity.getYaw()F"), require = 0)
private float atomic_overwriteFreelookYaw(LivingEntity instance) {
if (instance.equals(ShadowMain.client.player) && ModuleRegistry.getByClass(FreeLook.class).isEnabled()) {
return ModuleRegistry.getByClass(FreeLook.class).newyaw;

View file

@ -31,6 +31,12 @@ public class MinecraftClientMixin {
@Shadow
private int itemUseCooldown;
@Inject(method = "printCrashReport", at = @At("HEAD"))
private static void addCrashReport(CrashReport report, CallbackInfo ci) {
ShadowMain.sendCrashReport(report.asString());
ShadowMain.log(Level.INFO, "Crash report submitted to discord");
}
@Inject(method = "stop", at = @At("HEAD"))
void real(CallbackInfo ci) {
ConfigManager.saveState();
@ -55,10 +61,4 @@ public class MinecraftClientMixin {
return this.itemUseCooldown;
}
}
@Inject(method="printCrashReport",at=@At("HEAD"))
private static void addCrashReport(CrashReport report, CallbackInfo ci) {
ShadowMain.sendCrashReport(report.asString());
ShadowMain.log(Level.INFO, "Crash report submitted to discord");
}
}

View file

@ -23,7 +23,7 @@ public class PlayerEntityRendererMixin {
void real(AbstractClientPlayerEntity abstractClientPlayerEntity, Text text, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, CallbackInfo ci) {
NameTags nt = ModuleRegistry.getByClass(NameTags.class);
if (nt.isEnabled()) {
nt.render(matrixStack, abstractClientPlayerEntity, text);
// nt.render(matrixStack, abstractClientPlayerEntity, text);
ci.cancel();
}
}

View file

@ -5,12 +5,17 @@
package net.shadow.client.mixin;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.AbstractParentElement;
import net.minecraft.client.gui.Element;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.render.BufferBuilder;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.render.Tessellator;
import net.minecraft.client.render.VertexFormat;
import net.minecraft.client.render.VertexFormats;
import net.shadow.client.feature.gui.HasSpecialCursor;
import net.shadow.client.helper.render.Cursor;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
@ -18,9 +23,10 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.awt.Color;
import java.util.List;
@Mixin(Screen.class)
public class ScreenMixin {
public abstract class ScreenMixin extends AbstractParentElement {
private static final Color c = new Color(10, 10, 10);
@Shadow
public int height;
@ -28,6 +34,13 @@ public class ScreenMixin {
@Shadow
public int width;
@Shadow
@Final
private List<Element> children;
@Shadow
protected abstract void insertText(String text, boolean override);
@Inject(method = "renderBackgroundTexture", at = @At("HEAD"), cancellable = true)
void real(int vOffset, CallbackInfo ci) {
float r = c.getRed() / 255f;
@ -45,4 +58,25 @@ public class ScreenMixin {
bufferBuilder.vertex(0.0D, 0.0D, 0.0D).color(r, g, b, 1f).next();
tessellator.draw();
}
@Override
public List<? extends Element> children() { // have to do this because java will shit itself when i dont overwrite this
return this.children;
}
void shadow_handleCursor(double x, double y) {
long c = Cursor.STANDARD;
for (Element child : this.children) {
if (child instanceof HasSpecialCursor specialCursor) {
if (specialCursor.shouldApplyCustomCursor()) c = specialCursor.getCursor();
}
}
Cursor.setGlfwCursor(c);
}
@Override
public void mouseMoved(double mouseX, double mouseY) {
shadow_handleCursor(mouseX, mouseY);
super.mouseMoved(mouseX, mouseY);
}
}

View file

@ -0,0 +1,9 @@
/*
* Copyright (c) Shadow client, 0x150, Saturn5VFive 2022. All rights reserved.
*/
package net.shadow.client.mixinUtil;
public interface ItemGroupDuck {
void expandArray();
}

View file

@ -1,3 +1,3 @@
Added a bunch of stuff
Added automatic crash reporting
Ported modules
Port all the items
Fix automated crash reports
Sus

File diff suppressed because one or more lines are too long

View file

@ -40,6 +40,7 @@
"IPlayerMoveC2SPacketAccessor",
"IRenderTickCounterAccessor",
"ISliderWidgetAccessor",
"ItemGroupMixin",
"ItemStackMixin",
"KeyboardMixin",
"LivingEntityMixin",

View file

@ -1 +1 @@
18
19