kill yourself

This commit is contained in:
0x3C50 2022-04-24 21:54:16 +02:00
parent 53916f8884
commit 4cf4116bb0
18 changed files with 294 additions and 263 deletions

View file

@ -69,10 +69,8 @@ public class CommandRegistry {
private static final List<Command> vanillaCommands = new ArrayList<>(); private static final List<Command> vanillaCommands = new ArrayList<>();
private static final List<CustomCommandEntry> customCommands = new ArrayList<>(); private static final List<CustomCommandEntry> customCommands = new ArrayList<>();
private static final List<Command> sharedCommands = new ArrayList<>(); private static final List<Command> sharedCommands = new ArrayList<>();
private static final List<Command> consoleCommands = new ArrayList<>();
static { static {
// TODO: 18.12.21 add commands
// init(); // init();
rebuildSharedCommands(); rebuildSharedCommands();
} }
@ -100,16 +98,6 @@ public class CommandRegistry {
} }
} }
public static void buildConsoleCommands(){
consoleCommands.addAll(sharedCommands);
//consoleCommands.add();
}
public static List<Command> getConsoleCommands() {
return consoleCommands;
}
public static void init() { public static void init() {
vanillaCommands.clear(); vanillaCommands.clear();
vanillaCommands.add(new Toggle()); vanillaCommands.add(new Toggle());
@ -167,24 +155,12 @@ public class CommandRegistry {
vanillaCommands.add(new RandomBook()); vanillaCommands.add(new RandomBook());
rebuildSharedCommands(); rebuildSharedCommands();
buildConsoleCommands();
} }
public static List<Command> getCommands() { public static List<Command> getCommands() {
return sharedCommands; return sharedCommands;
} }
public static Command getCommand(String fullCommand) {
String[] spl = fullCommand.split(" +");
String cmd = spl[0].toLowerCase();
return CommandRegistry.getByAlias(cmd);
}
public static String[] getArgs(String command) {
String[] spl = command.split(" +");
return Arrays.copyOfRange(spl, 1, spl.length);
}
public static void execute(String command) { public static void execute(String command) {
String[] spl = command.split(" +"); String[] spl = command.split(" +");
String cmd = spl[0].toLowerCase(); String cmd = spl[0].toLowerCase();
@ -205,27 +181,6 @@ public class CommandRegistry {
} }
} }
public static void executeConsole(String command) {
String[] spl = command.split(" +");
String cmd = spl[0].toLowerCase();
String[] args = Arrays.copyOfRange(spl, 1, spl.length);
Command c = CommandRegistry.getConsoleByAlias(cmd);
if (c == null) {
Utils.Logging.error("Command \"" + cmd + "\" not found");
} else {
try {
c.onExecute(args);
} catch (CommandException cex) {
Utils.Logging.error(cex.getMessage());
if (cex.getPotentialFix() != null) Utils.Logging.error("Potential fix: " + cex.getPotentialFix());
} catch (Exception e) {
Utils.Logging.error("Error while running command " + command);
e.printStackTrace();
}
}
}
public static Command getByAlias(String n) { public static Command getByAlias(String n) {
for (Command command : getCommands()) { for (Command command : getCommands()) {
for (String alias : command.getAliases()) { for (String alias : command.getAliases()) {
@ -237,17 +192,6 @@ public class CommandRegistry {
return null; return null;
} }
public static Command getConsoleByAlias(String n) {
for (Command command : getConsoleCommands()) {
for (String alias : command.getAliases()) {
if (alias.equalsIgnoreCase(n)) {
return command;
}
}
}
return null;
}
record CustomCommandEntry(Addon addon, Command command) { record CustomCommandEntry(Addon addon, Command command) {
} }
} }

View file

@ -4,14 +4,6 @@
package net.shadow.client.feature.command.impl; package net.shadow.client.feature.command.impl;
import net.minecraft.world.GameMode;
import net.shadow.client.ShadowMain;
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.exception.CommandException;
import net.shadow.client.feature.gui.notifications.Notification;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
@ -19,8 +11,10 @@ import net.minecraft.nbt.StringNbtReader;
import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket; import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import net.shadow.client.feature.command.Command;
import java.util.Arrays; import net.shadow.client.feature.command.coloring.PossibleArgument;
import net.shadow.client.feature.command.exception.CommandException;
import net.shadow.client.feature.gui.notifications.Notification;
public class Gensploit extends Command { public class Gensploit extends Command {

View file

@ -14,8 +14,10 @@ import net.shadow.client.ShadowMain;
import net.shadow.client.feature.gui.FastTickable; import net.shadow.client.feature.gui.FastTickable;
import net.shadow.client.feature.gui.clickgui.element.Element; import net.shadow.client.feature.gui.clickgui.element.Element;
import net.shadow.client.feature.gui.clickgui.element.impl.CategoryDisplay; import net.shadow.client.feature.gui.clickgui.element.impl.CategoryDisplay;
import net.shadow.client.feature.gui.clickgui.element.impl.ModuleDisplay;
import net.shadow.client.feature.module.ModuleRegistry; import net.shadow.client.feature.module.ModuleRegistry;
import net.shadow.client.feature.module.ModuleType; import net.shadow.client.feature.module.ModuleType;
import net.shadow.client.helper.ConfigContainer;
import net.shadow.client.helper.event.EventType; import net.shadow.client.helper.event.EventType;
import net.shadow.client.helper.event.Events; import net.shadow.client.helper.event.Events;
import net.shadow.client.helper.font.FontRenderers; import net.shadow.client.helper.font.FontRenderers;
@ -26,17 +28,21 @@ import net.shadow.client.helper.util.Transitions;
import org.lwjgl.glfw.GLFW; import org.lwjgl.glfw.GLFW;
import java.awt.Color; import java.awt.Color;
import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
public class ClickGUI extends Screen implements FastTickable { public class ClickGUI extends Screen implements FastTickable {
// public static final Theme theme = new SipoverV1(); // public static final Theme theme = new SipoverV1();
static final Color tooltipColor = new Color(20, 20, 30, 255); static final Color tooltipColor = new Color(20, 20, 30, 255);
static ConfigContainer configContainer = new ConfigContainer(new File(ShadowMain.BASE, "clickGui.sip"), "amongUs");
private static ClickGUI instance; private static ClickGUI instance;
final List<Element> elements = new ArrayList<>(); final List<Element> elements = new ArrayList<>();
final ParticleRenderer real = new ParticleRenderer(100); final ParticleRenderer real = new ParticleRenderer(100);
@ -57,6 +63,10 @@ public class ClickGUI extends Screen implements FastTickable {
} }
this.real.render(Renderer.R3D.getEmptyMatrixStack()); this.real.render(Renderer.R3D.getEmptyMatrixStack());
}); });
Events.registerEventHandler(EventType.CONFIG_SAVE, event -> {
saveConfig();
});
loadConfig();
} }
public static ClickGUI instance() { public static ClickGUI instance() {
@ -70,6 +80,61 @@ public class ClickGUI extends Screen implements FastTickable {
if (instance != null) instance.initElements(); if (instance != null) instance.initElements();
} }
void loadConfig() {
configContainer.reload();
ClickguiConfigContainer cc = configContainer.get(ClickguiConfigContainer.class);
if (cc == null) return;
Map<String, CategoryDisplay> displays = new HashMap<>();
for (Element element : elements) {
if (element instanceof CategoryDisplay dd) {
displays.put(dd.getMt().getName(), dd);
}
}
for (ClickguiConfigContainer.CategoryEntry entry : cc.entries) {
String n = entry.name;
if (displays.containsKey(n)) {
CategoryDisplay disp = displays.get(n);
disp.setX(entry.posX);
disp.setY(entry.posY);
disp.setOpen(entry.expanded);
List<ModuleDisplay> mdList = disp.getMd();
for (ClickguiConfigContainer.ModuleEntry moduleEntry : entry.entries) {
ModuleDisplay mde = mdList.stream().filter(moduleDisplay -> moduleDisplay.getModule().getName().equals(moduleEntry.name)).findFirst().orElse(null);
if (mde == null) continue;
mde.setExtended(moduleEntry.expanded);
}
}
}
}
void saveConfig() {
ClickguiConfigContainer cc = new ClickguiConfigContainer();
List<ClickguiConfigContainer.CategoryEntry> e = new ArrayList<>();
for (Element element : elements) {
if (element instanceof CategoryDisplay ce) {
List<ModuleDisplay> mods = ce.getMd();
ModuleType type = ce.getMt();
ClickguiConfigContainer.CategoryEntry cm = new ClickguiConfigContainer.CategoryEntry();
cm.expanded = ce.isOpen();
cm.posX = ce.getX();
cm.posY = ce.getY();
cm.name = type.getName();
List<ClickguiConfigContainer.ModuleEntry> me = new ArrayList<>();
for (ModuleDisplay mod : mods) {
ClickguiConfigContainer.ModuleEntry moduleEntry = new ClickguiConfigContainer.ModuleEntry();
moduleEntry.expanded = mod.isExtended();
moduleEntry.name = mod.getModule().getName();
me.add(moduleEntry);
}
cm.entries = me.toArray(ClickguiConfigContainer.ModuleEntry[]::new);
e.add(cm);
}
}
cc.entries = e.toArray(ClickguiConfigContainer.CategoryEntry[]::new);
configContainer.set(cc);
configContainer.save();
}
@Override @Override
protected void init() { protected void init() {
@ -265,4 +330,20 @@ public class ClickGUI extends Screen implements FastTickable {
searchTerm += chr; searchTerm += chr;
return false; return false;
} }
static class ClickguiConfigContainer {
CategoryEntry[] entries;
static class CategoryEntry {
String name;
double posX, posY;
boolean expanded;
ModuleEntry[] entries;
}
static class ModuleEntry {
String name;
boolean expanded;
}
}
} }

View file

@ -5,6 +5,8 @@
package net.shadow.client.feature.gui.clickgui.element.impl; package net.shadow.client.feature.gui.clickgui.element.impl;
import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.systems.RenderSystem;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Quaternion; import net.minecraft.util.math.Quaternion;
@ -32,10 +34,14 @@ import static java.lang.Math.sqrt;
public class CategoryDisplay extends Element { public class CategoryDisplay extends Element {
static final FontAdapter cfr = FontRenderers.getCustomSize(20); static final FontAdapter cfr = FontRenderers.getCustomSize(20);
@Getter
final List<ModuleDisplay> md = new ArrayList<>(); final List<ModuleDisplay> md = new ArrayList<>();
@Getter
final ModuleType mt; final ModuleType mt;
final Scroller scroller = new Scroller(0); final Scroller scroller = new Scroller(0);
boolean selected = false; boolean selected = false;
@Getter
@Setter
boolean open = true; boolean open = true;
double openAnim = 1; double openAnim = 1;

View file

@ -4,6 +4,8 @@
package net.shadow.client.feature.gui.clickgui.element.impl; package net.shadow.client.feature.gui.clickgui.element.impl;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.shadow.client.feature.gui.clickgui.ClickGUI; import net.shadow.client.feature.gui.clickgui.ClickGUI;
@ -18,8 +20,11 @@ import net.shadow.client.helper.render.Renderer;
import net.shadow.client.helper.util.Utils; import net.shadow.client.helper.util.Utils;
public class ModuleDisplay extends Element { public class ModuleDisplay extends Element {
@Getter
final Module module; final Module module;
final ConfigDisplay cd; final ConfigDisplay cd;
@Getter
@Setter
boolean extended = false; boolean extended = false;
double extendAnim = 0; double extendAnim = 0;
long hoverStart = System.currentTimeMillis(); long hoverStart = System.currentTimeMillis();

View file

@ -72,7 +72,7 @@ public class ConsoleScreen extends ClientScreen implements FastTickable {
return; return;
} }
addLog(new LogEntry("> " + cmd, BACKGROUND)); addLog(new LogEntry("> " + cmd, BACKGROUND));
CommandRegistry.executeConsole(cmd); CommandRegistry.execute(cmd);
} }
@Override @Override
@ -127,14 +127,14 @@ public class ConsoleScreen extends ClientScreen implements FastTickable {
args = args1; args = args1;
} }
if (args.length > 0) { if (args.length > 0) {
Command c = CommandRegistry.getConsoleByAlias(cmd); Command c = CommandRegistry.getByAlias(cmd);
if (c != null) { if (c != null) {
a = List.of(c.getSuggestionsWithType(args.length - 1, args).getSuggestions()); a = List.of(c.getSuggestionsWithType(args.length - 1, args).getSuggestions());
} else { } else {
return new ArrayList<>(); // we have no command to ask -> we have no suggestions return new ArrayList<>(); // we have no command to ask -> we have no suggestions
} }
} else { } else {
for (Command command1 : CommandRegistry.getConsoleCommands()) { for (Command command1 : CommandRegistry.getCommands()) {
for (String alias : command1.getAliases()) { for (String alias : command1.getAliases()) {
if (alias.toLowerCase().startsWith(cmd.toLowerCase())) { if (alias.toLowerCase().startsWith(cmd.toLowerCase())) {
a.add(alias); a.add(alias);

View file

@ -5,10 +5,20 @@
package net.shadow.client.feature.module.impl.crash; package net.shadow.client.feature.module.impl.crash;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.StringNbtReader;
import net.minecraft.network.Packet;
import net.minecraft.network.packet.c2s.play.BookUpdateC2SPacket;
import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket; import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
import net.shadow.client.feature.config.DoubleSetting; import net.shadow.client.feature.config.DoubleSetting;
import net.shadow.client.feature.config.EnumSetting; import net.shadow.client.feature.config.EnumSetting;
import net.shadow.client.feature.gui.notifications.Notification; import net.shadow.client.feature.gui.notifications.Notification;
@ -19,26 +29,16 @@ import net.shadow.client.helper.event.EventType;
import net.shadow.client.helper.event.Events; import net.shadow.client.helper.event.Events;
import net.shadow.client.helper.event.events.PacketEvent; import net.shadow.client.helper.event.events.PacketEvent;
import java.util.Random;
import net.minecraft.item.BlockItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.nbt.StringNbtReader;
import net.minecraft.network.Packet;
import net.minecraft.network.packet.c2s.play.*;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.math.Vec3d;
import java.util.List; import java.util.List;
import java.util.*; import java.util.Optional;
import java.util.Random;
public class ClientCrasher extends Module { public class ClientCrasher extends Module {
BlockPos selectedbreaker;
final EnumSetting<Mode> mode = this.config.create(new EnumSetting.Builder<>(Mode.Offhand).name("Mode").description("How to crash").get()); final EnumSetting<Mode> mode = this.config.create(new EnumSetting.Builder<>(Mode.Offhand).name("Mode").description("How to crash").get());
final DoubleSetting power = this.config.create(new DoubleSetting.Builder(1000).min(5).max(2000).name("Power").description("How much power to crash with").get()); final DoubleSetting power = this.config.create(new DoubleSetting.Builder(1000).min(5).max(2000).name("Power").description("How much power to crash with").get());
BlockPos selectedbreaker;
public ClientCrasher() { public ClientCrasher() {
super("ClientCrasher", "Crash players games", ModuleType.CRASH); super("ClientCrasher", "Crash players games", ModuleType.CRASH);

View file

@ -4,7 +4,10 @@
package net.shadow.client.feature.module.impl.crash; package net.shadow.client.feature.module.impl.crash;
import net.minecraft.client.gui.screen.ingame.CraftingScreen;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.network.packet.c2s.play.CraftRequestC2SPacket;
import net.minecraft.recipe.Recipe;
import net.shadow.client.feature.gui.notifications.Notification; import net.shadow.client.feature.gui.notifications.Notification;
import net.shadow.client.feature.module.Module; import net.shadow.client.feature.module.Module;
import net.shadow.client.feature.module.ModuleType; import net.shadow.client.feature.module.ModuleType;
@ -12,9 +15,6 @@ import net.shadow.client.helper.event.EventListener;
import net.shadow.client.helper.event.EventType; import net.shadow.client.helper.event.EventType;
import net.shadow.client.helper.event.Events; import net.shadow.client.helper.event.Events;
import net.shadow.client.helper.event.events.PacketEvent; import net.shadow.client.helper.event.events.PacketEvent;
import net.minecraft.client.gui.screen.ingame.CraftingScreen;
import net.minecraft.network.packet.c2s.play.CraftRequestC2SPacket;
import net.minecraft.recipe.Recipe;
public class CraftCrash extends Module { public class CraftCrash extends Module {

View file

@ -5,18 +5,16 @@
package net.shadow.client.feature.module.impl.crash; package net.shadow.client.feature.module.impl.crash;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;
import net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket;
import net.shadow.client.feature.config.DoubleSetting; import net.shadow.client.feature.config.DoubleSetting;
import net.shadow.client.feature.module.Module; import net.shadow.client.feature.module.Module;
import net.shadow.client.feature.module.ModuleType; import net.shadow.client.feature.module.ModuleType;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;
import net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket;
import net.minecraft.world.World;
public class EntityCrash extends Module { public class EntityCrash extends Module {
Entity target = null;
final DoubleSetting repeat = this.config.create(new DoubleSetting.Builder(2000).min(500).max(10000).name("Power").description("how fast to crash").get()); final DoubleSetting repeat = this.config.create(new DoubleSetting.Builder(2000).min(500).max(10000).name("Power").description("how fast to crash").get());
Entity target = null;
public EntityCrash() { public EntityCrash() {
super("EntityCrash", "Crash the server by punching entities", ModuleType.CRASH); super("EntityCrash", "Crash the server by punching entities", ModuleType.CRASH);

View file

@ -4,25 +4,25 @@
package net.shadow.client.feature.module.impl.exploit; package net.shadow.client.feature.module.impl.exploit;
import net.minecraft.client.util.math.MatrixStack;
import net.shadow.client.feature.module.ModuleType;
import net.shadow.client.feature.config.EnumSetting;
import net.shadow.client.feature.gui.notifications.Notification;
import net.shadow.client.feature.module.Module;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import org.lwjgl.system.CallbackI.S;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtCompound;
import net.shadow.client.mixin.IdentifierAccessor;
import net.minecraft.nbt.NbtString; import net.minecraft.nbt.NbtString;
import net.minecraft.network.PacketByteBuf; import net.minecraft.network.PacketByteBuf;
import net.minecraft.network.packet.c2s.play.*; import net.minecraft.network.packet.c2s.play.AdvancementTabC2SPacket;
import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket;
import net.minecraft.network.packet.c2s.play.CustomPayloadC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
import net.minecraft.network.packet.c2s.play.SelectMerchantTradeC2SPacket;
import net.minecraft.network.packet.c2s.play.UpdateSelectedSlotC2SPacket;
import net.minecraft.util.Identifier; import net.minecraft.util.Identifier;
import net.shadow.client.feature.config.EnumSetting;
import net.shadow.client.feature.gui.notifications.Notification;
import net.shadow.client.feature.module.Module;
import net.shadow.client.feature.module.ModuleType;
import net.shadow.client.mixin.IdentifierAccessor;
public class ConsoleSpammer extends Module { public class ConsoleSpammer extends Module {
@ -51,16 +51,18 @@ public class ConsoleSpammer extends Module {
} }
case Merchant -> { case Merchant -> {
for(int i = 0; i < 5; i++) client.player.networkHandler.sendPacket(new SelectMerchantTradeC2SPacket(-1)); for (int i = 0; i < 5; i++)
client.player.networkHandler.sendPacket(new SelectMerchantTradeC2SPacket(-1));
} }
case Move -> { case Move -> {
for(int i = 0; i < 4; i++) client.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(client.player.getX(), 9999999, client.player.getZ(), false)); for (int i = 0; i < 4; i++)
client.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(client.player.getX(), 9999999, client.player.getZ(), false));
} }
case BadPackets -> { case BadPackets -> {
Identifier sysinfo = new Identifier("minecraft:code"); Identifier sysinfo = new Identifier("minecraft:code");
((IdentifierAccessor) sysinfo).setPath("\033\143\033\133\061\073\063\061\155"); ((IdentifierAccessor) sysinfo).setPath("\033c\033[1;31m");
AdvancementTabC2SPacket exploit1 = new AdvancementTabC2SPacket(AdvancementTabC2SPacket.Action.OPENED_TAB, sysinfo); AdvancementTabC2SPacket exploit1 = new AdvancementTabC2SPacket(AdvancementTabC2SPacket.Action.OPENED_TAB, sysinfo);
CustomPayloadC2SPacket exploit2 = new CustomPayloadC2SPacket(sysinfo, new PacketByteBuf(Unpooled.buffer())); CustomPayloadC2SPacket exploit2 = new CustomPayloadC2SPacket(sysinfo, new PacketByteBuf(Unpooled.buffer()));
client.getNetworkHandler().sendPacket(exploit1); client.getNetworkHandler().sendPacket(exploit1);

View file

@ -4,13 +4,7 @@
package net.shadow.client.feature.module.impl.misc; package net.shadow.client.feature.module.impl.misc;
import java.util.Random;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.shadow.client.feature.module.ModuleType;
import net.shadow.client.feature.config.DoubleSetting;
import net.shadow.client.feature.module.Module;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket; import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket; import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket;
@ -18,6 +12,11 @@ import net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket.Action;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction; import net.minecraft.util.math.Direction;
import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.Registry;
import net.shadow.client.feature.config.DoubleSetting;
import net.shadow.client.feature.module.Module;
import net.shadow.client.feature.module.ModuleType;
import java.util.Random;
public class ItemPuke extends Module { public class ItemPuke extends Module {

View file

@ -6,8 +6,6 @@ package net.shadow.client.feature.module.impl.render;
import com.mojang.brigadier.suggestion.Suggestion; import com.mojang.brigadier.suggestion.Suggestion;
import com.mojang.brigadier.suggestion.Suggestions; import com.mojang.brigadier.suggestion.Suggestions;
import net.minecraft.client.util.GlfwUtil;
import net.minecraft.client.util.math.MatrixStack; import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.network.packet.c2s.play.RequestCommandCompletionsC2SPacket; import net.minecraft.network.packet.c2s.play.RequestCommandCompletionsC2SPacket;
import net.minecraft.network.packet.s2c.play.CommandSuggestionsS2CPacket; import net.minecraft.network.packet.s2c.play.CommandSuggestionsS2CPacket;
@ -17,7 +15,6 @@ import net.shadow.client.ShadowMain;
import net.shadow.client.feature.config.BooleanSetting; import net.shadow.client.feature.config.BooleanSetting;
import net.shadow.client.feature.config.StringSetting; import net.shadow.client.feature.config.StringSetting;
import net.shadow.client.feature.gui.clickgui.element.Element; import net.shadow.client.feature.gui.clickgui.element.Element;
import net.shadow.client.feature.gui.clickgui.element.impl.config.BooleanSettingEditor;
import net.shadow.client.feature.gui.clickgui.element.impl.config.StringSettingEditor; import net.shadow.client.feature.gui.clickgui.element.impl.config.StringSettingEditor;
import net.shadow.client.feature.gui.notifications.Notification; import net.shadow.client.feature.gui.notifications.Notification;
import net.shadow.client.feature.gui.panels.PanelsGui; import net.shadow.client.feature.gui.panels.PanelsGui;

View file

@ -10,11 +10,10 @@ import com.google.gson.JsonParser;
import lombok.Getter; import lombok.Getter;
import net.shadow.client.helper.event.EventType; import net.shadow.client.helper.event.EventType;
import net.shadow.client.helper.event.Events; import net.shadow.client.helper.event.Events;
import org.apache.commons.io.FileUtils;
import java.io.File; import java.io.File;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.StandardOpenOption;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class ConfigContainer { public class ConfigContainer {
@ -23,6 +22,7 @@ public class ConfigContainer {
final String key; final String key;
@Getter @Getter
JsonObject value; JsonObject value;
boolean loaded = false;
public ConfigContainer(File f, String key) { public ConfigContainer(File f, String key) {
this.path = f; this.path = f;
@ -33,6 +33,7 @@ public class ConfigContainer {
} }
public <T> T get(Class<T> type) { public <T> T get(Class<T> type) {
if (!loaded) return null;
return gson.fromJson(getValue(), type); return gson.fromJson(getValue(), type);
} }
@ -45,8 +46,9 @@ public class ConfigContainer {
} }
void write(String data) { void write(String data) {
System.out.println("writing " + data);
try { try {
Files.writeString(path.toPath(), data, StandardOpenOption.CREATE); FileUtils.write(path, data, StandardCharsets.UTF_8);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -57,8 +59,9 @@ public class ConfigContainer {
return; return;
} }
try { try {
String p = Files.readString(path.toPath(), StandardCharsets.UTF_8); String p = FileUtils.readFileToString(path, StandardCharsets.UTF_8);
set(JsonParser.parseString(p).getAsJsonObject()); set(JsonParser.parseString(p).getAsJsonObject());
loaded = true;
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }

View file

@ -1,16 +1,15 @@
package net.shadow.client.helper.discord; package net.shadow.client.helper.discord;
import java.io.IOException;
import java.net.http.HttpResponse;
import com.google.gson.JsonArray; import com.google.gson.JsonArray;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import net.shadow.client.helper.http.HttpWrapper; import net.shadow.client.helper.http.HttpWrapper;
import java.io.IOException;
import java.net.http.HttpResponse;
public class DiscordClient { public class DiscordClient {
String token = ""; String token;
HttpWrapper requests = new HttpWrapper(); HttpWrapper requests = new HttpWrapper();
public DiscordClient(String token, boolean isBot) { public DiscordClient(String token, boolean isBot) {
@ -21,14 +20,14 @@ public class DiscordClient {
} }
} }
public long[] getGuilds() throws IOException, InterruptedException{ public long[] getGuilds() {
try { try {
HttpResponse<String> resp = requests.get("https://discord.com/api/v8/users/@me/guilds", "Authorization:" + token); HttpResponse<String> resp = requests.get("https://discord.com/api/v8/users/@me/guilds", "Authorization:" + token);
JsonArray guilds = new JsonParser().parse(resp.body()).getAsJsonArray(); JsonArray guilds = JsonParser.parseString(resp.body()).getAsJsonArray();
long[] guildr = new long[guilds.size()]; long[] guildr = new long[guilds.size()];
int iter = 0; int iter = 0;
for (JsonElement guild : guilds) { for (JsonElement guild : guilds) {
guildr[iter] = Long.valueOf(guild.getAsJsonObject().get("id").getAsString()); guildr[iter] = Long.parseLong(guild.getAsJsonObject().get("id").getAsString());
iter++; iter++;
} }
return guildr; return guildr;
@ -37,14 +36,14 @@ public class DiscordClient {
} }
} }
public long[] getChannels(long guildId) throws IOException, InterruptedException{ public long[] getChannels(long guildId) {
try { try {
HttpResponse<String> resp = requests.get("https://discord.com/api/v8/guilds/" + String.valueOf(guildId) + "/channels", "Authorization:" + token); HttpResponse<String> resp = requests.get("https://discord.com/api/v8/guilds/" + guildId + "/channels", "Authorization:" + token);
JsonArray guilds = new JsonParser().parse(resp.body()).getAsJsonArray(); JsonArray guilds = JsonParser.parseString(resp.body()).getAsJsonArray();
long[] guildr = new long[guilds.size()]; long[] guildr = new long[guilds.size()];
int iter = 0; int iter = 0;
for (JsonElement guild : guilds) { for (JsonElement guild : guilds) {
guildr[iter] = Long.valueOf(guild.getAsJsonObject().get("id").getAsString()); guildr[iter] = Long.parseLong(guild.getAsJsonObject().get("id").getAsString());
iter++; iter++;
} }
return guildr; return guildr;
@ -53,14 +52,14 @@ public class DiscordClient {
} }
} }
public long[] getDmChannels() throws IOException, InterruptedException{ public long[] getDmChannels() {
try { try {
HttpResponse<String> resp = requests.get("https://discord.com/api/v8/users/@me/channels", "Authorization:" + token); HttpResponse<String> resp = requests.get("https://discord.com/api/v8/users/@me/channels", "Authorization:" + token);
JsonArray guilds = new JsonParser().parse(resp.body()).getAsJsonArray(); JsonArray guilds = JsonParser.parseString(resp.body()).getAsJsonArray();
long[] guildr = new long[guilds.size()]; long[] guildr = new long[guilds.size()];
int iter = 0; int iter = 0;
for (JsonElement guild : guilds) { for (JsonElement guild : guilds) {
guildr[iter] = Long.valueOf(guild.getAsJsonObject().get("id").getAsString()); guildr[iter] = Long.parseLong(guild.getAsJsonObject().get("id").getAsString());
iter++; iter++;
} }
return guildr; return guildr;
@ -69,14 +68,14 @@ public class DiscordClient {
} }
} }
public long[] getRoles(long guildId) throws IOException, InterruptedException{ public long[] getRoles(long guildId) {
try { try {
HttpResponse<String> resp = requests.get("https://discord.com/api/v8/guilds/" + guildId + "/roles", "Authorization:" + token); HttpResponse<String> resp = requests.get("https://discord.com/api/v8/guilds/" + guildId + "/roles", "Authorization:" + token);
JsonArray guilds = new JsonParser().parse(resp.body()).getAsJsonArray(); JsonArray guilds = JsonParser.parseString(resp.body()).getAsJsonArray();
long[] guildr = new long[guilds.size()]; long[] guildr = new long[guilds.size()];
int iter = 0; int iter = 0;
for (JsonElement guild : guilds) { for (JsonElement guild : guilds) {
guildr[iter] = Long.valueOf(guild.getAsJsonObject().get("id").getAsString()); guildr[iter] = Long.parseLong(guild.getAsJsonObject().get("id").getAsString());
iter++; iter++;
} }
return guildr; return guildr;
@ -85,14 +84,14 @@ public class DiscordClient {
} }
} }
public long[] getMembers(long guildId) throws IOException, InterruptedException{ public long[] getMembers(long guildId) {
try { try {
HttpResponse<String> resp = requests.get("https://discord.com/api/v8/guilds/" + guildId + "/members", "Authorization:" + token); HttpResponse<String> resp = requests.get("https://discord.com/api/v8/guilds/" + guildId + "/members", "Authorization:" + token);
JsonArray guilds = new JsonParser().parse(resp.body()).getAsJsonArray(); JsonArray guilds = JsonParser.parseString(resp.body()).getAsJsonArray();
long[] guildr = new long[guilds.size()]; long[] guildr = new long[guilds.size()];
int iter = 0; int iter = 0;
for (JsonElement guild : guilds) { for (JsonElement guild : guilds) {
guildr[iter] = Long.valueOf(guild.getAsJsonObject().get("id").getAsString()); guildr[iter] = Long.parseLong(guild.getAsJsonObject().get("id").getAsString());
iter++; iter++;
} }
return guildr; return guildr;

View file

@ -2,8 +2,9 @@ package net.shadow.client.helper.http;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.net.http.*; import java.net.http.HttpClient;
import java.net.http.HttpClient.*; import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration; import java.time.Duration;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;

View file

@ -65,6 +65,7 @@ public class Renderer {
if (fade == null) continue; if (fade == null) continue;
long lifetimeLeft = fade.getLifeTimeLeft(); long lifetimeLeft = fade.getLifeTimeLeft();
double progress = lifetimeLeft / (double) fade.lifeTime; double progress = lifetimeLeft / (double) fade.lifeTime;
progress = MathHelper.clamp(progress, 0, 1);
double ip = 1 - progress; double ip = 1 - progress;
stack.push(); stack.push();
Color out = Util.modify(fade.outline, -1, -1, -1, (int) (fade.outline.getAlpha() * progress)); Color out = Util.modify(fade.outline, -1, -1, -1, (int) (fade.outline.getAlpha() * progress));

View file

@ -386,7 +386,8 @@ public class Utils {
public static void message0(String n, Color c) { public static void message0(String n, Color c) {
LiteralText t = new LiteralText(n); LiteralText t = new LiteralText(n);
t.setStyle(t.getStyle().withColor(TextColor.fromRgb(c.getRGB()))); t.setStyle(t.getStyle().withColor(TextColor.fromRgb(c.getRGB())));
if (ShadowMain.client.player != null) if(!(ShadowMain.client.currentScreen instanceof ConsoleScreen)) ShadowMain.client.player.sendMessage(t, false); if (ShadowMain.client.player != null) if (!(ShadowMain.client.currentScreen instanceof ConsoleScreen))
ShadowMain.client.player.sendMessage(t, false);
// if (c.equals(Color.WHITE)) c = Color.BLACK; // if (c.equals(Color.WHITE)) c = Color.BLACK;
ConsoleScreen.instance().addLog(new ConsoleScreen.LogEntry(n, c)); ConsoleScreen.instance().addLog(new ConsoleScreen.LogEntry(n, c));
} }