This commit is contained in:
Saturn5Vfive 2022-04-17 13:26:12 -05:00
commit b497d59a26
100 changed files with 622 additions and 903 deletions
src/main/java/net/shadow/client
feature
helper
mixin

View file

@ -76,6 +76,7 @@ public class AddonManager {
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
//noinspection ResultOfMethodCallIgnored
file.toFile().delete();
return FileVisitResult.CONTINUE;
}
@ -295,4 +296,3 @@ public class AddonManager {
record AddonEntry(File sourceFile, String name, String description, String[] devs, Addon registeredAddon) {
}
}

View file

@ -6,9 +6,12 @@ package net.shadow.client.feature.command;
import net.minecraft.client.MinecraftClient;
import net.shadow.client.feature.command.coloring.ArgumentType;
import net.shadow.client.feature.command.coloring.PossibleArgument;
import net.shadow.client.feature.command.exception.CommandException;
import net.shadow.client.helper.util.Utils;
import java.util.Arrays;
public abstract class Command extends Utils.Logging {
public final MinecraftClient client = MinecraftClient.getInstance();
@ -49,8 +52,6 @@ public abstract class Command extends Utils.Logging {
return aliases;
}
public abstract ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex);
public abstract void onExecute(String[] args) throws CommandException;
protected void validateArgumentsLength(String[] args, int requiredLength, String message) throws CommandException {
@ -58,8 +59,23 @@ public abstract class Command extends Utils.Logging {
throw new CommandException("Invalid number of arguments: " + requiredLength + " arguments required", message);
}
public String[] getSuggestions(String fullCommand, String[] args) {
return new String[0];
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
Object[] sug = getSuggestions(args, index);
if (sug != null && sug.length > 0) {
Object sample = sug[0];
ArgumentType type = null;
for (ArgumentType value : ArgumentType.values()) {
if (Arrays.stream(value.getAppliesTo()).anyMatch(aClass -> aClass.isAssignableFrom(sample.getClass()))) {
type = value;
break;
}
}
return new PossibleArgument(type, Arrays.stream(sug).map(Object::toString).toList().toArray(String[]::new));
}
return new PossibleArgument(null);
}
public Object[] getSuggestions(String[] args, int lookingAtArgIndex) {
return new Object[0];
}
}

View file

@ -8,7 +8,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.shadow.client.feature.command.exception.CommandException;
public class StreamlineArgumentParser {
String[] args;
final String[] args;
int index = 0;
public StreamlineArgumentParser(String[] args) {

View file

@ -4,19 +4,29 @@
package net.shadow.client.feature.command.coloring;
import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import java.awt.Color;
public enum ArgumentType {
STRING(new Color(0x55FF55)),
NUMBER(new Color(0x009DFF)),
PLAYER(new Color(0xFF9900));
STRING(new Color(0x55FF55), String.class),
NUMBER(new Color(0x009DFF), Integer.class, Double.class, Float.class, Long.class),
PLAYER(new Color(0xFF9900), PlayerEntity.class, AbstractClientPlayerEntity.class, LivingEntity.class);
final Color color;
final Class<?>[] appliesTo;
ArgumentType(Color color) {
ArgumentType(Color color, Class<?>... appliesToClass) {
this.color = color;
this.appliesTo = appliesToClass;
}
public Color getColor() {
return color;
}
public Class<?>[] getAppliesTo() {
return appliesTo;
}
}

View file

@ -0,0 +1,23 @@
/*
* Copyright (c) Shadow client, 0x150, Saturn5VFive 2022. All rights reserved.
*/
package net.shadow.client.feature.command.coloring;
public class PossibleArgument {
String[] suggestions;
ArgumentType type;
public PossibleArgument(ArgumentType type, String... suggestions) {
this.suggestions = suggestions;
this.type = type;
}
public ArgumentType getType() {
return type;
}
public String[] getSuggestions() {
return suggestions;
}
}

View file

@ -5,8 +5,8 @@
package net.shadow.client.feature.command.coloring;
public class StaticArgumentServer {
public static ArgumentType serveFromStatic(int index, ArgumentType... types) {
if (index >= types.length) return null;
public static PossibleArgument serveFromStatic(int index, PossibleArgument... types) {
if (index >= types.length) return new PossibleArgument(null);
return types[index];
}
}

View file

@ -8,7 +8,7 @@ import net.shadow.client.ShadowMain;
import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.argument.StreamlineArgumentParser;
import net.shadow.client.feature.command.coloring.ArgumentType;
import net.shadow.client.feature.command.coloring.StaticArgumentServer;
import net.shadow.client.feature.command.coloring.PossibleArgument;
import net.shadow.client.feature.command.exception.CommandException;
public class ApplyVel extends Command {
@ -18,20 +18,13 @@ public class ApplyVel extends Command {
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.NUMBER, ArgumentType.NUMBER, ArgumentType.NUMBER);
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"(x velocity)"};
} else if (args.length == 2) {
return new String[]{"(y velocity)"};
} else if (args.length == 3) {
return new String[]{"(z velocity)"};
}
return super.getSuggestions(fullCommand, args);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return switch (index) {
case 0 -> new PossibleArgument(ArgumentType.STRING, "(x velocity)");
case 1 -> new PossibleArgument(ArgumentType.STRING, "(y velocity)");
case 2 -> new PossibleArgument(ArgumentType.STRING, "(z velocity)");
default -> super.getSuggestionsWithType(index, args);
};
}
@Override

View file

@ -17,6 +17,7 @@ import net.minecraft.util.math.Direction;
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.exception.CommandException;
public class AsConsole extends Command {
@ -25,16 +26,8 @@ public class AsConsole extends Command {
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length > 0) {
return new String[]{"(command)"};
}
return super.getSuggestions(fullCommand, args);
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return ArgumentType.STRING;
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return new PossibleArgument(ArgumentType.STRING, "(command)");
}
@Override

View file

@ -10,6 +10,7 @@ import net.minecraft.nbt.NbtString;
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.exception.CommandException;
public class Author extends Command {
@ -18,16 +19,8 @@ public class Author extends Command {
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length > 0) {
return new String[]{"(new author)"};
}
return super.getSuggestions(fullCommand, args);
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return ArgumentType.STRING;
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return new PossibleArgument(ArgumentType.STRING, "(new author)");
}
@Override

View file

@ -13,7 +13,7 @@ import net.shadow.client.ShadowMain;
import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.argument.PlayerFromNameArgumentParser;
import net.shadow.client.feature.command.coloring.ArgumentType;
import net.shadow.client.feature.command.coloring.StaticArgumentServer;
import net.shadow.client.feature.command.coloring.PossibleArgument;
import net.shadow.client.feature.command.exception.CommandException;
import net.shadow.client.helper.util.Utils;
@ -24,17 +24,12 @@ public class Ban extends Command {
super("Ban", "Ban people from re-joining the server", "ban", "block");
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.STRING);
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return Objects.requireNonNull(ShadowMain.client.world).getPlayers().stream().map(abstractClientPlayerEntity -> abstractClientPlayerEntity.getGameProfile().getName()).toList().toArray(String[]::new);
}
return super.getSuggestions(fullCommand, args);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
if (index == 0)
return new PossibleArgument(ArgumentType.PLAYER, Objects.requireNonNull(ShadowMain.client.world).getPlayers().stream().map(abstractClientPlayerEntity -> abstractClientPlayerEntity.getGameProfile().getName()).toList().toArray(String[]::new));
return super.getSuggestionsWithType(index, args);
}
@Override

View file

@ -7,7 +7,7 @@ package net.shadow.client.feature.command.impl;
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.StaticArgumentServer;
import net.shadow.client.feature.command.coloring.PossibleArgument;
import net.shadow.client.feature.command.exception.CommandException;
import net.shadow.client.feature.gui.screen.BindScreen;
import net.shadow.client.feature.module.Module;
@ -20,16 +20,10 @@ public class Bind extends Command {
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return ModuleRegistry.getModules().stream().map(Module::getName).toList().toArray(String[]::new);
}
return super.getSuggestions(fullCommand, args);
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.STRING);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
if (index == 0)
return new PossibleArgument(ArgumentType.STRING, ModuleRegistry.getModules().stream().map(Module::getName).toList().toArray(String[]::new));
return super.getSuggestionsWithType(index, args);
}
@Override

View file

@ -13,18 +13,12 @@ import net.minecraft.network.packet.c2s.play.PlayerInteractItemC2SPacket;
import net.minecraft.util.Hand;
import net.shadow.client.ShadowMain;
import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.coloring.ArgumentType;
public class Boot extends Command {
public Boot() {
super("Boot", "Kicks all players in render distance", "boot");
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return null;
}
@Override
public void onExecute(String[] args) {
ItemStack boot = new ItemStack(Items.WRITTEN_BOOK, 1);

View file

@ -9,18 +9,12 @@ import net.minecraft.network.packet.c2s.play.UpdateCommandBlockC2SPacket;
import net.minecraft.util.math.Direction;
import net.shadow.client.ShadowMain;
import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.coloring.ArgumentType;
public class CheckCmd extends Command {
public CheckCmd() {
super("CheckCmd", "Check if command blocks are enabled", "checkCmd");
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return null;
}
@Override
public void onExecute(String[] args) {
message("Checking command blocks");

View file

@ -7,23 +7,12 @@ package net.shadow.client.feature.command.impl;
import net.minecraft.screen.slot.SlotActionType;
import net.shadow.client.ShadowMain;
import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.coloring.ArgumentType;
public class ClearInventory extends Command {
public ClearInventory() {
super("ClearInventory", "Clear your inventory the cool way", "clear", "clearInv", "void");
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return null;
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
return super.getSuggestions(fullCommand, args);
}
@Override
public void onExecute(String[] args) {
for (int i = 9; i < 45; i++) {

View file

@ -6,7 +6,7 @@ package net.shadow.client.feature.command.impl;
import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.coloring.ArgumentType;
import net.shadow.client.feature.command.coloring.StaticArgumentServer;
import net.shadow.client.feature.command.coloring.PossibleArgument;
import net.shadow.client.feature.config.SettingBase;
import net.shadow.client.feature.module.Module;
import net.shadow.client.feature.module.ModuleRegistry;
@ -21,20 +21,18 @@ public class Config extends Command {
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.STRING, ArgumentType.STRING, ArgumentType.STRING);
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return ModuleRegistry.getModules().stream().map(mod -> mod.getName().replaceAll(" ", "-")).toList().toArray(String[]::new);
} else if (args.length == 2 && ModuleRegistry.getByName(args[0]) != null) {
return Objects.requireNonNull(ModuleRegistry.getByName(args[0].replaceAll("-", " "))).config.getSettings().stream().map(SettingBase::getName).toList().toArray(String[]::new);
} else if (args.length == 3) {
return new String[]{"(New value)"};
}
return super.getSuggestions(fullCommand, args);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return switch (index) {
case 0 ->
new PossibleArgument(ArgumentType.STRING, ModuleRegistry.getModules().stream().map(mod -> mod.getName().replaceAll(" ", "-")).toList().toArray(String[]::new));
case 1 -> {
if (ModuleRegistry.getByName(args[0]) != null) {
yield new PossibleArgument(ArgumentType.STRING, Objects.requireNonNull(ModuleRegistry.getByName(args[0].replaceAll("-", " "))).config.getSettings().stream().map(SettingBase::getName).toList().toArray(String[]::new));
} else yield super.getSuggestionsWithType(index, args);
}
case 2 -> new PossibleArgument(ArgumentType.STRING, "(New value)");
default -> super.getSuggestionsWithType(index, args);
};
}
@Override

View file

@ -17,6 +17,7 @@ import net.minecraft.text.Text;
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.config.SettingBase;
@ -42,18 +43,8 @@ public class ConfigUtils extends Command {
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"load", "save"};
} else if (args.length == 2 && args[0].equalsIgnoreCase("load")) {
return Arrays.stream(Objects.requireNonNull(CONFIG_STORAGE.listFiles())).map(File::getName).toList().toArray(String[]::new);
}
return super.getSuggestions(fullCommand, args);
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.STRING, ArgumentType.STRING);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.STRING, "load", "save"), new PossibleArgument(ArgumentType.STRING, Arrays.stream(Objects.requireNonNull(CONFIG_STORAGE.listFiles())).map(File::getName).toList().toArray(String[]::new)));
}
@Override

View file

@ -10,6 +10,7 @@ import net.shadow.client.ShadowMain;
import net.shadow.client.feature.command.Command;
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.exception.CommandException;
@ -21,16 +22,8 @@ public class Crash extends Command {
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.PLAYER);
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return Objects.requireNonNull(ShadowMain.client.world).getPlayers().stream().map(abstractClientPlayerEntity -> abstractClientPlayerEntity.getGameProfile().getName()).toList().toArray(String[]::new);
}
return super.getSuggestions(fullCommand, args);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
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

View file

@ -10,6 +10,7 @@ import net.shadow.client.ShadowMain;
import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.argument.IntegerArgumentParser;
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;
@ -19,16 +20,8 @@ public class Damage extends Command {
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"(amount)"};
}
return super.getSuggestions(fullCommand, args);
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.NUMBER);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.NUMBER, "(amount)"));
}
@Override

View file

@ -5,7 +5,6 @@
package net.shadow.client.feature.command.impl;
import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.coloring.ArgumentType;
import net.shadow.client.helper.util.Utils;
public class Drop extends Command {
@ -14,11 +13,6 @@ public class Drop extends Command {
super("Drop", "Drops all items in your inventory", "drop", "d", "throw");
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return null;
}
@Override
public void onExecute(String[] args) {
for (int i = 0; i < 36; i++) {

View file

@ -9,6 +9,7 @@ import net.shadow.client.ShadowMain;
import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.argument.IntegerArgumentParser;
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;
@ -18,16 +19,8 @@ public class EVclip extends Command {
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"(amount)"};
}
return super.getSuggestions(fullCommand, args);
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.NUMBER);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.NUMBER, "(amount)"));
}
@Override

View file

@ -10,6 +10,7 @@ import net.shadow.client.ShadowMain;
import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.argument.IntegerArgumentParser;
import net.shadow.client.feature.command.coloring.ArgumentType;
import net.shadow.client.feature.command.coloring.PossibleArgument;
import net.shadow.client.feature.command.exception.CommandException;
public class Effect extends Command {
@ -19,29 +20,17 @@ public class Effect extends Command {
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"give", "clear"};
} else if (args.length == 2 && args[0].equalsIgnoreCase("give")) {
return new String[]{"(effect id)"};
} else if (args.length == 3 && args[0].equalsIgnoreCase("give")) {
return new String[]{"(duration)"};
} else if (args.length == 4 && args[0].equalsIgnoreCase("give")) {
return new String[]{"(strength)"};
}
return super.getSuggestions(fullCommand, args);
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
if (lookingAtArgIndex == 0) return ArgumentType.STRING;
if (args[0].equalsIgnoreCase("give")) {
return switch (lookingAtArgIndex) {
case 1, 2, 3 -> ArgumentType.NUMBER;
default -> null;
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
if (index == 0) return new PossibleArgument(ArgumentType.STRING, "give", "clear");
else if (args[0].equalsIgnoreCase("give")) {
return switch (index) {
case 1 -> new PossibleArgument(ArgumentType.NUMBER, "(effect id)");
case 2 -> new PossibleArgument(ArgumentType.NUMBER, "(duration)");
case 3 -> new PossibleArgument(ArgumentType.NUMBER, "(strength)");
default -> super.getSuggestionsWithType(index, args);
};
}
return null;
return super.getSuggestionsWithType(index, args);
}
@Override

View file

@ -8,6 +8,7 @@ import net.minecraft.screen.slot.SlotActionType;
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;
@ -17,16 +18,8 @@ public class Equip extends Command {
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"head", "chest", "legs", "feet"};
}
return super.getSuggestions(fullCommand, args);
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.STRING);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.STRING, "head", "chest", "legs", "feet"));
}
@Override

View file

@ -16,6 +16,7 @@ import net.shadow.client.ShadowMain;
import net.shadow.client.feature.command.Command;
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.exception.CommandException;
import java.util.Arrays;
@ -27,24 +28,19 @@ public class FakeItem extends Command {
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return Objects.requireNonNull(ShadowMain.client.world).getPlayers().stream().map(abstractClientPlayerEntity -> abstractClientPlayerEntity.getGameProfile().getName()).toList().toArray(String[]::new);
} else if (args.length == 2) {
return new String[]{"hand", "custom:(item id) [item nbt]"};
} else if (args.length == 3 && args[1].toLowerCase().startsWith("custom:")) {
return new String[]{"(item nbt)"};
}
return super.getSuggestions(fullCommand, args);
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
if (lookingAtArgIndex == 0) return ArgumentType.PLAYER;
if (lookingAtArgIndex == 1 || lookingAtArgIndex == 2)
return ArgumentType.STRING; // fakeitem target custom:dogshit
if (args.length > 2) return ArgumentType.STRING; // nbt
return null;
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return switch (index) {
case 0 ->
new PossibleArgument(ArgumentType.STRING, Objects.requireNonNull(ShadowMain.client.world).getPlayers().stream().map(abstractClientPlayerEntity -> abstractClientPlayerEntity.getGameProfile().getName()).toList().toArray(String[]::new));
case 1 -> new PossibleArgument(ArgumentType.STRING, "hand", "custom:(item id) [item nbt]");
case 2 -> {
if (args[1].toLowerCase().startsWith("custom:")) {
yield new PossibleArgument(ArgumentType.STRING, "(item nbt)");
}
yield super.getSuggestionsWithType(index, args);
}
default -> super.getSuggestionsWithType(index, args);
};
}
@Override

View file

@ -20,6 +20,7 @@ import net.minecraft.util.math.Vec3d;
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.helper.event.EventListener;
@ -107,16 +108,8 @@ public class Find extends Command {
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"(uuid)"};
}
return super.getSuggestions(fullCommand, args);
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.PLAYER);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.STRING, "(uuid)"));
}
@Override
@ -126,7 +119,6 @@ public class Find extends Command {
error("Cant find the player, need GMC");
return;
}
UUID u = Utils.Players.getUUIDFromName(args[0]);
if (u == null) {
error("Couldn't find user's uuid.");

View file

@ -8,6 +8,7 @@ import net.shadow.client.ShadowMain;
import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.argument.IntegerArgumentParser;
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;
@ -19,16 +20,8 @@ public class FloodLuckperms extends Command {
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"(amount)"};
}
return super.getSuggestions(fullCommand, args);
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.NUMBER);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.NUMBER, "(amount)"));
}
@Override

View file

@ -13,6 +13,7 @@ import net.shadow.client.ShadowMain;
import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.argument.IntegerArgumentParser;
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.helper.event.EventType;
@ -50,20 +51,8 @@ public class ForEach extends Command {
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"player", "tab"};
} else if (args.length == 2) {
return new String[]{"(delay)"};
} else if (args.length == 3) {
return new String[]{"(string)"};
}
return super.getSuggestions(fullCommand, args);
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.STRING, ArgumentType.NUMBER, ArgumentType.STRING);
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)"));
}
@Override

View file

@ -17,7 +17,6 @@ import net.minecraft.util.hit.HitResult;
import net.minecraft.util.math.BlockPos;
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.exception.CommandException;
public class ForceOP extends Command {
@ -25,11 +24,6 @@ public class ForceOP extends Command {
super("ForceOP", "Edit command blocks on paper 1.14 - 1.17", "forceop", "editcmd");
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return ArgumentType.STRING;
}
@Override
public void onExecute(String[] args) throws CommandException {
validateArgumentsLength(args, 1, "Provide command");

View file

@ -8,6 +8,7 @@ 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;
@ -20,16 +21,8 @@ public class Gamemode extends Command {
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return Arrays.stream(GameMode.values()).map(GameMode::getName).toList().toArray(String[]::new);
}
return super.getSuggestions(fullCommand, args);
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.STRING);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.STRING, Arrays.stream(GameMode.values()).map(GameMode::getName).toList().toArray(String[]::new)));
}
@Override

View file

@ -10,6 +10,7 @@ import net.shadow.client.ShadowMain;
import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.argument.DoubleArgumentParser;
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;
@ -19,16 +20,8 @@ public class HClip extends Command {
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"(amount)"};
}
return super.getSuggestions(fullCommand, args);
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.NUMBER);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.NUMBER, "(amount)"));
}
@Override

View file

@ -6,7 +6,6 @@ package net.shadow.client.feature.command.impl;
import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.CommandRegistry;
import net.shadow.client.feature.command.coloring.ArgumentType;
import java.awt.Color;
@ -16,11 +15,6 @@ public class Help extends Command {
super("Help", "Shows all commands", "help", "h", "?", "cmds", "commands");
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return null;
}
@Override
public void onExecute(String[] args) {
message("All commands and their description");

View file

@ -10,6 +10,7 @@ import net.minecraft.util.math.Vec3d;
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.helper.manager.HologramManager;
@ -24,19 +25,8 @@ public class Hologram extends Command {
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"(flags)"};
}
if (args.length == 2) {
return new String[]{"(message)"};
}
return super.getSuggestions(fullCommand, args);
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.STRING, ArgumentType.STRING);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.STRING, "(flags)"), new PossibleArgument(ArgumentType.STRING, "(message)"));
}
@Override

View file

@ -15,6 +15,7 @@ import net.minecraft.util.hit.BlockHitResult;
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.helper.event.EventType;
@ -48,22 +49,10 @@ public class Image extends Command {
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"chat", "book", "lore"};
}
if (args.length == 2) {
return new String[]{"(url)"};
}
if (args.length == 3) {
return new String[]{"(size)"};
}
return super.getSuggestions(fullCommand, args);
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.STRING, ArgumentType.STRING, ArgumentType.NUMBER);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.STRING, "chat", "book", "lore"),
new PossibleArgument(ArgumentType.STRING, "(url)"),
new PossibleArgument(ArgumentType.NUMBER, "(size)"));
}
@Override

View file

@ -10,6 +10,8 @@ import net.minecraft.nbt.StringNbtReader;
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;
public class Inject extends Command {
@ -18,13 +20,8 @@ public class Inject extends Command {
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
return super.getSuggestions(fullCommand, args);
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return ArgumentType.STRING;
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.STRING, "(nbt)"));
}
@Override

View file

@ -10,6 +10,7 @@ import net.shadow.client.ShadowMain;
import net.shadow.client.feature.command.Command;
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.exception.CommandException;
import net.shadow.client.helper.util.Utils;
@ -23,16 +24,8 @@ public class Invsee extends Command {
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return Objects.requireNonNull(ShadowMain.client.world).getPlayers().stream().map(abstractClientPlayerEntity -> abstractClientPlayerEntity.getGameProfile().getName()).toList().toArray(String[]::new);
}
return super.getSuggestions(fullCommand, args);
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.PLAYER);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
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

View file

@ -13,6 +13,7 @@ import net.shadow.client.ShadowMain;
import net.shadow.client.feature.command.Command;
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.exception.CommandException;
@ -24,22 +25,10 @@ public class ItemData extends Command {
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return Objects.requireNonNull(ShadowMain.client.world).getPlayers().stream().map(abstractClientPlayerEntity -> abstractClientPlayerEntity.getGameProfile().getName()).toList().toArray(String[]::new);
}
if (args.length == 2) {
return new String[]{"hand", "offhand", "head", "chest", "legs", "feet"};
}
if (args.length == 3) {
return new String[]{"--onlyShow"};
}
return super.getSuggestions(fullCommand, args);
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.PLAYER, ArgumentType.STRING, ArgumentType.STRING);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.PLAYER, Objects.requireNonNull(ShadowMain.client.world).getPlayers().stream().map(abstractClientPlayerEntity -> abstractClientPlayerEntity.getGameProfile().getName()).toList().toArray(String[]::new)),
new PossibleArgument(ArgumentType.STRING, "hand", "offhand", "head", "chest", "legs", "feet"),
new PossibleArgument(ArgumentType.STRING, "--onlyShow"));
}
@Override

View file

@ -11,7 +11,7 @@ import net.minecraft.item.ItemStack;
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.StaticArgumentServer;
import net.shadow.client.feature.command.coloring.PossibleArgument;
import net.shadow.client.feature.command.exception.CommandException;
import net.shadow.client.feature.items.Item;
import net.shadow.client.feature.items.ItemRegistry;
@ -28,10 +28,10 @@ public class ItemExploit extends Command {
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return ItemRegistry.instance.getItems().stream().map(Item::getName).toList().toArray(String[]::new);
} else if (args.length > 1) {
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
if (index == 0)
return new PossibleArgument(ArgumentType.STRING, ItemRegistry.instance.getItems().stream().map(Item::getName).toList().toArray(String[]::new));
else {
String eName = args[0];
Item meant = null;
for (Item item : ItemRegistry.instance.getItems()) {
@ -41,26 +41,18 @@ public class ItemExploit extends Command {
}
}
if (meant == null || meant.getOptions().length == 0) {
return new String[0];
return super.getSuggestionsWithType(index, args);
}
List<String> alreadyFilledOut = new ArrayList<>(Arrays.asList(Arrays.copyOfRange(args, 1, args.length)));
// return all options mapped to start with --, and filter them based on what we already filled out
return Arrays.stream(meant.getOptions()).map(option -> "--" + option.getName()).filter(s -> alreadyFilledOut.stream().noneMatch(s1 -> s1.equalsIgnoreCase(s))).toList().toArray(String[]::new);
return new PossibleArgument(ArgumentType.STRING, Arrays.stream(meant.getOptions()).map(option -> "--" + option.getName()).filter(s -> alreadyFilledOut.stream().noneMatch(s1 -> s1.equalsIgnoreCase(s))).toList().toArray(String[]::new));
}
return super.getSuggestions(fullCommand, args);
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.STRING);
}
@Override
public void onExecute(String[] args) throws CommandException {
validateArgumentsLength(args, 1, "Provide exploit name");
if (!ShadowMain.client.interactionManager.hasCreativeInventory()) {
error("No creative inventory present - can't generate");
return;
throw new CommandException("No creative inventory, can't generate", "get real");
}
String n = args[0].toLowerCase();
Item meant = null;

View file

@ -12,6 +12,7 @@ import net.shadow.client.ShadowMain;
import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.argument.IntegerArgumentParser;
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;
@ -21,18 +22,9 @@ public class ItemSpoof extends Command {
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return Registry.ITEM.stream().map(p -> Registry.ITEM.getId(p).toString()).toList().toArray(String[]::new);
} else if (args.length == 2) {
return new String[]{"(amount)"};
}
return super.getSuggestions(fullCommand, args);
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.STRING, ArgumentType.NUMBER);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.STRING, Registry.ITEM.stream().map(p -> Registry.ITEM.getId(p).toString()).toList().toArray(String[]::new)),
new PossibleArgument(ArgumentType.NUMBER, "(amount)"));
}
@Override

View file

@ -12,6 +12,7 @@ import net.minecraft.util.Hand;
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;
@ -21,16 +22,8 @@ public class KickSelf extends Command {
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"quit", "chars", "packet", "self", "spam", "packets"};
}
return super.getSuggestions(fullCommand, args);
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.STRING);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.STRING, "quit", "chars", "packet", "self", "spam", "packets"));
}
@Override

View file

@ -18,7 +18,6 @@ import net.minecraft.network.packet.s2c.login.LoginSuccessS2CPacket;
import net.minecraft.text.Text;
import net.shadow.client.ShadowMain;
import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.coloring.ArgumentType;
import java.net.InetSocketAddress;
@ -27,11 +26,6 @@ public class Kickall extends Command {
super("Kickall", "Kicks every single person on an offline server", "kickall");
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return null;
}
@Override
public void onExecute(String[] args) {
InetSocketAddress sa = (InetSocketAddress) ShadowMain.client.getNetworkHandler().getConnection().getAddress();

View file

@ -28,6 +28,7 @@ import net.minecraft.util.math.Vec3d;
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.helper.event.EventType;
@ -64,16 +65,8 @@ public class Kill extends Command {
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return Objects.requireNonNull(ShadowMain.client.world).getPlayers().stream().map(abstractClientPlayerEntity -> abstractClientPlayerEntity.getGameProfile().getName()).toList().toArray(String[]::new);
}
return super.getSuggestions(fullCommand, args);
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.PLAYER);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.PLAYER, Objects.requireNonNull(ShadowMain.client.world).getPlayers().stream().map(abstractClientPlayerEntity -> abstractClientPlayerEntity.getGameProfile().getName()).toList().toArray(String[]::new)));
}
void handlePacket(PacketEvent pe) {
@ -124,8 +117,8 @@ public class Kill extends Command {
}
void makeKillPotAt(BlockHitResult bhr, Vec3d target) {
target = target.add(0, 2.7, 0);
ItemStack s = Utils.generateItemStackWithMeta("{data: [], palette: [], EntityTag: {Item: {Count: 1b, id: \"minecraft:splash_potion\", tag: {CustomPotionEffects: [{ShowParticles: 1b, Duration: 20, Id: 6b, Amplifier: 125b}], Potion: \"minecraft:awkward\"}}, Pos: [" + target.x + "d, " + target.y + "d, " + target.z + "d], Motion: [0d,-5d,0d], id: \"minecraft:potion\", LeftOwner: 1b}}", Items.BAT_SPAWN_EGG);
Vec3d target1 = target.add(0, 2.7, 0);
ItemStack s = Utils.generateItemStackWithMeta("{data: [], palette: [], EntityTag: {Item: {Count: 1b, id: \"minecraft:splash_potion\", tag: {CustomPotionEffects: [{ShowParticles: 1b, Duration: 20, Id: 6b, Amplifier: 125b}], Potion: \"minecraft:awkward\"}}, Pos: [" + target1.x + "d, " + target1.y + "d, " + target1.z + "d], Motion: [0d,-5d,0d], id: \"minecraft:potion\", LeftOwner: 1b}}", Items.BAT_SPAWN_EGG);
assert ShadowMain.client.player != null;
CreativeInventoryActionC2SPacket pack = new CreativeInventoryActionC2SPacket(Utils.Inventory.slotIndexToId(ShadowMain.client.player.getInventory().selectedSlot), s);
Objects.requireNonNull(ShadowMain.client.getNetworkHandler()).sendPacket(pack);

View file

@ -4,9 +4,7 @@
package net.shadow.client.feature.command.impl;
import com.mojang.authlib.GameProfile;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
@ -22,6 +20,7 @@ import net.shadow.client.ShadowMain;
import net.shadow.client.feature.command.Command;
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.exception.CommandException;
import net.shadow.client.helper.util.Utils;
@ -34,16 +33,8 @@ public class LinkWolf extends Command {
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return Objects.requireNonNull(ShadowMain.client.world).getPlayers().stream().map(AbstractClientPlayerEntity::getGameProfile).map(GameProfile::getName).toList().toArray(String[]::new);
}
return super.getSuggestions(fullCommand, args);
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.PLAYER);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.PLAYER, Objects.requireNonNull(ShadowMain.client.world).getPlayers().stream().map(abstractClientPlayerEntity -> abstractClientPlayerEntity.getGameProfile().getName()).toList().toArray(String[]::new)));
}
@Override

View file

@ -13,7 +13,6 @@ import net.minecraft.nbt.NbtString;
import net.minecraft.network.packet.c2s.play.CreativeInventoryActionC2SPacket;
import net.shadow.client.ShadowMain;
import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.coloring.ArgumentType;
import net.shadow.client.helper.util.Utils;
import java.util.Base64;
@ -22,17 +21,12 @@ import java.util.concurrent.atomic.AtomicBoolean;
public class LogFlood extends Command {
AtomicBoolean running = new AtomicBoolean(false);
final AtomicBoolean running = new AtomicBoolean(false);
public LogFlood() {
super("LogFlood", "Floods the log files of players in render distance", "logflood", "lflood");
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return null;
}
@Override
public void onExecute(String[] args) {
if (running.get()) {

View file

@ -8,6 +8,8 @@ import net.shadow.client.ShadowMain;
import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.argument.IntegerArgumentParser;
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 java.util.Arrays;
@ -18,20 +20,8 @@ public class MessageSpam extends Command {
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
if (lookingAtArgIndex == 0) return ArgumentType.NUMBER;
return ArgumentType.STRING;
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"(amount)"};
}
if (args.length > 1) {
return new String[]{"(message)"};
}
return super.getSuggestions(fullCommand, args);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.NUMBER, "(amount)"), new PossibleArgument(ArgumentType.STRING, "(message)"));
}
@Override

View file

@ -7,6 +7,7 @@ package net.shadow.client.feature.command.impl;
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.module.Module;
import net.shadow.client.feature.module.ModuleRegistry;
@ -24,16 +25,8 @@ public class Panic extends Command {
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"hard", "restore"};
}
return super.getSuggestions(fullCommand, args);
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.STRING);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.STRING, "hard", "restore"));
}
@Override

View file

@ -8,6 +8,7 @@ import net.shadow.client.ShadowMain;
import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.argument.IntegerArgumentParser;
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;
@ -17,16 +18,8 @@ public class PermissionLevel extends Command {
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.NUMBER);
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"1", "2", "3", "4"};
}
return super.getSuggestions(fullCommand, args);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.NUMBER, "1", "2", "3", "4"));
}
@Override

View file

@ -13,6 +13,7 @@ import net.minecraft.screen.slot.SlotActionType;
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 java.util.Objects;
@ -27,16 +28,8 @@ public class Poof extends Command {
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.PLAYER);
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return Objects.requireNonNull(ShadowMain.client.world).getPlayers().stream().map(abstractClientPlayerEntity -> abstractClientPlayerEntity.getGameProfile().getName()).toList().toArray(String[]::new);
}
return super.getSuggestions(fullCommand, args);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.PLAYER, Objects.requireNonNull(ShadowMain.client.world).getPlayers().stream().map(abstractClientPlayerEntity -> abstractClientPlayerEntity.getGameProfile().getName()).toList().toArray(String[]::new)));
}
@Override

View file

@ -6,7 +6,6 @@ package net.shadow.client.feature.command.impl;
import net.minecraft.client.util.GlfwUtil;
import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.coloring.ArgumentType;
import org.apache.commons.lang3.SystemUtils;
import java.io.IOException;
@ -40,11 +39,6 @@ public class RageQuit extends Command {
return true;
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return null;
}
@Override
public void onExecute(String[] args) {
try {

View file

@ -8,6 +8,7 @@ import net.minecraft.network.packet.c2s.play.BookUpdateC2SPacket;
import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.argument.IntegerArgumentParser;
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;
@ -25,19 +26,8 @@ public class RandomBook extends Command {
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.STRING, ArgumentType.NUMBER);
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"Ascii", "Raw", "Unicode"};
}
if (args.length == 2) {
return new String[]{"(pages)"};
}
return super.getSuggestions(fullCommand, args);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.STRING, "ascii", "raw", "unicode"), new PossibleArgument(ArgumentType.NUMBER, "(pages)"));
}
@Override
@ -48,9 +38,7 @@ public class RandomBook extends Command {
case "raw" -> {
List<String> title = new ArrayList<>();
for (int i = 0; i < size; i++) {
StringBuilder page2 = new StringBuilder();
page2.append(String.valueOf((char) 2048).repeat(266));
title.add(page2.toString());
title.add(String.valueOf((char) 2048).repeat(266));
}
Optional<String> pages = Optional.of("Raw");
@ -75,7 +63,7 @@ public class RandomBook extends Command {
case "unicode" -> {
IntStream chars = new Random().ints(0, 0x10FFFF + 1);
String text = chars.limit(210 * Math.round(size)).mapToObj(i -> String.valueOf((char) i)).collect(Collectors.joining());
String text = chars.limit(210L * Math.round(size)).mapToObj(i -> String.valueOf((char) i)).collect(Collectors.joining());
List<String> title2 = new ArrayList<>();
Optional<String> pages2 = Optional.of("Unicode");

View file

@ -10,6 +10,8 @@ import net.minecraft.text.Text;
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.helper.util.Utils;
@ -22,16 +24,8 @@ public class Rename extends Command {
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return ArgumentType.STRING;
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"(new item name)"};
}
return super.getSuggestions(fullCommand, args);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.STRING, "(new name)"));
}
@Override

View file

@ -7,6 +7,8 @@ package net.shadow.client.feature.command.impl;
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 java.util.Objects;
@ -18,16 +20,8 @@ public class Say extends Command {
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return ArgumentType.STRING;
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"(message)"};
}
return super.getSuggestions(fullCommand, args);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.STRING, "(message)"));
}
@Override

View file

@ -29,6 +29,7 @@ import net.minecraft.util.math.Vec3d;
import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.argument.IntegerArgumentParser;
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;
@ -43,19 +44,9 @@ public class ServerCrash extends Command {
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.STRING, ArgumentType.NUMBER);
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"rider", "book", "malformednbt", "move", "papertest", "chunkoob", "mvcrash", "stackoverflow", "playtime", "playtimeold", "maptool", "fawe", "lag"};
}
if (args.length == 2) {
return new String[]{"(power)"};
}
return super.getSuggestions(fullCommand, args);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.STRING, "rider", "book", "malformednbt", "move", "papertest", "chunkoob", "mvcrash", "stackoverflow", "playtime", "playtimeold", "maptool", "fawe", "lag"),
new PossibleArgument(ArgumentType.NUMBER, "(power)"));
}
@Override
@ -153,7 +144,7 @@ public class ServerCrash extends Command {
}
case "lag" -> {
for(int i = 0; i < 3000000; i++){
for (int i = 0; i < 3000000; i++) {
client.player.networkHandler.sendPacket(new RequestCommandCompletionsC2SPacket(0, "/"));
}
Notification.create(2000, "Server Crash", Notification.Type.SUCCESS, "Sent Quick Lag Crash");

View file

@ -12,6 +12,7 @@ import net.shadow.client.ShadowMain;
import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.argument.StreamlineArgumentParser;
import net.shadow.client.feature.command.coloring.ArgumentType;
import net.shadow.client.feature.command.coloring.PossibleArgument;
import net.shadow.client.feature.command.exception.CommandException;
import net.shadow.client.helper.nbt.NbtGroup;
import net.shadow.client.helper.nbt.NbtList;
@ -26,32 +27,20 @@ public class SpawnData extends Command {
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"position", "velocity", "cursor"};
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
if (index == 0) {
return new PossibleArgument(ArgumentType.STRING, "position", "velocity", "cursor");
}
if (args.length > 1) {
if (args[0].equals("position") || args[0].equals("velocity")) {
return switch (args.length) {
case 2 -> new String[]{"x"};
case 3 -> new String[]{"y"};
case 4 -> new String[]{"z"};
default -> new String[0];
};
}
String s = args[0];
if (s.equalsIgnoreCase("position") || s.equalsIgnoreCase("velocity")) {
return switch (index) {
case 1 -> new PossibleArgument(ArgumentType.NUMBER, "x");
case 2 -> new PossibleArgument(ArgumentType.NUMBER, "y");
case 3 -> new PossibleArgument(ArgumentType.NUMBER, "z");
default -> super.getSuggestionsWithType(index, args);
};
}
return super.getSuggestions(fullCommand, args);
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
if (lookingAtArgIndex == 0) return ArgumentType.STRING;
if (lookingAtArgIndex == 1 || lookingAtArgIndex == 2 || lookingAtArgIndex == 3) {
if (args[0].equalsIgnoreCase("position") || args[0].equals("velocity")) {
return ArgumentType.NUMBER;
}
}
return null;
return super.getSuggestionsWithType(index, args);
}
@Override

View file

@ -16,18 +16,12 @@ import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
import net.shadow.client.ShadowMain;
import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.coloring.ArgumentType;
public class StopServer extends Command {
public StopServer() {
super("StopServer", "Stops the server (real)", "stop");
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return null;
}
@Override
public void onExecute(String[] args) {
if (!ShadowMain.client.player.getAbilities().creativeMode) {

View file

@ -8,7 +8,7 @@ import com.google.gson.Gson;
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.StaticArgumentServer;
import net.shadow.client.feature.command.coloring.PossibleArgument;
import net.shadow.client.feature.command.exception.CommandException;
import net.shadow.client.helper.Texture;
import net.shadow.client.helper.event.EventType;
@ -177,22 +177,19 @@ public class Taco extends Command {
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"fps", "play", "toggle"};
} else if (args.length == 2) {
return switch (args[0].toLowerCase()) {
case "fps" -> new String[]{"(new fps)"};
case "play" -> new String[]{"(path to gif file)"};
default -> new String[0];
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
if (index == 0) {
return new PossibleArgument(ArgumentType.STRING, "fps", "play", "toggle");
}
String a = args[0];
if (index == 1) {
return switch (a.toLowerCase()) {
case "fps" -> new PossibleArgument(ArgumentType.NUMBER, "(new fps)");
case "play" -> new PossibleArgument(ArgumentType.STRING, "(path to gif file)");
default -> super.getSuggestionsWithType(index, args);
};
}
return super.getSuggestions(fullCommand, args);
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.STRING, ArgumentType.STRING);
return super.getSuggestionsWithType(index, args);
}
@Override

View file

@ -5,20 +5,11 @@
package net.shadow.client.feature.command.impl;
import net.minecraft.client.gui.screen.ingame.GenericContainerScreen;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.inventory.SimpleInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.screen.GenericContainerScreenHandler;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.text.Text;
import net.shadow.client.ShadowMain;
import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.coloring.ArgumentType;
import net.shadow.client.helper.nbt.NbtGroup;
import net.shadow.client.helper.nbt.NbtObject;
import net.shadow.client.helper.nbt.NbtProperty;
import net.shadow.client.helper.util.Utils;
public class Test extends Command {
@ -26,11 +17,6 @@ public class Test extends Command {
super("Test", "REAL", "test");
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return null;
}
@Override
public void onExecute(String[] args) {
Utils.TickManager.runOnNextRender(() -> {

View file

@ -14,6 +14,7 @@ import net.shadow.client.ShadowMain;
import net.shadow.client.feature.command.Command;
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.exception.CommandException;
@ -25,16 +26,8 @@ public class TitleLag extends Command {
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.PLAYER);
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return Objects.requireNonNull(ShadowMain.client.world).getPlayers().stream().map(abstractClientPlayerEntity -> abstractClientPlayerEntity.getGameProfile().getName()).toList().toArray(String[]::new);
}
return super.getSuggestions(fullCommand, args);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.PLAYER, Objects.requireNonNull(ShadowMain.client.world).getPlayers().stream().map(abstractClientPlayerEntity -> abstractClientPlayerEntity.getGameProfile().getName()).toList().toArray(String[]::new)));
}
@Override

View file

@ -6,6 +6,7 @@ package net.shadow.client.feature.command.impl;
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.module.Module;
@ -18,16 +19,8 @@ public class Toggle extends Command {
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.STRING);
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return ModuleRegistry.getModules().stream().map(Module::getName).toList().toArray(String[]::new);
}
return super.getSuggestions(fullCommand, args);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.STRING, ModuleRegistry.getModules().stream().map(Module::getName).toList().toArray(String[]::new)));
}
@Override

View file

@ -9,6 +9,7 @@ import net.shadow.client.ShadowMain;
import net.shadow.client.feature.command.Command;
import net.shadow.client.feature.command.argument.DoubleArgumentParser;
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;
@ -18,14 +19,8 @@ public class VClip extends Command {
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.NUMBER);
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) return new String[]{"(height)"};
return super.getSuggestions(fullCommand, args);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.NUMBER, "(amount)"));
}
@Override

View file

@ -19,6 +19,7 @@ import net.minecraft.text.Text;
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 java.util.Objects;
@ -32,16 +33,8 @@ public class ViewNbt extends Command {
}
@Override
public ArgumentType getArgumentType(String[] args, String lookingAtArg, int lookingAtArgIndex) {
return StaticArgumentServer.serveFromStatic(lookingAtArgIndex, ArgumentType.STRING);
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"(flags)"};
}
return super.getSuggestions(fullCommand, args);
public PossibleArgument getSuggestionsWithType(int index, String[] args) {
return StaticArgumentServer.serveFromStatic(index, new PossibleArgument(ArgumentType.STRING, "(flags)"));
}
@Override

View file

@ -134,6 +134,7 @@ public class ClickGUI extends Screen implements FastTickable {
}
void renderIntern(MatrixStack matrices, int mouseX, int mouseY, float delta) {
int mouseY1 = mouseY;
double wid = width / 2d;
double hei = height / 2d;
FontAdapter bigAssFr = FontRenderers.getCustomSize(70);
@ -154,25 +155,22 @@ public class ClickGUI extends Screen implements FastTickable {
matrices.translate((1 - intp) * width / 2, (1 - intp) * height / 2, 0);
matrices.scale((float) intp, (float) intp, 1);
matrices.translate(0, -trackedScroll, 0);
mouseY += trackedScroll;
mouseY1 += trackedScroll;
List<Element> rev = new ArrayList<>(elements);
Collections.reverse(rev);
for (Element element : rev) {
element.render(matrices, mouseX, mouseY, trackedScroll);
element.render(matrices, mouseX, mouseY1, trackedScroll);
}
matrices.pop();
super.render(matrices, mouseX, mouseY, delta);
super.render(matrices, mouseX, mouseY1, delta);
if (desc != null) {
// double width = FontRenderers.getNormal().getStringWidth(desc);
double width = 0;
List<String> text = Arrays.stream(desc.split("\n")).map(s -> s = s.trim()).toList();
List<String> text = Arrays.stream(desc.split("\n")).map(String::trim).toList();
for (String s : text) {
width = Math.max(width, FontRenderers.getRenderer().getStringWidth(s));
}
// if (descX + width > ShadowMain.client.getWindow().getScaledWidth()) {
// descX -= (descX + width - ShadowMain.client.getWindow().getScaledWidth()) + 4;
// }
Vec2f root = Renderer.R2D.renderTooltip(matrices, descX, descY, width + 4, FontRenderers.getRenderer().getMarginHeight() + 4, tooltipColor);
float yOffset = 2;
for (String s : text) {
@ -186,35 +184,38 @@ public class ClickGUI extends Screen implements FastTickable {
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
mouseY += trackedScroll;
double mouseY1 = mouseY;
mouseY1 += trackedScroll;
for (Element element : new ArrayList<>(elements)) {
if (element.clicked(mouseX, mouseY, button)) {
if (element.clicked(mouseX, mouseY1, button)) {
elements.remove(element);
elements.add(0, element); // put to front when clicked
return true;
}
}
return super.mouseClicked(mouseX, mouseY, button);
return super.mouseClicked(mouseX, mouseY1, button);
}
@Override
public boolean mouseReleased(double mouseX, double mouseY, int button) {
mouseY += trackedScroll;
double mouseY1 = mouseY;
mouseY1 += trackedScroll;
for (Element element : elements) {
element.released();
}
return super.mouseReleased(mouseX, mouseY, button);
return super.mouseReleased(mouseX, mouseY1, button);
}
@Override
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) {
mouseY += trackedScroll;
double mouseY1 = mouseY;
mouseY1 += trackedScroll;
for (Element element : elements) {
if (element.dragged(mouseX, mouseY, deltaX, deltaY, button)) {
if (element.dragged(mouseX, mouseY1, deltaX, deltaY, button)) {
return true;
}
}
return super.mouseDragged(mouseX, mouseY, button, deltaX, deltaY);
return super.mouseDragged(mouseX, mouseY1, button, deltaX, deltaY);
}

View file

@ -137,7 +137,9 @@ public class CategoryDisplay extends Element {
@Override
public void render(MatrixStack matrices, double mouseX, double mouseY, double scrollBeingUsed) {
scroll(mouseX, mouseY, 0);
double mouseX1 = mouseX;
double mouseY1 = mouseY;
scroll(mouseX1, mouseY1, 0);
Theme theme = ThemeManager.getMainTheme();
double openAnim = this.openAnim < 0.5
? (1 - sqrt(1 - pow(2 * this.openAnim, 2))) / 2
@ -181,16 +183,16 @@ public class CategoryDisplay extends Element {
double y = headerHeight();
matrices.push();
matrices.translate(0, scroller.getScroll(), 0);
if (!(mouseX >= x && mouseX < x + width && mouseY >= this.y + headerHeight() && mouseY < this.y + this.height - (modHeight != 0 ? r : 0))) {
mouseX = -1000;
mouseY = -1000;
if (!(mouseX1 >= x && mouseX1 < x + width && mouseY1 >= this.y + headerHeight() && mouseY1 < this.y + this.height - (modHeight != 0 ? r : 0))) {
mouseX1 = -1000;
mouseY1 = -1000;
}
for (ModuleDisplay moduleDisplay : getModules()) {
moduleDisplay.setX(this.x);
moduleDisplay.setY(this.y + y);
if (moduleDisplay.getY() + scroller.getScroll() > this.y + height) continue;
moduleDisplay.render(matrices, mouseX, mouseY - scroller.getScroll(), scrollBeingUsed);
moduleDisplay.render(matrices, mouseX1, mouseY1 - scroller.getScroll(), scrollBeingUsed);
y += moduleDisplay.getHeight();
}
matrices.pop();

View file

@ -49,15 +49,16 @@ public class KeybindEditor extends ConfigBase<DoubleSetting> {
// long lastUpdate = System.currentTimeMillis();
@Override
public boolean keyPressed(int keycode, int modifiers) {
int keycode1 = keycode;
if (selecting) {
// lastUpdate = System.currentTimeMillis();
cancelNextCharTyped = true;
if (keycode == GLFW.GLFW_KEY_ESCAPE) {
if (keycode1 == GLFW.GLFW_KEY_ESCAPE) {
selecting = false;
return true;
}
if (keycode == GLFW.GLFW_KEY_BACKSPACE) keycode = -1;
configValue.setValue(keycode + 0d);
if (keycode1 == GLFW.GLFW_KEY_BACKSPACE) keycode1 = -1;
configValue.setValue(keycode1 + 0d);
selecting = false;
return true;
}

View file

@ -28,11 +28,11 @@ import java.util.ArrayList;
import java.util.List;
public class AddonManagerScreen extends ClientScreen implements FastTickable {
Timer discoverTimer = new Timer();
Scroller scroller = new Scroller(0);
double WIDGET_WIDTH = 600;
double WIDGET_HEIGHT = 300;
List<AddonViewer> viewerList = new ArrayList<>();
final Timer discoverTimer = new Timer();
final Scroller scroller = new Scroller(0);
final double WIDGET_WIDTH = 600;
final double WIDGET_HEIGHT = 300;
final List<AddonViewer> viewerList = new ArrayList<>();
@Override
public void onFastTick() {
@ -107,10 +107,11 @@ public class AddonManagerScreen extends ClientScreen implements FastTickable {
class AddonViewer implements FastTickable {
static final double iconDimensions = 64;
static final double padding = 5;
Addon addon;
double width;
final Addon addon;
final double width;
final RoundButton reload;
double lastX, lastY;
RoundButton disable, reload;
RoundButton disable;
public AddonViewer(Addon addon, double width) {
this.addon = addon;

View file

@ -48,13 +48,14 @@ public class BindScreen extends ClientScreen {
@Override
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
int keyCodeCpy = keyCode;
if (closeAt != -1) {
return false;
}
if (keyCode == GLFW.GLFW_KEY_ESCAPE) {
keyCode = -1;
if (keyCodeCpy == GLFW.GLFW_KEY_ESCAPE) {
keyCodeCpy = -1;
}
a.keybind.setValue((double) keyCode);
a.keybind.setValue((double) keyCodeCpy);
closeAt = System.currentTimeMillis() + 500;
return true;
}

View file

@ -129,7 +129,7 @@ public class ConsoleScreen extends ClientScreen implements FastTickable {
if (args.length > 0) {
Command c = CommandRegistry.getByAlias(cmd);
if (c != null) {
a = List.of(c.getSuggestions(command, args));
a = List.of(c.getSuggestionsWithType(args.length - 1, args).getSuggestions());
} else {
return new ArrayList<>(); // we have no command to ask -> we have no suggestions
}
@ -184,6 +184,7 @@ public class ConsoleScreen extends ClientScreen implements FastTickable {
smoothScroll = Transitions.transition(smoothScroll, scroll, 7, 0);
}
@SuppressWarnings("AssignmentToForLoopParameter")
@Override
public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) {

View file

@ -35,7 +35,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class QuickSelectScreen extends ClientScreen implements FastTickable {
public class SpotLightScreen extends ClientScreen implements FastTickable {
CommandTextField command;
List<SuggestionsEntry> entries = new ArrayList<>();
double anim = 0;
@ -95,6 +95,11 @@ public class QuickSelectScreen extends ClientScreen implements FastTickable {
this.entries = entries;
}
@Override
public boolean shouldPause() {
return false;
}
@Override
public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) {
double anim = ease(this.anim);
@ -191,14 +196,15 @@ public class QuickSelectScreen extends ClientScreen implements FastTickable {
}
int makeSureInBounds(int index, int size) {
int indexCpy = index;
if (size == 0) {
return 0;
}
index %= size;
if (index < 0) {
index = size + index;
indexCpy %= size;
if (indexCpy < 0) {
indexCpy = size + indexCpy;
}
return index;
return indexCpy;
}
@Override
@ -633,9 +639,7 @@ public class QuickSelectScreen extends ClientScreen implements FastTickable {
private void runAction() {
cursorChanged();
if (changeListener != null) {
changeListener.run();
}
changeListener.run();
}
private double textWidth() {
@ -654,19 +658,14 @@ public class QuickSelectScreen extends ClientScreen implements FastTickable {
}
textStart = MathHelper.clamp(textStart, 0, Math.max(textWidth() - maxTextWidth(), 0));
onCursorChanged();
}
protected void onCursorChanged() {
}
protected double getTextWidth(int pos) {
if (pos < 0) {
return 0;
}
pos = Math.min(text.length(), pos);
return fa.getStringWidth(text.substring(0, pos)) + 1;
int pos1 = Math.min(text.length(), pos);
return fa.getStringWidth(text.substring(0, pos1)) + 1;
}
protected double getCursorTextWidth(int offset) {
@ -696,16 +695,9 @@ public class QuickSelectScreen extends ClientScreen implements FastTickable {
}
public void setFocused(boolean focused) {
boolean wasJustFocused = focused && !this.focused;
this.focused = focused;
resetSelection();
if (wasJustFocused) {
onCursorChanged();
}
}
public void setCursorMax() {
@ -775,7 +767,6 @@ public class QuickSelectScreen extends ClientScreen implements FastTickable {
public void render(MatrixStack stack) {
double yCenter = y + height() / 2d;
double xCenter = x + wid / 2d;
double contentSize = height() - padUpDown * 2d;
if (selected) {
Renderer.R2D.renderRoundedQuad(stack, new Color(40, 40, 40), x, y, x + wid, y + height(), 5, 20);

View file

@ -18,17 +18,17 @@ import java.util.List;
import java.util.Objects;
public class StatsScreen extends ClientScreen implements FastTickable {
static List<Float> packetIn = Util.make(() -> {
static final List<Float> packetIn = Util.make(() -> {
List<Float> f = new ArrayList<>();
for (int i = 0; i < 100; i++) f.add(0f);
return f;
});
static List<Float> packetOut = Util.make(() -> {
static final List<Float> packetOut = Util.make(() -> {
List<Float> f = new ArrayList<>();
for (int i = 0; i < 100; i++) f.add(0f);
return f;
});
Timer packetUpdater = new Timer();
final Timer packetUpdater = new Timer();
@Override
public void onFastTick() {

View file

@ -6,29 +6,14 @@ package net.shadow.client.feature.gui.screen;
import net.minecraft.client.util.math.MatrixStack;
import net.shadow.client.feature.gui.FastTickable;
import net.shadow.client.feature.gui.widget.DataVisualizerWidget;
import net.shadow.client.helper.Timer;
import net.shadow.client.helper.render.Renderer;
import java.awt.Color;
public class TestScreen extends ClientScreen implements FastTickable {
DataVisualizerWidget v;
Timer u = new Timer();
@Override
protected void init() {
super.init();
// v = new DataVisualizerWidget(Color.WHITE, true, 50, 1, height - 10, width - 10, 5, 5);
// addDrawableChild(v);
}
@Override
public void onFastTick() {
// if (u.hasExpired(500)) {
// u.reset();
// v.addDataPoint(Math.random() * 10 - 5);
// }
}
@Override

View file

@ -22,11 +22,15 @@ import java.util.List;
import java.util.Objects;
public class DataVisualizerWidget implements Element, Drawable, Selectable, FastTickable, DoesMSAA {
List<Double> data = new ArrayList<>();
int maxSize;
double width, height, x, y, minDataHeight;
Color c;
boolean showScale;
final List<Double> data = new ArrayList<>();
final int maxSize;
final double width;
final double height;
final double x;
final double y;
final double minDataHeight;
final Color c;
final boolean showScale;
public DataVisualizerWidget(Color dataColor, boolean showScale, int maxSize, double minDataScale, double height, double width, double x, double y, double... existingData) {
for (double existingDatum : existingData) {

View file

@ -446,19 +446,14 @@ public class RoundTextFieldWidget implements Element, Drawable, Selectable, Does
}
textStart = MathHelper.clamp(textStart, 0, Math.max(textWidth() - maxTextWidth(), 0));
onCursorChanged();
}
protected void onCursorChanged() {
}
protected double getTextWidth(int pos) {
if (pos < 0) {
return 0;
}
pos = Math.min(text.length(), pos);
return FontRenderers.getRenderer().getStringWidth(text.substring(0, pos));
int pos1 = Math.min(text.length(), pos);
return FontRenderers.getRenderer().getStringWidth(text.substring(0, pos1));
}
protected double getCursorTextWidth(int offset) {
@ -489,15 +484,9 @@ public class RoundTextFieldWidget implements Element, Drawable, Selectable, Does
public void setFocused(boolean focused) {
boolean wasJustFocused = focused && !this.focused;
this.focused = focused;
resetSelection();
if (wasJustFocused) {
onCursorChanged();
}
}
public void setCursorMax() {

View file

@ -90,6 +90,7 @@ import net.shadow.client.feature.module.impl.movement.Step;
import net.shadow.client.feature.module.impl.movement.Swing;
import net.shadow.client.feature.module.impl.render.BlockHighlighting;
import net.shadow.client.feature.module.impl.render.CaveMapper;
import net.shadow.client.feature.module.impl.render.ChestHighlighter;
import net.shadow.client.feature.module.impl.render.ClickGUI;
import net.shadow.client.feature.module.impl.render.ESP;
import net.shadow.client.feature.module.impl.render.FakeHacker;
@ -301,9 +302,10 @@ public class ModuleRegistry {
vanillaModules.add(new InteractCrash());
vanillaModules.add(new FlightCrash());
vanillaModules.add(new ClickTP());
vanillaModules.add(new DauntedAutoClaim()); //it was hurting my finger
vanillaModules.add(new ChestHighlighter());
vanillaModules.add(new DauntedAutoClaim());
rebuildSharedModuleList();
}
public static List<Module> getModules() {

View file

@ -128,7 +128,8 @@ public class Killaura extends Module {
p = new Vec3d(p.x, 0, p.z).normalize().multiply(1.5);
updatePos = e.getPos().add(p.multiply(-1));
}
case TP -> updatePos = new Vec3d(e.getX() + (Math.random() * 4 - 2), e.getY(), e.getZ() + (Math.random() * 4 - 2));
case TP ->
updatePos = new Vec3d(e.getX() + (Math.random() * 4 - 2), e.getY(), e.getZ() + (Math.random() * 4 - 2));
case Circle -> {
circleProg += 20;
circleProg %= 360;
@ -336,4 +337,3 @@ public class Killaura extends Module {
TP, Behind, Circle
}
}

View file

@ -21,7 +21,7 @@ import java.util.List;
public class ReverseKnockback extends Module {
List<PlayerMoveC2SPacket> dontRepeat = new ArrayList<>();
final List<PlayerMoveC2SPacket> dontRepeat = new ArrayList<>();
public ReverseKnockback() {
super("ReverseKnockback", "Reverse the knockback you deal", ModuleType.MISC);

View file

@ -52,7 +52,6 @@ public class InteractCrash extends Module {
case Entity -> {
Entity target;
if (!(client.crosshairTarget instanceof EntityHitResult)) {
target = null;
return;
}
target = ((EntityHitResult) client.crosshairTarget).getEntity();

View file

@ -81,7 +81,7 @@ public class LoominaCrash extends Module {
void simplePacketMove(int slotId) {
//System.out.println(client.player.currentScreenHandler.getSlot(slotId).getStack().getName().getString());
ScreenHandler screenHandler = client.player.currentScreenHandler;
Int2ObjectOpenHashMap<ItemStack> int2ObjectMap = new Int2ObjectOpenHashMap<ItemStack>();
Int2ObjectOpenHashMap<ItemStack> int2ObjectMap = new Int2ObjectOpenHashMap<>();
int2ObjectMap.put(slotId, client.player.currentScreenHandler.getSlot(slotId).getStack().copy());
client.player.networkHandler.sendPacket(new ClickSlotC2SPacket(client.player.currentScreenHandler.syncId, screenHandler.getRevision(), slotId, 0, SlotActionType.PICKUP, client.player.currentScreenHandler.getSlot(slotId).getStack().copy(), int2ObjectMap));
}

View file

@ -47,7 +47,6 @@ public class BeaconSpoofer extends Module {
case "SATURATION" -> StatusEffects.SATURATION;
case "SLOWNESS" -> StatusEffects.SLOWNESS;
case "SLOW FALLING" -> StatusEffects.SLOW_FALLING;
case "SPEED" -> StatusEffects.SPEED;
case "STRENGTH" -> StatusEffects.STRENGTH;
case "UNLUCK" -> StatusEffects.UNLUCK;
case "WATER BREATHING" -> StatusEffects.WATER_BREATHING;

View file

@ -69,8 +69,8 @@ public class AntiCrash extends Module {
public AntiCrash() {
super("AntiCrash", "Prevents you from being fucked", ModuleType.MISC);
nameMax.showIf(() -> capNames.getValue());
particleMax.showIf(() -> capParticles.getValue());
nameMax.showIf(capNames::getValue);
particleMax.showIf(capParticles::getValue);
Events.registerEventHandler(EventType.PACKET_RECEIVE, this::handlePacketEvent);
}

View file

@ -22,7 +22,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
public class Test extends Module {
static final Block searchTerm = Blocks.NETHER_PORTAL;
CopyOnWriteArrayList<BlockPos> discovered = new CopyOnWriteArrayList<>();
final CopyOnWriteArrayList<BlockPos> discovered = new CopyOnWriteArrayList<>();
public Test() {
super("Test", "Testing stuff with the client, can be ignored", ModuleType.MISC);
@ -44,11 +44,6 @@ public class Test extends Module {
}
}
/*@EventListener(type=EventType.PACKET_SEND)
void onPacketSend(PacketEvent pe){
if(this.isEnabled()) System.out.println("-> " + pe.getPacket().toString());
}*/
@Override
public void enable() {
@ -69,9 +64,6 @@ public class Test extends Module {
for (BlockPos bruh : discovered) {
Renderer.R3D.renderEdged(matrices, Vec3d.of(bruh), new Vec3d(1, 1, 1), Renderer.Util.modify(Utils.getCurrentRGB(), -1, -1, -1, 100).darker(), Renderer.Util.modify(Utils.getCurrentRGB(), -1, -1, -1, 255));
}
// for (BlockPos bruh : bruhs.pop()) {
// Renderer.R3D.renderEdged(matrices, Vec3d.of(bruh), new Vec3d(1,1,1), Renderer.Util.modify(Utils.getCurrentRGB(), -1, -1, -1, 100).darker(), Renderer.Util.modify(Utils.getCurrentRGB(), -1, -1, -1, 255));
// }
}
@Override

View file

@ -81,9 +81,7 @@ public class ClickTP extends Module {
return;
switch (mode.getValue()) {
case Normal -> {
client.player.updatePosition(dest.getX(), dest.getY(), dest.getZ());
}
case Normal -> client.player.updatePosition(dest.getX(), dest.getY(), dest.getZ());
case Split -> {
client.player.jump();
@ -101,53 +99,49 @@ public class ClickTP extends Module {
player.updatePosition(dest.getX(), dest.getY(), dest.getZ());
}
case Tween -> {
new Thread(() -> {
int rdd = lengthTo(ray.getBlockPos());
BlockPos destt = new BlockPos(blockHitResult.getBlockPos());
client.player.jump();
ClientPlayerEntity player = client.player;
Vec3d playerpos = player.getPos();
double xn = destt.getX() - playerpos.x;
double yn = destt.getY() - playerpos.y;
double zn = destt.getZ() - playerpos.z;
double x = xn / rdd;
double y = yn / rdd;
double z = zn / rdd;
for (int i = 0; i < rdd; i++) {
client.player.updatePosition(player.getX() + x, player.getY() + y, player.getZ() + z);
try {
Thread.sleep(7);
} catch (Exception ignored) {
}
client.player.setVelocity(0, 0, 0);
case Tween -> new Thread(() -> {
int rdd = lengthTo(ray.getBlockPos());
BlockPos destt = new BlockPos(blockHitResult.getBlockPos());
client.player.jump();
ClientPlayerEntity player = client.player;
Vec3d playerpos = player.getPos();
double xn = destt.getX() - playerpos.x;
double yn = destt.getY() - playerpos.y;
double zn = destt.getZ() - playerpos.z;
double x = xn / rdd;
double y = yn / rdd;
double z = zn / rdd;
for (int i = 0; i < rdd; i++) {
client.player.updatePosition(player.getX() + x, player.getY() + y, player.getZ() + z);
try {
Thread.sleep(7);
} catch (Exception ignored) {
}
}).start();
}
client.player.setVelocity(0, 0, 0);
}
}).start();
case Experimental -> {
new Thread(() -> {
int rdd = lengthTo(ray.getBlockPos());
BlockPos destt = new BlockPos(blockHitResult.getBlockPos());
client.player.jump();
ClientPlayerEntity player = client.player;
Vec3d playerpos = player.getPos();
double xn = destt.getX() - playerpos.x;
double yn = destt.getY() - playerpos.y;
double zn = destt.getZ() - playerpos.z;
double x = xn / rdd;
double y = yn / rdd;
double z = zn / rdd;
for (int i = 0; i < rdd; i++) {
client.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(player.getX() + x, player.getY() + y, player.getZ() + z, true));
try {
Thread.sleep(10);
} catch (Exception ignored) {
}
client.player.setVelocity(0, 0, 0);
case Experimental -> new Thread(() -> {
int rdd = lengthTo(ray.getBlockPos());
BlockPos destt = new BlockPos(blockHitResult.getBlockPos());
client.player.jump();
ClientPlayerEntity player = client.player;
Vec3d playerpos = player.getPos();
double xn = destt.getX() - playerpos.x;
double yn = destt.getY() - playerpos.y;
double zn = destt.getZ() - playerpos.z;
double x = xn / rdd;
double y = yn / rdd;
double z = zn / rdd;
for (int i = 0; i < rdd; i++) {
client.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(player.getX() + x, player.getY() + y, player.getZ() + z, true));
try {
Thread.sleep(10);
} catch (Exception ignored) {
}
}).start();
}
client.player.setVelocity(0, 0, 0);
}
}).start();
}
}
}

View file

@ -33,8 +33,10 @@ public class Jesus extends Module {
if (ShadowMain.client.player.isWet()) {
switch (mode.getValue()) {
case Jump -> Objects.requireNonNull(client.player).jump();
case Velocity -> Objects.requireNonNull(client.player).setVelocity(client.player.getVelocity().x, velStrength.getValue(), client.player.getVelocity().z);
case Legit -> Objects.requireNonNull(client.player).addVelocity(0, 0.03999999910593033, 0); // LivingEntity:1978, vanilla velocity
case Velocity ->
Objects.requireNonNull(client.player).setVelocity(client.player.getVelocity().x, velStrength.getValue(), client.player.getVelocity().z);
case Legit ->
Objects.requireNonNull(client.player).addVelocity(0, 0.03999999910593033, 0); // LivingEntity:1978, vanilla velocity
}
}
}
@ -68,4 +70,3 @@ public class Jesus extends Module {
Solid, Jump, Velocity, Legit
}
}

View file

@ -38,7 +38,8 @@ public class LongJump extends Module {
double scaled = xz.getValue() / 5;
return switch (focus.getValue()) {
case Direction -> new Vec3d(-MathHelper.sin(f) * scaled, 0.0D, MathHelper.cos(f) * scaled);
case Velocity -> new Vec3d(ShadowMain.client.player.getVelocity().normalize().x * scaled, 0.0D, ShadowMain.client.player.getVelocity().normalize().z * scaled);
case Velocity ->
new Vec3d(ShadowMain.client.player.getVelocity().normalize().x * scaled, 0.0D, ShadowMain.client.player.getVelocity().normalize().z * scaled);
};
}
@ -101,4 +102,3 @@ public class LongJump extends Module {
Velocity, Direction
}
}

View file

@ -15,7 +15,7 @@ public class Speed extends Module {
static float fovEffectScal = 0;
static int ticksonground = 0;
static int ticksjustsneaking = 0;
final EnumSetting<Mode> mode = this.config.create(new EnumSetting.Builder<Mode>(Mode.OnGround).name("Mode").description("How to apply the speed").get());
final EnumSetting<Mode> mode = this.config.create(new EnumSetting.Builder<>(Mode.OnGround).name("Mode").description("How to apply the speed").get());
final DoubleSetting speed = this.config.create(new DoubleSetting.Builder(20).min(5).max(50).name("Speed").description("How fast to go").get());
public Speed() {

View file

@ -0,0 +1,79 @@
/*
* Copyright (c) Shadow client, 0x150, Saturn5VFive 2022. All rights reserved.
*/
package net.shadow.client.feature.module.impl.render;
import net.minecraft.block.ChestBlock;
import net.minecraft.block.entity.ChestBlockEntity;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.shadow.client.feature.module.Module;
import net.shadow.client.feature.module.ModuleType;
import net.shadow.client.helper.event.EventListener;
import net.shadow.client.helper.event.EventType;
import net.shadow.client.helper.event.Events;
import net.shadow.client.helper.event.events.BlockEntityRenderEvent;
import net.shadow.client.helper.render.Renderer;
import java.awt.Color;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
public class ChestHighlighter extends Module {
List<BlockPos> positions = new CopyOnWriteArrayList<>();
public ChestHighlighter() {
super("ChestHighlighter", "No description", ModuleType.RENDER);
Events.registerEventHandlerClass(this);
}
void addIfNotExisting(BlockPos p) {
if (positions.stream().noneMatch(blockPos -> blockPos.equals(p))) positions.add(p);
}
void remove(BlockPos p) {
positions.removeIf(blockPos -> blockPos.equals(p));
}
@EventListener(type = EventType.BLOCK_ENTITY_RENDER)
void r(BlockEntityRenderEvent be) {
if (!this.isEnabled()) return;
if (be.getBlockEntity() instanceof ChestBlockEntity) {
addIfNotExisting(be.getBlockEntity().getPos());
}
}
@Override
public void tick() {
positions.removeIf(blockPos -> !(client.world.getBlockState(blockPos).getBlock() instanceof ChestBlock));
}
@Override
public void enable() {
}
@Override
public void disable() {
}
@Override
public String getContext() {
return null;
}
@Override
public void onWorldRender(MatrixStack matrices) {
for (BlockPos position : positions) {
Renderer.R3D.renderFadingBlock(Color.WHITE, Color.RED, Vec3d.of(position), new Vec3d(1, 1, 1), 500);
}
}
@Override
public void onHudRender() {
}
}

View file

@ -129,9 +129,11 @@ public class ESP extends Module {
Color c = Utils.getCurrentRGB();
Vec3d eSource = Utils.getInterpolatedEntityPosition(entity);
switch (outlineMode.getValue()) {
case Filled -> Renderer.R3D.renderFilled(eSource.subtract(new Vec3d(entity.getWidth(), 0, entity.getWidth()).multiply(0.5)), new Vec3d(entity.getWidth(), entity.getHeight(), entity.getWidth()), Renderer.Util.modify(c, -1, -1, -1, 130), matrices);
case Filled ->
Renderer.R3D.renderFilled(eSource.subtract(new Vec3d(entity.getWidth(), 0, entity.getWidth()).multiply(0.5)), new Vec3d(entity.getWidth(), entity.getHeight(), entity.getWidth()), Renderer.Util.modify(c, -1, -1, -1, 130), matrices);
case Rect -> renderOutline(entity, c, matrices);
case Outline -> Renderer.R3D.renderOutline(eSource.subtract(new Vec3d(entity.getWidth(), 0, entity.getWidth()).multiply(0.5)), new Vec3d(entity.getWidth(), entity.getHeight(), entity.getWidth()), Renderer.Util.modify(c, -1, -1, -1, 130), matrices);
case Outline ->
Renderer.R3D.renderOutline(eSource.subtract(new Vec3d(entity.getWidth(), 0, entity.getWidth()).multiply(0.5)), new Vec3d(entity.getWidth(), entity.getHeight(), entity.getWidth()), Renderer.Util.modify(c, -1, -1, -1, 130), matrices);
}
}
}
@ -190,4 +192,3 @@ public class ESP extends Module {
Filled, Rect, Outline, Model
}
}

View file

@ -53,7 +53,7 @@ public class Hud extends Module {
// final List<ModuleEntry> moduleList = new ArrayList<>();
final Timer tpsUpdateTimer = new Timer();
final List<Double> last5SecondTpsAverage = new ArrayList<>();
Map<Module, ModuleEntry> entryList = new ConcurrentHashMap<>();
final Map<Module, ModuleEntry> entryList = new ConcurrentHashMap<>();
long lastTimePacketReceived;
double rNoConnectionPosY = -10d;
Notification serverNotResponding = null;
@ -117,12 +117,6 @@ public class Hud extends Module {
}
@Override
public void postInit() {
super.postInit();
}
@Override
public void onHudRender() {
if (ShadowMain.client.getNetworkHandler() == null) {

View file

@ -57,11 +57,11 @@ public class ShowTntPrime extends Module {
}
static void semicircle(MatrixStack stack, Color c, double x, double y, double rad, double width, double segments, double toRad) {
toRad = MathHelper.clamp(toRad, 0, 360);
double toRad1 = MathHelper.clamp(toRad, 0, 360);
stack.push();
stack.translate(x, y, 0);
// stack.multiply(new Quaternion(0, 0, (System.currentTimeMillis() % 2000) / 2000f * 360f, true));
segments = MathHelper.clamp(segments, 2, 90);
double segments1 = MathHelper.clamp(segments, 2, 90);
RenderSystem.setShaderColor(1, 1, 1, 1);
int color = c.getRGB();
@ -76,7 +76,7 @@ public class ShowTntPrime extends Module {
RenderSystem.disableTexture();
RenderSystem.setShader(GameRenderer::getPositionColorShader);
bufferBuilder.begin(VertexFormat.DrawMode.TRIANGLE_STRIP, VertexFormats.POSITION_COLOR);
for (double r = 0; r < toRad; r += Math.min(360 / segments, (toRad - r))) {
for (double r = 0; r < toRad1; r += Math.min(360 / segments1, (toRad1 - r))) {
double rad1 = Math.toRadians(r);
double sin = Math.sin(rad1);
double cos = Math.cos(rad1);

View file

@ -5,7 +5,7 @@
package net.shadow.client.feature.module.impl.render;
import net.minecraft.client.util.math.MatrixStack;
import net.shadow.client.feature.gui.screen.QuickSelectScreen;
import net.shadow.client.feature.gui.screen.SpotLightScreen;
import net.shadow.client.feature.module.Module;
import net.shadow.client.feature.module.ModuleType;
import net.shadow.client.feature.module.NoNotificationDefault;
@ -18,7 +18,7 @@ public class Spotlight extends Module {
@Override
public void tick() {
client.setScreen(new QuickSelectScreen());
client.setScreen(new SpotLightScreen());
setEnabled(false);
}

View file

@ -56,7 +56,7 @@ public class TabGui extends Module {
TabPane modules = new TabPane();
for (Module module : ModuleRegistry.getModules()) {
if (module.getModuleType() != value) continue;
GuiEntry ge1 = new GuiEntry(module.getName(), module::isEnabled, module::toggle, () -> tabStack.pop(), FontRenderers.getRenderer().getStringWidth(module.getName()), FontRenderers.getRenderer().getMarginHeight());
GuiEntry ge1 = new GuiEntry(module.getName(), module::isEnabled, module::toggle, tabStack::pop, FontRenderers.getRenderer().getStringWidth(module.getName()), FontRenderers.getRenderer().getMarginHeight());
modules.entries.add(ge1);
}
if (modules.entries.isEmpty()) return;
@ -70,11 +70,12 @@ public class TabGui extends Module {
}
int makeSureInBounds(int index, int size) {
index %= size;
if (index < 0) {
index = size + index;
int index1 = index;
index1 %= size;
if (index1 < 0) {
index1 = size + index1;
}
return index;
return index1;
}
void handleMouse(KeyboardEvent me) {

View file

@ -10,7 +10,7 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
public class AddonClassLoader extends URLClassLoader {
Map<String, URL> resourceMap = new ConcurrentHashMap<>();
final Map<String, URL> resourceMap = new ConcurrentHashMap<>();
public AddonClassLoader(ClassLoader parent) {
super(new URL[0], parent);

View file

@ -43,7 +43,7 @@ public class NbtFormatter implements NbtElementVisitor {
map.put("{}.entities.[].{}", Lists.newArrayList("blockPos", "pos"));
});
private static final Set<String> IGNORED_PATHS = Sets.newHashSet("{}.size.[]", "{}.data.[].{}", "{}.palette.[].{}", "{}.entities.[].{}");
private static final Pattern SIMPLE_NAME = Pattern.compile("[A-Za-z0-9._+-]+");
private static final Pattern SIMPLE_NAME = Pattern.compile("[A-Za-z\\d._+-]+");
private static final String KEY_VALUE_SEPARATOR = String.valueOf(':');
private static final String ENTRY_SEPARATOR = String.valueOf(',');
private static final int NAME_COLOR = 0x55FFFF;
@ -295,4 +295,4 @@ public class NbtFormatter implements NbtElementVisitor {
}
}
}
}

View file

@ -66,7 +66,7 @@ public class Events {
}
}
@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked", "rawtypes"})
public static boolean fireEvent(EventType event, Event argument) {
for (ListenerEntry entry : entries) {
if (entry.type == event) {

View file

@ -39,13 +39,14 @@ public class FontRenderers {
}
public static BruhAdapter getCustomSize(int size) {
size *= 2;
int size1 = size;
size1 *= 2;
for (BruhAdapter fontRenderer : fontRenderers) {
if (fontRenderer.getSize() == size) {
if (fontRenderer.getSize() == size1) {
return fontRenderer;
}
}
int fsize = size;
int fsize = size1;
try {
BruhAdapter bruhAdapter = (new BruhAdapter(new FontRenderer(Font.createFont(Font.TRUETYPE_FONT, Objects.requireNonNull(FontRenderers.class.getClassLoader().getResourceAsStream("Font.ttf"))).deriveFont(Font.PLAIN, fsize), fsize)));
fontRenderers.add(bruhAdapter);

View file

@ -21,25 +21,27 @@ public class BruhAdapter implements FontAdapter {
@Override
public void drawString(MatrixStack matrices, String text, float x, float y, int color) {
if ((color & 0xfc000000) == 0) {
color |= 0xff000000;
int color1 = color;
if ((color1 & 0xfc000000) == 0) {
color1 |= 0xff000000;
}
float alpha = (float) (color >> 24 & 255) / 255.0F;
float r = (float) (color >> 16 & 255) / 255.0F;
float g = (float) (color >> 8 & 255) / 255.0F;
float b = (float) (color & 255) / 255.0F;
float alpha = (float) (color1 >> 24 & 255) / 255.0F;
float r = (float) (color1 >> 16 & 255) / 255.0F;
float g = (float) (color1 >> 8 & 255) / 255.0F;
float b = (float) (color1 & 255) / 255.0F;
renderer.drawString(matrices, text, x, y, r, g, b, alpha);
}
@Override
public void drawString(MatrixStack matrices, String text, double x, double y, int color) {
if ((color & 0xfc000000) == 0) {
color |= 0xff000000;
int color1 = color;
if ((color1 & 0xfc000000) == 0) {
color1 |= 0xff000000;
}
float alpha = (float) (color >> 24 & 255) / 255.0F;
float r = (float) (color >> 16 & 255) / 255.0F;
float g = (float) (color >> 8 & 255) / 255.0F;
float b = (float) (color & 255) / 255.0F;
float alpha = (float) (color1 >> 24 & 255) / 255.0F;
float r = (float) (color1 >> 16 & 255) / 255.0F;
float g = (float) (color1 >> 8 & 255) / 255.0F;
float b = (float) (color1 & 255) / 255.0F;
renderer.drawString(matrices, text, (float) x, (float) y, r, g, b, alpha);
}
@ -50,13 +52,14 @@ public class BruhAdapter implements FontAdapter {
@Override
public void drawCenteredString(MatrixStack matrices, String text, double x, double y, int color) {
if ((color & 0xfc000000) == 0) {
color |= 0xff000000;
int color1 = color;
if ((color1 & 0xfc000000) == 0) {
color1 |= 0xff000000;
}
float alpha = (float) (color >> 24 & 255) / 255.0F;
float r = (float) (color >> 16 & 255) / 255.0F;
float g = (float) (color >> 8 & 255) / 255.0F;
float b = (float) (color & 255) / 255.0F;
float alpha = (float) (color1 >> 24 & 255) / 255.0F;
float r = (float) (color1 >> 16 & 255) / 255.0F;
float g = (float) (color1 >> 8 & 255) / 255.0F;
float b = (float) (color1 & 255) / 255.0F;
renderer.drawCenteredString(matrices, text, (float) x, (float) y, r, g, b, alpha);
}
@ -87,13 +90,14 @@ public class BruhAdapter implements FontAdapter {
@Override
public void drawString(MatrixStack matrices, String s, float x, float y, int color, boolean dropShadow) {
if ((color & 0xfc000000) == 0) {
color |= 0xff000000;
int color1 = color;
if ((color1 & 0xfc000000) == 0) {
color1 |= 0xff000000;
}
float alpha = (float) (color >> 24 & 255) / 255.0F;
float r = (float) (color >> 16 & 255) / 255.0F;
float g = (float) (color >> 8 & 255) / 255.0F;
float b = (float) (color & 255) / 255.0F;
float alpha = (float) (color1 >> 24 & 255) / 255.0F;
float r = (float) (color1 >> 16 & 255) / 255.0F;
float g = (float) (color1 >> 8 & 255) / 255.0F;
float b = (float) (color1 & 255) / 255.0F;
drawString(matrices, s, x, y, r, g, b, alpha, dropShadow);
}

View file

@ -50,7 +50,7 @@ public class FontRenderer {
final Font f;
final Map<Character, Glyph> glyphMap = new ConcurrentHashMap<>();
final int size;
float cachedHeight;
final float cachedHeight;
public FontRenderer(Font f, int size) {
this.f = f;
@ -76,6 +76,9 @@ public class FontRenderer {
}
public void drawString(MatrixStack matrices, String s, float x, float y, float r, float g, float b, float a) {
float r1 = r;
float g1 = g;
float b1 = b;
matrices.push();
matrices.translate(x, y, 0);
matrices.scale(0.25F, 0.25F, 1f);
@ -94,9 +97,9 @@ public class FontRenderer {
if (isInSelector) {
char upper = String.valueOf(c).toUpperCase().charAt(0);
int color = colorMap.getOrDefault(upper, 0xFFFFFF);
r = (float) (color >> 16 & 255) / 255.0F;
g = (float) (color >> 8 & 255) / 255.0F;
b = (float) (color & 255) / 255.0F;
r1 = (float) (color >> 16 & 255) / 255.0F;
g1 = (float) (color >> 8 & 255) / 255.0F;
b1 = (float) (color & 255) / 255.0F;
isInSelector = false;
continue;
}
@ -106,13 +109,14 @@ public class FontRenderer {
}
Matrix4f matrix = matrices.peek().getPositionMatrix();
double prevWidth = drawChar(bufferBuilder, matrix, c, r, g, b, a);
double prevWidth = drawChar(bufferBuilder, matrix, c, r1, g1, b1, a);
matrices.translate(prevWidth, 0, 0);
}
matrices.pop();
}
@SuppressWarnings("AssignmentToForLoopParameter")
String stripControlCodes(String in) {
char[] s = in.toCharArray();
StringBuilder out = new StringBuilder();

View file

@ -65,9 +65,12 @@ public class Renderer {
if (fade == null) continue;
long lifetimeLeft = fade.getLifeTimeLeft();
double progress = lifetimeLeft / (double) fade.lifeTime;
double ip = 1 - progress;
stack.push();
Color out = Util.modify(fade.outline, -1, -1, -1, (int) (fade.outline.getAlpha() * progress));
Color fill = Util.modify(fade.fill, -1, -1, -1, (int) (fade.fill.getAlpha() * progress));
Renderer.R3D.renderEdged(stack, fade.start, fade.dimensions, fill, out);
Renderer.R3D.renderEdged(stack, fade.start.add(new Vec3d(0.2, 0.2, 0.2).multiply(ip)), fade.dimensions.subtract(new Vec3d(.4, .4, .4).multiply(ip)), fill, out);
stack.pop();
}
fades = clone;
}
@ -75,10 +78,10 @@ public class Renderer {
public static void renderCircleOutline(MatrixStack stack, Color c, Vec3d start, double rad, double width, double segments) {
Camera camera = ShadowMain.client.gameRenderer.getCamera();
Vec3d camPos = camera.getPos();
start = start.subtract(camPos);
Vec3d start1 = start.subtract(camPos);
stack.push();
stack.translate(start.x, start.y, start.z);
segments = MathHelper.clamp(segments, 2, 90);
stack.translate(start1.x, start1.y, start1.z);
double segments1 = MathHelper.clamp(segments, 2, 90);
int color = c.getRGB();
Matrix4f matrix = stack.peek().getPositionMatrix();
@ -91,7 +94,7 @@ public class Renderer {
setupRender();
RenderSystem.setShader(GameRenderer::getPositionColorShader);
bufferBuilder.begin(VertexFormat.DrawMode.TRIANGLE_STRIP, VertexFormats.POSITION_COLOR);
for (double r = 0; r < 360; r += (360 / segments)) {
for (double r = 0; r < 360; r += (360 / segments1)) {
double rad1 = Math.toRadians(r);
double sin = Math.sin(rad1);
double cos = Math.cos(rad1);
@ -121,12 +124,12 @@ public class Renderer {
Camera c = ShadowMain.client.gameRenderer.getCamera();
Vec3d camPos = c.getPos();
start = start.subtract(camPos);
Vec3d end = start.add(dimensions);
Vec3d start1 = start.subtract(camPos);
Vec3d end = start1.add(dimensions);
Matrix4f matrix = stack.peek().getPositionMatrix();
float x1 = (float) start.x;
float y1 = (float) start.y;
float z1 = (float) start.z;
float x1 = (float) start1.x;
float y1 = (float) start1.y;
float z1 = (float) start1.z;
float x2 = (float) end.x;
float y2 = (float) end.y;
float z2 = (float) end.z;
@ -192,12 +195,12 @@ public class Renderer {
Camera c = ShadowMain.client.gameRenderer.getCamera();
Vec3d camPos = c.getPos();
start = start.subtract(camPos);
Vec3d end = start.add(dimensions);
Vec3d start1 = start.subtract(camPos);
Vec3d end = start1.add(dimensions);
Matrix4f matrix = stack.peek().getPositionMatrix();
float x1 = (float) start.x;
float y1 = (float) start.y;
float z1 = (float) start.z;
float x1 = (float) start1.x;
float y1 = (float) start1.y;
float z1 = (float) start1.z;
float x2 = (float) end.x;
float y2 = (float) end.y;
float z2 = (float) end.z;
@ -286,12 +289,12 @@ public class Renderer {
float alpha = color.getAlpha() / 255f;
Camera c = ShadowMain.client.gameRenderer.getCamera();
Vec3d camPos = c.getPos();
start = start.subtract(camPos);
Vec3d end = start.add(dimensions);
Vec3d start1 = start.subtract(camPos);
Vec3d end = start1.add(dimensions);
Matrix4f matrix = stack.peek().getPositionMatrix();
float x1 = (float) start.x;
float y1 = (float) start.y;
float z1 = (float) start.z;
float x1 = (float) start1.x;
float y1 = (float) start1.y;
float z1 = (float) start1.z;
float x2 = (float) end.x;
float y2 = (float) end.y;
float z2 = (float) end.z;
@ -345,11 +348,11 @@ public class Renderer {
float alpha = color.getAlpha() / 255f;
Camera c = ShadowMain.client.gameRenderer.getCamera();
Vec3d camPos = c.getPos();
start = start.subtract(camPos);
Vec3d start1 = start.subtract(camPos);
Matrix4f matrix = matrices.peek().getPositionMatrix();
float x1 = (float) start.x;
float y1 = (float) start.y;
float z1 = (float) start.z;
float x1 = (float) start1.x;
float y1 = (float) start1.y;
float z1 = (float) start1.z;
BufferBuilder buffer = Tessellator.getInstance().getBuffer();
GL11.glDepthFunc(GL11.GL_ALWAYS);
@ -376,15 +379,15 @@ public class Renderer {
float alpha = color.getAlpha() / 255f;
Camera c = ShadowMain.client.gameRenderer.getCamera();
Vec3d camPos = c.getPos();
start = start.subtract(camPos);
end = end.subtract(camPos);
Vec3d start1 = start.subtract(camPos);
Vec3d end1 = end.subtract(camPos);
Matrix4f matrix = matrices.peek().getPositionMatrix();
float x1 = (float) start.x;
float y1 = (float) start.y;
float z1 = (float) start.z;
float x2 = (float) end.x;
float y2 = (float) end.y;
float z2 = (float) end.z;
float x1 = (float) start1.x;
float y1 = (float) start1.y;
float z1 = (float) start1.z;
float x2 = (float) end1.x;
float y2 = (float) end1.y;
float z2 = (float) end1.z;
BufferBuilder buffer = Tessellator.getInstance().getBuffer();
GL11.glDepthFunc(GL11.GL_ALWAYS);
@ -603,9 +606,9 @@ public class Renderer {
public static void renderBezierCurve(MatrixStack stack, Vec2f[] points, float r, float g, float b, float a, float laziness) {
if (points.length < 2) return;
float minIncr = 0.0001f;
laziness = MathHelper.clamp(laziness, minIncr, 1);
float laziness1 = MathHelper.clamp(laziness, minIncr, 1);
Vec2f prev = null;
for (float d = 0; d <= 1; d += Math.min(laziness, Math.max(minIncr, 1 - d))) {
for (float d = 0; d <= 1; d += Math.min(laziness1, Math.max(minIncr, 1 - d))) {
Vec2f pos = getMultiBezPoint(points, d);
if (prev == null) {
prev = pos;
@ -622,7 +625,7 @@ public class Renderer {
stack.translate(x, y, 0);
float rot = (System.currentTimeMillis() % 2000) / 2000f;
stack.multiply(new Quaternion(0, 0, rot * 360f, true));
segments = MathHelper.clamp(segments, 2, 90);
double segments1 = MathHelper.clamp(segments, 2, 90);
Matrix4f matrix = stack.peek().getPositionMatrix();
BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
@ -630,7 +633,7 @@ public class Renderer {
setupRender();
RenderSystem.setShader(GameRenderer::getPositionColorShader);
bufferBuilder.begin(VertexFormat.DrawMode.TRIANGLE_STRIP, VertexFormats.POSITION_COLOR);
for (double r = 0; r < 90; r += (90 / segments)) {
for (double r = 0; r < 90; r += (90 / segments1)) {
double rad1 = Math.toRadians(r);
double sin = Math.sin(rad1);
double cos = Math.cos(rad1);
@ -666,7 +669,7 @@ public class Renderer {
}
public static void renderCircle(MatrixStack matrices, Color c, double originX, double originY, double rad, int segments) {
segments = MathHelper.clamp(segments, 4, 360);
int segments1 = MathHelper.clamp(segments, 4, 360);
int color = c.getRGB();
Matrix4f matrix = matrices.peek().getPositionMatrix();
@ -678,7 +681,7 @@ public class Renderer {
setupRender();
RenderSystem.setShader(GameRenderer::getPositionColorShader);
bufferBuilder.begin(VertexFormat.DrawMode.TRIANGLE_FAN, VertexFormats.POSITION_COLOR);
for (int i = 0; i < 360; i += Math.min((360 / segments), 360 - i)) {
for (int i = 0; i < 360; i += Math.min((360 / segments1), 360 - i)) {
double radians = Math.toRadians(i);
double sin = Math.sin(radians) * rad;
double cos = Math.cos(radians) * rad;
@ -712,18 +715,22 @@ public class Renderer {
}
public static void renderQuad(MatrixStack matrices, Color c, double x1, double y1, double x2, double y2) {
double x11 = x1;
double x21 = x2;
double y11 = y1;
double y21 = y2;
int color = c.getRGB();
double j;
if (x1 < x2) {
j = x1;
x1 = x2;
x2 = j;
if (x11 < x21) {
j = x11;
x11 = x21;
x21 = j;
}
if (y1 < y2) {
j = y1;
y1 = y2;
y2 = j;
if (y11 < y21) {
j = y11;
y11 = y21;
y21 = j;
}
Matrix4f matrix = matrices.peek().getPositionMatrix();
float f = (float) (color >> 24 & 255) / 255.0F;
@ -734,16 +741,20 @@ public class Renderer {
setupRender();
RenderSystem.setShader(GameRenderer::getPositionColorShader);
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
bufferBuilder.vertex(matrix, (float) x1, (float) y2, 0.0F).color(g, h, k, f).next();
bufferBuilder.vertex(matrix, (float) x2, (float) y2, 0.0F).color(g, h, k, f).next();
bufferBuilder.vertex(matrix, (float) x2, (float) y1, 0.0F).color(g, h, k, f).next();
bufferBuilder.vertex(matrix, (float) x1, (float) y1, 0.0F).color(g, h, k, f).next();
bufferBuilder.vertex(matrix, (float) x11, (float) y21, 0.0F).color(g, h, k, f).next();
bufferBuilder.vertex(matrix, (float) x21, (float) y21, 0.0F).color(g, h, k, f).next();
bufferBuilder.vertex(matrix, (float) x21, (float) y11, 0.0F).color(g, h, k, f).next();
bufferBuilder.vertex(matrix, (float) x11, (float) y11, 0.0F).color(g, h, k, f).next();
bufferBuilder.end();
BufferRenderer.draw(bufferBuilder);
endRender();
}
public static void renderQuadGradient(MatrixStack matrices, Color c2, Color c1, double x1, double y1, double x2, double y2) {
double x11 = x1;
double x21 = x2;
double y11 = y1;
double y21 = y2;
float r1 = c1.getRed() / 255f;
float g1 = c1.getGreen() / 255f;
float b1 = c1.getBlue() / 255f;
@ -755,16 +766,16 @@ public class Renderer {
double j;
if (x1 < x2) {
j = x1;
x1 = x2;
x2 = j;
if (x11 < x21) {
j = x11;
x11 = x21;
x21 = j;
}
if (y1 < y2) {
j = y1;
y1 = y2;
y2 = j;
if (y11 < y21) {
j = y11;
y11 = y21;
y21 = j;
}
Matrix4f matrix = matrices.peek().getPositionMatrix();
BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
@ -772,10 +783,10 @@ public class Renderer {
RenderSystem.setShader(GameRenderer::getPositionColorShader);
bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
bufferBuilder.vertex(matrix, (float) x1, (float) y1, 0.0F).color(r1, g1, b1, a1).next();
bufferBuilder.vertex(matrix, (float) x1, (float) y2, 0.0F).color(r1, g1, b1, a1).next();
bufferBuilder.vertex(matrix, (float) x2, (float) y2, 0.0F).color(r2, g2, b2, a2).next();
bufferBuilder.vertex(matrix, (float) x2, (float) y1, 0.0F).color(r2, g2, b2, a2).next();
bufferBuilder.vertex(matrix, (float) x11, (float) y11, 0.0F).color(r1, g1, b1, a1).next();
bufferBuilder.vertex(matrix, (float) x11, (float) y21, 0.0F).color(r1, g1, b1, a1).next();
bufferBuilder.vertex(matrix, (float) x21, (float) y21, 0.0F).color(r2, g2, b2, a2).next();
bufferBuilder.vertex(matrix, (float) x21, (float) y11, 0.0F).color(r2, g2, b2, a2).next();
bufferBuilder.end();
BufferRenderer.draw(bufferBuilder);
endRender();

View file

@ -19,9 +19,9 @@ public class Transitions {
}
public static double transition(double value, double goal, double speed, double skipSize) {
speed = speed < 1 ? 1 : speed;
double speed1 = speed < 1 ? 1 : speed;
double diff = goal - value;
double diffCalc = diff / speed;
double diffCalc = diff / speed1;
if (Math.abs(diffCalc) < skipSize) {
diffCalc = diff;
}

View file

@ -293,15 +293,15 @@ public class Utils {
}
public static UUID getUUIDFromName(String name) {
name = completeName(name); // this really helps trust me
if (!isPlayerNameValid(name)) {
String name1 = completeName(name); // this really helps trust me
if (!isPlayerNameValid(name1)) {
return null;
}
if (UUID_CACHE.containsKey(name.toLowerCase())) {
return UUID_CACHE.get(name.toLowerCase());
if (UUID_CACHE.containsKey(name1.toLowerCase())) {
return UUID_CACHE.get(name1.toLowerCase());
}
try {
HttpRequest req = HttpRequest.newBuilder().GET().uri(URI.create("https://api.mojang.com/users/profiles/minecraft/" + name)).build();
HttpRequest req = HttpRequest.newBuilder().GET().uri(URI.create("https://api.mojang.com/users/profiles/minecraft/" + name1)).build();
HttpResponse<String> response = client.send(req, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() == 204 || response.statusCode() == 400) {
return null; // no user / invalid username
@ -310,7 +310,7 @@ public class Utils {
String id = root.get("id").getAsString();
String uuid = id.replaceAll("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})", "$1-$2-$3-$4-$5");
UUID u = UUID.fromString(uuid);
UUID_CACHE.put(name.toLowerCase(), u);
UUID_CACHE.put(name1.toLowerCase(), u);
return u;
} catch (Exception ignored) {
return null;

View file

@ -46,7 +46,7 @@ public class AChatScreenMixin extends Screen {
protected TextFieldWidget chatField;
String previousSuggestionInput = "";
@Shadow
private CommandSuggestor commandSuggestor;
CommandSuggestor commandSuggestor;
protected AChatScreenMixin(Text title) {
super(title);
@ -85,7 +85,7 @@ public class AChatScreenMixin extends Screen {
if (args.length > 0) {
Command c = CommandRegistry.getByAlias(cmd);
if (c != null) {
a = List.of(c.getSuggestions(command, args));
a = List.of(c.getSuggestionsWithType(args.length - 1, args).getSuggestions());
} else {
return new ArrayList<>(); // we have no command to ask -> we have no suggestions
}
@ -208,7 +208,7 @@ public class AChatScreenMixin extends Screen {
countedSpaceBefore = false;
if (i < integer) continue;
if (countedGaps >= 1) {
ArgumentType current = c.getArgumentType(args, "", countedGaps - 1);
ArgumentType current = c.getSuggestionsWithType(countedGaps - 1, args).getType();
int col = 0xFFFFFF;
if (current != null) col = current.getColor().getRGB();
texts.add(OrderedText.styledForwardsVisitedString(String.valueOf(c1), Style.EMPTY.withColor(col)));

View file

@ -15,16 +15,17 @@ import org.spongepowered.asm.mixin.injection.ModifyVariable;
public class EntityRendererMixin {
@ModifyVariable(method = "renderLabelIfPresent", at = @At("HEAD"), index = 2, argsOnly = true)
Text real(Text text) {
Text text1 = text;
AntiCrash ac = AntiCrash.instance();
if (ac.isEnabled() && ac.getCapNames().getValue()) {
String t = text.getString();
String t = text1.getString();
int maxlen = (int) Math.floor(ac.getNameMax().getValue());
int len = t.length();
if (len > maxlen) {
t = t.substring(0, maxlen) + "§r...";
}
text = Text.of(t);
text1 = Text.of(t);
}
return text;
return text1;
}
}

View file

@ -30,6 +30,7 @@ import java.util.Iterator;
import java.util.Random;
import java.util.Set;
@SuppressWarnings("rawtypes")
@Debug(export = true)
@Mixin(targets = "net/minecraft/client/render/chunk/ChunkBuilder$BuiltChunk$RebuildTask")
public class RebuildTaskMixin {