i put the ;

This commit is contained in:
0x3C50 2022-04-17 19:28:20 +02:00
parent 562a65918d
commit 632e79f8db
62 changed files with 345 additions and 600 deletions

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

@ -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) {

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;
@ -28,11 +27,6 @@ public class LogFlood extends Command {
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

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

@ -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
}

View file

@ -89,6 +89,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;
@ -300,6 +301,7 @@ public class ModuleRegistry {
vanillaModules.add(new InteractCrash());
vanillaModules.add(new FlightCrash());
vanillaModules.add(new ClickTP());
vanillaModules.add(new ChestHighlighter());
rebuildSharedModuleList();
}

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

@ -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;
}

View file

@ -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)));