1
0
Fork 0
mirror of https://github.com/Miasmusa/Shadow.git synced 2025-04-21 17:00:52 -04:00

ah fuck lowice i reformatted the entire client again

This commit is contained in:
0x150 2022-03-03 13:07:47 +01:00
parent 6556236a96
commit 932681b469
234 changed files with 2632 additions and 3658 deletions
build.gradle
src/main/java/me/x150/coffee
CoffeeClientMain.java
feature
command
config
gui
module

View file

@ -30,6 +30,9 @@ dependencies {
// modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_version}"
// modImplementation ("net.fabricmc.fabric-api:fabric-resource-loader:0.1.0")
compileOnly 'org.projectlombok:lombok:1.18.22'
annotationProcessor 'org.projectlombok:lombok:1.18.22'
impl(name: "xauthlib-1.0.0")
impl("org.java-websocket:Java-WebSocket:1.5.2")

View file

@ -5,7 +5,6 @@ import me.x150.coffee.feature.gui.FastTickable;
import me.x150.coffee.feature.gui.notifications.NotificationRenderer;
import me.x150.coffee.feature.module.Module;
import me.x150.coffee.feature.module.ModuleRegistry;
import me.x150.coffee.helper.ManagerThread;
import me.x150.coffee.helper.Rotations;
import me.x150.coffee.helper.Texture;
import me.x150.coffee.helper.event.EventType;
@ -28,29 +27,27 @@ import java.io.File;
import java.util.ArrayList;
import java.util.List;
@SuppressWarnings("ResultOfMethodCallIgnored")
public class CoffeeClientMain implements ModInitializer {
@SuppressWarnings("ResultOfMethodCallIgnored") public class CoffeeClientMain implements ModInitializer {
public static final String MOD_ID = "sipoverprivate";
public static final String MOD_NAME = "SipoverPrivate";
public static final Logger LOGGER = LogManager.getLogger();
public static final MinecraftClient client = MinecraftClient.getInstance();
public static final File BASE = new File(MinecraftClient.getInstance().runDirectory, "sip");
public static final String MOD_ID = "sipoverprivate";
public static final String MOD_NAME = "SipoverPrivate";
public static final Logger LOGGER = LogManager.getLogger();
public static final MinecraftClient client = MinecraftClient.getInstance();
public static final File BASE = new File(MinecraftClient.getInstance().runDirectory, "sip");
// public static final List<ResourceEntry> resources = List.of(
// new ResourceEntry(new Texture("background.jpg"), "https://gitlab.com/0x151/coffee-fs/-/raw/main/background.jpg"),
// new ResourceEntry(new Texture("notif/error.png"), "https://gitlab.com/0x151/coffee-fs/-/raw/main/error.png"),
// new ResourceEntry(new Texture("notif/info.png"), "https://gitlab.com/0x151/coffee-fs/-/raw/main/info.png"),
// new ResourceEntry(new Texture("notif/success.png"), "https://gitlab.com/0x151/coffee-fs/-/raw/main/success.png"),
// new ResourceEntry(new Texture("notif/warning.png"), "https://gitlab.com/0x151/coffee-fs/-/raw/main/warning.png")
// );
public static final List<ResourceEntry> resources = new ArrayList<>();
public static long lastScreenChange = System.currentTimeMillis();
public static CoffeeClientMain INSTANCE;
public static Thread MODULE_FTTICKER;
public static Thread FAST_TICKER;
public static ManagerThread sman;
public static String sessionKey = null;
public boolean initialized = false;
// new ResourceEntry(new Texture("background.jpg"), "https://gitlab.com/0x151/coffee-fs/-/raw/main/background.jpg"),
// new ResourceEntry(new Texture("notif/error.png"), "https://gitlab.com/0x151/coffee-fs/-/raw/main/error.png"),
// new ResourceEntry(new Texture("notif/info.png"), "https://gitlab.com/0x151/coffee-fs/-/raw/main/info.png"),
// new ResourceEntry(new Texture("notif/success.png"), "https://gitlab.com/0x151/coffee-fs/-/raw/main/success.png"),
// new ResourceEntry(new Texture("notif/warning.png"), "https://gitlab.com/0x151/coffee-fs/-/raw/main/warning.png")
// );
public static final List<ResourceEntry> resources = new ArrayList<>();
public static long lastScreenChange = System.currentTimeMillis();
public static CoffeeClientMain INSTANCE;
public static Thread MODULE_FTTICKER;
public static Thread FAST_TICKER;
public static String sessionKey = null;
public boolean initialized = false;
public static void log(Level level, String message) {
LOGGER.log(level, "[" + MOD_NAME + "] " + message);
@ -61,13 +58,14 @@ public class CoffeeClientMain implements ModInitializer {
}
public static String generateOrGetSessionToken() {
if (sessionKey != null) return sessionKey;
if (sessionKey != null) {
return sessionKey;
}
sessionKey = RandomStringUtils.randomAlphabetic(32);
return sessionKey;
}
@Override
public void onInitialize() {
@Override public void onInitialize() {
INSTANCE = this;
log(Level.INFO, "Initializing");

View file

@ -9,8 +9,8 @@ import me.x150.coffee.helper.util.Utils;
public abstract class Command extends Utils.Logging {
private final String name;
private final String description;
private final String name;
private final String description;
private final String[] aliases;
public Command(String n, String d, String... a) {

View file

@ -5,7 +5,31 @@
package me.x150.coffee.feature.command;
import me.x150.coffee.feature.command.impl.*;
import me.x150.coffee.feature.command.impl.Bind;
import me.x150.coffee.feature.command.impl.Config;
import me.x150.coffee.feature.command.impl.ConfigUtils;
import me.x150.coffee.feature.command.impl.Drop;
import me.x150.coffee.feature.command.impl.Effect;
import me.x150.coffee.feature.command.impl.FakeItem;
import me.x150.coffee.feature.command.impl.Find;
import me.x150.coffee.feature.command.impl.ForEach;
import me.x150.coffee.feature.command.impl.Gamemode;
import me.x150.coffee.feature.command.impl.Help;
import me.x150.coffee.feature.command.impl.Hologram;
import me.x150.coffee.feature.command.impl.Invsee;
import me.x150.coffee.feature.command.impl.Kickall;
import me.x150.coffee.feature.command.impl.Kill;
import me.x150.coffee.feature.command.impl.Locate;
import me.x150.coffee.feature.command.impl.Panic;
import me.x150.coffee.feature.command.impl.Plugins;
import me.x150.coffee.feature.command.impl.RageQuit;
import me.x150.coffee.feature.command.impl.Rename;
import me.x150.coffee.feature.command.impl.Say;
import me.x150.coffee.feature.command.impl.SkinExploit;
import me.x150.coffee.feature.command.impl.Taco;
import me.x150.coffee.feature.command.impl.Test;
import me.x150.coffee.feature.command.impl.Toggle;
import me.x150.coffee.feature.command.impl.ViewNbt;
import me.x150.coffee.helper.util.Utils;
import java.util.ArrayList;
@ -62,16 +86,16 @@ public class CommandRegistry {
if (c == null) {
Utils.Logging.error("Command \"" + cmd + "\" not found");
} else {
// CoffeeConsoleScreen.instance().log("> " + command, CoffeeConsoleScreen.CLIENT);
// CoffeeConsoleScreen.instance().log("> " + command, CoffeeConsoleScreen.CLIENT);
try {
c.onExecute(args);
} catch (Exception e) {
Utils.Logging.error("Error while running command " + command);
// StringWriter sw = new StringWriter();
// e.printStackTrace(new PrintWriter(sw));
// for (String s : sw.toString().split("\n")) {
// CoffeeConsoleScreen.instance().log(s, CoffeeConsoleScreen.BACKGROUND);
// }
// StringWriter sw = new StringWriter();
// e.printStackTrace(new PrintWriter(sw));
// for (String s : sw.toString().split("\n")) {
// CoffeeConsoleScreen.instance().log(s, CoffeeConsoleScreen.BACKGROUND);
// }
}
}
}

View file

@ -14,16 +14,14 @@ public class Bind extends Command {
super("Bind", "Sets the keybind of a module", "bind");
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
@Override public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return ModuleRegistry.getModules().stream().map(Module::getName).collect(Collectors.toList()).toArray(String[]::new);
}
return super.getSuggestions(fullCommand, args);
}
@Override
public void onExecute(String[] args) {
@Override public void onExecute(String[] args) {
if (args.length == 0) {
error("Give me a module name");
return;

View file

@ -20,8 +20,7 @@ public class Config extends Command {
super("Config", "Changes configuration of a module", "config", "conf");
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
@Override public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return ModuleRegistry.getModules().stream().map(Module::getName).collect(Collectors.toList()).toArray(String[]::new);
} else if (args.length == 2 && ModuleRegistry.getByName(args[0]) != null) {
@ -32,8 +31,7 @@ public class Config extends Command {
return super.getSuggestions(fullCommand, args);
}
@Override
public void onExecute(String[] args) {
@Override public void onExecute(String[] args) {
if (args.length == 0) {
message("Syntax: .config (module) <key> <value>");
message("For a module or key with spaces, use - as a separator");

View file

@ -15,7 +15,11 @@ import me.x150.coffee.feature.command.Command;
import me.x150.coffee.feature.config.SettingBase;
import me.x150.coffee.feature.module.Module;
import me.x150.coffee.feature.module.ModuleRegistry;
import net.minecraft.text.*;
import net.minecraft.text.ClickEvent;
import net.minecraft.text.HoverEvent;
import net.minecraft.text.LiteralText;
import net.minecraft.text.Style;
import net.minecraft.text.Text;
import org.apache.commons.io.FileUtils;
import java.io.File;
@ -31,11 +35,12 @@ public class ConfigUtils extends Command {
public ConfigUtils() {
super("ConfigUtils", "Config file management", "configUtils", "cu");
if (!CONFIG_STORAGE.exists()) //noinspection ResultOfMethodCallIgnored
{
CONFIG_STORAGE.mkdir();
}
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
@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")) {
@ -44,8 +49,7 @@ public class ConfigUtils extends Command {
return super.getSuggestions(fullCommand, args);
}
@Override
public void onExecute(String[] args) {
@Override public void onExecute(String[] args) {
if (args.length == 0) {
error("I need an action, load or save");
return;

View file

@ -14,8 +14,7 @@ public class Drop extends Command {
super("Drop", "Drops all items in your inventory", "drop", "d", "throw");
}
@Override
public void onExecute(String[] args) {
@Override public void onExecute(String[] args) {
for (int i = 0; i < 36; i++) {
Utils.Inventory.drop(i);
}

View file

@ -17,8 +17,7 @@ public class Effect extends Command {
super("Effect", "Gives you an effect client side", "effect", "eff");
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
@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")) {
@ -31,8 +30,7 @@ public class Effect extends Command {
return super.getSuggestions(fullCommand, args);
}
@Override
public void onExecute(String[] args) {
@Override public void onExecute(String[] args) {
if (CoffeeClientMain.client.player == null) {
return;
}

View file

@ -22,11 +22,10 @@ public class FakeItem extends Command {
super("FakeItem", "Fakes a person holding a specific item", "spoofitem", "fakeitem");
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
@Override public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return Objects.requireNonNull(CoffeeClientMain.client.world).getPlayers().stream().map(abstractClientPlayerEntity -> abstractClientPlayerEntity.getGameProfile().getName()).collect(Collectors.toList())
.toArray(String[]::new);
return Objects.requireNonNull(CoffeeClientMain.client.world).getPlayers().stream().map(abstractClientPlayerEntity -> abstractClientPlayerEntity.getGameProfile().getName())
.collect(Collectors.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:")) {
@ -35,8 +34,7 @@ public class FakeItem extends Command {
return super.getSuggestions(fullCommand, args);
}
@Override
public void onExecute(String[] args) {
@Override public void onExecute(String[] args) {
if (args.length == 0) { // no uuid or item
error("Specify player UUID or player username and item");
return;
@ -92,11 +90,11 @@ public class FakeItem extends Command {
stack.setNbt(StringNbtReader.parse(String.join(" ", Arrays.copyOfRange(args, 2, args.length))));
} catch (CommandSyntaxException e) {
error("Invalid NBT: " + e.getContext());
// StringWriter sw = new StringWriter();
// e.printStackTrace(new PrintWriter(sw));
// for (String s : sw.toString().split("\n")) {
// CoffeeConsoleScreen.instance().log(s, CoffeeConsoleScreen.BACKGROUND);
// }
// StringWriter sw = new StringWriter();
// e.printStackTrace(new PrintWriter(sw));
// for (String s : sw.toString().split("\n")) {
// CoffeeConsoleScreen.instance().log(s, CoffeeConsoleScreen.BACKGROUND);
// }
return;
}
}

View file

@ -26,8 +26,8 @@ import java.util.UUID;
public class Find extends Command {
boolean pendingBook = false;
boolean sent2nd = false;
int bookSlot = -1;
boolean sent2nd = false;
int bookSlot = -1;
public Find() {
super("Find", "NoCom 2 (requires creative)", "find", "cfind");
@ -92,16 +92,14 @@ public class Find extends Command {
}
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
@Override public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"(uuid)"};
}
return super.getSuggestions(fullCommand, args);
}
@Override
public void onExecute(String[] args) {
@Override public void onExecute(String[] args) {
if (!Objects.requireNonNull(CoffeeClientMain.client.interactionManager).hasCreativeInventory()) {
error("Cant find the player, need GMC");
return;

View file

@ -23,8 +23,7 @@ public class ForEach extends Command {
super("ForEach", "Do something for each player", "foreach", "for", "fe");
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
@Override public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"(delay in ms)"};
} else if (args.length == 2) {
@ -33,8 +32,7 @@ public class ForEach extends Command {
return super.getSuggestions(fullCommand, args);
}
@Override
public void onExecute(String[] args) {
@Override public void onExecute(String[] args) {
if (args.length < 2) {
message("Syntax: foreach (delayMS) (message)");
message("%s in the message gets replaced with the player name");

View file

@ -18,16 +18,14 @@ public class Gamemode extends Command {
super("Gamemode", "Switch gamemodes client side", "gamemode", "gm", "gmode", "gamemodespoof", "gmspoof");
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
@Override public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return Arrays.stream(GameMode.values()).map(GameMode::getName).collect(Collectors.toList()).toArray(String[]::new);
}
return super.getSuggestions(fullCommand, args);
}
@Override
public void onExecute(String[] args) {
@Override public void onExecute(String[] args) {
if (CoffeeClientMain.client.interactionManager == null) {
return;
}

View file

@ -8,7 +8,7 @@ package me.x150.coffee.feature.command.impl;
import me.x150.coffee.feature.command.Command;
import me.x150.coffee.feature.command.CommandRegistry;
import java.awt.*;
import java.awt.Color;
public class Help extends Command {
@ -16,8 +16,7 @@ public class Help extends Command {
super("Help", "Shows all commands", "help", "h", "?", "cmds", "commands", "manual", "man");
}
@Override
public void onExecute(String[] args) {
@Override public void onExecute(String[] args) {
message("All commands and their description");
for (Command command : CommandRegistry.getCommands()) {
message(command.getName() + ": " + command.getDescription());

View file

@ -21,8 +21,7 @@ public class Hologram extends Command {
super("Hologram", "Generates a hologram without needing op (requires creative)", "hologram", "holo", "hlg");
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
@Override public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"(flags)"};
}
@ -32,8 +31,7 @@ public class Hologram extends Command {
return super.getSuggestions(fullCommand, args);
}
@Override
public void onExecute(String[] args) {
@Override public void onExecute(String[] args) {
if (args.length < 2) {
message("i need options and text pls. example: \".hologram eb your text\". specify option \"h\" to show help");
return;

View file

@ -21,17 +21,15 @@ public class Invsee extends Command {
super("Invsee", "Shows you the inventory of another player", "invsee", "isee");
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
@Override public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return Objects.requireNonNull(CoffeeClientMain.client.world).getPlayers().stream().map(abstractClientPlayerEntity -> abstractClientPlayerEntity.getGameProfile().getName()).collect(Collectors.toList())
.toArray(String[]::new);
return Objects.requireNonNull(CoffeeClientMain.client.world).getPlayers().stream().map(abstractClientPlayerEntity -> abstractClientPlayerEntity.getGameProfile().getName())
.collect(Collectors.toList()).toArray(String[]::new);
}
return super.getSuggestions(fullCommand, args);
}
@Override
public void onExecute(String[] args) {
@Override public void onExecute(String[] args) {
if (args.length == 0) {
message("i need username");
return;

View file

@ -8,7 +8,11 @@ import net.minecraft.network.NetworkState;
import net.minecraft.network.listener.ClientLoginPacketListener;
import net.minecraft.network.packet.c2s.handshake.HandshakeC2SPacket;
import net.minecraft.network.packet.c2s.login.LoginHelloC2SPacket;
import net.minecraft.network.packet.s2c.login.*;
import net.minecraft.network.packet.s2c.login.LoginCompressionS2CPacket;
import net.minecraft.network.packet.s2c.login.LoginDisconnectS2CPacket;
import net.minecraft.network.packet.s2c.login.LoginHelloS2CPacket;
import net.minecraft.network.packet.s2c.login.LoginQueryRequestS2CPacket;
import net.minecraft.network.packet.s2c.login.LoginSuccessS2CPacket;
import net.minecraft.text.Text;
import java.net.InetSocketAddress;
@ -18,45 +22,39 @@ public class Kickall extends Command {
super("Kickall", "Kicks every single person on an offline server", "kickall");
}
@Override
public void onExecute(String[] args) {
@Override public void onExecute(String[] args) {
InetSocketAddress sa = (InetSocketAddress) CoffeeClientMain.client.getNetworkHandler().getConnection().getAddress();
for (PlayerListEntry playerListEntry : CoffeeClientMain.client.getNetworkHandler().getPlayerList()) {
if (playerListEntry.getProfile().equals(CoffeeClientMain.client.player.getGameProfile())) continue;
if (playerListEntry.getProfile().equals(CoffeeClientMain.client.player.getGameProfile())) {
continue;
}
ClientConnection conn = ClientConnection.connect(sa, CoffeeClientMain.client.options.shouldUseNativeTransport());
conn.setPacketListener(new ClientLoginPacketListener() {
@Override
public void onHello(LoginHelloS2CPacket packet) {
@Override public void onHello(LoginHelloS2CPacket packet) {
conn.disconnect(Text.of("your mother"));
}
@Override
public void onSuccess(LoginSuccessS2CPacket packet) {
@Override public void onSuccess(LoginSuccessS2CPacket packet) {
}
@Override
public void onDisconnect(LoginDisconnectS2CPacket packet) {
@Override public void onDisconnect(LoginDisconnectS2CPacket packet) {
}
@Override
public void onCompression(LoginCompressionS2CPacket packet) {
@Override public void onCompression(LoginCompressionS2CPacket packet) {
}
@Override
public void onQueryRequest(LoginQueryRequestS2CPacket packet) {
@Override public void onQueryRequest(LoginQueryRequestS2CPacket packet) {
}
@Override
public void onDisconnected(Text reason) {
@Override public void onDisconnected(Text reason) {
}
@Override
public ClientConnection getConnection() {
@Override public ClientConnection getConnection() {
return null;
}
});

View file

@ -41,8 +41,8 @@ import java.util.UUID;
public class Kill extends Command {
boolean pendingBook = false;
boolean sent2nd = false;
int bookSlot = -1;
boolean sent2nd = false;
int bookSlot = -1;
public Kill() {
super("Kill", "Makes another person have a sudden heart attack (requires creative)", "kill");
@ -61,8 +61,7 @@ public class Kill extends Command {
});
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
@Override public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"(player username)", "U(uuid)"};
}
@ -128,8 +127,7 @@ public class Kill extends Command {
CoffeeClientMain.client.getNetworkHandler().sendPacket(pack3);
}
@Override
public void onExecute(String[] args) {
@Override public void onExecute(String[] args) {
if (args.length == 0) {
error("Cant kill no one");
return;

View file

@ -17,7 +17,12 @@ import net.minecraft.world.biome.Biome;
import net.minecraft.world.biome.source.BiomeSource;
import net.minecraft.world.biome.source.MultiNoiseBiomeSource;
import net.minecraft.world.biome.source.TheEndBiomeSource;
import net.minecraft.world.gen.chunk.*;
import net.minecraft.world.gen.chunk.ChunkGenerator;
import net.minecraft.world.gen.chunk.ChunkGeneratorSettings;
import net.minecraft.world.gen.chunk.NoiseChunkGenerator;
import net.minecraft.world.gen.chunk.StrongholdConfig;
import net.minecraft.world.gen.chunk.StructureConfig;
import net.minecraft.world.gen.chunk.StructuresConfig;
import net.minecraft.world.gen.feature.ConfiguredStructureFeature;
import net.minecraft.world.gen.feature.FeatureConfig;
import net.minecraft.world.gen.feature.StructureFeature;
@ -25,7 +30,12 @@ import net.minecraft.world.level.storage.LevelStorage;
import org.jetbrains.annotations.Nullable;
import java.io.IOException;
import java.util.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.stream.Collectors;
@ -33,13 +43,13 @@ import java.util.stream.Collectors;
public class Locate extends Command {
private final DynamicRegistryManager jigsawRegistry = DynamicRegistryManager.create();
private List<ChunkPos> strongholds = Lists.newArrayList();
private BiomeSource biomeSource;
private StructuresConfig structuresConfig;
private long worldSeed;
private ChunkGenerator chunkGenerator;
private StructureManager structureManager;
private Registry<Biome> biomeRegistry;
private List<ChunkPos> strongholds = Lists.newArrayList();
private BiomeSource biomeSource;
private StructuresConfig structuresConfig;
private long worldSeed;
private ChunkGenerator chunkGenerator;
private StructureManager structureManager;
private Registry<Biome> biomeRegistry;
public Locate() {
super("Locate", "locates structures", "locate");
@ -50,8 +60,7 @@ public class Locate extends Command {
return category != Biome.Category.OCEAN && category != Biome.Category.RIVER && category != Biome.Category.BEACH && category != Biome.Category.SWAMP && category != Biome.Category.NETHER && category != Biome.Category.THEEND;
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
@Override public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
String[] structures = new String[StructureFeature.STRUCTURES.size()];
StructureFeature.STRUCTURES.keySet().toArray(structures);
@ -60,8 +69,7 @@ public class Locate extends Command {
return super.getSuggestions(fullCommand, args);
}
@Override
public void onExecute(String[] args) {
@Override public void onExecute(String[] args) {
if (args.length != 2) {
message("syntax is .locate <structure> <seed>");
return;
@ -94,7 +102,6 @@ public class Locate extends Command {
this.structuresConfig = chunkGenerator.getStructuresConfig();
System.out.println(registryManager.get(Registry.STRUCTURE_POOL_KEY).toString());
} catch (Exception e) {
System.out.println(e.getLocalizedMessage());
}
@ -128,8 +135,7 @@ public class Locate extends Command {
this.biomeRegistry = null;
}
@Nullable
public BlockPos locateStructure(StructureFeature<?> structureFeature, BlockPos center, int radius) {
@Nullable public BlockPos locateStructure(StructureFeature<?> structureFeature, BlockPos center, int radius) {
if (structureFeature == StructureFeature.STRONGHOLD) {
BlockPos blockPos = null;
double d = Double.MAX_VALUE;
@ -143,7 +149,9 @@ public class Locate extends Command {
d = e;
continue;
}
if (!(e < d)) continue;
if (!(e < d)) {
continue;
}
blockPos = new BlockPos(mutable);
d = e;
}
@ -161,8 +169,7 @@ public class Locate extends Command {
return locateStructure2(center, radius, structureConfig, structureFeature);
}
@Nullable
private BlockPos locateStructure2(BlockPos searchStartPos, int searchRadius, StructureConfig config, StructureFeature<?> structureFeature) {
@Nullable private BlockPos locateStructure2(BlockPos searchStartPos, int searchRadius, StructureConfig config, StructureFeature<?> structureFeature) {
int i = config.getSpacing();
int j = ChunkSectionPos.getSectionCoord(searchStartPos.getX());
int k = ChunkSectionPos.getSectionCoord(searchStartPos.getZ());
@ -174,10 +181,14 @@ public class Locate extends Command {
ChunkPos chunkPos;
boolean bl2 = n == -l || n == l;
boolean structurePresence = getStructurePresence(chunkPos = structureFeature.getStartChunk(config, worldSeed, j + i * m, k + i * n), structureFeature);
if (!bl && !bl2 || !structurePresence) continue;
if (!bl && !bl2 || !structurePresence) {
continue;
}
return structureFeature.getLocatedPos(chunkPos);
}
if (l == 0) continue block0;
if (l == 0) {
continue block0;
}
}
}
return null;
@ -186,7 +197,9 @@ public class Locate extends Command {
private <F extends StructureFeature<?>> boolean getStructurePresence(ChunkPos pos2, F feature2) {
ImmutableMultimap<ConfiguredStructureFeature<?, ?>, RegistryKey<Biome>> multimap = structuresConfig.getConfiguredStructureFeature(feature2);
for (Map.Entry<ConfiguredStructureFeature<?, ?>, Collection<RegistryKey<Biome>>> entry : multimap.asMap().entrySet()) {
if (!this.isGenerationPossible(pos2, entry.getKey(), entry.getValue())) continue;
if (!this.isGenerationPossible(pos2, entry.getKey(), entry.getValue())) {
continue;
}
return true;
}
return false;
@ -207,7 +220,9 @@ public class Locate extends Command {
}
ArrayList<Biome> list = Lists.newArrayList();
for (Biome biome : this.biomeSource.getBiomes()) {
if (!canPlaceStrongholdInBiome(biome)) continue;
if (!canPlaceStrongholdInBiome(biome)) {
continue;
}
list.add(biome);
}
int i = strongholdConfig.getDistance();
@ -229,7 +244,9 @@ public class Locate extends Command {
}
this.strongholds.add(new ChunkPos(n, o));
d += Math.PI * 2 / (double) j;
if (++k != j) continue;
if (++k != j) {
continue;
}
k = 0;
j += 2 * j / (++l + 1);
j = Math.min(j, biome - m);

View file

@ -22,16 +22,14 @@ public class Panic extends Command {
super("Panic", "Turns off all modules in case you get caught", "panic", "p", "disableall");
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
@Override public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"hard", "restore"};
}
return super.getSuggestions(fullCommand, args);
}
@Override
public void onExecute(String[] args) {
@Override public void onExecute(String[] args) {
if (args.length == 0) {
stored.clear();
message("Disabling all non-render modules");

View file

@ -57,8 +57,7 @@ public class Plugins extends Command {
}
}
@Override
public void onExecute(String[] args) {
@Override public void onExecute(String[] args) {
if (CoffeeClientMain.client.getNetworkHandler() != null) {
CoffeeClientMain.client.getNetworkHandler().sendPacket(new RequestCommandCompletionsC2SPacket(0, "/"));
pendingCmdTree = true;

View file

@ -40,8 +40,7 @@ public class RageQuit extends Command {
return true;
}
@Override
public void onExecute(String[] args) {
@Override public void onExecute(String[] args) {
try {
boolean i = shutdown(0);
if (!i) {

View file

@ -17,16 +17,14 @@ public class Rename extends Command {
super("Rename", "Renames an item (requires creative)", "rename", "rn", "name");
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
@Override public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"(new item name)"};
}
return super.getSuggestions(fullCommand, args);
}
@Override
public void onExecute(String[] args) {
@Override public void onExecute(String[] args) {
if (args.length == 0) {
error("I need a new name dude");
error("example: rename &c&lthe &afunny");

View file

@ -16,16 +16,14 @@ public class Say extends Command {
super("Say", "Says something in chat", "say", "tell");
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
@Override public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"(message)"};
}
return super.getSuggestions(fullCommand, args);
}
@Override
public void onExecute(String[] args) {
@Override public void onExecute(String[] args) {
if (args.length == 0) {
error("not sure if i can say nothing");
return;

View file

@ -19,16 +19,14 @@ public class SkinExploit extends Command {
super("SkinExploit", "Config for the SkinExploit module", "skinexploit");
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
@Override public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"(skin url)"};
}
return super.getSuggestions(fullCommand, args);
}
@Override
public void onExecute(String[] args) {
@Override public void onExecute(String[] args) {
if (args.length == 0) {
error("Need skin URL");
return;

View file

@ -27,13 +27,13 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
public class Taco extends Command {
public static final File storage = new File(CoffeeClientMain.BASE, "taco.sip");
public static final List<Frame> frames = new ArrayList<>();
public static final AtomicBoolean init = new AtomicBoolean(false);
static final File gifPath = new File(CoffeeClientMain.BASE, "tacoFrames");
public static TacoConfig config = new TacoConfig();
public static long currentFrame = 0;
static final Thread ticker = new Thread(() -> {
public static final File storage = new File(CoffeeClientMain.BASE, "taco.sip");
public static final List<Frame> frames = new ArrayList<>();
public static final AtomicBoolean init = new AtomicBoolean(false);
static final File gifPath = new File(CoffeeClientMain.BASE, "tacoFrames");
public static TacoConfig config = new TacoConfig();
public static long currentFrame = 0;
static final Thread ticker = new Thread(() -> {
while (true) {
long sleepTime = 1000 / config.fps;
currentFrame++;
@ -155,8 +155,7 @@ public class Taco extends Command {
}
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
@Override public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"fps", "frames", "toggle"};
} else if (args.length == 2) {
@ -169,8 +168,7 @@ public class Taco extends Command {
return super.getSuggestions(fullCommand, args);
}
@Override
public void onExecute(String[] args) {
@Override public void onExecute(String[] args) {
if (args.length == 0) {
error("Please specify an action");
return;
@ -229,14 +227,14 @@ public class Taco extends Command {
}
public static class TacoConfig {
public long fps = 30;
public long fps = 30;
public boolean enabled = false;
}
public static class Frame {
static long frameCounter = 0;
NativeImageBackedTexture tex;
Texture i;
Texture i;
public Frame(BufferedImage image) {
try {
@ -248,7 +246,7 @@ public class Taco extends Command {
data.flip();
tex = new NativeImageBackedTexture(NativeImage.read(data));
// i = new Identifier("atomic", "tacoframe_" + frameCounter);
// i = new Identifier("atomic", "tacoframe_" + frameCounter);
i = new Texture("taco/frame_" + frameCounter);
frameCounter++;
CoffeeClientMain.client.execute(() -> CoffeeClientMain.client.getTextureManager().registerTexture(i, tex));

View file

@ -7,7 +7,11 @@ import net.minecraft.network.NetworkState;
import net.minecraft.network.listener.ClientLoginPacketListener;
import net.minecraft.network.packet.c2s.handshake.HandshakeC2SPacket;
import net.minecraft.network.packet.c2s.login.LoginHelloC2SPacket;
import net.minecraft.network.packet.s2c.login.*;
import net.minecraft.network.packet.s2c.login.LoginCompressionS2CPacket;
import net.minecraft.network.packet.s2c.login.LoginDisconnectS2CPacket;
import net.minecraft.network.packet.s2c.login.LoginHelloS2CPacket;
import net.minecraft.network.packet.s2c.login.LoginQueryRequestS2CPacket;
import net.minecraft.network.packet.s2c.login.LoginSuccessS2CPacket;
import net.minecraft.text.Text;
import java.net.InetSocketAddress;
@ -17,48 +21,40 @@ public class Test extends Command {
super("Test", "REAL", "test");
}
@Override
public void onExecute(String[] args) {
@Override public void onExecute(String[] args) {
InetSocketAddress addr = new InetSocketAddress(args[0], Integer.parseInt(args[1]));
ClientConnection conn = ClientConnection.connect(addr, CoffeeClientMain.client.options.shouldUseNativeTransport());
conn.setPacketListener(new ClientLoginPacketListener() {
@Override
public void onHello(LoginHelloS2CPacket packet) {
@Override public void onHello(LoginHelloS2CPacket packet) {
conn.disconnect(Text.of("your mother"));
}
@Override
public void onSuccess(LoginSuccessS2CPacket packet) {
@Override public void onSuccess(LoginSuccessS2CPacket packet) {
}
@Override
public void onDisconnect(LoginDisconnectS2CPacket packet) {
@Override public void onDisconnect(LoginDisconnectS2CPacket packet) {
}
@Override
public void onCompression(LoginCompressionS2CPacket packet) {
@Override public void onCompression(LoginCompressionS2CPacket packet) {
}
@Override
public void onQueryRequest(LoginQueryRequestS2CPacket packet) {
@Override public void onQueryRequest(LoginQueryRequestS2CPacket packet) {
}
@Override
public void onDisconnected(Text reason) {
@Override public void onDisconnected(Text reason) {
}
@Override
public ClientConnection getConnection() {
@Override public ClientConnection getConnection() {
return null;
}
});
conn.send(new HandshakeC2SPacket(addr.getHostName(), addr.getPort(), NetworkState.LOGIN));
conn.send(new LoginHelloC2SPacket(CoffeeClientMain.client.getSession().getProfile()));
// conn.disconnect(Text.of("cumfart"));
// conn.disconnect(Text.of("cumfart"));
}
}

View file

@ -17,16 +17,14 @@ public class Toggle extends Command {
super("Toggle", "Toggles a module", "toggle", "t");
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
@Override public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return ModuleRegistry.getModules().stream().map(Module::getName).collect(Collectors.toList()).toArray(String[]::new);
}
return super.getSuggestions(fullCommand, args);
}
@Override
public void onExecute(String[] args) {
@Override public void onExecute(String[] args) {
if (args.length == 0) {
error("ima need the module name");
return;

View file

@ -8,7 +8,16 @@ package me.x150.coffee.feature.command.impl;
import me.x150.coffee.CoffeeClientMain;
import me.x150.coffee.feature.command.Command;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.*;
import net.minecraft.nbt.NbtByte;
import net.minecraft.nbt.NbtByteArray;
import net.minecraft.nbt.NbtCompound;
import net.minecraft.nbt.NbtElement;
import net.minecraft.nbt.NbtHelper;
import net.minecraft.nbt.NbtInt;
import net.minecraft.nbt.NbtIntArray;
import net.minecraft.nbt.NbtList;
import net.minecraft.nbt.NbtLong;
import net.minecraft.nbt.NbtLongArray;
import net.minecraft.text.Text;
import java.util.Objects;
@ -21,16 +30,14 @@ public class ViewNbt extends Command {
super("ViewNbt", "Views the nbt data of the current item", "viewnbt", "shownbt");
}
@Override
public String[] getSuggestions(String fullCommand, String[] args) {
@Override public String[] getSuggestions(String fullCommand, String[] args) {
if (args.length == 1) {
return new String[]{"(flags)"};
}
return super.getSuggestions(fullCommand, args);
}
@Override
public void onExecute(String[] args) {
@Override public void onExecute(String[] args) {
boolean formatted = false;
boolean copy = false;
boolean noColor = false;

View file

@ -9,8 +9,7 @@ public class BooleanSetting extends SettingBase<Boolean> {
super(defaultValue, name, description);
}
@Override
public Boolean parse(String value) {
@Override public Boolean parse(String value) {
return (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("1"));
}
@ -20,8 +19,7 @@ public class BooleanSetting extends SettingBase<Boolean> {
super(defaultValue);
}
@Override
public BooleanSetting get() {
@Override public BooleanSetting get() {
return new BooleanSetting(defaultValue, name, description);
}
}

View file

@ -1,7 +1,7 @@
package me.x150.coffee.feature.config;
public class DoubleSetting extends SettingBase<Double> {
final int precision;
final int precision;
final double min;
final double max;
@ -24,8 +24,7 @@ public class DoubleSetting extends SettingBase<Double> {
return precision;
}
@Override
public Double parse(String value) {
@Override public Double parse(String value) {
try {
return Double.parseDouble(value);
} catch (Exception ignored) {
@ -33,8 +32,7 @@ public class DoubleSetting extends SettingBase<Double> {
}
}
@Override
public void setValue(Double value) {
@Override public void setValue(Double value) {
if (value > max || value < min) {
return;
}
@ -64,8 +62,7 @@ public class DoubleSetting extends SettingBase<Double> {
return this;
}
@Override
public DoubleSetting get() {
@Override public DoubleSetting get() {
return new DoubleSetting(defaultValue, name, description, precision, min, max);
}
}

View file

@ -6,8 +6,7 @@ import java.util.Arrays;
public class EnumSetting<T extends Enum<?>> extends SettingBase<T> {
private T[] values;
@SuppressWarnings("unchecked")
public EnumSetting(T defaultValue, String name, String description) {
@SuppressWarnings("unchecked") public EnumSetting(T defaultValue, String name, String description) {
super(defaultValue, name, description);
if (!Modifier.isPublic(defaultValue.getClass().getModifiers())) {
throw new IllegalArgumentException("Enum has to be public!");
@ -19,8 +18,7 @@ public class EnumSetting<T extends Enum<?>> extends SettingBase<T> {
}
}
@Override
public T parse(String value) {
@Override public T parse(String value) {
for (T t : values) {
if (value.equalsIgnoreCase(t.toString())) {
return t;
@ -33,8 +31,7 @@ public class EnumSetting<T extends Enum<?>> extends SettingBase<T> {
return values;
}
@Override
public void setValue(T value) {
@Override public void setValue(T value) {
if (Arrays.stream(values).noneMatch(t -> t.equals(value))) {
return;
}
@ -46,8 +43,7 @@ public class EnumSetting<T extends Enum<?>> extends SettingBase<T> {
super(defaultValue);
}
@Override
public EnumSetting<T> get() {
@Override public EnumSetting<T> get() {
return new EnumSetting<>(defaultValue, name, description);
}
}

View file

@ -5,7 +5,7 @@ import java.util.List;
public class ModuleConfig {
final List<SettingBase<?>> settings = new ArrayList<>();
final List<SettingsGroup> groups = new ArrayList<>();
final List<SettingsGroup> groups = new ArrayList<>();
public <S extends SettingBase<?>> S create(S in) { // used as a proxy to make a one liner
settings.add(in);

View file

@ -18,7 +18,7 @@ public abstract class SettingBase<V> {
/**
* The default value of this setting
*/
final V defaultValue;
final V defaultValue;
final List<BooleanSupplier> suppliers = new ArrayList<>();
/**
* The current value of this setting
@ -119,8 +119,7 @@ public abstract class SettingBase<V> {
* @param <V> The type of value we want to parse
* @param <S> The setting class
*/
@SuppressWarnings("unchecked")
public abstract static class Builder<B extends Builder<?, ?, ?>, V, S extends SettingBase<?>> {
@SuppressWarnings("unchecked") public abstract static class Builder<B extends Builder<?, ?, ?>, V, S extends SettingBase<?>> {
/**
* Name and description
*/
@ -128,7 +127,7 @@ public abstract class SettingBase<V> {
/**
* The default value
*/
V defaultValue;
V defaultValue;
/**
* Event listener when the value changed
*/

View file

@ -6,10 +6,9 @@ import java.util.List;
/**
* A group of settings
*/
@SuppressWarnings("ClassCanBeRecord")
public class SettingsGroup {
final String name;
final String description;
@SuppressWarnings("ClassCanBeRecord") public class SettingsGroup {
final String name;
final String description;
final List<SettingBase<?>> settings;
SettingsGroup(String name, String description, List<SettingBase<?>> settings) {

View file

@ -6,8 +6,7 @@ public class StringSetting extends SettingBase<String> {
super(defaultValue, name, description);
}
@Override
public String parse(String value) {
@Override public String parse(String value) {
return value;
}
@ -17,8 +16,7 @@ public class StringSetting extends SettingBase<String> {
super(defaultValue);
}
@Override
public StringSetting get() {
@Override public StringSetting get() {
return new StringSetting(defaultValue, name, description);
}
}

View file

@ -23,24 +23,28 @@ import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec2f;
import org.lwjgl.glfw.GLFW;
import java.awt.*;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.*;
import java.util.Objects;
import java.util.stream.Collectors;
public class ClickGUI extends Screen implements FastTickable {
public static final Theme theme = new SipoverV1();
static Color idk = new Color(20, 20, 30, 255);
private static ClickGUI instance;
final List<Element> elements = new ArrayList<>();
final ParticleRenderer real = new ParticleRenderer(100);
public String searchTerm = "";
public static final Theme theme = new SipoverV1();
static Color idk = new Color(20, 20, 30, 255);
private static ClickGUI instance;
final List<Element> elements = new ArrayList<>();
final ParticleRenderer real = new ParticleRenderer(100);
public String searchTerm = "";
String desc = null;
double descX, descY;
double scroll = 0;
double trackedScroll = 0;
double introAnimation = 0;
boolean closing = false;
double scroll = 0;
double trackedScroll = 0;
double introAnimation = 0;
boolean closing = false;
private ClickGUI() {
super(Text.of(""));
@ -60,22 +64,19 @@ public class ClickGUI extends Screen implements FastTickable {
return instance;
}
@Override
protected void init() {
@Override protected void init() {
closing = false;
introAnimation = 0;
// this.real.particles.clear();
this.real.shouldAdd = true;
}
@Override
public void onClose() {
@Override public void onClose() {
closing = true;
this.real.shouldAdd = false;
}
@Override
public boolean mouseScrolled(double mouseX, double mouseY, double amount) {
@Override public boolean mouseScrolled(double mouseX, double mouseY, double amount) {
scroll -= amount * 10;
double bottomMost = 0;
for (Element element : elements) {
@ -100,7 +101,8 @@ public class ClickGUI extends Screen implements FastTickable {
double x = 5;
double y = 5;
double tallestInTheRoom = 0;
for (ModuleType value : Arrays.stream(ModuleType.values()).sorted(Comparator.comparingLong(value -> -ModuleRegistry.getModules().stream().filter(module -> module.getModuleType() == value).count())).collect(Collectors.toList())) {
for (ModuleType value : Arrays.stream(ModuleType.values())
.sorted(Comparator.comparingLong(value -> -ModuleRegistry.getModules().stream().filter(module -> module.getModuleType() == value).count())).collect(Collectors.toList())) {
CategoryDisplay cd = new CategoryDisplay(x, y, value);
tallestInTheRoom = Math.max(tallestInTheRoom, cd.getHeight());
x += cd.getWidth() + 5;
@ -118,8 +120,7 @@ public class ClickGUI extends Screen implements FastTickable {
}
@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
@Override public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
if (closing && introAnimation == 0) {
Objects.requireNonNull(client).setScreen(null);
return;
@ -158,7 +159,7 @@ public class ClickGUI extends Screen implements FastTickable {
super.render(matrices, mouseX, mouseY, delta);
if (desc != null) {
// double width = FontRenderers.getNormal().getStringWidth(desc);
// double width = FontRenderers.getNormal().getStringWidth(desc);
double width = 0;
List<String> text = Arrays.stream(desc.split("\n")).map(s -> s = s.trim()).collect(Collectors.toList());
for (String s : text) {
@ -178,8 +179,7 @@ public class ClickGUI extends Screen implements FastTickable {
}
}
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
@Override public boolean mouseClicked(double mouseX, double mouseY, int button) {
mouseY += trackedScroll;
for (Element element : new ArrayList<>(elements)) {
if (element.clicked(mouseX, mouseY, button)) {
@ -191,8 +191,7 @@ public class ClickGUI extends Screen implements FastTickable {
return super.mouseClicked(mouseX, mouseY, button);
}
@Override
public boolean mouseReleased(double mouseX, double mouseY, int button) {
@Override public boolean mouseReleased(double mouseX, double mouseY, int button) {
mouseY += trackedScroll;
for (Element element : elements) {
element.released();
@ -200,8 +199,7 @@ public class ClickGUI extends Screen implements FastTickable {
return super.mouseReleased(mouseX, mouseY, button);
}
@Override
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) {
@Override public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) {
mouseY += trackedScroll;
for (Element element : elements) {
if (element.dragged(mouseX, mouseY, deltaX, deltaY, button)) {
@ -211,8 +209,7 @@ public class ClickGUI extends Screen implements FastTickable {
return super.mouseDragged(mouseX, mouseY, button, deltaX, deltaY);
}
@Override
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
@Override public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
for (Element element : elements) {
if (element.keyPressed(keyCode, modifiers)) {
return true;
@ -228,13 +225,11 @@ public class ClickGUI extends Screen implements FastTickable {
return super.keyPressed(keyCode, scanCode, modifiers);
}
@Override
public boolean isPauseScreen() {
@Override public boolean isPauseScreen() {
return false;
}
@Override
public void onFastTick() {
@Override public void onFastTick() {
double d = 0.03;
if (closing) {
d *= -1;
@ -247,10 +242,11 @@ public class ClickGUI extends Screen implements FastTickable {
}
}
@Override
public boolean charTyped(char chr, int modifiers) {
@Override public boolean charTyped(char chr, int modifiers) {
for (Element element : elements) {
if (element.charTyped(chr, modifiers)) return true;
if (element.charTyped(chr, modifiers)) {
return true;
}
}
searchTerm += chr;
return false;

View file

@ -4,7 +4,12 @@ import com.mojang.blaze3d.systems.RenderSystem;
import me.x150.coffee.CoffeeClientMain;
import me.x150.coffee.feature.gui.clickgui.theme.Theme;
import me.x150.coffee.helper.render.Renderer;
import net.minecraft.client.render.*;
import net.minecraft.client.render.BufferBuilder;
import net.minecraft.client.render.BufferRenderer;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.render.Tessellator;
import net.minecraft.client.render.VertexFormat;
import net.minecraft.client.render.VertexFormats;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Matrix4f;
@ -12,15 +17,15 @@ import net.minecraft.util.math.Quaternion;
import net.minecraft.util.math.Vec3d;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
public class ParticleRenderer {
static final Color DYING = new Color(255, 255, 255, 0); // it goes gradient so you can still see the white
static final Color DYING = new Color(255, 255, 255, 0); // it goes gradient so you can still see the white
public final List<Particle> particles = new ArrayList<>();
final int pc;
public boolean shouldAdd = true;
final int pc;
public boolean shouldAdd = true;
long lastTick = System.currentTimeMillis();
public ParticleRenderer(int pc) {
@ -66,10 +71,10 @@ public class ParticleRenderer {
}
static class Particle {
final long rotSpeed = (long) MathHelper.lerp(Math.random(), 3000, 10000);
final long rotSpeed2 = (long) MathHelper.lerp(Math.random(), 3000, 10000);
final double velX = 0;
final boolean spinsReverse = Math.random() > .5;
final long rotSpeed = (long) MathHelper.lerp(Math.random(), 3000, 10000);
final long rotSpeed2 = (long) MathHelper.lerp(Math.random(), 3000, 10000);
final double velX = 0;
final boolean spinsReverse = Math.random() > .5;
final boolean spinsReverse2 = Math.random() > .5;
double x = 0, y = 0, size = 10, decline = 0.1;
double velY = 0;

View file

@ -9,6 +9,8 @@ import me.x150.coffee.feature.module.ModuleRegistry;
import me.x150.coffee.feature.module.ModuleType;
import me.x150.coffee.helper.font.FontRenderers;
import me.x150.coffee.helper.font.adapter.impl.ClientFontRenderer;
import me.x150.coffee.helper.render.ClipStack;
import me.x150.coffee.helper.render.Rectangle;
import me.x150.coffee.helper.render.Renderer;
import net.minecraft.client.util.math.MatrixStack;
@ -17,9 +19,9 @@ import java.util.List;
import java.util.stream.Collectors;
public class CategoryDisplay extends Element {
static final ClientFontRenderer cfr = FontRenderers.getCustomSize(20);
final List<ModuleDisplay> md = new ArrayList<>();
final ModuleType mt;
static final ClientFontRenderer cfr = FontRenderers.getCustomSize(20);
final List<ModuleDisplay> md = new ArrayList<>();
final ModuleType mt;
boolean selected = false;
public CategoryDisplay(double x, double y, ModuleType mt) {
@ -33,8 +35,7 @@ public class CategoryDisplay extends Element {
}
}
@Override
public boolean clicked(double x, double y, int button) {
@Override public boolean clicked(double x, double y, int button) {
if (x >= this.x && x < this.x + this.width && y >= this.y && y < this.y + headerHeight()) {
if (button == 0) {
selected = true;
@ -50,8 +51,7 @@ public class CategoryDisplay extends Element {
return false;
}
@Override
public boolean dragged(double x, double y, double deltaX, double deltaY, int button) {
@Override public boolean dragged(double x, double y, double deltaX, double deltaY, int button) {
if (selected) {
this.x += deltaX;
this.y += deltaY;
@ -66,8 +66,7 @@ public class CategoryDisplay extends Element {
return false;
}
@Override
public boolean released() {
@Override public boolean released() {
selected = false;
for (ModuleDisplay moduleDisplay : getModules()) {
moduleDisplay.released();
@ -75,8 +74,7 @@ public class CategoryDisplay extends Element {
return false;
}
@Override
public boolean keyPressed(int keycode, int modifiers) {
@Override public boolean keyPressed(int keycode, int modifiers) {
for (ModuleDisplay moduleDisplay : getModules()) {
if (moduleDisplay.keyPressed(keycode, modifiers)) {
return true;
@ -94,8 +92,7 @@ public class CategoryDisplay extends Element {
return padding + cfr.getFontHeight() + padding;
}
@Override
public void render(MatrixStack matrices, double mouseX, double mouseY, double scrollBeingUsed) {
@Override public void render(MatrixStack matrices, double mouseX, double mouseY, double scrollBeingUsed) {
Theme theme = ClickGUI.theme;
// Renderer.R2D.fill(matrices, theme.getHeader(), x, y, x + width, y + headerHeight());
double r = 5;
@ -104,12 +101,16 @@ public class CategoryDisplay extends Element {
double texDim = hheight - texPad * 2;
double modHeight = getModules().stream().map(ModuleDisplay::getHeight).reduce(Double::sum).orElse(0d);
modHeight = Math.min(modHeight, 100);
this.height = headerHeight() + modHeight; // pre calc height
if (modHeight != 0) height += r;
if (modHeight != 0) {
height += r;
}
ClipStack.globalInstance.addWindow(matrices, new Rectangle(x, y, x + width, y + this.height));
Renderer.R2D.renderRoundedQuad(matrices, theme.getHeader(), x, y, x + width, y + this.height, r, 20);
RenderSystem.setShaderTexture(0, mt.getTex());
Renderer.R2D.renderTexture(matrices, x + texPad, y + texPad, texDim, texDim, 0, 0, texDim, texDim, texDim, texDim);
// cfr.drawCenteredString(matrices,mt.getName(),x+texPad+texDim+texPad,y+headerHeight()/2d-cfr.getFontHeight()/2d,0xFFFFFF);
// cfr.drawCenteredString(matrices,mt.getName(),x+texPad+texDim+texPad,y+headerHeight()/2d-cfr.getFontHeight()/2d,0xFFFFFF);
cfr.drawCenteredString(matrices, mt.getName(), x + width / 2d, y + headerHeight() / 2d - cfr.getFontHeight() / 2d, 0xFFFFFF);
double y = headerHeight();
for (ModuleDisplay moduleDisplay : getModules()) {
@ -118,18 +119,17 @@ public class CategoryDisplay extends Element {
moduleDisplay.render(matrices, mouseX, mouseY, scrollBeingUsed);
y += moduleDisplay.getHeight();
}
// FontRenderers.getRenderer().drawCenteredString(matrices, getModules().size() + " modules", this.x + this.width / 2d, this.y + this.height - 1 - FontRenderers.getRenderer().getMarginHeight(), 0xFFFFFF);
ClipStack.globalInstance.popWindow(matrices);
// FontRenderers.getRenderer().drawCenteredString(matrices, getModules().size() + " modules", this.x + this.width / 2d, this.y + this.height - 1 - FontRenderers.getRenderer().getMarginHeight(), 0xFFFFFF);
}
@Override
public void tickAnim() {
@Override public void tickAnim() {
for (ModuleDisplay moduleDisplay : getModules()) {
moduleDisplay.tickAnim();
}
}
@Override
public boolean charTyped(char c, int mods) {
@Override public boolean charTyped(char c, int mods) {
for (ModuleDisplay moduleDisplay : getModules()) {
if (moduleDisplay.charTyped(c, mods)) {
return true;

View file

@ -1,9 +1,18 @@
package me.x150.coffee.feature.gui.clickgui.element.impl;
import me.x150.coffee.feature.config.*;
import me.x150.coffee.feature.config.BooleanSetting;
import me.x150.coffee.feature.config.DoubleSetting;
import me.x150.coffee.feature.config.EnumSetting;
import me.x150.coffee.feature.config.ModuleConfig;
import me.x150.coffee.feature.config.SettingBase;
import me.x150.coffee.feature.config.StringSetting;
import me.x150.coffee.feature.gui.clickgui.ClickGUI;
import me.x150.coffee.feature.gui.clickgui.element.Element;
import me.x150.coffee.feature.gui.clickgui.element.impl.config.*;
import me.x150.coffee.feature.gui.clickgui.element.impl.config.BooleanSettingEditor;
import me.x150.coffee.feature.gui.clickgui.element.impl.config.ConfigBase;
import me.x150.coffee.feature.gui.clickgui.element.impl.config.DoubleSettingEditor;
import me.x150.coffee.feature.gui.clickgui.element.impl.config.EnumSettingEditor;
import me.x150.coffee.feature.gui.clickgui.element.impl.config.StringSettingEditor;
import me.x150.coffee.feature.gui.clickgui.theme.Theme;
import me.x150.coffee.helper.render.Renderer;
import me.x150.coffee.helper.util.Utils;
@ -14,11 +23,11 @@ import java.util.List;
import java.util.stream.Collectors;
public class ConfigDisplay extends Element {
final List<ConfigBase<?>> bases = new ArrayList<>();
final ModuleConfig mc;
final double padding = 4;
final double paddingLeft = 3;
long hoverStart = System.currentTimeMillis();
final List<ConfigBase<?>> bases = new ArrayList<>();
final ModuleConfig mc;
final double padding = 4;
final double paddingLeft = 3;
long hoverStart = System.currentTimeMillis();
boolean hoveredBefore = false;
public ConfigDisplay(double x, double y, ModuleConfig mc) {
@ -46,8 +55,7 @@ public class ConfigDisplay extends Element {
return bases.stream().filter(configBase -> configBase.getConfigValue().shouldShow()).collect(Collectors.toList());
}
@Override
public boolean clicked(double x, double y, int button) {
@Override public boolean clicked(double x, double y, int button) {
for (ConfigBase<?> basis : getBases()) {
if (basis.getConfigValue().shouldShow() && basis.clicked(x, y, button)) {
return true;
@ -56,8 +64,7 @@ public class ConfigDisplay extends Element {
return false;
}
@Override
public boolean dragged(double x, double y, double deltaX, double deltaY, int button) {
@Override public boolean dragged(double x, double y, double deltaX, double deltaY, int button) {
for (ConfigBase<?> basis : getBases()) {
if (basis.getConfigValue().shouldShow() && basis.dragged(x, y, deltaX, deltaY, button)) {
return true;
@ -66,8 +73,7 @@ public class ConfigDisplay extends Element {
return false;
}
@Override
public boolean released() {
@Override public boolean released() {
for (ConfigBase<?> basis : bases) {
if (basis.getConfigValue().shouldShow()) {
basis.released();
@ -76,8 +82,7 @@ public class ConfigDisplay extends Element {
return false;
}
@Override
public boolean keyPressed(int keycode, int modifiers) {
@Override public boolean keyPressed(int keycode, int modifiers) {
for (ConfigBase<?> basis : getBases()) {
if (basis.getConfigValue().shouldShow() && basis.keyPressed(keycode, modifiers)) {
return true;
@ -86,14 +91,12 @@ public class ConfigDisplay extends Element {
return false;
}
@Override
public double getHeight() {
@Override public double getHeight() {
this.height = 4 + getBases().stream().map(Element::getHeight).reduce(Double::sum).orElse(0d);
return super.getHeight();
}
@Override
public void render(MatrixStack matrices, double mouseX, double mouseY, double scrollBeingUsed) {
@Override public void render(MatrixStack matrices, double mouseX, double mouseY, double scrollBeingUsed) {
double yOffset = 2;
Theme theme = ClickGUI.theme;
double height = getHeight();
@ -124,16 +127,14 @@ public class ConfigDisplay extends Element {
}
}
@Override
public void tickAnim() {
@Override public void tickAnim() {
for (ConfigBase<?> basis : bases) {
basis.tickAnim();
}
}
@Override
public boolean charTyped(char c, int mods) {
@Override public boolean charTyped(char c, int mods) {
for (ConfigBase<?> basis : getBases()) {
if (basis.getConfigValue().shouldShow() && basis.charTyped(c, mods)) {
return true;

View file

@ -5,17 +5,19 @@ import me.x150.coffee.feature.gui.clickgui.element.Element;
import me.x150.coffee.feature.gui.clickgui.theme.Theme;
import me.x150.coffee.feature.module.Module;
import me.x150.coffee.helper.font.FontRenderers;
import me.x150.coffee.helper.render.ClipStack;
import me.x150.coffee.helper.render.Rectangle;
import me.x150.coffee.helper.render.Renderer;
import me.x150.coffee.helper.util.Utils;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.MathHelper;
public class ModuleDisplay extends Element {
final Module module;
final Module module;
final ConfigDisplay cd;
boolean extended = false;
double extendAnim = 0;
long hoverStart = System.currentTimeMillis();
boolean extended = false;
double extendAnim = 0;
long hoverStart = System.currentTimeMillis();
boolean hoveredBefore = false;
public ModuleDisplay(double x, double y, Module module) {
@ -24,8 +26,7 @@ public class ModuleDisplay extends Element {
this.cd = new ConfigDisplay(x, y, module.config);
}
@Override
public boolean clicked(double x, double y, int button) {
@Override public boolean clicked(double x, double y, int button) {
if (inBounds(x, y)) {
if (button == 0) {
module.setEnabled(!module.isEnabled()); // left click
@ -40,13 +41,11 @@ public class ModuleDisplay extends Element {
}
}
@Override
public boolean dragged(double x, double y, double deltaX, double deltaY, int button) {
@Override public boolean dragged(double x, double y, double deltaX, double deltaY, int button) {
return extended && cd.dragged(x, y, deltaX, deltaY, button);
}
@Override
public boolean released() {
@Override public boolean released() {
return extended && cd.released();
}
@ -55,18 +54,15 @@ public class ModuleDisplay extends Element {
}
@Override
public double getHeight() {
@Override public double getHeight() {
return super.getHeight() + cd.getHeight() * easeInOutCubic(extendAnim);
}
@Override
public boolean keyPressed(int keycode, int modifiers) {
@Override public boolean keyPressed(int keycode, int modifiers) {
return extended && cd.keyPressed(keycode, modifiers);
}
@Override
public void render(MatrixStack matrices, double mouseX, double mouseY, double scrollBeingUsed) {
@Override public void render(MatrixStack matrices, double mouseX, double mouseY, double scrollBeingUsed) {
Theme theme = ClickGUI.theme;
boolean hovered = inBounds(mouseX, mouseY);
@ -80,22 +76,22 @@ public class ModuleDisplay extends Element {
Renderer.R2D.renderQuad(matrices, hovered ? theme.getModule().darker() : theme.getModule(), x, y, x + width, y + height);
FontRenderers.getRenderer().drawCenteredString(matrices, module.getName(), x + width / 2d, y + height / 2d - FontRenderers.getRenderer().getMarginHeight() / 2d, 0xFFFFFF);
if (module.isEnabled()) {
// Renderer.R2D.renderQuad(matrices, theme.getAccent(), x, y, x + 1, y + height);
// Renderer.R2D.renderQuad(matrices, theme.getAccent(), x, y, x + 1, y + height);
double wid = 1.5;
Renderer.R2D.renderRoundedQuad(matrices, theme.getAccent(), x + 1, y + 1, x + 1 + wid, y + height - 1, wid / 2d, 6);
}
cd.setX(this.x);
cd.setY(this.y + height);
Renderer.R2D.beginScissor(matrices, x, y, x + width, y + getHeight());
ClipStack.globalInstance.addWindow(matrices, new Rectangle(x, y, x + width, y + getHeight()));
//Renderer.R2D.beginScissor(matrices, x, y, x + width, y + getHeight());
if (extendAnim > 0) {
cd.render(matrices, mouseX, mouseY, getHeight() - super.getHeight());
}
Renderer.R2D.endScissor();
//Renderer.R2D.endScissor();
ClipStack.globalInstance.popWindow(matrices);
}
@Override
public void tickAnim() {
@Override public void tickAnim() {
double a = 0.04;
if (!extended) {
a *= -1;
@ -105,8 +101,7 @@ public class ModuleDisplay extends Element {
cd.tickAnim();
}
@Override
public boolean charTyped(char c, int mods) {
@Override public boolean charTyped(char c, int mods) {
return extended && cd.charTyped(c, mods);
}
}

View file

@ -9,9 +9,9 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.MathHelper;
public class BooleanSettingEditor extends ConfigBase<BooleanSetting> {
final double rw = 14;
final double rh = 5;
final double rid = 4;
final double rw = 14;
final double rh = 5;
final double rid = 4;
final double margin = .5;
double animProgress = 0;
@ -19,18 +19,15 @@ public class BooleanSettingEditor extends ConfigBase<BooleanSetting> {
super(x, y, width, FontRenderers.getRenderer().getFontHeight() + 2, configValue);
}
@Override
public boolean dragged(double x, double y, double deltaX, double deltaY, int button) {
@Override public boolean dragged(double x, double y, double deltaX, double deltaY, int button) {
return false;
}
@Override
public boolean released() {
@Override public boolean released() {
return false;
}
@Override
public boolean clicked(double x, double y, int button) {
@Override public boolean clicked(double x, double y, int button) {
// System.out.println(x+", "+y+", "+button);
if (inBounds(x, y) && button == 0) {
// System.out.println("clicked");
@ -49,13 +46,11 @@ public class BooleanSettingEditor extends ConfigBase<BooleanSetting> {
// double xSmooth = -1;
@Override
public boolean keyPressed(int keycode, int modifiers) {
@Override public boolean keyPressed(int keycode, int modifiers) {
return false;
}
@Override
public void render(MatrixStack matrices, double mouseX, double mouseY, double scrollBeingUsed) {
@Override public void render(MatrixStack matrices, double mouseX, double mouseY, double scrollBeingUsed) {
Theme theme = ClickGUI.theme;
double smoothAnimProgress = easeInOutCubic(animProgress);
Renderer.R2D.renderRoundedQuad(matrices, Renderer.Util.lerp(theme.getActive(), theme.getInactive(), smoothAnimProgress), x, y + height / 2d - rh / 2d, x + rw, y + height / 2d + rh / 2d, rh / 2d, 5);
@ -71,8 +66,7 @@ public class BooleanSettingEditor extends ConfigBase<BooleanSetting> {
}
@Override
public void tickAnim() {
@Override public void tickAnim() {
double a = 0.03;
if (!configValue.getValue()) {
a *= -1;
@ -81,8 +75,7 @@ public class BooleanSettingEditor extends ConfigBase<BooleanSetting> {
animProgress = MathHelper.clamp(animProgress, 0, 1);
}
@Override
public boolean charTyped(char c, int mods) {
@Override public boolean charTyped(char c, int mods) {
return false;
}
}

View file

@ -23,8 +23,7 @@ public class DoubleSettingEditor extends ConfigBase<DoubleSetting> {
configValue.setValue(Utils.Math.roundToDecimal(perIn * (configValue.getMax() - configValue.getMin()) + configValue.getMin(), configValue.getPrecision()));
}
@Override
public boolean clicked(double x, double y, int button) {
@Override public boolean clicked(double x, double y, int button) {
if (inBounds(x, y)) {
clicked = true;
if (button == 0) {
@ -35,22 +34,19 @@ public class DoubleSettingEditor extends ConfigBase<DoubleSetting> {
return false;
}
@Override
public boolean dragged(double x, double y, double deltaX, double deltaY, int button) {
@Override public boolean dragged(double x, double y, double deltaX, double deltaY, int button) {
if (clicked) {
handleClick(x);
}
return false;
}
@Override
public boolean released() {
@Override public boolean released() {
clicked = false;
return false;
}
@Override
public boolean keyPressed(int keycode, int modifiers) {
@Override public boolean keyPressed(int keycode, int modifiers) {
return false;
}
@ -58,8 +54,7 @@ public class DoubleSettingEditor extends ConfigBase<DoubleSetting> {
return MathHelper.clamp((configValue.getValue() - configValue.getMin()) / (configValue.getMax() - configValue.getMin()), 0, 1);
}
@Override
public void render(MatrixStack matrices, double mouseX, double mouseY, double scrollBeingUsed) {
@Override public void render(MatrixStack matrices, double mouseX, double mouseY, double scrollBeingUsed) {
Theme theme = ClickGUI.theme;
FontRenderers.getRenderer().drawString(matrices, configValue.name, x, y, 0xFFFFFF);
String t = configValue.getValue().toString();
@ -71,13 +66,11 @@ public class DoubleSettingEditor extends ConfigBase<DoubleSetting> {
Renderer.R2D.renderCircle(matrices, theme.getAccent(), x + width * getPer(), h + 9 / 2d, 2, 10);
}
@Override
public void tickAnim() {
@Override public void tickAnim() {
}
@Override
public boolean charTyped(char c, int mods) {
@Override public boolean charTyped(char c, int mods) {
return false;
}
}

View file

@ -7,13 +7,13 @@ import me.x150.coffee.helper.font.FontRenderers;
import me.x150.coffee.helper.render.Renderer;
import net.minecraft.client.util.math.MatrixStack;
import java.awt.*;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
public class EnumSettingEditor extends ConfigBase<EnumSetting<?>> {
static Color idk2 = new Color(0, 0, 20, 60);
final List<EnumSelectorClickable<?>> values = new ArrayList<>();
static Color idk2 = new Color(0, 0, 20, 60);
final List<EnumSelectorClickable<?>> values = new ArrayList<>();
public EnumSettingEditor(double x, double y, double width, EnumSetting<?> configValue) {
super(x, y, width, 0, configValue);
@ -31,8 +31,7 @@ public class EnumSettingEditor extends ConfigBase<EnumSetting<?>> {
return configValue.getValue().equals(value) ? theme.getActive().getRGB() : theme.getInactive().getRGB();
}
@Override
public boolean clicked(double x, double y, int button) {
@Override public boolean clicked(double x, double y, int button) {
if (inBounds(x, y)) {
for (EnumSelectorClickable<?> value : values) {
if (value.inBounds(x, y)) {
@ -44,23 +43,19 @@ public class EnumSettingEditor extends ConfigBase<EnumSetting<?>> {
return false;
}
@Override
public boolean dragged(double x, double y, double deltaX, double deltaY, int button) {
@Override public boolean dragged(double x, double y, double deltaX, double deltaY, int button) {
return false;
}
@Override
public boolean released() {
@Override public boolean released() {
return false;
}
@Override
public boolean keyPressed(int keycode, int modifiers) {
@Override public boolean keyPressed(int keycode, int modifiers) {
return false;
}
@Override
public void render(MatrixStack matrices, double mouseX, double mouseY, double scrollBeingUsed) {
@Override public void render(MatrixStack matrices, double mouseX, double mouseY, double scrollBeingUsed) {
double pad = 0;
FontRenderers.getRenderer().drawString(matrices, configValue.name, x, y + 1, 0xFFFFFF);
double yOffset = FontRenderers.getRenderer().getMarginHeight() + 2;
@ -77,20 +72,18 @@ public class EnumSettingEditor extends ConfigBase<EnumSetting<?>> {
this.height = yOffset + pad;
}
@Override
public void tickAnim() {
@Override public void tickAnim() {
}
@Override
public boolean charTyped(char c, int mods) {
@Override public boolean charTyped(char c, int mods) {
return false;
}
static class EnumSelectorClickable<T extends Enum<?>> {
final EnumSettingEditor instance;
final double height;
final T value;
final double height;
final T value;
double x;
double y;
double width;

View file

@ -17,41 +17,34 @@ public class StringSettingEditor extends ConfigBase<StringSetting> {
this.height = h + FontRenderers.getRenderer().getMarginHeight() + 1;
}
@Override
public boolean clicked(double x, double y, int button) {
@Override public boolean clicked(double x, double y, int button) {
return input.mouseClicked(x, y, button);
}
@Override
public boolean dragged(double x, double y, double deltaX, double deltaY, int button) {
@Override public boolean dragged(double x, double y, double deltaX, double deltaY, int button) {
return false;
}
@Override
public boolean released() {
@Override public boolean released() {
return false;
}
@Override
public boolean keyPressed(int keycode, int modifiers) {
@Override public boolean keyPressed(int keycode, int modifiers) {
return input.keyPressed(keycode, 0, modifiers);
}
@Override
public void render(MatrixStack matrices, double mouseX, double mouseY, double scrollBeingUsed) {
@Override public void render(MatrixStack matrices, double mouseX, double mouseY, double scrollBeingUsed) {
FontRenderers.getRenderer().drawString(matrices, configValue.getName(), x, y, 0xFFFFFF);
input.setX(x);
input.setY(y + FontRenderers.getRenderer().getFontHeight());
input.render(matrices, (int) mouseX, (int) mouseY, 0);
}
@Override
public void tickAnim() {
@Override public void tickAnim() {
}
@Override
public boolean charTyped(char c, int mods) {
@Override public boolean charTyped(char c, int mods) {
return input.charTyped(c, mods);
}
}

View file

@ -1,6 +1,6 @@
package me.x150.coffee.feature.gui.clickgui.theme;
import java.awt.*;
import java.awt.Color;
public interface Theme {
String getName();

View file

@ -2,49 +2,42 @@ package me.x150.coffee.feature.gui.clickgui.theme.impl;
import me.x150.coffee.feature.gui.clickgui.theme.Theme;
import java.awt.*;
import java.awt.Color;
public class SipoverV1 implements Theme {
static final Color accent = new Color(0x3AD99D);
static final Color header = new Color(0xFF1D2525, true);
static final Color module = new Color(0xFF171E1F, true);
static final Color config = new Color(0xFF111A1A, true);
static final Color active = new Color(21, 157, 204, 255);
static final Color accent = new Color(0x3AD99D);
static final Color header = new Color(0xFF1D2525, true);
static final Color module = new Color(0xFF171E1F, true);
static final Color config = new Color(0xFF111A1A, true);
static final Color active = new Color(21, 157, 204, 255);
static final Color inactive = new Color(66, 66, 66, 255);
@Override
public String getName() {
@Override public String getName() {
return "Sipover V1";
}
@Override
public Color getAccent() {
@Override public Color getAccent() {
return accent;
}
@Override
public Color getHeader() {
@Override public Color getHeader() {
return header;
}
@Override
public Color getModule() {
@Override public Color getModule() {
return module;
}
@Override
public Color getConfig() {
@Override public Color getConfig() {
return config;
}
@Override
public Color getActive() {
@Override public Color getActive() {
return active;
}
@Override
public Color getInactive() {
@Override public Color getInactive() {
return inactive;
}
}

View file

@ -24,15 +24,15 @@ import java.util.List;
public class HudRenderer {
static final File CONFIG = new File(CoffeeClientMain.BASE, "hud.sip");
private static HudRenderer INSTANCE;
final List<HudElement> elements = register();
boolean isEditing = false;
static final File CONFIG = new File(CoffeeClientMain.BASE, "hud.sip");
private static HudRenderer INSTANCE;
final List<HudElement> elements = register();
boolean isEditing = false;
boolean mouseHeldDown = false;
double prevX = Utils.Mouse.getMouseX();
double prevY = Utils.Mouse.getMouseY();
double prevWX = CoffeeClientMain.client.getWindow().getScaledWidth();
double prevWY = CoffeeClientMain.client.getWindow().getScaledHeight();
double prevX = Utils.Mouse.getMouseX();
double prevY = Utils.Mouse.getMouseY();
double prevWX = CoffeeClientMain.client.getWindow().getScaledWidth();
double prevWY = CoffeeClientMain.client.getWindow().getScaledHeight();
private HudRenderer() {
Events.registerEventHandler(EventType.MOUSE_EVENT, event -> {
@ -92,8 +92,7 @@ public class HudRenderer {
}
}
@SuppressWarnings("ResultOfMethodCallIgnored")
void loadConfig() {
@SuppressWarnings("ResultOfMethodCallIgnored") void loadConfig() {
CoffeeClientMain.log(Level.INFO, "Loading hud");
if (!CONFIG.isFile()) {
CONFIG.delete();

View file

@ -6,14 +6,14 @@ import me.x150.coffee.helper.render.Renderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.MathHelper;
import java.awt.*;
import java.awt.Color;
public abstract class HudElement {
static final MatrixStack stack = new MatrixStack();
final double width;
final double height;
final String id;
final double width;
final double height;
final String id;
double posX, posY;
boolean selected = false;

View file

@ -16,14 +16,13 @@ import java.util.Objects;
public class SpeedHud extends HudElement {
List<Double> speedSaved = new ArrayList<>();
Timer update = new Timer();
Timer update = new Timer();
public SpeedHud() {
super("Speed", CoffeeClientMain.client.getWindow().getScaledWidth() / 2d - 160 / 2d, CoffeeClientMain.client.getWindow().getScaledHeight() - 40 - 64, 160, 64);
}
@Override
public void renderIntern(MatrixStack stack) {
@Override public void renderIntern(MatrixStack stack) {
if (ModuleRegistry.getByClass(Hud.class).speed.getValue()) {
MSAAFramebuffer.use(MSAAFramebuffer.MAX_SAMPLES, () -> {
double size = speedSaved.size();
@ -40,11 +39,7 @@ public class SpeedHud extends HudElement {
double previous = height - ((speeds.get(0) - min) / max) * height;
for (int i = 1; i < speeds.size(); i++) {
double ppr = Math.sin(
Math.toRadians(
((double) i / speeds.size() + (System.currentTimeMillis() % 3000) / -3000d) * 360 * 3
)
) + 1;
double ppr = Math.sin(Math.toRadians(((double) i / speeds.size() + (System.currentTimeMillis() % 3000) / -3000d) * 360 * 3)) + 1;
ppr /= 2d;
double aDouble = speeds.get(i);
double prog = ((aDouble - min) / max);
@ -60,13 +55,14 @@ public class SpeedHud extends HudElement {
}
}
@Override
public void fastTick() {
@Override public void fastTick() {
if (update.hasExpired(50)) { // update when velocity gets updated
double speedCombined = CoffeeClientMain.client.player.getVelocity().length();
double last = speedSaved.isEmpty() ? speedCombined : speedSaved.get(speedSaved.size() - 1);
speedSaved.add((speedCombined + last) / 2d);
while (speedSaved.size() > 50) speedSaved.remove(0);
while (speedSaved.size() > 50) {
speedSaved.remove(0);
}
update.reset();
}
super.fastTick();

View file

@ -13,8 +13,7 @@ public class Taco extends HudElement {
super("Taco", 0, CoffeeClientMain.client.getWindow().getScaledHeight(), 100, 100);
}
@Override
public void renderIntern(MatrixStack stack) {
@Override public void renderIntern(MatrixStack stack) {
if (!me.x150.coffee.feature.command.impl.Taco.config.enabled) {
return;
}

View file

@ -13,8 +13,7 @@ public class TargetHUD extends HudElement {
.getScaledHeight() / 2f + 10, TargetHud.modalWidth, TargetHud.modalHeight);
}
@Override
public void renderIntern(MatrixStack stack) {
@Override public void renderIntern(MatrixStack stack) {
MSAAFramebuffer.use(MSAAFramebuffer.MAX_SAMPLES, () -> {
ModuleRegistry.getByClass(TargetHud.class).draw(stack);
});

View file

@ -8,23 +8,23 @@ package me.x150.coffee.feature.gui.notifications;
import me.x150.coffee.helper.Texture;
import me.x150.coffee.helper.font.FontRenderers;
import java.awt.*;
import java.awt.Color;
import java.util.ArrayList;
import java.util.List;
public class Notification {
public final String title;
public final long creationDate;
public String[] contents;
public long duration;
public double posX;
public double posY;
public double renderPosX = 0;
public double renderPosY = 0;
public double animationProgress = 0;
public double animationGoal = 0;
public boolean shouldDoAnimation = false;
public Type type;
public final String title;
public final long creationDate;
public String[] contents;
public long duration;
public double posX;
public double posY;
public double renderPosX = 0;
public double renderPosY = 0;
public double animationProgress = 0;
public double animationGoal = 0;
public boolean shouldDoAnimation = false;
public Type type;
public Notification(long duration, String title, Type type, String... contents) {
this.duration = duration;
@ -64,8 +64,7 @@ public class Notification {
return create(duration, title, false, type, contents);
}
@SuppressWarnings("UnusedReturnValue")
public static Notification create(long duration, String title, Type type, String split) {
@SuppressWarnings("UnusedReturnValue") public static Notification create(long duration, String title, Type type, String split) {
List<String> splitContent = new ArrayList<>();
StringBuilder line = new StringBuilder();
for (String c : split.split(" +")) {
@ -80,11 +79,9 @@ public class Notification {
}
public enum Type {
SUCCESS(new Texture("notif/success.png"), new Color(58, 223, 118)),
INFO(new Texture("notif/info.png"), new Color(39, 186, 253)),
WARNING(new Texture("notif/warning.png"), new Color(255, 189, 17)),
ERROR(new Texture("notif/error.png"), new Color(254, 92, 92));
Color c;
SUCCESS(new Texture("notif/success.png"), new Color(58, 223, 118)), INFO(new Texture("notif/info.png"), new Color(39, 186, 253)),
WARNING(new Texture("notif/warning.png"), new Color(255, 189, 17)), ERROR(new Texture("notif/error.png"), new Color(254, 92, 92));
Color c;
Texture i;
Type(Texture icon, Color color) {

View file

@ -9,22 +9,24 @@ import com.mojang.blaze3d.systems.RenderSystem;
import me.x150.coffee.CoffeeClientMain;
import me.x150.coffee.feature.gui.clickgui.ClickGUI;
import me.x150.coffee.helper.font.FontRenderers;
import me.x150.coffee.helper.render.ClipStack;
import me.x150.coffee.helper.render.Rectangle;
import me.x150.coffee.helper.render.Renderer;
import me.x150.coffee.helper.util.Transitions;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.MathHelper;
import java.awt.*;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
public class NotificationRenderer {
public static final List<Notification> notifications = new ArrayList<>();
public static final List<Notification> notifications = new ArrayList<>();
public static final List<Notification> topBarNotifications = new ArrayList<>();
static Color topBg = new Color(28, 28, 28, 200);
static Color rightBg = new Color(28, 28, 28);
static Color topBg = new Color(28, 28, 28, 200);
static Color rightBg = new Color(28, 28, 28);
public static void render() {
renderSide();
@ -87,7 +89,8 @@ public class NotificationRenderer {
float width = FontRenderers.getRenderer().getStringWidth(contents) + 5;
width = width / 2f;
width = Math.max(minWidth, width);
Renderer.R2D.beginScissor(Renderer.R3D.getEmptyMatrixStack(), notification.renderPosX - width * notification.animationProgress, notification.renderPosY, notification.renderPosX + width * notification.animationProgress + 1, notification.renderPosY + height + 1);
ClipStack.globalInstance.addWindow(Renderer.R3D.getEmptyMatrixStack(), new Rectangle(notification.renderPosX - width * notification.animationProgress, notification.renderPosY, notification.renderPosX + width * notification.animationProgress + 1, notification.renderPosY + height + 1));
//Renderer.R2D.beginScissor(Renderer.R3D.getEmptyMatrixStack(), notification.renderPosX - width * notification.animationProgress, notification.renderPosY, notification.renderPosX + width * notification.animationProgress + 1, notification.renderPosY + height + 1);
Renderer.R2D.renderQuad(ms, topBg, notification.renderPosX - width, notification.renderPosY, notification.renderPosX + width + 1, notification.renderPosY + height);
FontRenderers.getRenderer().drawCenteredString(ms, contents, notification.renderPosX, notification.renderPosY + height / 2f - FontRenderers.getRenderer().getFontHeight() / 2f, 0xFFFFFF);
double timeRemainingInv = 1 - timeRemaining;
@ -104,7 +107,8 @@ public class NotificationRenderer {
Renderer.R2D.renderQuad(ms, ClickGUI.theme.getActive(), notification.renderPosX - width, notification.renderPosY + height - 1, notification.renderPosX + width + 1, notification.renderPosY + height);
Renderer.R2D.renderQuad(ms, ClickGUI.theme.getAccent(), notification.renderPosX - width, notification.renderPosY + height - 1, notification.renderPosX - width + ((width + 1) * 2 * timeRemainingInv), notification.renderPosY + height);
}
Renderer.R2D.endScissor();
ClipStack.globalInstance.popWindow(Renderer.R3D.getEmptyMatrixStack());
//Renderer.R2D.endScissor();
currentYOffset += height + 3;
}
}
@ -116,8 +120,8 @@ public class NotificationRenderer {
int baseY = CoffeeClientMain.client.getWindow().getScaledHeight() - 10;
long c = System.currentTimeMillis();
for (Notification notification : new ArrayList<>(notifications)) {
// double timeRemaining = Math.abs(c - notification.creationDate - notification.duration) / (double) notification.duration;
// timeRemaining = MathHelper.clamp(timeRemaining, 0, 1);
// double timeRemaining = Math.abs(c - notification.creationDate - notification.duration) / (double) notification.duration;
// timeRemaining = MathHelper.clamp(timeRemaining, 0, 1);
boolean notificationExpired = notification.creationDate + notification.duration < c;
int notifHeight = (int) (2 + ((notification.contents.length + (notification.title.isEmpty() ? 0 : 1)) * FontRenderers.getRenderer().getFontHeight()));
notifHeight = Math.max(notifHeight, 32);

View file

@ -16,7 +16,9 @@ import me.x150.coffee.helper.Texture;
import me.x150.coffee.helper.font.FontRenderers;
import me.x150.coffee.helper.font.adapter.FontAdapter;
import me.x150.coffee.helper.font.adapter.impl.ClientFontRenderer;
import me.x150.coffee.helper.render.ClipStack;
import me.x150.coffee.helper.render.MSAAFramebuffer;
import me.x150.coffee.helper.render.Rectangle;
import me.x150.coffee.helper.render.Renderer;
import me.x150.coffee.helper.util.Transitions;
import me.x150.coffee.mixin.IMinecraftClientAccessor;
@ -36,7 +38,7 @@ import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL40C;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.Color;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
@ -46,39 +48,45 @@ import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.*;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;
public class AltManagerScreen extends ClientScreen implements FastTickable {
public static final Map<UUID, Texture> texCache = new HashMap<>();
static final File ALTS_FILE = new File(CoffeeClientMain.BASE, "alts.sip");
static final String TOP_NOTE = """
public static final Map<UUID, Texture> texCache = new HashMap<>();
static final File ALTS_FILE = new File(CoffeeClientMain.BASE, "alts.sip");
static final String TOP_NOTE = """
// DO NOT SHARE THIS FILE
// This file contains sensitive information about your accounts
// Unless you REALLY KNOW WHAT YOU ARE DOING, DO NOT SEND THIS TO ANYONE
""";
static final HttpClient downloader = HttpClient.newHttpClient();
static Color bg = new Color(20, 20, 20);
static Color pillColor = new Color(40, 40, 40, 100);
static Color widgetColor = new Color(40, 40, 40);
static Color backgroundOverlay = new Color(0, 0, 0, 130);
static Color overlayBackground = new Color(30, 30, 30);
private static AltManagerScreen instance = null;
final List<AltContainer> alts = new ArrayList<>();
final double leftWidth = 200;
final ClientFontRenderer titleSmall = FontRenderers.getCustomSize(30);
final ClientFontRenderer title = FontRenderers.getCustomSize(40);
final AtomicBoolean isLoggingIn = new AtomicBoolean(false);
static final HttpClient downloader = HttpClient.newHttpClient();
static Color bg = new Color(20, 20, 20);
static Color pillColor = new Color(40, 40, 40, 100);
static Color widgetColor = new Color(40, 40, 40);
static Color backgroundOverlay = new Color(0, 0, 0, 130);
static Color overlayBackground = new Color(30, 30, 30);
private static AltManagerScreen instance = null;
final List<AltContainer> alts = new ArrayList<>();
final double leftWidth = 200;
final ClientFontRenderer titleSmall = FontRenderers.getCustomSize(30);
final ClientFontRenderer title = FontRenderers.getCustomSize(40);
final AtomicBoolean isLoggingIn = new AtomicBoolean(false);
AltContainer selectedAlt;
ThemedButton add, exit, remove, tags, login, session, censorMail;
RoundTextFieldWidget search;
boolean censorEmail = true;
double scroll = 0;
double scrollSmooth = 0;
Texture currentAccountTexture = new Texture("dynamic/currentaccount");
boolean currentAccountTextureLoaded = false;
boolean censorEmail = true;
double scroll = 0;
double scrollSmooth = 0;
Texture currentAccountTexture = new Texture("dynamic/currentaccount");
boolean currentAccountTextureLoaded = false;
private AltManagerScreen() {
super(MSAAFramebuffer.MAX_SAMPLES);
@ -94,7 +102,9 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
}
public List<AltContainer> getAlts() {
return alts.stream().filter(altContainer -> altContainer.storage.cachedName.toLowerCase().startsWith(search.get().toLowerCase()) || Arrays.stream(altContainer.storage.tags.split(",")).map(String::trim).filter(s -> !s.isEmpty()).anyMatch(s -> s.toLowerCase().startsWith(search.get().toLowerCase()))).collect(Collectors.toList());
return alts.stream()
.filter(altContainer -> altContainer.storage.cachedName.toLowerCase().startsWith(search.get().toLowerCase()) || Arrays.stream(altContainer.storage.tags.split(",")).map(String::trim)
.filter(s -> !s.isEmpty()).anyMatch(s -> s.toLowerCase().startsWith(search.get().toLowerCase()))).collect(Collectors.toList());
}
void saveAlts() {
@ -121,14 +131,12 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
}
}
@Override
public void onClose() {
@Override public void onClose() {
super.onClose();
saveAlts();
}
@SuppressWarnings("ResultOfMethodCallIgnored")
void loadAlts() {
@SuppressWarnings("ResultOfMethodCallIgnored") void loadAlts() {
CoffeeClientMain.log(Level.INFO, "Loading alts");
if (!ALTS_FILE.isFile()) {
@ -144,7 +152,8 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
for (JsonElement jsonElement : ja) {
JsonObject jo = jsonElement.getAsJsonObject();
try {
AltStorage container = new AltStorage(jo.get("cachedUsername").getAsString(), jo.get("email").getAsString(), jo.get("password").getAsString(), UUID.fromString(jo.get("cachedUUID").getAsString()), AddScreenOverlay.AccountType.valueOf(jo.get("type").getAsString()), jo.get("tags") == null ? "" : jo.get("tags").getAsString());
AltStorage container = new AltStorage(jo.get("cachedUsername").getAsString(), jo.get("email").getAsString(), jo.get("password").getAsString(), UUID.fromString(jo.get("cachedUUID")
.getAsString()), AddScreenOverlay.AccountType.valueOf(jo.get("type").getAsString()), jo.get("tags") == null ? "" : jo.get("tags").getAsString());
container.valid = !jo.has("valid") || jo.get("valid").getAsBoolean();
AltContainer ac = new AltContainer(0, 0, 0, container);
ac.renderY = ac.renderX = -1;
@ -177,8 +186,7 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
censorMail.text = censorEmail ? "Show email" : "Hide email";
}
@Override
protected void init() {
@Override protected void init() {
search = new RoundTextFieldWidget(width - 200 - 5 - 100 - 5 - 60 - 5 - 20 - getPadding(), 10 + title.getMarginHeight() / 2d - 20 / 2d, 200, 20, "Search");
addDrawableChild(search);
censorMail = new ThemedButton(width - 100 - 5 - 60 - 5 - 20 - getPadding(), 10 + title.getMarginHeight() / 2d - 20 / 2d, 100, 20, "Show email", this::toggleCensor);
@ -240,7 +248,9 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
}
void login() {
if (this.selectedAlt == null) return;
if (this.selectedAlt == null) {
return;
}
isLoggingIn.set(true);
new Thread(() -> {
this.selectedAlt.login();
@ -255,13 +265,14 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
}
void remove() {
if (this.selectedAlt == null) return;
if (this.selectedAlt == null) {
return;
}
alts.remove(this.selectedAlt);
this.selectedAlt = null;
}
@Override
public void onFastTick() {
@Override public void onFastTick() {
for (AltContainer alt : getAlts()) {
alt.tickAnim();
}
@ -275,8 +286,7 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
scrollSmooth = Transitions.transition(scrollSmooth, scroll, 7, 0);
}
@Override
public boolean mouseScrolled(double mouseX, double mouseY, double amount) {
@Override public boolean mouseScrolled(double mouseX, double mouseY, double amount) {
scroll -= amount * 10;
double max = 0;
for (AltContainer alt : getAlts()) {
@ -289,8 +299,7 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
return super.mouseScrolled(mouseX, mouseY, amount);
}
@Override
public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) {
@Override public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) {
Renderer.R2D.renderQuad(stack, bg, 0, 0, width, height);
title.drawString(stack, "Coffee", 10, 10, 0xFFFFFF, false);
titleSmall.drawString(stack, "Alt manager", 10 + title.getStringWidth("Coffee") + 5, 10 + title.getMarginHeight() - titleSmall.getMarginHeight() - 1, 0xFFFFFF, false);
@ -298,7 +307,8 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
add.render(stack, mouseX, mouseY);
exit.render(stack, mouseX, mouseY);
Renderer.R2D.beginScissor(stack, getPadding(), getHeaderHeight(), getPadding() + (width - (getPadding() + leftWidth + getPadding() * 2)), height);
ClipStack.globalInstance.addWindow(stack, new Rectangle(getPadding(), getHeaderHeight(), getPadding() + (width - (getPadding() + leftWidth + getPadding() * 2)), height));
//Renderer.R2D.beginScissor(stack, getPadding(), getHeaderHeight(), getPadding() + (width - (getPadding() + leftWidth + getPadding() * 2)), height);
stack.push();
stack.translate(0, -scrollSmooth, 0);
mouseY += scrollSmooth;
@ -309,13 +319,18 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
alt.x = x;
alt.y = y;
alt.width = wid;
if (alt.renderX == -1) alt.renderX = -alt.width;
if (alt.renderY == -1) alt.renderY = alt.y;
if (alt.renderX == -1) {
alt.renderX = -alt.width;
}
if (alt.renderY == -1) {
alt.renderY = alt.y;
}
alt.render(stack, mouseX, mouseY);
y += alt.getHeight() + getPadding();
}
stack.pop();
Renderer.R2D.endScissor();
ClipStack.globalInstance.popWindow(stack);
//Renderer.R2D.endScissor();
double padding = 5;
double widRHeight = 64 + padding * 2;
@ -358,8 +373,7 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
AltContainer.PropEntry[] props = new AltContainer.PropEntry[]{
new AltContainer.PropEntry(this.selectedAlt.storage.type == AddScreenOverlay.AccountType.CRACKED ? this.selectedAlt.storage.email : this.selectedAlt.storage.cachedName, FontRenderers.getCustomSize(22), this.selectedAlt.storage.valid ? 0xFFFFFF : 0xFF3333),
new AltContainer.PropEntry(mail, FontRenderers.getRenderer(), 0xAAAAAA),
new AltContainer.PropEntry("Type: " + this.selectedAlt.storage.type.s, FontRenderers.getRenderer(), 0xAAAAAA)
};
new AltContainer.PropEntry("Type: " + this.selectedAlt.storage.type.s, FontRenderers.getRenderer(), 0xAAAAAA)};
float propsOffset = (float) (fromY + padding);
for (AltContainer.PropEntry prop : props) {
@ -386,9 +400,11 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
RenderSystem.blendFunc(GL40C.GL_DST_ALPHA, GL40C.GL_ONE_MINUS_DST_ALPHA);
RenderSystem.setShaderTexture(0, currentAccountTextureLoaded ? currentAccountTexture : DefaultSkinHelper.getTexture());
if (currentAccountTextureLoaded)
if (currentAccountTextureLoaded) {
Renderer.R2D.renderTexture(stack, fromX + padding, fromY + padding, texDim, texDim, 0, 0, 64, 64, 64, 64);
else Renderer.R2D.renderTexture(stack, fromX + padding, fromY + padding, texDim, texDim, 8, 8, 8, 8, 64, 64);
} else {
Renderer.R2D.renderTexture(stack, fromX + padding, fromY + padding, texDim, texDim, 8, 8, 8, 8, 64, 64);
}
RenderSystem.defaultBlendFunc();
String uuid = CoffeeClientMain.client.getSession().getUuid();
double uuidWid = FontRenderers.getRenderer().getStringWidth(uuid);
@ -410,10 +426,11 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
super.renderInternal(stack, mouseX, mouseY, delta);
}
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
@Override public boolean mouseClicked(double mouseX, double mouseY, int button) {
censorMail.clicked(mouseX, mouseY);
if (isLoggingIn.get()) return false;
if (isLoggingIn.get()) {
return false;
}
add.clicked(mouseX, mouseY);
exit.clicked(mouseX, mouseY);
if (this.selectedAlt != null) {
@ -431,14 +448,14 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
static class ThemedButton {
final Runnable onPress;
final double width;
final double height;
String text;
double x;
double y;
double animProgress = 0;
boolean isHovered = false;
boolean enabled = true;
final double width;
final double height;
String text;
double x;
double y;
double animProgress = 0;
boolean isHovered = false;
boolean enabled = true;
public ThemedButton(double x, double y, double w, double h, String t, Runnable a) {
@ -485,7 +502,8 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
double originX = -width / 2d;
double originY = -height / 2d;
Renderer.R2D.renderRoundedQuad(matrices, widgetColor, originX, originY, width / 2d, height / 2d, 5, 20);
FontRenderers.getRenderer().drawString(matrices, text, -(FontRenderers.getRenderer().getStringWidth(text) + 2) / 2f, -FontRenderers.getRenderer().getMarginHeight() / 2f, isEnabled() ? 0xFFFFFF : 0xAAAAAA, false);
FontRenderers.getRenderer().drawString(matrices, text, -(FontRenderers.getRenderer().getStringWidth(text) + 2) / 2f, -FontRenderers.getRenderer()
.getMarginHeight() / 2f, isEnabled() ? 0xFFFFFF : 0xAAAAAA, false);
matrices.pop();
}
@ -497,14 +515,14 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
}
static class AltStorage {
final String email;
final String password;
final String email;
final String password;
final AddScreenOverlay.AccountType type;
String tags;
String cachedName;
String accessToken;
UUID cachedUuid;
boolean valid = true;
String tags;
String cachedName;
String accessToken;
UUID cachedUuid;
boolean valid = true;
boolean didLogin = false;
public AltStorage(String n, String e, String p, UUID u, AddScreenOverlay.AccountType type, String tags) {
@ -518,12 +536,12 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
}
static class SessionEditor extends ClientScreen {
static final double widgetWid = 300;
static double widgetHei = 0;
final Session session;
final ClientScreen parent;
final double padding = 5;
final ClientFontRenderer title = FontRenderers.getCustomSize(40);
static final double widgetWid = 300;
static double widgetHei = 0;
final Session session;
final ClientScreen parent;
final double padding = 5;
final ClientFontRenderer title = FontRenderers.getCustomSize(40);
RoundTextFieldWidget access, name, uuid;
RoundButton save;
@ -533,8 +551,7 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
this.parent = parent;
}
@Override
protected void init() {
@Override protected void init() {
RoundButton exit = new RoundButton(widgetColor, width - 20 - 5, 5, 20, 20, "X", () -> Objects.requireNonNull(client).setScreen(parent));
addDrawableChild(exit);
double y = height / 2d - widgetHei / 2d + padding + title.getMarginHeight() + FontRenderers.getRenderer().getMarginHeight() + padding;
@ -567,8 +584,7 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
super.init();
}
@Override
public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) {
@Override public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) {
if (parent != null) {
parent.renderInternal(stack, mouseX, mouseY, delta);
}
@ -602,8 +618,7 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
super.renderInternal(stack, mouseX, mouseY, delta);
}
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
@Override public boolean mouseClicked(double mouseX, double mouseY, int button) {
for (Element child : children()) {
child.mouseClicked(-1, -1, button);
}
@ -612,12 +627,12 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
}
class TagEditor extends ClientScreen implements FastTickable {
List<ThemedButton> tags = new ArrayList<>();
List<ThemedButton> tags = new ArrayList<>();
RoundTextFieldWidget tagName;
RoundButton add;
double widgetWidth = 300;
double widgetHeight = 0;
double widgetStartX, widgetStartY;
RoundButton add;
double widgetWidth = 300;
double widgetHeight = 0;
double widgetStartX, widgetStartY;
Screen parent;
public TagEditor(Screen parent) {
@ -625,16 +640,14 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
this.parent = parent;
}
@Override
public void onFastTick() {
@Override public void onFastTick() {
for (ThemedButton tag : tags) {
tag.tickAnim();
}
add.onFastTick();
}
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
@Override public boolean mouseClicked(double mouseX, double mouseY, int button) {
for (ThemedButton tag : new ArrayList<>(tags)) {
tag.clicked(mouseX, mouseY);
}
@ -643,20 +656,17 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
return super.mouseClicked(mouseX, mouseY, button);
}
@Override
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
@Override public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
tagName.keyPressed(keyCode, scanCode, modifiers);
return super.keyPressed(keyCode, scanCode, modifiers);
}
@Override
public boolean charTyped(char chr, int modifiers) {
@Override public boolean charTyped(char chr, int modifiers) {
tagName.charTyped(chr, modifiers);
return super.charTyped(chr, modifiers);
}
@Override
protected void init() {
@Override protected void init() {
RoundButton exit = new RoundButton(RoundButton.STANDARD, width - 20 - 5, 5, 20, 20, "X", this::onClose);
addDrawableChild(exit);
this.tags.clear();
@ -667,7 +677,9 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
double padding = 5;
List<String> parsedTags = new ArrayList<>(Arrays.stream(tags.split(",")).map(String::trim).filter(s -> !s.isEmpty()).toList());
for (String s : parsedTags) {
if (s.isEmpty()) continue;
if (s.isEmpty()) {
continue;
}
float width = FontRenderers.getRenderer().getStringWidth(s) + 2 + 4;
if (xOffset + width > (widgetWidth - 5)) {
xOffset = 5;
@ -684,7 +696,9 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
double yBase = parsedTags.isEmpty() ? 0 : yOffset + FontRenderers.getRenderer().getMarginHeight() + 4 + padding;
tagName = new RoundTextFieldWidget(5, yBase, widgetWidth - 60 - padding * 3, widgetsHeight, "Tag name");
add = new RoundButton(RoundButton.STANDARD, tagName.getX() + tagName.getWidth() + padding, yBase, 60, widgetsHeight, "Add", () -> {
if (tagName.get().isEmpty()) return;
if (tagName.get().isEmpty()) {
return;
}
parsedTags.add(tagName.get());
tagName.set("");
selectedAlt.storage.tags = String.join(",", parsedTags);
@ -706,14 +720,14 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
add.setY(add.getY() + widgetStartY);
}
@Override
public void onClose() {
@Override public void onClose() {
client.setScreen(parent);
}
@Override
public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) {
if (parent != null) parent.render(stack, mouseX, mouseY, delta);
@Override public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) {
if (parent != null) {
parent.render(stack, mouseX, mouseY, delta);
}
Renderer.R2D.renderQuad(stack, backgroundOverlay, 0, 0, width, height);
Renderer.R2D.renderRoundedQuad(stack, overlayBackground, widgetStartX, widgetStartY, widgetStartX + widgetWidth, widgetStartY + widgetHeight, 5, 20);
for (ThemedButton tag : tags) {
@ -726,25 +740,24 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
}
class AddScreenOverlay extends ClientScreen implements FastTickable {
static final double widgetWid = 200;
static int accountTypeI = 0;
static double widgetHei = 0;
final List<ThemedButton> buttons = new ArrayList<>();
final ClientScreen parent;
final double padding = 5;
final ClientFontRenderer title = FontRenderers.getCustomSize(40);
static final double widgetWid = 200;
static int accountTypeI = 0;
static double widgetHei = 0;
final List<ThemedButton> buttons = new ArrayList<>();
final ClientScreen parent;
final double padding = 5;
final ClientFontRenderer title = FontRenderers.getCustomSize(40);
RoundTextFieldWidget email;
RoundTextFieldWidget passwd;
ThemedButton type;
ThemedButton add;
ThemedButton type;
ThemedButton add;
public AddScreenOverlay(ClientScreen parent) {
super(MSAAFramebuffer.MAX_SAMPLES);
this.parent = parent;
}
@Override
protected void init() {
@Override protected void init() {
ThemedButton exit = new ThemedButton(width - 20 - 5, 5, 20, 20, "X", () -> Objects.requireNonNull(client).setScreen(parent));
buttons.add(exit);
email = new RoundTextFieldWidget(width / 2d - (widgetWid - padding * 2) / 2d, height / 2d - widgetHei / 2d + padding, widgetWid - padding * 2, 20, "E-Mail or username");
@ -763,18 +776,22 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
}
boolean isAddApplicable() {
if (AccountType.values()[accountTypeI] == AccountType.CRACKED && !email.getText().isEmpty()) return true;
else return !email.getText().isEmpty() && !passwd.getText().isEmpty();
if (AccountType.values()[accountTypeI] == AccountType.CRACKED && !email.getText().isEmpty()) {
return true;
} else {
return !email.getText().isEmpty() && !passwd.getText().isEmpty();
}
}
void cycle() {
accountTypeI++;
if (accountTypeI >= AccountType.values().length) accountTypeI = 0;
if (accountTypeI >= AccountType.values().length) {
accountTypeI = 0;
}
type.text = "Type: " + AccountType.values()[accountTypeI].s;
}
@Override
public void onFastTick() {
@Override public void onFastTick() {
for (ThemedButton button : buttons) {
button.tickAnim();
}
@ -782,8 +799,7 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
add.tickAnim();
}
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
@Override public boolean mouseClicked(double mouseX, double mouseY, int button) {
for (ThemedButton themedButton : buttons) {
themedButton.clicked(mouseX, mouseY);
}
@ -794,8 +810,7 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
return super.mouseClicked(mouseX, mouseY, button);
}
@Override
public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) {
@Override public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) {
if (parent != null) {
parent.renderInternal(stack, mouseX, mouseY, delta);
}
@ -828,19 +843,18 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
add.y = originY + padding + title.getMarginHeight() + FontRenderers.getRenderer().getMarginHeight() + padding + email.getHeight() + padding + passwd.getHeight() + padding;
add.setEnabled(isAddApplicable());
add.render(stack, mouseX, mouseY);
widgetHei = padding + title.getMarginHeight() + FontRenderers.getRenderer().getMarginHeight() + padding + email.getHeight() + padding + passwd.getHeight() + padding + type.height + padding;
widgetHei = padding + title.getMarginHeight() + FontRenderers.getRenderer()
.getMarginHeight() + padding + email.getHeight() + padding + passwd.getHeight() + padding + type.height + padding;
stack.pop();
}
@Override
public boolean charTyped(char chr, int modifiers) {
@Override public boolean charTyped(char chr, int modifiers) {
email.charTyped(chr, modifiers);
passwd.charTyped(chr, modifiers);
return super.charTyped(chr, modifiers);
}
@Override
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
@Override public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
email.keyPressed(keyCode, scanCode, modifiers);
passwd.keyPressed(keyCode, scanCode, modifiers);
return super.keyPressed(keyCode, scanCode, modifiers);
@ -860,10 +874,10 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
public class AltContainer {
final AltStorage storage;
Texture tex;
boolean texLoaded = false;
float animProgress = 0;
boolean isHovered = false;
double x, y, width, renderX, renderY;
boolean texLoaded = false;
float animProgress = 0;
boolean isHovered = false;
double x, y, width, renderX, renderY;
public AltContainer(double x, double y, double width, AltStorage inner) {
@ -949,8 +963,12 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
}
animProgress += d;
animProgress = MathHelper.clamp(animProgress, 0, 1);
if (renderX != -1) renderX = Transitions.transition(renderX, x, 7, 0.0001);
if (renderY != -1) renderY = Transitions.transition(renderY, y, 7, 0.0001);
if (renderX != -1) {
renderX = Transitions.transition(renderX, x, 7, 0.0001);
}
if (renderY != -1) {
renderY = Transitions.transition(renderY, y, 7, 0.0001);
}
}
boolean inBounds(double cx, double cy) {
@ -986,10 +1004,11 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
RenderSystem.blendFunc(GL40C.GL_DST_ALPHA, GL40C.GL_ONE_MINUS_DST_ALPHA);
RenderSystem.setShaderTexture(0, tex);
if (texLoaded)
if (texLoaded) {
Renderer.R2D.renderTexture(stack, originX + padding, originY + padding, texWidth, texHeight, 0, 0, 64, 64, 64, 64);
else
} else {
Renderer.R2D.renderTexture(stack, originX + padding, originY + padding, texWidth, texHeight, 8, 8, 8, 8, 64, 64); // default skin
}
String mail;
if (this.storage.type != AddScreenOverlay.AccountType.CRACKED) {
mail = this.storage.email;
@ -1003,9 +1022,9 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
} else {
mail = "No email bound";
}
PropEntry[] props = new PropEntry[]{new PropEntry(this.storage.type == AddScreenOverlay.AccountType.CRACKED ? this.storage.email : this.storage.cachedName, FontRenderers.getCustomSize(22), storage.valid ? 0xFFFFFF : 0xFF3333),
new PropEntry("Email: " + mail, FontRenderers.getRenderer(), 0xAAAAAA)
, new PropEntry("Type: " + this.storage.type.s, FontRenderers.getRenderer(), 0xAAAAAA)};
PropEntry[] props = new PropEntry[]{
new PropEntry(this.storage.type == AddScreenOverlay.AccountType.CRACKED ? this.storage.email : this.storage.cachedName, FontRenderers.getCustomSize(22), storage.valid ? 0xFFFFFF : 0xFF3333),
new PropEntry("Email: " + mail, FontRenderers.getRenderer(), 0xAAAAAA), new PropEntry("Type: " + this.storage.type.s, FontRenderers.getRenderer(), 0xAAAAAA)};
float propsOffset = (float) (getHeight() - (texHeight)) / 2f;
for (PropEntry prop : props) {
prop.cfr.drawString(stack, prop.name, (float) (originX + padding + texWidth + padding), (float) (originY + propsOffset), prop.color, false);
@ -1016,16 +1035,21 @@ public class AltManagerScreen extends ClientScreen implements FastTickable {
Renderer.R2D.renderLoadingSpinner(stack, 1f, originX + width - fromTop, originY + fromTop, 10, 1, 10);
}
double xOff = 0;
if (!storage.tags.isEmpty()) for (String s : storage.tags.split(",")) {
String v = s.trim();
if (v.isEmpty()) continue;
float w = FontRenderers.getRenderer().getStringWidth(v) + 2;
float h = FontRenderers.getRenderer().getMarginHeight();
float pad = 2;
w += pad * 2;
Renderer.R2D.renderRoundedQuad(stack, RoundButton.STANDARD, originX + padding + texWidth + padding + xOff, originY + getHeight() - h - pad * 2 - padding, originX + padding + texWidth + padding + xOff + w, originY + getHeight() - padding, 5, 10);
FontRenderers.getRenderer().drawString(stack, v, originX + padding + texWidth + padding + xOff + pad, originY + getHeight() - pad - FontRenderers.getRenderer().getMarginHeight() - padding, 0xFFFFFF);
xOff += w + 2;
if (!storage.tags.isEmpty()) {
for (String s : storage.tags.split(",")) {
String v = s.trim();
if (v.isEmpty()) {
continue;
}
float w = FontRenderers.getRenderer().getStringWidth(v) + 2;
float h = FontRenderers.getRenderer().getMarginHeight();
float pad = 2;
w += pad * 2;
Renderer.R2D.renderRoundedQuad(stack, RoundButton.STANDARD, originX + padding + texWidth + padding + xOff, originY + getHeight() - h - pad * 2 - padding, originX + padding + texWidth + padding + xOff + w, originY + getHeight() - padding, 5, 10);
FontRenderers.getRenderer()
.drawString(stack, v, originX + padding + texWidth + padding + xOff + pad, originY + getHeight() - pad - FontRenderers.getRenderer().getMarginHeight() - padding, 0xFFFFFF);
xOff += w + 2;
}
}
stack.pop();

View file

@ -11,8 +11,8 @@ import org.lwjgl.glfw.GLFW;
import java.lang.reflect.Field;
public class BindScreen extends Screen {
final Module a;
final ClientFontRenderer cfr = FontRenderers.getCustomSize(30);
final Module a;
final ClientFontRenderer cfr = FontRenderers.getCustomSize(30);
final ClientFontRenderer smaller = FontRenderers.getCustomSize(20);
long closeAt = -1;
@ -21,8 +21,7 @@ public class BindScreen extends Screen {
this.a = toBind;
}
@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
@Override public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
renderBackground(matrices);
cfr.drawCenteredString(matrices, "Press any key", width / 2d, height / 2d - cfr.getMarginHeight(), 0xAAAAAA);
String kn = a.keybind.getValue() > 0 ? GLFW.glfwGetKeyName((int) (a.keybind.getValue() + 0), GLFW.glfwGetKeyScancode((int) (a.keybind.getValue() + 0))) : "None";
@ -45,8 +44,7 @@ public class BindScreen extends Screen {
super.render(matrices, mouseX, mouseY, delta);
}
@Override
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
@Override public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
if (closeAt != -1) {
return false;
}
@ -58,8 +56,7 @@ public class BindScreen extends Screen {
return true;
}
@Override
public void tick() {
@Override public void tick() {
if (closeAt != -1 && closeAt < System.currentTimeMillis()) {
onClose();
}

View file

@ -22,13 +22,14 @@ public class ClientScreen extends Screen {
super.render(stack, mouseX, mouseY, delta);
}
@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
@Override public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
CoffeeClientMain.client.keyboard.setRepeatEvents(true);
if (samples != -1) {
if (!MSAAFramebuffer.framebufferInUse())
if (!MSAAFramebuffer.framebufferInUse()) {
MSAAFramebuffer.use(samples, () -> renderInternal(matrices, mouseX, mouseY, delta));
else renderInternal(matrices, mouseX, mouseY, delta);
} else {
renderInternal(matrices, mouseX, mouseY, delta);
}
} else {
renderInternal(matrices, mouseX, mouseY, delta);
}

View file

@ -6,7 +6,9 @@ import me.x150.coffee.feature.gui.FastTickable;
import me.x150.coffee.feature.gui.widget.RoundButton;
import me.x150.coffee.feature.gui.widget.RoundTextFieldWidget;
import me.x150.coffee.helper.font.FontRenderers;
import me.x150.coffee.helper.render.ClipStack;
import me.x150.coffee.helper.render.MSAAFramebuffer;
import me.x150.coffee.helper.render.Rectangle;
import me.x150.coffee.helper.render.Renderer;
import me.x150.coffee.helper.util.Transitions;
import net.minecraft.client.MinecraftClient;
@ -14,7 +16,7 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.MathHelper;
import org.lwjgl.glfw.GLFW;
import java.awt.*;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -22,32 +24,36 @@ import java.util.Objects;
import java.util.stream.Collectors;
public class CoffeeConsoleScreen extends ClientScreen implements FastTickable {
static final Color BACKGROUND = new Color(60, 60, 60);
static Color NORMAL = Color.BLACK;
static Color ERROR = new Color(214, 93, 62);
static Color SUCCESS = new Color(65, 217, 101);
static Color WARNING = Color.YELLOW;
static final Color BACKGROUND = new Color(60, 60, 60);
static Color NORMAL = Color.BLACK;
static Color ERROR = new Color(214, 93, 62);
static Color SUCCESS = new Color(65, 217, 101);
static Color WARNING = Color.YELLOW;
private static CoffeeConsoleScreen instance;
final Color background = new Color(0, 0, 0, 120);
final List<LogEntry> logs = new ArrayList<>();
ClientScreen parent = null;
final Color background = new Color(0, 0, 0, 120);
final List<LogEntry> logs = new ArrayList<>();
ClientScreen parent = null;
RoundTextFieldWidget command;
double scroll = 0;
double smoothScroll = 0;
double lastLogsHeight = 0;
double scroll = 0;
double smoothScroll = 0;
double lastLogsHeight = 0;
private CoffeeConsoleScreen() {
super(MSAAFramebuffer.MAX_SAMPLES);
}
public static CoffeeConsoleScreen instance(ClientScreen parent) {
if (instance == null) instance = new CoffeeConsoleScreen();
if (instance == null) {
instance = new CoffeeConsoleScreen();
}
instance.parent = parent;
return instance;
}
public static CoffeeConsoleScreen instance() {
if (instance == null) instance = new CoffeeConsoleScreen();
if (instance == null) {
instance = new CoffeeConsoleScreen();
}
return instance;
}
@ -55,8 +61,7 @@ public class CoffeeConsoleScreen extends ClientScreen implements FastTickable {
return 5;
}
@Override
protected void init() {
@Override protected void init() {
super.init();
double widgetWidthA = width - padding() * 2;
double buttonWidth = 60;
@ -70,13 +75,14 @@ public class CoffeeConsoleScreen extends ClientScreen implements FastTickable {
void execute() {
String cmd = command.get();
command.setText("");
if (cmd.isEmpty()) return;
if (cmd.isEmpty()) {
return;
}
addLog(new LogEntry("> " + cmd, BACKGROUND));
CommandRegistry.execute(cmd);
}
@Override
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
@Override public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
if (keyCode == GLFW.GLFW_KEY_ENTER || keyCode == GLFW.GLFW_KEY_KP_ENTER) {
execute();
return true;
@ -87,17 +93,22 @@ public class CoffeeConsoleScreen extends ClientScreen implements FastTickable {
return super.keyPressed(keyCode, scanCode, modifiers);
}
@Override
public void resize(MinecraftClient client, int width, int height) {
if (parent != null) parent.resize(client, width, height);
@Override public void resize(MinecraftClient client, int width, int height) {
if (parent != null) {
parent.resize(client, width, height);
}
super.resize(client, width, height);
}
void autocomplete() {
String cmd = command.get();
if (cmd.isEmpty()) return;
if (cmd.isEmpty()) {
return;
}
List<String> suggestions = getSuggestions(cmd);
if (suggestions.isEmpty()) return;
if (suggestions.isEmpty()) {
return;
}
String[] cmdSplit = cmd.split(" +");
if (cmd.endsWith(" ")) {
String[] cmdSplitNew = new String[cmdSplit.length + 1];
@ -144,9 +155,13 @@ public class CoffeeConsoleScreen extends ClientScreen implements FastTickable {
String cmd = command.get();
float cmdTWidth = FontRenderers.getRenderer().getStringWidth(cmd);
double cmdXS = command.getX() + 5 + cmdTWidth;
if (cmd.isEmpty()) return;
if (cmd.isEmpty()) {
return;
}
List<String> suggestions = getSuggestions(cmd);
if (suggestions.isEmpty()) return;
if (suggestions.isEmpty()) {
return;
}
double probableHeight = suggestions.size() * FontRenderers.getRenderer().getMarginHeight() + padding();
float yC = (float) (height - padding() - 20 - padding() - probableHeight) - 5;
double probableWidth = 0;
@ -169,21 +184,22 @@ public class CoffeeConsoleScreen extends ClientScreen implements FastTickable {
}
}
@Override
public void onFastTick() {
@Override public void onFastTick() {
smoothScroll = Transitions.transition(smoothScroll, scroll, 7, 0);
}
@Override
public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) {
@Override public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) {
command.setFocused(true);
if (parent != null) parent.renderInternal(stack, mouseX, mouseY, delta);
if (parent != null) {
parent.renderInternal(stack, mouseX, mouseY, delta);
}
Renderer.R2D.renderQuad(stack, background, 0, 0, width, height);
// log field
Renderer.R2D.renderRoundedQuad(stack, new Color(20, 20, 20), padding(), padding(), width - padding(), height - padding() - 20 - padding(), 5, 20);
Renderer.R2D.beginScissor(stack, padding(), padding(), width - padding(), height - padding() - 20 - padding());
ClipStack.globalInstance.addWindow(stack, new Rectangle(padding(), padding(), width - padding(), height - padding() - 20 - padding()));
//Renderer.R2D.beginScissor(stack, padding(), padding(), width - padding(), height - padding() - 20 - padding());
// logs
float startingY = (float) (padding() + 5);
@ -192,7 +208,9 @@ public class CoffeeConsoleScreen extends ClientScreen implements FastTickable {
double availHeight = height - padding() - 20 - padding() - 13.5;
List<LogEntryIntern> processedLogs = new ArrayList<>();
while (logs.size() > 1000) logs.remove(0); // max log size of 1000 before we clear
while (logs.size() > 1000) {
logs.remove(0); // max log size of 1000 before we clear
}
for (LogEntry log : logs) {
List<String> logSplitToWidth = new ArrayList<>();
StringBuilder currentLog = new StringBuilder();
@ -202,8 +220,9 @@ public class CoffeeConsoleScreen extends ClientScreen implements FastTickable {
currentLog.append(current);
if (FontRenderers.getRenderer().getStringWidth(currentLog.toString()) > availWidth) {
currentLog.delete(currentLog.length() - 2, currentLog.length());
while (currentLog.charAt(currentLog.length() - 1) == ' ')
while (currentLog.charAt(currentLog.length() - 1) == ' ') {
currentLog.deleteCharAt(currentLog.length() - 1); // clear trailing whitespaces
}
currentLog.append("-");
logSplitToWidth.add(currentLog.toString());
currentLog = new StringBuilder();
@ -222,14 +241,16 @@ public class CoffeeConsoleScreen extends ClientScreen implements FastTickable {
for (LogEntryIntern processedLog : processedLogs) {
for (String s : processedLog.text) {
// we're in bounds, render
if (startingY + FontRenderers.getRenderer().getMarginHeight() >= padding() && startingY <= height - padding() - 20 - padding())
if (startingY + FontRenderers.getRenderer().getMarginHeight() >= padding() && startingY <= height - padding() - 20 - padding()) {
FontRenderers.getRenderer().drawString(stack, s, startingX, startingY, processedLog.color.getRGB(), false);
}
// else, just add
startingY += FontRenderers.getRenderer().getMarginHeight();
}
}
Renderer.R2D.endScissor();
ClipStack.globalInstance.popWindow(stack);
//Renderer.R2D.endScissor();
if (logsHeight > availHeight) {
double viewportHeight = (height - padding() - 20 - padding()) - padding();
@ -245,7 +266,7 @@ public class CoffeeConsoleScreen extends ClientScreen implements FastTickable {
Renderer.R2D.renderRoundedQuad(stack, new Color(10, 10, 10, 150), cursorX - wid / 2d, padding() * 2, cursorX + wid / 2d, padding() * 2 + barHeight, wid / 2d, 10);
// Renderer.R2D.renderCircle(stack, new Color(50, 50, 50, 150), cursorX, cursorY, 3, 10);
// Renderer.R2D.renderCircle(stack, new Color(50, 50, 50, 150), cursorX, cursorY, 3, 10);
Renderer.R2D.renderRoundedQuad(stack, new Color(50, 50, 50, 150), cursorX - wid / 2d, cursorY, cursorX + wid / 2d, cursorY + per * barHeight, wid / 2d, 10);
}
@ -253,20 +274,17 @@ public class CoffeeConsoleScreen extends ClientScreen implements FastTickable {
super.renderInternal(stack, mouseX, mouseY, delta);
}
@Override
public boolean mouseScrolled(double mouseX, double mouseY, double amount) {
@Override public boolean mouseScrolled(double mouseX, double mouseY, double amount) {
scroll += (amount * 10);
scroll = MathHelper.clamp(scroll, 0, Math.max(0, lastLogsHeight - (height - padding() - 20 - padding() - 13.5)));
return super.mouseScrolled(mouseX, mouseY, amount);
}
@Override
public void onClose() {
@Override public void onClose() {
Objects.requireNonNull(client).setScreen(parent);
}
@Override
public boolean isPauseScreen() {
@Override public boolean isPauseScreen() {
return false;
}

View file

@ -25,7 +25,7 @@ import org.lwjgl.BufferUtils;
import org.lwjgl.opengl.GL40C;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.Color;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
@ -40,31 +40,33 @@ import java.util.Objects;
import java.util.UUID;
public class HomeScreen extends ClientScreen implements FastTickable {
static final double padding = 5;
static final Texture background = new Texture("background.jpg");
static final HttpClient downloader = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(3)).build();
static boolean isDev = false;
static String version = "unknown";
static String changelog = "";
private static HomeScreen instance;
final ClientFontRenderer title = FontRenderers.getCustomSize(40);
final ClientFontRenderer smaller = FontRenderers.getCustomSize(30);
final ClientFontRenderer propFr = FontRenderers.getCustomSize(22);
final Texture currentAccountTexture = new Texture("dynamic/tex_currentaccount_home");
boolean loaded = false;
long initTime = System.currentTimeMillis();
double prog = 0;
boolean fadeOut = false;
double initProg = 0;
static final double padding = 5;
static final Texture background = new Texture("background.jpg");
static final HttpClient downloader = HttpClient.newBuilder().connectTimeout(Duration.ofSeconds(3)).build();
static boolean isDev = false;
static String version = "unknown";
static String changelog = "";
private static HomeScreen instance;
final ClientFontRenderer title = FontRenderers.getCustomSize(40);
final ClientFontRenderer smaller = FontRenderers.getCustomSize(30);
final ClientFontRenderer propFr = FontRenderers.getCustomSize(22);
final Texture currentAccountTexture = new Texture("dynamic/tex_currentaccount_home");
boolean loaded = false;
long initTime = System.currentTimeMillis();
double prog = 0;
boolean fadeOut = false;
double initProg = 0;
boolean currentAccountTextureLoaded = false;
UUID previousChecked = null;
UUID previousChecked = null;
private HomeScreen() {
super(MSAAFramebuffer.MAX_SAMPLES);
}
public static HomeScreen instance() {
if (instance == null) instance = new HomeScreen();
if (instance == null) {
instance = new HomeScreen();
}
return instance;
}
@ -86,8 +88,7 @@ public class HomeScreen extends ClientScreen implements FastTickable {
}
}
@Override
public void resize(MinecraftClient client, int width, int height) {
@Override public void resize(MinecraftClient client, int width, int height) {
this.width = width;
this.height = height;
clearChildren();
@ -101,10 +102,9 @@ public class HomeScreen extends ClientScreen implements FastTickable {
RoundButton single = new RoundButton(bg, rightPad - (padding + 60), centerWidgetsY, 60, 20, "Singleplayer", () -> CoffeeClientMain.client.setScreen(new SelectWorldScreen(this)));
RoundButton multi = new RoundButton(bg, rightPad - (padding + 60) * 2, centerWidgetsY, 60, 20, "Multiplayer", () -> CoffeeClientMain.client.setScreen(new MultiplayerScreen(this)));
RoundButton realms = new RoundButton(bg, rightPad - (padding + 60) * 3, centerWidgetsY, 60, 20, "Realms", () -> CoffeeClientMain.client.setScreen(new RealmsMainScreen(this)));
RoundButton alts = new RoundButton(bg, rightPad - (padding + 60) * 4, centerWidgetsY, 60, 20, "Alts", () -> CoffeeClientMain.client.setScreen(
AltManagerScreen.instance()
// new TestScreen()
));
RoundButton alts = new RoundButton(bg, rightPad - (padding + 60) * 4, centerWidgetsY, 60, 20, "Alts", () -> CoffeeClientMain.client.setScreen(AltManagerScreen.instance()
// new TestScreen()
));
RoundButton settings = new RoundButton(bg, rightPad - (padding + 60) * 5, centerWidgetsY, 60, 20, "Options", () -> CoffeeClientMain.client.setScreen(new OptionsScreen(this, CoffeeClientMain.client.options)));
RoundButton quit = new RoundButton(bg, rightPad - (padding + 60) * 5 - padding - 20, centerWidgetsY, 20, 20, "X", CoffeeClientMain.client::scheduleStop);
addDrawableChild(single);
@ -115,13 +115,14 @@ public class HomeScreen extends ClientScreen implements FastTickable {
addDrawableChild(quit);
}
@Override
protected void init() {
@Override protected void init() {
super.init();
initTime = System.currentTimeMillis();
initWidgets();
if (loaded) updateCurrentAccount(() -> {
}); // already loaded this instance, refresh on the fly
if (loaded) {
updateCurrentAccount(() -> {
}); // already loaded this instance, refresh on the fly
}
}
void complete() {
@ -161,8 +162,7 @@ public class HomeScreen extends ClientScreen implements FastTickable {
});
}
@Override
public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) {
@Override public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) {
double initProg = this.initProg * 2;
Renderer.R2D.renderQuad(stack, new Color(20, 20, 20), 0, 0, width, height);
@ -212,9 +212,11 @@ public class HomeScreen extends ClientScreen implements FastTickable {
RenderSystem.blendFunc(GL40C.GL_DST_ALPHA, GL40C.GL_ONE_MINUS_DST_ALPHA);
RenderSystem.setShaderTexture(0, currentAccountTextureLoaded ? currentAccountTexture : DefaultSkinHelper.getTexture());
if (currentAccountTextureLoaded)
if (currentAccountTextureLoaded) {
Renderer.R2D.renderTexture(stack, fromX + padding, fromY + padding, texDim, texDim, 0, 0, 64, 64, 64, 64);
else Renderer.R2D.renderTexture(stack, fromX + padding, fromY + padding, texDim, texDim, 8, 8, 8, 8, 64, 64);
} else {
Renderer.R2D.renderTexture(stack, fromX + padding, fromY + padding, texDim, texDim, 8, 8, 8, 8, 64, 64);
}
RenderSystem.defaultBlendFunc();
String uuid = CoffeeClientMain.client.getSession().getUuid();
double uuidWid = FontRenderers.getRenderer().getStringWidth(uuid);
@ -224,7 +226,8 @@ public class HomeScreen extends ClientScreen implements FastTickable {
uuid = FontRenderers.getRenderer().trimStringToWidth(uuid, maxWid - 1 - threeDotWidth);
uuid += "...";
}
AltManagerScreen.AltContainer.PropEntry[] props = new AltManagerScreen.AltContainer.PropEntry[]{new AltManagerScreen.AltContainer.PropEntry(CoffeeClientMain.client.getSession().getUsername(), FontRenderers.getCustomSize(22), 0xFFFFFF),
AltManagerScreen.AltContainer.PropEntry[] props = new AltManagerScreen.AltContainer.PropEntry[]{
new AltManagerScreen.AltContainer.PropEntry(CoffeeClientMain.client.getSession().getUsername(), FontRenderers.getCustomSize(22), 0xFFFFFF),
new AltManagerScreen.AltContainer.PropEntry(uuid, FontRenderers.getRenderer(), 0xAAAAAA)};
float propsOffset = (float) (fromY + padding);
for (AltManagerScreen.AltContainer.PropEntry prop : props) {
@ -253,12 +256,14 @@ public class HomeScreen extends ClientScreen implements FastTickable {
Renderer.R2D.renderLoadingSpinner(stack, (float) spinnerProg, width - 25, height - 25, 20, 1d, 20);
}
@Override
public void onFastTick() {
if (CoffeeClientMain.client.getOverlay() == null && CoffeeClientMain.client.currentScreen == this && System.currentTimeMillis() - initTime > 1000 && !loaded)
@Override public void onFastTick() {
if (CoffeeClientMain.client.getOverlay() == null && CoffeeClientMain.client.currentScreen == this && System.currentTimeMillis() - initTime > 1000 && !loaded) {
load();
}
double delta = 10 / 600d;
if (fadeOut) delta *= -1;
if (fadeOut) {
delta *= -1;
}
prog += delta;
prog = MathHelper.clamp(prog, 0, 1);
@ -269,9 +274,10 @@ public class HomeScreen extends ClientScreen implements FastTickable {
}
}
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
if (prog != 0 || !fadeOut) return false;
@Override public boolean mouseClicked(double mouseX, double mouseY, int button) {
if (prog != 0 || !fadeOut) {
return false;
}
return super.mouseClicked(mouseX, mouseY, button);
}

View file

@ -1,6 +1,7 @@
package me.x150.coffee.feature.gui.screen;
import com.google.common.util.concurrent.AtomicDouble;
import lombok.Data;
import me.x150.coffee.CoffeeClientMain;
import me.x150.coffee.feature.gui.FastTickable;
import me.x150.coffee.helper.font.FontRenderers;
@ -14,50 +15,61 @@ import net.minecraft.util.math.MathHelper;
import org.apache.logging.log4j.Level;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.Color;
import java.awt.image.BufferedImage;
import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
public class LoadingScreen extends ClientScreen implements FastTickable {
static LoadingScreen INSTANCE = null;
static Color GREEN = new Color(100, 255, 20);
static Color RED = new Color(255, 50, 20);
AtomicBoolean loaded = new AtomicBoolean(false);
static final int atOnce = 3;
static LoadingScreen INSTANCE = null;
static Color GREEN = new Color(100, 255, 20);
static Color RED = new Color(255, 50, 20);
AtomicBoolean loaded = new AtomicBoolean(false);
AtomicBoolean loadInProg = new AtomicBoolean(false);
// double progress = 0;
volatile AtomicDouble progress = new AtomicDouble();
double smoothProgress = 0;
double opacity = 1;
ClientFontRenderer title = FontRenderers.getCustomSize(40);
StartScreen inst;
double smoothProgress = 0;
double opacity = 1;
ClientFontRenderer title = FontRenderers.getCustomSize(40);
Map<CoffeeClientMain.ResourceEntry, ProgressData> progressMap = new ConcurrentHashMap<>();
private LoadingScreen() {
super(MSAAFramebuffer.MAX_SAMPLES);
}
public static LoadingScreen instance() {
if (INSTANCE == null) INSTANCE = new LoadingScreen();
if (INSTANCE == null) {
INSTANCE = new LoadingScreen();
}
return INSTANCE;
}
@Override
protected void init() {
@Override protected void init() {
assert client != null;
HomeScreen.instance().init(client, width, height);
if (loaded.get() && opacity == 0.001) {
client.setScreen(inst);
client.setScreen(HomeScreen.instance());
}
super.init();
}
@Override
public void onFastTick() {
@Override public void onFastTick() {
//System.out.println(progressMap.values().stream().map(AtomicDouble::get).reduce(Double::sum)+"-"+CoffeeClientMain.resources.size());
progress.set(progressMap.values().stream().map(progressData -> progressData.getProgress().get()).reduce(Double::sum).orElse(0d) / CoffeeClientMain.resources.size());
smoothProgress = Transitions.transition(smoothProgress, progress.get(), 10, 0.0001);
// smoothProgress = progress.get();
// smoothProgress = progress.get();
if (CoffeeClientMain.client.getOverlay() == null) {
if (!loadInProg.get()) {
load();
@ -67,18 +79,22 @@ public class LoadingScreen extends ClientScreen implements FastTickable {
opacity -= 0.01;
opacity = MathHelper.clamp(opacity, 0.001, 1);
}
if (inst != null) inst.onFastTick();
HomeScreen.instance().onFastTick();
}
void load() {
loadInProg.set(true);
new Thread(() -> {
for (int i = 0; i < CoffeeClientMain.resources.size(); i++) {
double progressBefore = i / ((double) CoffeeClientMain.resources.size());
double completedProgress = (i + 1) / ((double) CoffeeClientMain.resources.size());
CoffeeClientMain.ResourceEntry resource = CoffeeClientMain.resources.get(i);
ExecutorService es = Executors.newFixedThreadPool(atOnce);
for (CoffeeClientMain.ResourceEntry resource : CoffeeClientMain.resources) {
progressMap.put(resource, new ProgressData());
es.execute(() -> {
CoffeeClientMain.log(Level.INFO, "Downloading " + resource.url());
progressMap.get(resource).getWorkingOnIt().set(true);
try {
URL url = new URL(resource.url());
HttpURLConnection httpConnection = (HttpURLConnection) (url.openConnection());
long completeFileSize = httpConnection.getContentLength();
@ -88,11 +104,13 @@ public class LoadingScreen extends ClientScreen implements FastTickable {
byte[] data = new byte[16];
long downloadedFileSize = 0;
int x;
progressMap.get(resource).getProgress().set(0.1);
while ((x = in.read(data, 0, 16)) >= 0) {
downloadedFileSize += x;
double currentProgress = ((double) downloadedFileSize) / ((double) completeFileSize);
progress.set(MathHelper.lerp(currentProgress, progressBefore, completedProgress));
// progress.set(MathHelper.lerp(currentProgress, progressBefore, completedProgress));
progressMap.get(resource).getProgress().set(currentProgress * 0.8 + 0.1);
bout.write(data, 0, x);
}
@ -105,22 +123,32 @@ public class LoadingScreen extends ClientScreen implements FastTickable {
} catch (Exception e) {
CoffeeClientMain.log(Level.ERROR, "Failed to download " + resource.url() + ": " + e.getMessage());
} finally {
progress.set(MathHelper.lerp(1, progressBefore, completedProgress));
progressMap.get(resource).getProgress().set(1);
progressMap.get(resource).getWorkingOnIt().set(false);
}
});
}
new Thread(() -> {
es.shutdown();
try {
//noinspection ResultOfMethodCallIgnored
es.awaitTermination(99999, TimeUnit.DAYS);
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
loaded.set(true);
}
loaded.set(true);
}, "Loader").start();
}
@Override
public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) {
@Override public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) {
if (loaded.get()) {
if (inst == null) inst = new StartScreen();
// inst.init(client, width, height);
inst.renderInternal(stack, mouseX, mouseY, delta);
HomeScreen.instance().renderInternal(stack, mouseX, mouseY, delta);
if (opacity == 0.001) {
this.client.setScreen(inst);
assert this.client != null;
this.client.setScreen(HomeScreen.instance());
return;
}
}
@ -131,15 +159,34 @@ public class LoadingScreen extends ClientScreen implements FastTickable {
double textHeight = title.getMarginHeight();
double centerY1 = height / 2d;
double centerX = width / 2d;
title.drawString(stack, coffee, (float) (centerX - textWidth / 2f), (float) (centerY1 - textHeight / 2d), 1f, 1f, 1f, (float) opacity);
title.drawString(stack, coffee, centerX - textWidth / 2f, centerY1 - textHeight / 2d, new Color(1f, 1f, 1f, (float) opacity).getRGB());
double maxWidth = 200;
double rWidth = smoothProgress * maxWidth;
double barHeight = 3;
rWidth = Math.max(rWidth, barHeight);
Color MID_END = Renderer.Util.lerp(GREEN, RED, smoothProgress);
String perStr = Utils.Math.roundToDecimal(smoothProgress * 100, 1) + "%";
Renderer.R2D.renderRoundedQuad(stack, new Color(40, 40, 40, (int) (opacity * 255)), centerX - maxWidth / 2d, centerY1 + textHeight / 2d + pad, centerX + maxWidth / 2d, centerY1 + textHeight / 2d + pad + barHeight, barHeight / 2d, 10);
Renderer.R2D.renderRoundedQuad(stack, Renderer.Util.modify(MID_END, -1, -1, -1, (int) (opacity * 255)), centerX - maxWidth / 2d, centerY1 + textHeight / 2d + pad, centerX - maxWidth / 2d + rWidth, centerY1 + textHeight / 2d + pad + barHeight, barHeight / 2d, 10);
double currentY = centerY1 + textHeight / 2d + pad + barHeight + 5;
//double xOffset = 0;
for (ProgressData value : progressMap.values()) {
if (value.getWorkingOnIt().get()) {
double prg = value.getProgress().get() * maxWidth;
prg = Math.max(prg, barHeight);
Renderer.R2D.renderRoundedQuad(stack, new Color(40, 40, 40, (int) (opacity * 255)), centerX - maxWidth / 2d, currentY, centerX + maxWidth / 2d, currentY + barHeight, barHeight / 2d, 10);
Renderer.R2D.renderRoundedQuad(stack, Renderer.Util.modify(MID_END, -1, -1, -1, (int) (opacity * 255)), centerX - maxWidth / 2d, currentY, centerX - maxWidth / 2d + prg, currentY + barHeight, barHeight / 2d, 10);
currentY += barHeight + 2;
}
}
//Renderer.R2D.renderQuad(stack,Color.BLACK,width/2d-pslen/2d,centerY1 + textHeight / 2d + pad,width/2d+pslen/2d,centerY1 + textHeight / 2d + pad + barHeight);
FontRenderers.getRenderer().drawCenteredString(stack, perStr, width / 2d, currentY + 3, 1f, 1f, 1f, (float) opacity);
super.renderInternal(stack, mouseX, mouseY, delta);
}
@Data static class ProgressData {
AtomicDouble progress = new AtomicDouble(0);
AtomicBoolean workingOnIt = new AtomicBoolean(false);
}
}

View file

@ -7,6 +7,8 @@ import me.x150.coffee.feature.gui.widget.RoundButton;
import me.x150.coffee.feature.gui.widget.RoundTextFieldWidget;
import me.x150.coffee.helper.NbtFormatter;
import me.x150.coffee.helper.font.FontRenderers;
import me.x150.coffee.helper.render.ClipStack;
import me.x150.coffee.helper.render.Rectangle;
import me.x150.coffee.helper.render.Renderer;
import me.x150.coffee.helper.util.Transitions;
import net.minecraft.client.util.InputUtil;
@ -18,31 +20,24 @@ import net.minecraft.util.math.MathHelper;
import org.apache.commons.compress.utils.Lists;
import org.lwjgl.glfw.GLFW;
import java.awt.*;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
public class NbtEditorScreen extends ClientScreen implements FastTickable {
ItemStack stack;
List<String> initial = new ArrayList<>();
char[] suffixes = {
'b', 's', 'L', 'f', 'd'
};
int editorX = 0;
int editorY = 0;
double scrollX = 0;
double smoothScrollX = 0;
double scroll = 0;
double smoothScroll = 0;
ItemStack stack;
List<String> initial = new ArrayList<>();
char[] suffixes = {'b', 's', 'L', 'f', 'd'};
int editorX = 0;
int editorY = 0;
double scrollX = 0;
double smoothScrollX = 0;
double scroll = 0;
double smoothScroll = 0;
RoundTextFieldWidget search;
char[][] appendPairs = {
{'"', '"'},
{'{', '}'},
{'\'', '\''},
{'[', ']'}
};
boolean skipAppend = false;
char[][] appendPairs = {{'"', '"'}, {'{', '}'}, {'\'', '\''}, {'[', ']'}};
boolean skipAppend = false;
public NbtEditorScreen(ItemStack stack) {
super();
@ -54,13 +49,14 @@ public class NbtEditorScreen extends ClientScreen implements FastTickable {
if (entry == NbtFormatter.RGBColorText.NEWLINE) {
initial.add(current.toString());
current = new StringBuilder();
} else current.append(entry.value());
} else {
current.append(entry.value());
}
}
initial.add(current.toString());
}
@Override
public boolean isPauseScreen() {
@Override public boolean isPauseScreen() {
return false;
}
@ -84,7 +80,9 @@ public class NbtEditorScreen extends ClientScreen implements FastTickable {
if (entry == NbtFormatter.RGBColorText.NEWLINE) {
initial.add(current.toString());
current = new StringBuilder();
} else current.append(entry.value());
} else {
current.append(entry.value());
}
}
initial.add(current.toString());
} catch (Exception e) {
@ -103,8 +101,7 @@ public class NbtEditorScreen extends ClientScreen implements FastTickable {
}
}
@Override
public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) {
@Override public boolean mouseDragged(double mouseX, double mouseY, int button, double deltaX, double deltaY) {
if (mouseX > 5 && mouseX < width - 5 && mouseY > 5 && mouseY < height - 30) {
scroll -= deltaY;
scrollX -= deltaX;
@ -113,8 +110,7 @@ public class NbtEditorScreen extends ClientScreen implements FastTickable {
return super.mouseDragged(mouseX, mouseY, button, deltaX, deltaY);
}
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
@Override public boolean mouseClicked(double mouseX, double mouseY, int button) {
if (mouseX > 5 && mouseX < width - 5 && mouseY > 5 && mouseY < height - 30) {
double relativeX = mouseX - 5 + smoothScrollX;
double relativeY = mouseY - 5 + smoothScroll;
@ -127,13 +123,11 @@ public class NbtEditorScreen extends ClientScreen implements FastTickable {
editorX = relativeX < wid ? t.length() - 1 : t.length();
}
}
return super.mouseClicked(mouseX, mouseY, button);
}
@Override
protected void init() {
@Override protected void init() {
RoundButton format = new RoundButton(RoundButton.STANDARD, 5, height - 30 + 5, 64, 20, "Format", this::format);
addDrawableChild(format);
RoundButton save = new RoundButton(RoundButton.STANDARD, 5 + format.getWidth() + 5, height - 30 + 5, 64, 20, "Save", this::save);
@ -149,26 +143,32 @@ public class NbtEditorScreen extends ClientScreen implements FastTickable {
if (total.charAt(i) == '"' && (i == 0 || total.charAt(i - 1) != '\\')) {
amountOfDoubles++;
}
if (total.charAt(i) == '\'' && (i == 0 || total.charAt(i - 1) != '\\')) amountOfSingles++;
if (total.charAt(i) == '\'' && (i == 0 || total.charAt(i - 1) != '\\')) {
amountOfSingles++;
}
}
boolean inString = amountOfDoubles % 2 == 1;
boolean inSingleString = amountOfSingles % 2 == 1;
if (c == '"') {
if (!(index > 0 && total.charAt(index - 1) == '\\')) {
if (total.indexOf('"', index + 1) == -1 && !inString) return 0xFF5555;
if (total.indexOf('"', index + 1) == -1 && !inString) {
return 0xFF5555;
}
}
}
if (c == '\'') {
if (!(index > 0 && total.charAt(index - 1) == '\\')) {
if (total.indexOf('\'', index + 1) == -1 && !inSingleString) return 0xFF5555;
if (total.indexOf('\'', index + 1) == -1 && !inSingleString) {
return 0xFF5555;
}
}
}
if (inString || inSingleString || c == '"' || c == '\'') return 0x55FF55;
if (inString || inSingleString || c == '"' || c == '\'') {
return 0x55FF55;
}
// if the index of the next : from where we are right now is smaller than the index of the last , or the last , is beyond where we are now
// and the next : from where we are right now is beyond where we are right now, mark it
if ((total.indexOf(':', index) < total.lastIndexOf(',') || total.lastIndexOf(',') < index)
&& total.indexOf(' ', index) > total.indexOf(':', index)
&& total.indexOf(':', index) > index) {
if ((total.indexOf(':', index) < total.lastIndexOf(',') || total.lastIndexOf(',') < index) && total.indexOf(' ', index) > total.indexOf(':', index) && total.indexOf(':', index) > index) {
return 0x55FFFF;
}
boolean isSuffix = false;
@ -184,14 +184,12 @@ public class NbtEditorScreen extends ClientScreen implements FastTickable {
return 0xFFFFFF;
}
@Override
public void onFastTick() {
@Override public void onFastTick() {
this.smoothScroll = Transitions.transition(smoothScroll, scroll, 7, 0);
this.smoothScrollX = Transitions.transition(smoothScrollX, scrollX, 7, 0);
}
@Override
public boolean mouseScrolled(double mouseX, double mouseY, double amount) {
@Override public boolean mouseScrolled(double mouseX, double mouseY, double amount) {
double contentWidth = initial.stream().map(s -> FontRenderers.getMono().getStringWidth(s)).max(Comparator.comparingDouble(value -> value)).orElse(0f);
double windowWidth = width - 14;
double entitledX = contentWidth - windowWidth;
@ -217,15 +215,19 @@ public class NbtEditorScreen extends ClientScreen implements FastTickable {
return 7 + FontRenderers.getMono().getStringWidth(i.substring(0, editorX)) - smoothScrollX;
}
@Override
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
if (super.keyPressed(keyCode, scanCode, modifiers)) return true;
@Override public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
if (super.keyPressed(keyCode, scanCode, modifiers)) {
return true;
}
if (isPaste(keyCode)) {
String clip = CoffeeClientMain.client.keyboard.getClipboard();
skipAppend = true;
for (char c : clip.toCharArray()) {
if (c == '\n') keyPressed(GLFW.GLFW_KEY_ENTER, 0, 0);
else charTyped(c, 0);
if (c == '\n') {
keyPressed(GLFW.GLFW_KEY_ENTER, 0, 0);
} else {
charTyped(c, 0);
}
}
skipAppend = false;
} else {
@ -254,7 +256,9 @@ public class NbtEditorScreen extends ClientScreen implements FastTickable {
}
case GLFW.GLFW_KEY_DELETE -> {
String index = initial.get(editorY);
if (editorY == initial.size() - 1 && editorX == index.length()) break;
if (editorY == initial.size() - 1 && editorX == index.length()) {
break;
}
if (editorX < index.length()) {
StringBuilder sb = new StringBuilder(index);
sb.deleteCharAt(editorX);
@ -277,7 +281,9 @@ public class NbtEditorScreen extends ClientScreen implements FastTickable {
for (int i = 0; i <= editorY; i++) {
String p = initial.get(i);
String trimmed = p;
while (trimmed.endsWith(",")) trimmed = trimmed.substring(0, trimmed.length() - 1);
while (trimmed.endsWith(",")) {
trimmed = trimmed.substring(0, trimmed.length() - 1);
}
if (p.endsWith("{") || p.endsWith("[")) {
indent += 2;
} else if (trimmed.endsWith("}") || trimmed.endsWith("]")) {
@ -330,16 +336,19 @@ public class NbtEditorScreen extends ClientScreen implements FastTickable {
return true;
}
@Override
public boolean charTyped(char chr, int modifiers) {
@Override public boolean charTyped(char chr, int modifiers) {
boolean b = super.charTyped(chr, modifiers);
if (b) return true;
if (b) {
return true;
}
String index = initial.get(editorY);
StringBuilder sb = new StringBuilder(index);
sb.insert(editorX, chr);
if (!skipAppend) for (char[] appendPair : appendPairs) {
if (appendPair[0] == chr) {
sb.insert(editorX + 1, appendPair[1]);
if (!skipAppend) {
for (char[] appendPair : appendPairs) {
if (appendPair[0] == chr) {
sb.insert(editorX + 1, appendPair[1]);
}
}
}
initial.set(editorY, sb.toString());
@ -347,12 +356,12 @@ public class NbtEditorScreen extends ClientScreen implements FastTickable {
return true;
}
@Override
public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) {
// stack.translate(50,50,0);
// stack.scale(0.7f,0.7f,1f);
@Override public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) {
// stack.translate(50,50,0);
// stack.scale(0.7f,0.7f,1f);
Renderer.R2D.renderRoundedQuad(stack, new Color(20, 20, 20, 200), 5, 5, width - 5, height - 30, 5, 20);
Renderer.R2D.beginScissor(stack, 5, 5, width - 5, height - 30);
ClipStack.globalInstance.addWindow(stack, new Rectangle(5, 5, width - 5, height - 30));
//Renderer.R2D.beginScissor(stack, 5, 5, width - 5, height - 30);
double initY = 7 - smoothScroll;
double initX = 7 - smoothScrollX;
@ -375,13 +384,13 @@ public class NbtEditorScreen extends ClientScreen implements FastTickable {
}
}
for (int i = 0; i < s.toCharArray().length; i++) {
// boolean isInSearch = indexOfSearch != -1 && i >= indexOfSearch && i < indexOfSearch+searchLen;
// boolean isInSearch = indexOfSearch != -1 && i >= indexOfSearch && i < indexOfSearch+searchLen;
char c = s.charAt(i);
double cw = FontRenderers.getMono().getStringWidth(c + "");
// double cw = 8;
// double cw = 8;
if (x > 5 - cw && x < width - 5) {
int color = getColor(s, i, c);
// int color = 0xFFFFFF;
// int color = 0xFFFFFF;
FontRenderers.getMono().drawString(stack, c + "", x, y, color);
}
x += cw;
@ -396,7 +405,8 @@ public class NbtEditorScreen extends ClientScreen implements FastTickable {
String before = index.substring(0, editorX);
double cx = FontRenderers.getMono().getStringWidth(before) + initX + 0.5;
double cy = FontRenderers.getMono().getMarginHeight() * editorY + initY;
Renderer.R2D.endScissor();
//Renderer.R2D.endScissor();
ClipStack.globalInstance.popWindow(stack);
Renderer.R2D.renderQuad(stack, Color.WHITE, cx, cy, cx + 1, cy + FontRenderers.getMono().getMarginHeight());
super.renderInternal(stack, mouseX, mouseY, delta);
}

View file

@ -10,15 +10,15 @@ import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.MathHelper;
import java.awt.*;
import java.awt.Color;
public class NotificationScreen extends ClientScreen implements FastTickable {
String t;
String t;
Notification.Type ty;
Screen parent;
boolean closing = false;
double anim = 0;
Color bg = new Color(20, 20, 20, 100);
Screen parent;
boolean closing = false;
double anim = 0;
Color bg = new Color(20, 20, 20, 100);
public NotificationScreen(Screen parent, String text, Notification.Type type) {
this.ty = type;
@ -26,32 +26,32 @@ public class NotificationScreen extends ClientScreen implements FastTickable {
this.parent = parent;
}
@Override
public void onFastTick() {
@Override public void onFastTick() {
double d = 0.05;
if (closing) d *= -1;
if (closing) {
d *= -1;
}
anim += d;
anim = MathHelper.clamp(anim, 0, 1);
}
@Override
protected void init() {
@Override protected void init() {
double height = 5 + 32 + 5 + FontRenderers.getRenderer().getMarginHeight() + 5 + 20 + 5;
double w = Math.max(120, FontRenderers.getRenderer().getStringWidth(t));
RoundButton rb = new RoundButton(RoundButton.STANDARD, width / 2d - w / 2d, this.height / 2d - height / 2d + height - 5 - 20, w, 20, "Close", this::onClose);
addDrawableChild(rb);
}
@Override
public void onClose() {
@Override public void onClose() {
closing = true;
}
@Override
public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) {
@Override public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) {
double x = anim;
double anim = x < 0.5 ? 16 * x * x * x * x * x : 1 - Math.pow(-2 * x + 2, 5) / 2;
if (parent != null) parent.render(stack, mouseX, mouseY, delta);
if (parent != null) {
parent.render(stack, mouseX, mouseY, delta);
}
Renderer.R2D.renderQuad(stack, Renderer.Util.modify(bg, -1, -1, -1, (int) (160 * anim)), 0, 0, width, height);
stack.push();
stack.translate(width / 2d * (1 - anim), height / 2d * (1 - anim), 10);

View file

@ -10,15 +10,15 @@ import net.minecraft.client.gui.Element;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.math.MatrixStack;
import java.awt.*;
import java.awt.Color;
public class ProxyManagerScreen extends ClientScreen {
public static Proxy currentProxy = null;
static double widgetWidth = 300;
static double widgetHeight = 400;
static ClientFontRenderer title = FontRenderers.getCustomSize(40);
static boolean isSocks4 = false;
Screen parent;
public static Proxy currentProxy = null;
static double widgetWidth = 300;
static double widgetHeight = 400;
static ClientFontRenderer title = FontRenderers.getCustomSize(40);
static boolean isSocks4 = false;
Screen parent;
RoundTextFieldWidget ip, port;
RoundButton reset, apply, type;
@ -31,8 +31,7 @@ public class ProxyManagerScreen extends ClientScreen {
return 5;
}
@Override
protected void init() {
@Override protected void init() {
RoundButton exit = new RoundButton(new Color(40, 40, 40), width - 20 - 5, 5, 20, 20, "X", this::onClose);
addDrawableChild(exit);
@ -74,9 +73,10 @@ public class ProxyManagerScreen extends ClientScreen {
super.init();
}
@Override
public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) {
if (parent != null) parent.render(stack, mouseX, mouseY, delta);
@Override public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) {
if (parent != null) {
parent.render(stack, mouseX, mouseY, delta);
}
Renderer.R2D.renderQuad(stack, new Color(0, 0, 0, 130), 0, 0, width, height);
double wWidth = widgetWidth - padding() * 2d;
double sourceX = width / 2d - widgetWidth / 2d + padding();
@ -118,11 +118,15 @@ public class ProxyManagerScreen extends ClientScreen {
boolean canApply() {
String currentIp = this.ip.get();
if (currentIp.isEmpty()) return false;
if (currentIp.isEmpty()) {
return false;
}
String currentPort = this.port.get();
try {
int port = Integer.parseInt(currentPort);
if (port < 0 || port > 0xFFFF) return false;
if (port < 0 || port > 0xFFFF) {
return false;
}
} catch (Exception ignored) {
return false;
}
@ -130,16 +134,14 @@ public class ProxyManagerScreen extends ClientScreen {
}
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
@Override public boolean mouseClicked(double mouseX, double mouseY, int button) {
for (Element child : children()) {
child.mouseClicked(0, 0, button);
}
return super.mouseClicked(mouseX, mouseY, button);
}
@Override
public void onClose() {
@Override public void onClose() {
client.setScreen(parent);
}

View file

@ -1,109 +0,0 @@
package me.x150.coffee.feature.gui.screen;
import me.x150.coffee.CoffeeClientMain;
import me.x150.coffee.feature.gui.FastTickable;
import me.x150.coffee.feature.gui.widget.RoundButton;
import me.x150.coffee.helper.ManagerThread;
import me.x150.coffee.helper.font.FontRenderers;
import me.x150.coffee.helper.font.adapter.impl.ClientFontRenderer;
import me.x150.coffee.helper.render.Renderer;
import me.x150.coffee.helper.util.Transitions;
import me.x150.coffee.helper.util.Utils;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.MathHelper;
import java.awt.*;
import java.util.List;
public class StartScreen extends ClientScreen implements FastTickable {
public static StartScreen currentInstance;
public String status = "Connecting...";
public String desc = "Connecting to the main server";
public String footer = "";
public boolean renderGoButton = false;
ClientFontRenderer cfr = FontRenderers.getCustomSize(30);
boolean shouldBeginStarting = false;
RoundButton go;
double opacity = 1;
double goButtonYOffset = 35;
double goButtonYOffsetRender = 35;
public StartScreen() {
currentInstance = this;
}
@Override
protected void init() {
if (CoffeeClientMain.sman == null) {
CoffeeClientMain.sman = new ManagerThread();
CoffeeClientMain.sman.start();
Thread managerWatcherThread = new Thread(() -> {
while (true) {
try {
Thread.sleep(10_000);
} catch (Exception ignored) {
}
if (CoffeeClientMain.sman.needRestart.get()) {
System.out.println("Restarting because big man asked for it");
CoffeeClientMain.sman.clear();
CoffeeClientMain.sman = new ManagerThread();
CoffeeClientMain.sman.start();
}
}
});
managerWatcherThread.start();
}
HomeScreen.instance().init(client, width, height);
}
@Override
public void renderInternal(MatrixStack stack, int mouseX, int mouseY, float delta) {
width = CoffeeClientMain.client.getWindow().getScaledWidth();
height = CoffeeClientMain.client.getWindow().getScaledHeight();
if (shouldBeginStarting) {
HomeScreen.instance().renderInternal(stack, mouseX, mouseY, delta);
if (opacity == 0) {
client.setScreen(HomeScreen.instance());
}
}
Renderer.R2D.renderQuad(stack, new Color(0, 0, 0, (int) (opacity * 255)), 0, 0, width, height);
List<String> statusList = List.of(Utils.splitLinesToWidth(desc, 300, FontRenderers.getRenderer()));
double modalHeight = cfr.getFontHeight() + 5 + FontRenderers.getRenderer().getMarginHeight() * statusList.size();
cfr.drawCenteredString(stack, status, width / 2d, height / 2d - modalHeight / 2d, 1, 1, 1, (float) opacity);
double yOffset = cfr.getFontHeight() + 5;
for (String s : statusList) {
FontRenderers.getRenderer().drawCenteredString(stack, s, width / 2d, height / 2d - modalHeight / 2d + yOffset, 1, 1, 1, (float) opacity);
yOffset += FontRenderers.getRenderer().getMarginHeight();
}
FontRenderers.getRenderer().drawCenteredString(stack, footer, width / 2d, height / 2d - modalHeight / 2d + yOffset, 1, 1, 1, (float) opacity);
if (go == null) {
go = new RoundButton(RoundButton.STANDARD, width / 2d - 120 / 2d, height - 10 - 20, 120, 20, "Continue", () -> {
shouldBeginStarting = true;
this.go.setEnabled(false);
});
}
go.setY(height - 10 - 20 + goButtonYOffsetRender);
go.render(stack, mouseX, mouseY, delta);
super.renderInternal(stack, mouseX, mouseY, delta);
}
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
if (go != null) go.mouseClicked(mouseX, mouseY, button);
return super.mouseClicked(mouseX, mouseY, button);
}
@Override
public void onFastTick() {
if (shouldBeginStarting) {
opacity -= 0.01;
opacity = MathHelper.clamp(opacity, 0, 1);
}
goButtonYOffsetRender = Transitions.transition(goButtonYOffsetRender, goButtonYOffset, 30, 0);
if (renderGoButton && !shouldBeginStarting) goButtonYOffset = 0;
else if (shouldBeginStarting) goButtonYOffset = 30;
if (go != null) go.onFastTick();
HomeScreen.instance().onFastTick();
}
}

View file

@ -12,24 +12,23 @@ import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
import org.apache.commons.compress.utils.Lists;
import java.awt.*;
import java.awt.Color;
public class TestScreen extends Screen implements FastTickable {
DoubleOptionSliderWidget goopy;
DoubleOptionSliderWidget curve;
double goopyV = 1d;
double curveV = 1d;
double[] data = new double[100];
double[] viewerData = new double[data.length];
Timer updater = new Timer();
double goopyV = 1d;
double curveV = 1d;
double[] data = new double[100];
double[] viewerData = new double[data.length];
Timer updater = new Timer();
public TestScreen() {
super(Text.of(""));
}
@Override
protected void init() {
@Override protected void init() {
DoubleOption dop = new DoubleOption("bruh", 1, 10, 0.01f, gameOptions -> 1d, (gameOptions, aDouble) -> goopyV = aDouble, (gameOptions, doubleOption) -> Text.of("goopy"));
goopy = new DoubleOptionSliderWidget(CoffeeClientMain.client.options, 5, height - 30, 100, 20, dop, Lists.newArrayList());
DoubleOption curve = new DoubleOption("curve", 1, 10, 0.01f, gameOptions -> 1d, (gameOptions, aDouble) -> curveV = aDouble, (gameOptions, doubleOption) -> Text.of("real"));
@ -39,8 +38,7 @@ public class TestScreen extends Screen implements FastTickable {
super.init();
}
@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
@Override public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
renderBackground(matrices);
@ -66,8 +64,7 @@ public class TestScreen extends Screen implements FastTickable {
super.render(matrices, mouseX, mouseY, delta);
}
@Override
public void onFastTick() {
@Override public void onFastTick() {
if (updater.hasExpired(5000)) {
updater.reset();
for (int i = 0; i < data.length; i++) {

View file

@ -11,19 +11,19 @@ import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.MathHelper;
import java.awt.*;
import java.awt.Color;
public class RoundButton implements Element, Drawable, Selectable, FastTickable, DoesMSAA {
public static Color STANDARD = new Color(40, 40, 40);
final Runnable onPress;
final Color color;
final Color color;
String text;
double x, y, width, height;
double animProgress = 0;
boolean isHovered = false;
boolean enabled = true;
double animProgress = 0;
boolean isHovered = false;
boolean enabled = true;
public RoundButton(Color color, double x, double y, double w, double h, String t, Runnable a) {
this.onPress = a;
@ -97,8 +97,7 @@ public class RoundButton implements Element, Drawable, Selectable, FastTickable,
return cx >= x && cx < x + width && cy >= y && cy < y + height;
}
@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
@Override public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
isHovered = inBounds(mouseX, mouseY) && isEnabled();
matrices.push();
matrices.translate(x + width / 2d, y + height / 2d, 0);
@ -107,23 +106,21 @@ public class RoundButton implements Element, Drawable, Selectable, FastTickable,
double originX = -width / 2d;
double originY = -height / 2d;
Renderer.R2D.renderRoundedQuad(matrices, color, originX, originY, width / 2d, height / 2d, Math.min(height / 2d, 5), 20);
FontRenderers.getRenderer().drawString(matrices, text, -(FontRenderers.getRenderer().getStringWidth(text) + 2) / 2f, -FontRenderers.getRenderer().getMarginHeight() / 2f, isEnabled() ? 0xFFFFFF : 0xAAAAAA, false);
FontRenderers.getRenderer().drawString(matrices, text, -(FontRenderers.getRenderer().getStringWidth(text) + 2) / 2f, -FontRenderers.getRenderer()
.getMarginHeight() / 2f, isEnabled() ? 0xFFFFFF : 0xAAAAAA, false);
matrices.pop();
}
@Override
public SelectionType getType() {
@Override public SelectionType getType() {
return isHovered ? SelectionType.HOVERED : SelectionType.NONE;
}
@Override
public void appendNarrations(NarrationMessageBuilder builder) {
@Override public void appendNarrations(NarrationMessageBuilder builder) {
}
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
@Override public boolean mouseClicked(double mouseX, double mouseY, int button) {
if (inBounds(mouseX, mouseY) && isEnabled() && button == 0) {
onPress.run();
return true;

View file

@ -3,6 +3,8 @@ package me.x150.coffee.feature.gui.widget;
import me.x150.coffee.CoffeeClientMain;
import me.x150.coffee.feature.gui.DoesMSAA;
import me.x150.coffee.helper.font.FontRenderers;
import me.x150.coffee.helper.render.ClipStack;
import me.x150.coffee.helper.render.Rectangle;
import me.x150.coffee.helper.render.Renderer;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.Drawable;
@ -14,19 +16,19 @@ import net.minecraft.util.math.MathHelper;
import org.apache.commons.lang3.SystemUtils;
import org.lwjgl.glfw.GLFW;
import java.awt.*;
import java.awt.Color;
public class RoundTextFieldWidget implements Element, Drawable, Selectable, DoesMSAA {
protected final String suggestion;
public Runnable changeListener = () -> {
protected final String suggestion;
public Runnable changeListener = () -> {
};
protected String text = "";
protected boolean focused;
protected int cursor;
protected double textStart;
protected int selectionStart, selectionEnd;
protected String text = "";
protected boolean focused;
protected int cursor;
protected double textStart;
protected int selectionStart, selectionEnd;
boolean mouseOver = false;
double x, y, width, height;
double x, y, width, height;
public RoundTextFieldWidget(double x, double y, double width, double height, String text) {
this.x = x;
@ -40,8 +42,7 @@ public class RoundTextFieldWidget implements Element, Drawable, Selectable, Does
return width - pad() * 2 - 1;
}
@Override
public boolean mouseReleased(double mouseX, double mouseY, int button) {
@Override public boolean mouseReleased(double mouseX, double mouseY, int button) {
int preSelectionCursor = 0;
if (selectionStart < preSelectionCursor && preSelectionCursor == selectionEnd) {
cursor = selectionStart;
@ -52,9 +53,10 @@ public class RoundTextFieldWidget implements Element, Drawable, Selectable, Does
return false;
}
@Override
public boolean keyPressed(int key, int scanCode, int mods) {
if (!focused) return false;
@Override public boolean keyPressed(int key, int scanCode, int mods) {
if (!focused) {
return false;
}
boolean control = MinecraftClient.IS_SYSTEM_MAC ? mods == GLFW.GLFW_MOD_SUPER : mods == GLFW.GLFW_MOD_CONTROL;
@ -85,7 +87,9 @@ public class RoundTextFieldWidget implements Element, Drawable, Selectable, Does
}
public boolean onKeyRepeated(int key, int mods) {
if (!focused) return false;
if (!focused) {
return false;
}
boolean control = MinecraftClient.IS_SYSTEM_MAC ? mods == GLFW.GLFW_MOD_SUPER : mods == GLFW.GLFW_MOD_CONTROL;
boolean shift = mods == GLFW.GLFW_MOD_SHIFT;
@ -115,23 +119,23 @@ public class RoundTextFieldWidget implements Element, Drawable, Selectable, Does
cursor += addedChars;
resetSelection();
if (!text.equals(preText)) runAction();
if (!text.equals(preText)) {
runAction();
}
return true;
} else if (key == GLFW.GLFW_KEY_BACKSPACE) {
if (cursor > 0 && cursor == selectionStart && cursor == selectionEnd) {
String preText = text;
int count = (mods == isCtrlPressed)
? cursor
: (mods == (SystemUtils.IS_OS_WINDOWS ? GLFW.GLFW_MOD_CONTROL : GLFW.GLFW_MOD_ALT))
? countToNextSpace(true)
: 1;
int count = (mods == isCtrlPressed) ? cursor : (mods == (SystemUtils.IS_OS_WINDOWS ? GLFW.GLFW_MOD_CONTROL : GLFW.GLFW_MOD_ALT)) ? countToNextSpace(true) : 1;
text = text.substring(0, cursor - count) + text.substring(cursor);
cursor -= count;
resetSelection();
if (!text.equals(preText)) runAction();
if (!text.equals(preText)) {
runAction();
}
} else if (cursor != selectionStart || cursor != selectionEnd) {
clearSelection();
}
@ -144,15 +148,13 @@ public class RoundTextFieldWidget implements Element, Drawable, Selectable, Does
if (cursor == selectionStart && cursor == selectionEnd) {
String preText = text;
int count = ctrl
? text.length() - cursor
: (mods == (SystemUtils.IS_OS_WINDOWS ? GLFW.GLFW_MOD_CONTROL : GLFW.GLFW_MOD_ALT))
? countToNextSpace(false)
: 1;
int count = ctrl ? text.length() - cursor : (mods == (SystemUtils.IS_OS_WINDOWS ? GLFW.GLFW_MOD_CONTROL : GLFW.GLFW_MOD_ALT)) ? countToNextSpace(false) : 1;
text = text.substring(0, cursor) + text.substring(cursor + count);
if (!text.equals(preText)) runAction();
if (!text.equals(preText)) {
runAction();
}
} else {
clearSelection();
}
@ -307,9 +309,10 @@ public class RoundTextFieldWidget implements Element, Drawable, Selectable, Does
runAction();
}
@Override
public boolean charTyped(char c, int modifiers) {
if (!focused) return false;
@Override public boolean charTyped(char c, int modifiers) {
if (!focused) {
return false;
}
clearSelection();
@ -326,17 +329,17 @@ public class RoundTextFieldWidget implements Element, Drawable, Selectable, Does
return cx >= x && cx < x + width && cy >= y && cy < y + height;
}
@Override
public void render(MatrixStack stack, int mouseX, int mouseY, float delta) {
@Override public void render(MatrixStack stack, int mouseX, int mouseY, float delta) {
mouseOver = inBounds(mouseX, mouseY);
double pad = pad();
double overflowWidth = getOverflowWidthForRender();
double innerHeight = FontRenderers.getRenderer().getFontHeight();
double centerY = y + height / 2d - innerHeight / 2d;
// Renderer.R2D.renderQuad(stack,Color.RED,x,y+height,x+width,y+height+.5);
// Renderer.R2D.renderQuad(stack,Color.RED,x,y+height,x+width,y+height+.5);
Renderer.R2D.renderRoundedQuad(stack, new Color(40, 40, 40), x, y, x + width, y + height, 5, 20);
Renderer.R2D.beginScissor(stack, x + pad, y, x + width - pad, y + height);
ClipStack.globalInstance.addWindow(stack, new Rectangle(x + pad, y, x + width - pad, y + height));
//Renderer.R2D.beginScissor(stack, x + pad, y, x + width - pad, y + height);
// Text content
if (!text.isEmpty()) {
FontRenderers.getRenderer().drawString(stack, text, (float) (x + pad - overflowWidth), (float) (centerY), 0xFFFFFF, false);
@ -350,17 +353,20 @@ public class RoundTextFieldWidget implements Element, Drawable, Selectable, Does
double selEnd = x + pad + getTextWidth(selectionEnd) - overflowWidth;
Renderer.R2D.renderQuad(stack, new Color(50, 50, 255, 100), selStart, centerY, selEnd, centerY + FontRenderers.getRenderer().getMarginHeight());
}
Renderer.R2D.endScissor();
ClipStack.globalInstance.popWindow(stack);
//Renderer.R2D.endScissor();
boolean renderCursor = (System.currentTimeMillis() % 1000) / 500d > 1;
if (focused && renderCursor) {
Renderer.R2D.renderQuad(stack, Color.WHITE, x + pad + getTextWidth(cursor) - overflowWidth, centerY, x + pad + getTextWidth(cursor) - overflowWidth + 1, centerY + FontRenderers.getRenderer().getMarginHeight());
Renderer.R2D.renderQuad(stack, Color.WHITE, x + pad + getTextWidth(cursor) - overflowWidth, centerY, x + pad + getTextWidth(cursor) - overflowWidth + 1, centerY + FontRenderers.getRenderer()
.getMarginHeight());
}
}
private void clearSelection() {
if (selectionStart == selectionEnd) return;
if (selectionStart == selectionEnd) {
return;
}
String preText = text;
@ -369,7 +375,9 @@ public class RoundTextFieldWidget implements Element, Drawable, Selectable, Does
cursor = selectionStart;
selectionEnd = cursor;
if (!text.equals(preText)) runAction();
if (!text.equals(preText)) {
runAction();
}
}
private void resetSelection() {
@ -383,13 +391,22 @@ public class RoundTextFieldWidget implements Element, Drawable, Selectable, Does
for (int i = cursor; toLeft ? i >= 0 : i < text.length(); i += toLeft ? -1 : 1) {
int j = i;
if (toLeft) j--;
if (toLeft) {
j--;
}
if (j >= text.length()) continue;
if (j < 0) break;
if (j >= text.length()) {
continue;
}
if (j < 0) {
break;
}
if (hadNonSpace && Character.isWhitespace(text.charAt(j))) break;
else if (!Character.isWhitespace(text.charAt(j))) hadNonSpace = true;
if (hadNonSpace && Character.isWhitespace(text.charAt(j))) {
break;
} else if (!Character.isWhitespace(text.charAt(j))) {
hadNonSpace = true;
}
count++;
}
@ -399,7 +416,9 @@ public class RoundTextFieldWidget implements Element, Drawable, Selectable, Does
private void runAction() {
cursorChanged();
if (changeListener != null) changeListener.run();
if (changeListener != null) {
changeListener.run();
}
}
private double textWidth() {
@ -426,7 +445,9 @@ public class RoundTextFieldWidget implements Element, Drawable, Selectable, Does
}
protected double getTextWidth(int pos) {
if (pos < 0) return 0;
if (pos < 0) {
return 0;
}
pos = Math.min(text.length(), pos);
return FontRenderers.getRenderer().getStringWidth(text.substring(0, pos)) + 1;
}
@ -465,7 +486,9 @@ public class RoundTextFieldWidget implements Element, Drawable, Selectable, Does
resetSelection();
if (wasJustFocused) onCursorChanged();
if (wasJustFocused) {
onCursorChanged();
}
}
public void setCursorMax() {
@ -476,18 +499,15 @@ public class RoundTextFieldWidget implements Element, Drawable, Selectable, Does
return 4;
}
@Override
public SelectionType getType() {
@Override public SelectionType getType() {
return mouseOver ? SelectionType.HOVERED : SelectionType.NONE;
}
@Override
public void appendNarrations(NarrationMessageBuilder builder) {
@Override public void appendNarrations(NarrationMessageBuilder builder) {
}
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
@Override public boolean mouseClicked(double mouseX, double mouseY, int button) {
if (mouseOver) {
if (button == GLFW.GLFW_MOUSE_BUTTON_RIGHT) {
if (!text.isEmpty()) {
@ -504,7 +524,9 @@ public class RoundTextFieldWidget implements Element, Drawable, Selectable, Does
return true;
}
if (focused) setFocused(false);
if (focused) {
setFocused(false);
}
return false;
}

View file

@ -15,15 +15,15 @@ import net.minecraft.client.util.math.MatrixStack;
public abstract class Module {
protected static final MinecraftClient client = CoffeeClientMain.client;
public final ModuleConfig config;
public final DoubleSetting keybind;
private final BooleanSetting debuggerEnabled;
private final String name;
private final String description;
private final ModuleType moduleType;
private final BooleanSetting toasts;
private boolean enabled = false;
protected static final MinecraftClient client = CoffeeClientMain.client;
public final ModuleConfig config;
public final DoubleSetting keybind;
private final BooleanSetting debuggerEnabled;
private final String name;
private final String description;
private final ModuleType moduleType;
private final BooleanSetting toasts;
private boolean enabled = false;
public Module(String n, String d, ModuleType type) {
this.name = n;

View file

@ -6,20 +6,104 @@
package me.x150.coffee.feature.module;
import me.x150.coffee.feature.module.impl.combat.*;
import me.x150.coffee.feature.module.impl.exploit.*;
import me.x150.coffee.feature.module.impl.fun.*;
import me.x150.coffee.feature.module.impl.misc.*;
import me.x150.coffee.feature.module.impl.movement.*;
import me.x150.coffee.feature.module.impl.render.*;
import me.x150.coffee.feature.module.impl.world.*;
import me.x150.coffee.feature.module.impl.combat.AimAssist;
import me.x150.coffee.feature.module.impl.combat.AutoAttack;
import me.x150.coffee.feature.module.impl.combat.Criticals;
import me.x150.coffee.feature.module.impl.combat.Killaura;
import me.x150.coffee.feature.module.impl.combat.Velocity;
import me.x150.coffee.feature.module.impl.exploit.AntiAntiXray;
import me.x150.coffee.feature.module.impl.exploit.AntiReducedDebugInfo;
import me.x150.coffee.feature.module.impl.exploit.Boaty;
import me.x150.coffee.feature.module.impl.exploit.CarpetBomb;
import me.x150.coffee.feature.module.impl.exploit.InstaBow;
import me.x150.coffee.feature.module.impl.exploit.NoComCrash;
import me.x150.coffee.feature.module.impl.exploit.OOBCrash;
import me.x150.coffee.feature.module.impl.exploit.OffhandCrash;
import me.x150.coffee.feature.module.impl.exploit.PingSpoof;
import me.x150.coffee.feature.module.impl.exploit.SkinChangeExploit;
import me.x150.coffee.feature.module.impl.exploit.VanillaSpoof;
import me.x150.coffee.feature.module.impl.fun.AutoTrap;
import me.x150.coffee.feature.module.impl.fun.Deadmau5;
import me.x150.coffee.feature.module.impl.fun.FakeHacker;
import me.x150.coffee.feature.module.impl.fun.Spinner;
import me.x150.coffee.feature.module.impl.fun.Test;
import me.x150.coffee.feature.module.impl.fun.TpRange;
import me.x150.coffee.feature.module.impl.misc.AllowFormatCodes;
import me.x150.coffee.feature.module.impl.misc.AntiOffhandCrash;
import me.x150.coffee.feature.module.impl.misc.AntiPacketKick;
import me.x150.coffee.feature.module.impl.misc.FireballDeflector;
import me.x150.coffee.feature.module.impl.misc.InfChatLength;
import me.x150.coffee.feature.module.impl.misc.MinehutAdBlocker;
import me.x150.coffee.feature.module.impl.misc.NoTitles;
import me.x150.coffee.feature.module.impl.misc.PortalGUI;
import me.x150.coffee.feature.module.impl.misc.ShulkerDeflector;
import me.x150.coffee.feature.module.impl.misc.Timer;
import me.x150.coffee.feature.module.impl.misc.XCarry;
import me.x150.coffee.feature.module.impl.movement.AirJump;
import me.x150.coffee.feature.module.impl.movement.AntiAnvil;
import me.x150.coffee.feature.module.impl.movement.AutoElytra;
import me.x150.coffee.feature.module.impl.movement.Backtrack;
import me.x150.coffee.feature.module.impl.movement.Blink;
import me.x150.coffee.feature.module.impl.movement.BlocksmcFlight;
import me.x150.coffee.feature.module.impl.movement.BoatPhase;
import me.x150.coffee.feature.module.impl.movement.Boost;
import me.x150.coffee.feature.module.impl.movement.EdgeJump;
import me.x150.coffee.feature.module.impl.movement.EdgeSneak;
import me.x150.coffee.feature.module.impl.movement.EntityFly;
import me.x150.coffee.feature.module.impl.movement.Flight;
import me.x150.coffee.feature.module.impl.movement.Hyperspeed;
import me.x150.coffee.feature.module.impl.movement.IgnoreWorldBorder;
import me.x150.coffee.feature.module.impl.movement.InventoryWalk;
import me.x150.coffee.feature.module.impl.movement.Jesus;
import me.x150.coffee.feature.module.impl.movement.LongJump;
import me.x150.coffee.feature.module.impl.movement.MoonGravity;
import me.x150.coffee.feature.module.impl.movement.NoFall;
import me.x150.coffee.feature.module.impl.movement.NoJumpCooldown;
import me.x150.coffee.feature.module.impl.movement.NoLevitation;
import me.x150.coffee.feature.module.impl.movement.NoPush;
import me.x150.coffee.feature.module.impl.movement.Phase;
import me.x150.coffee.feature.module.impl.movement.Sprint;
import me.x150.coffee.feature.module.impl.movement.Step;
import me.x150.coffee.feature.module.impl.movement.Swing;
import me.x150.coffee.feature.module.impl.render.CaveMapper;
import me.x150.coffee.feature.module.impl.render.ClickGUI;
import me.x150.coffee.feature.module.impl.render.ESP;
import me.x150.coffee.feature.module.impl.render.FreeLook;
import me.x150.coffee.feature.module.impl.render.Freecam;
import me.x150.coffee.feature.module.impl.render.Fullbright;
import me.x150.coffee.feature.module.impl.render.Hud;
import me.x150.coffee.feature.module.impl.render.ItemByteSize;
import me.x150.coffee.feature.module.impl.render.NameTags;
import me.x150.coffee.feature.module.impl.render.TabGui;
import me.x150.coffee.feature.module.impl.render.TargetHud;
import me.x150.coffee.feature.module.impl.render.Tracers;
import me.x150.coffee.feature.module.impl.render.Trail;
import me.x150.coffee.feature.module.impl.render.Zoom;
import me.x150.coffee.feature.module.impl.world.AnyPlacer;
import me.x150.coffee.feature.module.impl.world.AutoLavacast;
import me.x150.coffee.feature.module.impl.world.AutoTnt;
import me.x150.coffee.feature.module.impl.world.AutoTool;
import me.x150.coffee.feature.module.impl.world.BlockTagViewer;
import me.x150.coffee.feature.module.impl.world.Boom;
import me.x150.coffee.feature.module.impl.world.ClickNuke;
import me.x150.coffee.feature.module.impl.world.FastUse;
import me.x150.coffee.feature.module.impl.world.Flattener;
import me.x150.coffee.feature.module.impl.world.GodBridge;
import me.x150.coffee.feature.module.impl.world.InstantBreak;
import me.x150.coffee.feature.module.impl.world.LetThereBeLight;
import me.x150.coffee.feature.module.impl.world.MassUse;
import me.x150.coffee.feature.module.impl.world.NoBreakDelay;
import me.x150.coffee.feature.module.impl.world.Nuker;
import me.x150.coffee.feature.module.impl.world.Scaffold;
import me.x150.coffee.feature.module.impl.world.Voider;
import me.x150.coffee.feature.module.impl.world.XRAY;
import java.util.ArrayList;
import java.util.List;
public class ModuleRegistry {
static final List<Module> modules = new ArrayList<>();
static boolean initialized = false;
static final List<Module> modules = new ArrayList<>();
static boolean initialized = false;
public static void init() {
initialized = true;
@ -123,8 +207,7 @@ public class ModuleRegistry {
return modules;
}
@SuppressWarnings("unchecked")
public static <T extends Module> T getByClass(Class<T> clazz) {
@SuppressWarnings("unchecked") public static <T extends Module> T getByClass(Class<T> clazz) {
if (!initialized) {
init();
}

View file

@ -8,10 +8,11 @@ package me.x150.coffee.feature.module;
import me.x150.coffee.helper.Texture;
public enum ModuleType {
RENDER("Render", new Texture("icons/render")), MOVEMENT("Movement", new Texture("icons/move")), MISC("Miscellaneous", new Texture("icons/misc")), WORLD("World", new Texture("icons/world")), EXPLOIT("Exploit", new Texture("icons/exploit")), FUN("Fun", new Texture("icons/fun")), COMBAT("Combat", new Texture("icons/combat"));
RENDER("Render", new Texture("icons/render")), MOVEMENT("Movement", new Texture("icons/move")), MISC("Miscellaneous", new Texture("icons/misc")), WORLD("World", new Texture("icons/world")),
EXPLOIT("Exploit", new Texture("icons/exploit")), FUN("Fun", new Texture("icons/fun")), COMBAT("Combat", new Texture("icons/combat"));
final String name;
final String name;
final Texture tex;
ModuleType(String n, Texture tex) {

View file

@ -33,44 +33,17 @@ import java.util.stream.Collectors;
public class AimAssist extends Module {
final BooleanSetting attackPlayers = this.config.create(new BooleanSetting.Builder(true)
.name("Attack players")
.description("Whether or not to aim at players")
final BooleanSetting attackPlayers = this.config.create(new BooleanSetting.Builder(true).name("Attack players").description("Whether or not to aim at players").get());
final BooleanSetting attackHostile = this.config.create(new BooleanSetting.Builder(true).name("Attack hostile").description("Whether or not to aim at hostile entities").get());
final BooleanSetting attackNeutral = this.config.create(new BooleanSetting.Builder(true).name("Attack neutral").description("Whether or not to aim at neutral entities").get());
final BooleanSetting attackPassive = this.config.create(new BooleanSetting.Builder(true).name("Attack passive").description("Whether or nott o aim at passive entities").get());
final BooleanSetting attackEverything = this.config.create(new BooleanSetting.Builder(true).name("Attack everything").description("Whether or not to aim at everything else").get());
final BooleanSetting aimAtCombatPartner = this.config.create(new BooleanSetting.Builder(true).name("Aim at combat").description("Whether or not to only aim at the combat partner")
.get());
final BooleanSetting attackHostile = this.config.create(new BooleanSetting.Builder(true)
.name("Attack hostile")
.description("Whether or not to aim at hostile entities")
final EnumSetting<PriorityMode> priority = this.config.create(new EnumSetting.Builder<>(PriorityMode.Distance).name("Priority").description("What to prioritize when aiminig").get());
final DoubleSetting laziness = this.config.create(new DoubleSetting.Builder(1).name("Laziness").description("How lazy to get when aiming").min(0.1).max(5).precision(1)
.get());
final BooleanSetting attackNeutral = this.config.create(new BooleanSetting.Builder(true)
.name("Attack neutral")
.description("Whether or not to aim at neutral entities")
.get());
final BooleanSetting attackPassive = this.config.create(new BooleanSetting.Builder(true)
.name("Attack passive")
.description("Whether or nott o aim at passive entities")
.get());
final BooleanSetting attackEverything = this.config.create(new BooleanSetting.Builder(true)
.name("Attack everything")
.description("Whether or not to aim at everything else")
.get());
final BooleanSetting aimAtCombatPartner = this.config.create(new BooleanSetting.Builder(true)
.name("Aim at combat")
.description("Whether or not to only aim at the combat partner")
.get());
final EnumSetting<PriorityMode> priority = this.config.create(new EnumSetting.Builder<>(PriorityMode.Distance)
.name("Priority")
.description("What to prioritize when aiminig")
.get());
final DoubleSetting laziness = this.config.create(new DoubleSetting.Builder(1)
.name("Laziness")
.description("How lazy to get when aiming")
.min(0.1)
.max(5)
.precision(1)
.get());
final BooleanSetting aimInstant = this.config.create(new BooleanSetting.Builder(false)
.name("Aim instantly")
.description("Whether or not to aim instantly instead of smoothly")
final BooleanSetting aimInstant = this.config.create(new BooleanSetting.Builder(false).name("Aim instantly").description("Whether or not to aim instantly instead of smoothly")
.get());
Entity le;
@ -84,8 +57,7 @@ public class AimAssist extends Module {
laziness.showIf(() -> !aimInstant.getValue());
}
@Override
public void tick() {
@Override public void tick() {
List<Entity> attacks = new ArrayList<>();
if (aimAtCombatPartner.getValue()) {
if (AttackManager.getLastAttackInTimeRange() != null) {
@ -136,7 +108,8 @@ public class AimAssist extends Module {
return;
}
if (priority.getValue() == PriorityMode.Distance) {
le = attacks.stream().sorted(Comparator.comparingDouble(value -> value.getPos().distanceTo(Objects.requireNonNull(CoffeeClientMain.client.player).getPos()))).collect(Collectors.toList()).get(0);
le = attacks.stream().sorted(Comparator.comparingDouble(value -> value.getPos().distanceTo(Objects.requireNonNull(CoffeeClientMain.client.player).getPos()))).collect(Collectors.toList())
.get(0);
} else {
// get entity with the least health if mode is ascending, else get most health
le = attacks.stream().sorted(Comparator.comparingDouble(value -> {
@ -149,23 +122,19 @@ public class AimAssist extends Module {
}
@Override
public void onFastTick() {
@Override public void onFastTick() {
aimAtTarget();
}
@Override
public void enable() {
@Override public void enable() {
}
@Override
public void disable() {
@Override public void disable() {
}
@Override
public String getContext() {
@Override public String getContext() {
return null;
}
@ -179,8 +148,7 @@ public class AimAssist extends Module {
}
}
@Override
public void onWorldRender(MatrixStack matrices) {
@Override public void onWorldRender(MatrixStack matrices) {
if (le != null) {
Vec3d origin = le.getPos();
float h = le.getHeight();
@ -188,8 +156,7 @@ public class AimAssist extends Module {
}
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
}

View file

@ -16,36 +16,31 @@ public class AutoAttack extends Module {
super("AutoAttack", "Automatically attacks the entity you're looking at", ModuleType.COMBAT);
}
@Override
public void tick() {
if (!(CoffeeClientMain.client.crosshairTarget instanceof EntityHitResult) || Objects.requireNonNull(CoffeeClientMain.client.player).getAttackCooldownProgress(0) < 1)
@Override public void tick() {
if (!(CoffeeClientMain.client.crosshairTarget instanceof EntityHitResult) || Objects.requireNonNull(CoffeeClientMain.client.player).getAttackCooldownProgress(0) < 1) {
return;
}
Objects.requireNonNull(CoffeeClientMain.client.interactionManager).attackEntity(CoffeeClientMain.client.player, ((EntityHitResult) CoffeeClientMain.client.crosshairTarget).getEntity());
CoffeeClientMain.client.player.swingHand(Hand.MAIN_HAND);
}
@Override
public void enable() {
@Override public void enable() {
}
@Override
public void disable() {
@Override public void disable() {
}
@Override
public String getContext() {
@Override public String getContext() {
return null;
}
@Override
public void onWorldRender(MatrixStack matrices) {
@Override public void onWorldRender(MatrixStack matrices) {
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
}
}

View file

@ -21,10 +21,7 @@ import net.minecraft.util.math.Vec3d;
public class Criticals extends Module {
final EnumSetting<Mode> mode = this.config.create(new EnumSetting.Builder<>(Mode.Packet)
.name("Mode")
.description("How to deal crits")
.get());
final EnumSetting<Mode> mode = this.config.create(new EnumSetting.Builder<>(Mode.Packet).name("Mode").description("How to deal crits").get());
public Criticals() {
super("Criticals", "Makes you deal a perfect 10/10 crit every time", ModuleType.COMBAT);
@ -60,33 +57,27 @@ public class Criticals extends Module {
}
@Override
public void tick() {
@Override public void tick() {
}
@Override
public void enable() {
@Override public void enable() {
}
@Override
public void disable() {
@Override public void disable() {
}
@Override
public String getContext() {
@Override public String getContext() {
return null;
}
@Override
public void onWorldRender(MatrixStack matrices) {
@Override public void onWorldRender(MatrixStack matrices) {
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
}

View file

@ -42,86 +42,30 @@ import java.util.stream.Collectors;
public class Killaura extends Module {
final Timer delayExec = new Timer();
final BooleanSetting capRangeAtMax = this.config.create(new BooleanSetting.Builder(true)
.name("Auto range")
.description("Whether or not to set the range to the vanilla one")
.get());
final DoubleSetting range = this.config.create(new DoubleSetting.Builder(3.2)
.name("Range")
.description("How far to reach")
.min(0.1)
.max(7)
.precision(1)
.get());
final Timer delayExec = new Timer();
final BooleanSetting capRangeAtMax = this.config.create(new BooleanSetting.Builder(true).name("Auto range").description("Whether or not to set the range to the vanilla one").get());
final DoubleSetting range = this.config.create(new DoubleSetting.Builder(3.2).name("Range").description("How far to reach").min(0.1).max(7).precision(1).get());
final BooleanSetting automaticDelay = this.config.create(new BooleanSetting.Builder(true)
.name("Auto delay")
.description("Whether or not to automatically calculate perfect delay")
.get());
final DoubleSetting delay = this.config.create(new DoubleSetting.Builder(0)
.name("Delay")
.description("How much to wait between attacks")
.min(0)
.max(20)
.precision(1)
.get());
final BooleanSetting automaticDelay = this.config.create(new BooleanSetting.Builder(true).name("Auto delay").description("Whether or not to automatically calculate perfect delay").get());
final DoubleSetting delay = this.config.create(new DoubleSetting.Builder(0).name("Delay").description("How much to wait between attacks").min(0).max(20).precision(1).get());
final BooleanSetting attackOnlyCombatPartner = this.config.create(new BooleanSetting.Builder(true)
.name("Attack only combat")
.description("Whether or not to only aim at the combat partner")
.get());
final BooleanSetting attackPlayers = this.config.create(new BooleanSetting.Builder(true)
.name("Attack players")
.description("Whether or not to aim at players")
.get());
final BooleanSetting attackHostile = this.config.create(new BooleanSetting.Builder(true)
.name("Attack hostile")
.description("Whether or not to aim at hostile entities")
.get());
final BooleanSetting attackNeutral = this.config.create(new BooleanSetting.Builder(true)
.name("Attack neutral")
.description("Whether or not to aim at neutral entities")
.get());
final BooleanSetting attackPassive = this.config.create(new BooleanSetting.Builder(true)
.name("Attack passive")
.description("Whether or nott o aim at passive entities")
.get());
final BooleanSetting attackEverything = this.config.create(new BooleanSetting.Builder(true)
.name("Attack everything")
.description("Whether or not to aim at everything else")
final BooleanSetting attackOnlyCombatPartner = this.config.create(new BooleanSetting.Builder(true).name("Attack only combat").description("Whether or not to only aim at the combat partner")
.get());
final BooleanSetting attackPlayers = this.config.create(new BooleanSetting.Builder(true).name("Attack players").description("Whether or not to aim at players").get());
final BooleanSetting attackHostile = this.config.create(new BooleanSetting.Builder(true).name("Attack hostile").description("Whether or not to aim at hostile entities").get());
final BooleanSetting attackNeutral = this.config.create(new BooleanSetting.Builder(true).name("Attack neutral").description("Whether or not to aim at neutral entities").get());
final BooleanSetting attackPassive = this.config.create(new BooleanSetting.Builder(true).name("Attack passive").description("Whether or nott o aim at passive entities").get());
final BooleanSetting attackEverything = this.config.create(new BooleanSetting.Builder(true).name("Attack everything").description("Whether or not to aim at everything else").get());
final EnumSetting<SelectMode> mode = this.config.create(new EnumSetting.Builder<>(SelectMode.Single)
.name("Mode")
.description("How to attack the entities")
.get());
final DoubleSetting multiLimit = this.config.create(new DoubleSetting.Builder(1)
.name("Targets")
.description("How many multi targets to attack")
.min(1)
.max(10)
.precision(0)
.get());
final EnumSetting<PriorityMode> prio = this.config.create(new EnumSetting.Builder<>(PriorityMode.Distance)
.name("Priority")
.description("What to prioritize when aiming")
.get());
final EnumSetting<SelectMode> mode = this.config.create(new EnumSetting.Builder<>(SelectMode.Single).name("Mode").description("How to attack the entities").get());
final DoubleSetting multiLimit = this.config.create(new DoubleSetting.Builder(1).name("Targets").description("How many multi targets to attack").min(1).max(10).precision(0).get());
final EnumSetting<PriorityMode> prio = this.config.create(new EnumSetting.Builder<>(PriorityMode.Distance).name("Priority").description("What to prioritize when aiming").get());
final BooleanSetting enableConfuse = this.config.create(new BooleanSetting.Builder(false)
.name("Enable confuse")
.description("Whether or not to enable confuse")
.get());
final EnumSetting<ConfuseMode> confuseMode = this.config.create(new EnumSetting.Builder<>(ConfuseMode.TP)
.name("Confuse mode")
.description("How to confuse the enemy")
.get());
final BooleanSetting confuseAllowClip = this.config.create(new BooleanSetting.Builder(false)
.name("Confuse into solid")
.description("Allow confuse to tp into blocks")
.get());
final List<Entity> attacks = new ArrayList<>();
final BooleanSetting enableConfuse = this.config.create(new BooleanSetting.Builder(false).name("Enable confuse").description("Whether or not to enable confuse").get());
final EnumSetting<ConfuseMode> confuseMode = this.config.create(new EnumSetting.Builder<>(ConfuseMode.TP).name("Confuse mode").description("How to confuse the enemy").get());
final BooleanSetting confuseAllowClip = this.config.create(new BooleanSetting.Builder(false).name("Confuse into solid").description("Allow confuse to tp into blocks").get());
final List<Entity> attacks = new ArrayList<>();
Entity combatPartner;
double circleProg = 0;
@ -204,8 +148,7 @@ public class Killaura extends Module {
}
}
@Override
public void tick() {
@Override public void tick() {
if (CoffeeClientMain.client.world == null || CoffeeClientMain.client.player == null || CoffeeClientMain.client.interactionManager == null) {
return;
}
@ -296,8 +239,8 @@ public class Killaura extends Module {
if (mode.getValue() == SelectMode.Single) {
Entity tar = null;
if (prio.getValue() == PriorityMode.Distance) {
tar = attacks.stream().sorted(Comparator.comparingDouble(value -> value.getPos().distanceTo(Objects.requireNonNull(CoffeeClientMain.client.player).getPos()))).collect(Collectors.toList())
.get(0);
tar = attacks.stream().sorted(Comparator.comparingDouble(value -> value.getPos().distanceTo(Objects.requireNonNull(CoffeeClientMain.client.player).getPos())))
.collect(Collectors.toList()).get(0);
} else if (prio.getValue() == PriorityMode.Health_ascending || prio.getValue() == PriorityMode.Health_descending) { // almost missed this
// get entity with the least health if mode is ascending, else get most health
tar = attacks.stream().sorted(Comparator.comparingDouble(value -> {
@ -346,18 +289,15 @@ public class Killaura extends Module {
}
}
@Override
public void enable() {
@Override public void enable() {
}
@Override
public void disable() {
@Override public void disable() {
}
@Override
public String getContext() {
@Override public String getContext() {
List<String> t = new ArrayList<>();
t.add("T" + attacks.size());
t.add("D" + getDelay());
@ -366,8 +306,7 @@ public class Killaura extends Module {
return "[" + String.join(";", t) + "]";
}
@Override
public void onWorldRender(MatrixStack matrices) {
@Override public void onWorldRender(MatrixStack matrices) {
if (!attackOnlyCombatPartner.getValue()) {
return;
}
@ -378,8 +317,7 @@ public class Killaura extends Module {
}
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
}

View file

@ -19,24 +19,11 @@ import net.minecraft.network.packet.s2c.play.EntityVelocityUpdateS2CPacket;
public class Velocity extends Module {
final DoubleSetting multiplierX = this.config.create(new DoubleSetting.Builder(0.2)
.name("Horizontal velocity")
.description("How much to multiply X and Z velocity by")
.min(-2.5)
.max(2.5)
.precision(1)
.get());
final DoubleSetting multiplierY = this.config.create(new DoubleSetting.Builder(0.2)
.name("Vertical velocity")
.description("How much to multiply Y velocity by")
.min(-2.5)
.max(2.5)
.precision(1)
.get());
final EnumSetting<Mode> mode = this.config.create(new EnumSetting.Builder<>(Mode.Modify)
.name("Mode")
.description("How to modify velocity")
final DoubleSetting multiplierX = this.config.create(new DoubleSetting.Builder(0.2).name("Horizontal velocity").description("How much to multiply X and Z velocity by").min(-2.5).max(2.5)
.precision(1).get());
final DoubleSetting multiplierY = this.config.create(new DoubleSetting.Builder(0.2).name("Vertical velocity").description("How much to multiply Y velocity by").min(-2.5).max(2.5).precision(1)
.get());
final EnumSetting<Mode> mode = this.config.create(new EnumSetting.Builder<>(Mode.Modify).name("Mode").description("How to modify velocity").get());
public Velocity() {
super("Velocity", "Modifies all incoming velocity updates", ModuleType.COMBAT);
@ -66,33 +53,27 @@ public class Velocity extends Module {
});
}
@Override
public void tick() {
@Override public void tick() {
}
@Override
public void enable() {
@Override public void enable() {
}
@Override
public void disable() {
@Override public void disable() {
}
@Override
public String getContext() {
@Override public String getContext() {
return null;
}
@Override
public void onWorldRender(MatrixStack matrices) {
@Override public void onWorldRender(MatrixStack matrices) {
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
}

View file

@ -24,7 +24,7 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
import java.awt.*;
import java.awt.Color;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.List;
@ -32,58 +32,24 @@ import java.util.Queue;
public class AntiAntiXray extends Module {
final Queue<BlockPos> toScan = new ArrayDeque<>();
final List<BlockPos> renders = new ArrayList<>();
final List<BlockPos> visitsAfter = new ArrayList<>();
final DoubleSetting range = this.config.create(new DoubleSetting.Builder(16)
.name("Range")
.description("How far to scan")
.min(2)
.max(64)
.precision(0)
.get());
final DoubleSetting customYSize = this.config.create(new DoubleSetting.Builder(-1)
.name("Custom Y size")
.description("Custom Y size of the scanner box (-1 to disable)")
.min(-1)
.max(128)
.precision(0)
.get());
final DoubleSetting skipDistance = this.config.create(new DoubleSetting.Builder(2)
.name("Skip distance")
.description("In which interval to skip blocks")
.min(0)
.max(6)
.precision(1)
.get());
final EnumSetting<Mode> mode = this.config.create(new EnumSetting.Builder<>(Mode.Ores)
.name("Mode")
.description("Which blocks to scan")
.get());
final DoubleSetting blocksPerTick = this.config.create(new DoubleSetting.Builder(10)
.name("Blocks per tick")
.description("How many blocks to scan per tick")
.min(1)
.max(20)
.precision(0)
.get());
final DoubleSetting delay = this.config.create(new DoubleSetting.Builder(0)
.name("Delay")
.description("How much to wait between scan bursts")
.min(0)
.max(20)
.precision(0)
.get());
final BooleanSetting showAura = this.config.create(new BooleanSetting.Builder(false)
.name("Show aura")
.description("Shows a nice effect around the scanner (VERY performance intensive)")
final Queue<BlockPos> toScan = new ArrayDeque<>();
final List<BlockPos> renders = new ArrayList<>();
final List<BlockPos> visitsAfter = new ArrayList<>();
final DoubleSetting range = this.config.create(new DoubleSetting.Builder(16).name("Range").description("How far to scan").min(2).max(64).precision(0).get());
final DoubleSetting customYSize = this.config.create(new DoubleSetting.Builder(-1).name("Custom Y size").description("Custom Y size of the scanner box (-1 to disable)").min(-1).max(128)
.precision(0).get());
final DoubleSetting skipDistance = this.config.create(new DoubleSetting.Builder(2).name("Skip distance").description("In which interval to skip blocks").min(0).max(6).precision(1).get());
final EnumSetting<Mode> mode = this.config.create(new EnumSetting.Builder<>(Mode.Ores).name("Mode").description("Which blocks to scan").get());
final DoubleSetting blocksPerTick = this.config.create(new DoubleSetting.Builder(10).name("Blocks per tick").description("How many blocks to scan per tick").min(1).max(20).precision(0).get());
final DoubleSetting delay = this.config.create(new DoubleSetting.Builder(0).name("Delay").description("How much to wait between scan bursts").min(0).max(20).precision(0).get());
final BooleanSetting showAura = this.config.create(new BooleanSetting.Builder(false).name("Show aura").description("Shows a nice effect around the scanner (VERY performance intensive)")
.get());
// final SliderValue customYSize = (SliderValue) this.config.create("Custom Y size", -1, -1, 255, 0).description("Custom Y size of scanner box (-1 to disable)");
List<BlockPos> permanentToScan = new ArrayList<>();
Vec3d startPos;
int scanned = 0;
int delayPassed = 0;
BlockPos latestGoal = null;
Vec3d startPos;
int scanned = 0;
int delayPassed = 0;
BlockPos latestGoal = null;
public AntiAntiXray() {
super("AntiAntiXray", "Bypasses most anti xray plugins", ModuleType.EXPLOIT);
@ -102,8 +68,7 @@ public class AntiAntiXray extends Module {
};
}
@Override
public void tick() {
@Override public void tick() {
if (CoffeeClientMain.client.player == null || CoffeeClientMain.client.getNetworkHandler() == null) {
return;
}
@ -132,8 +97,7 @@ public class AntiAntiXray extends Module {
}
}
@Override
public void enable() {
@Override public void enable() {
if (CoffeeClientMain.client.player == null || CoffeeClientMain.client.world == null) {
return;
}
@ -162,19 +126,16 @@ public class AntiAntiXray extends Module {
permanentToScan = new ArrayList<>(toScan);
}
@Override
public void disable() {
@Override public void disable() {
visitsAfter.clear();
latestGoal = null;
}
@Override
public String getContext() {
@Override public String getContext() {
return "[" + scanned + "S;" + toScan.size() + "R]";
}
@Override
public void onWorldRender(MatrixStack matrices) {
@Override public void onWorldRender(MatrixStack matrices) {
for (BlockPos latestScan : renders.toArray(new BlockPos[0])) {
Renderer.R3D.renderFilled(new Vec3d(latestScan.getX(), latestScan.getY(), latestScan.getZ()), new Vec3d(1, 1, 1), Utils.getCurrentRGB(), matrices);
}
@ -222,8 +183,7 @@ public class AntiAntiXray extends Module {
}
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
}

View file

@ -18,34 +18,28 @@ public class AntiReducedDebugInfo extends Module {
super("AntiRDI", "Stops the \"reduced debug info\" gamerule from taking effect", ModuleType.EXPLOIT);
}
@Override
public void tick() {
@Override public void tick() {
}
@Override
public void enable() {
@Override public void enable() {
}
@Override
public void disable() {
@Override public void disable() {
}
@Override
public String getContext() {
@Override public String getContext() {
boolean origDebugInfoReduce = Objects.requireNonNull(CoffeeClientMain.client.player).hasReducedDebugInfo() || CoffeeClientMain.client.options.reducedDebugInfo;
return origDebugInfoReduce ? "Active!" : null;
}
@Override
public void onWorldRender(MatrixStack matrices) {
@Override public void onWorldRender(MatrixStack matrices) {
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
}
}

View file

@ -17,7 +17,7 @@ import net.minecraft.network.packet.c2s.play.VehicleMoveC2SPacket;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import java.awt.*;
import java.awt.Color;
import java.util.Objects;
public class Boaty extends Module {
@ -25,14 +25,13 @@ public class Boaty extends Module {
// final SliderValue amount = this.config.create("Amount per tick", 2000, 1, 10000, 0);
final DoubleSetting amount = this.config.create(new DoubleSetting.Builder(2000).name("Amount per tick").description("How many packets to send per tick").min(1).precision(0).max(10000).get());
boolean running = false;
Vec3d start = null;
Vec3d start = null;
public Boaty() {
super("Boaty", "Uses boat movement to crash a server", ModuleType.EXPLOIT);
}
@Override
public void tick() {
@Override public void tick() {
if (Objects.requireNonNull(CoffeeClientMain.client.player).hasVehicle()) {
Entity vehicle = CoffeeClientMain.client.player.getVehicle();
if (!running) {
@ -50,36 +49,30 @@ public class Boaty extends Module {
}
}
@Override
public void enable() {
@Override public void enable() {
}
@Override
public void disable() {
@Override public void disable() {
this.start = null;
running = false;
}
@Override
public String getContext() {
@Override public String getContext() {
return running ? "Running" : "Not running";
}
@Override
public void onWorldRender(MatrixStack matrices) {
@Override public void onWorldRender(MatrixStack matrices) {
if (start != null) {
Renderer.R3D.renderFilled(start.subtract(.1, .1, .1), new Vec3d(.2, .2, .2), Utils.getCurrentRGB(), matrices);
Renderer.R3D.renderLine(start, start.add(0, -1, 0), Color.RED, matrices);
}
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
}
@Override
public void onFastTick_NWC() {
@Override public void onFastTick_NWC() {
if (CoffeeClientMain.client.world == null || CoffeeClientMain.client.player == null) {
setEnabled(false);
}

View file

@ -26,24 +26,31 @@ import net.minecraft.network.packet.c2s.play.PlayerInteractBlockC2SPacket;
import net.minecraft.util.Hand;
import net.minecraft.util.hit.BlockHitResult;
import net.minecraft.util.hit.EntityHitResult;
import net.minecraft.util.math.*;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Quaternion;
import net.minecraft.util.math.Vec2f;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.RaycastContext;
import java.awt.*;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
public class CarpetBomb extends Module {
final EnumSetting<Mode> mode = this.config.create(new EnumSetting.Builder<>(Mode.Focussed).name("Focus mode").description("How to rotate the fireballs").get());
final DoubleSetting spacing = this.config.create(new DoubleSetting.Builder(2).name("Spacing").description("How far away the fireballs should be").min(0.1).max(10).precision(1).get());
final DoubleSetting speed = this.config.create(new DoubleSetting.Builder(5).name("Speed").description("Speed of the fired fireball").min(0.01).max(1).precision(3).get());
final DoubleSetting power = this.config.create(new DoubleSetting.Builder(10).name("Power").description("How powerful the fireballs are gonna be").min(0).max(127).precision(0).get());
final DoubleSetting spawnDelay = this.config.create(new DoubleSetting.Builder(10).name("Delay").description("How long to wait until spawning another fireball").min(10).max(500).precision(0).get());
final Timer spawnTimer = new Timer();
List<Entity> positions = new ArrayList<>();
net.minecraft.entity.Entity eTarget = null;
final EnumSetting<Mode> mode = this.config.create(new EnumSetting.Builder<>(Mode.Focussed).name("Focus mode").description("How to rotate the fireballs").get());
final DoubleSetting spacing = this.config.create(new DoubleSetting.Builder(2).name("Spacing").description("How far away the fireballs should be").min(0.1).max(10).precision(1).get());
final DoubleSetting speed = this.config.create(new DoubleSetting.Builder(5).name("Speed").description("Speed of the fired fireball").min(0.01).max(1).precision(3).get());
final DoubleSetting power = this.config.create(new DoubleSetting.Builder(10).name("Power").description("How powerful the fireballs are gonna be").min(0).max(127).precision(0).get());
final DoubleSetting spawnDelay = this.config.create(new DoubleSetting.Builder(10).name("Delay").description("How long to wait until spawning another fireball").min(10).max(500).precision(0)
.get());
final Timer spawnTimer = new Timer();
List<Entity> positions = new ArrayList<>();
net.minecraft.entity.Entity eTarget = null;
public CarpetBomb() {
super("CarpetBomb", "Spawns a ton of fireballs where you click", ModuleType.EXPLOIT);
@ -78,7 +85,8 @@ public class CarpetBomb extends Module {
for (int oz = -10; oz < 11; oz++) {
Vec3d off = new Vec3d(ox, oz, 0);
off = off.multiply(spacing.getValue());
Vec3d a = Rotations.relativeToAbsolute(Objects.requireNonNull(CoffeeClientMain.client.player).getCameraPosVec(CoffeeClientMain.client.getTickDelta()), CoffeeClientMain.client.player.getRotationClient(), off);
Vec3d a = Rotations.relativeToAbsolute(Objects.requireNonNull(CoffeeClientMain.client.player)
.getCameraPosVec(CoffeeClientMain.client.getTickDelta()), CoffeeClientMain.client.player.getRotationClient(), off);
Vec3d rot = switch (mode.getValue()) {
case Relative -> CoffeeClientMain.client.player.getRotationVector();
case Focussed -> {
@ -103,8 +111,7 @@ public class CarpetBomb extends Module {
}
}
@Override
public void onFastTick() {
@Override public void onFastTick() {
if (!spawnTimer.hasExpired((long) (this.spawnDelay.getValue() + 0))) {
return;
}
@ -150,7 +157,8 @@ public class CarpetBomb extends Module {
motion.add(NbtDouble.of(vel.z));
entityTag.put("power", motion);
entityTag.put("ExplosionPower", NbtDouble.of(power.getValue()));
CreativeInventoryActionC2SPacket set = new CreativeInventoryActionC2SPacket(Utils.Inventory.slotIndexToId(Objects.requireNonNull(CoffeeClientMain.client.player).getInventory().selectedSlot), spawnEgg);
CreativeInventoryActionC2SPacket set = new CreativeInventoryActionC2SPacket(Utils.Inventory.slotIndexToId(Objects.requireNonNull(CoffeeClientMain.client.player)
.getInventory().selectedSlot), spawnEgg);
CreativeInventoryActionC2SPacket clr = new CreativeInventoryActionC2SPacket(Utils.Inventory.slotIndexToId(CoffeeClientMain.client.player.getInventory().selectedSlot), new ItemStack(Items.AIR));
BlockHitResult bhr = new BlockHitResult(CoffeeClientMain.client.player.getPos(), Direction.DOWN, new BlockPos(CoffeeClientMain.client.player.getPos()), false);
PlayerInteractBlockC2SPacket put = new PlayerInteractBlockC2SPacket(Hand.MAIN_HAND, bhr);
@ -160,31 +168,26 @@ public class CarpetBomb extends Module {
positions = positionsCopy;
}
@Override
public void tick() {
@Override public void tick() {
}
@Override
public void enable() {
@Override public void enable() {
this.positions.clear();
}
@Override
public void disable() {
@Override public void disable() {
}
@Override
public String getContext() {
@Override public String getContext() {
if (this.positions.isEmpty()) {
return null;
}
return this.positions.size() + "";
}
@Override
public void onWorldRender(MatrixStack matrices) {
@Override public void onWorldRender(MatrixStack matrices) {
if (isDebuggerEnabled()) {
for (Entity position : new ArrayList<>(this.positions)) {
Vec3d p = position.position;
@ -211,8 +214,7 @@ public class CarpetBomb extends Module {
}
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
}

View file

@ -30,8 +30,10 @@ import java.util.Objects;
public class InstaBow extends Module {
final DoubleSetting it = this.config.create(new DoubleSetting.Builder(40).precision(0).name("Iterations").description("How often to spoof velocity (more = bigger damage)").min(5).max(100).get());
final BooleanSetting autoFire = this.config.create(new BooleanSetting.Builder(false).name("Auto fire").description("Automatically fire the bow when its held and an entity is on the same Y").get());
final DoubleSetting it = this.config.create(new DoubleSetting.Builder(40).precision(0).name("Iterations").description("How often to spoof velocity (more = bigger damage)").min(5).max(100)
.get());
final BooleanSetting autoFire = this.config.create(new BooleanSetting.Builder(false).name("Auto fire").description("Automatically fire the bow when its held and an entity is on the same Y")
.get());
public InstaBow() {
super("BowOneTap", "Exploits the velocity handler on the server to give your arrow near infinite velocity", ModuleType.EXPLOIT);
@ -56,8 +58,7 @@ public class InstaBow extends Module {
});
}
@Override
public void tick() {
@Override public void tick() {
if (!autoFire.getValue()) {
return;
}
@ -98,28 +99,23 @@ public class InstaBow extends Module {
}
}
@Override
public void enable() {
@Override public void enable() {
}
@Override
public void disable() {
@Override public void disable() {
}
@Override
public String getContext() {
@Override public String getContext() {
return null;
}
@Override
public void onWorldRender(MatrixStack matrices) {
@Override public void onWorldRender(MatrixStack matrices) {
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
}
}

View file

@ -26,9 +26,10 @@ import java.util.Objects;
import java.util.Random;
public class NoComCrash extends Module {
final Random r = new Random();
final DoubleSetting packets = this.config.create(new DoubleSetting.Builder(5).precision(0).name("Packets per tick").description("How many crash packets to send per tick").min(1).max(100).get());
final EnumSetting<Method> method = this.config.create(new EnumSetting.Builder<>(Method.Interact).name("Method")
final Random r = new Random();
final DoubleSetting packets = this.config.create(new DoubleSetting.Builder(5).precision(0).name("Packets per tick").description("How many crash packets to send per tick").min(1).max(100)
.get());
final EnumSetting<Method> method = this.config.create(new EnumSetting.Builder<>(Method.Interact).name("Method")
.description("Chunk loading method. Interact works on vanilla/spigot, BLT on creative mode").get());
int i = 0;
@ -36,8 +37,7 @@ public class NoComCrash extends Module {
super("NoComCrash", "Crashes the server by requesting chunks out of bounds", ModuleType.EXPLOIT);
}
@Override
public void tick() {
@Override public void tick() {
for (int i = 0; i < packets.getValue(); i++) {
Vec3d cpos = pickRandomPos();
if (method.getValue() == Method.Interact) {
@ -64,28 +64,23 @@ public class NoComCrash extends Module {
return new Vec3d(x, y, z);
}
@Override
public void enable() {
@Override public void enable() {
}
@Override
public void disable() {
@Override public void disable() {
i = 0;
}
@Override
public String getContext() {
@Override public String getContext() {
return i == 0 ? "Waiting" : i + " " + (i == 1 ? "packet" : "packets") + " sent";
}
@Override
public void onWorldRender(MatrixStack matrices) {
@Override public void onWorldRender(MatrixStack matrices) {
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
}

View file

@ -32,8 +32,7 @@ public class OOBCrash extends Module {
super("OOBCrash", "Crashes / even bricks a vanilla server by requesting block placement", ModuleType.EXPLOIT);
}
@Override
public void tick() {
@Override public void tick() {
}
@ -46,8 +45,7 @@ public class OOBCrash extends Module {
setEnabled(false);
}
@Override
public void onFastTick() {
@Override public void onFastTick() {
long timeDelay = System.currentTimeMillis() - startTime;
timeDelay = Math.max(0, timeDelay);
long passed = 0;
@ -63,28 +61,23 @@ public class OOBCrash extends Module {
}
}
@Override
public void enable() {
@Override public void enable() {
startTime = System.currentTimeMillis();
}
@Override
public void disable() {
@Override public void disable() {
}
@Override
public String getContext() {
@Override public String getContext() {
return null;
}
@Override
public void onWorldRender(MatrixStack matrices) {
@Override public void onWorldRender(MatrixStack matrices) {
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
if (current != null) {
FontRenderers.getRenderer().drawCenteredString(Renderer.R3D.getEmptyMatrixStack(), current.t, CoffeeClientMain.client.getWindow().getScaledWidth() / 2f, CoffeeClientMain.client.getWindow()
.getScaledHeight() / 2f, 0xFFFFFF);

View file

@ -25,8 +25,7 @@ public class OffhandCrash extends Module {
super("OffhandCrash", "Crashes players around with sound packets", ModuleType.EXPLOIT);
}
@Override
public void tick() {
@Override public void tick() {
try {
if (CoffeeClientMain.client.player == null || CoffeeClientMain.client.getNetworkHandler() == null) {
throw new Exception();
@ -40,31 +39,26 @@ public class OffhandCrash extends Module {
}
}
@Override
public void enable() {
@Override public void enable() {
if (!ModuleRegistry.getByClass(AntiOffhandCrash.class).isEnabled()) {
Utils.Logging.message("I would recommend you turn on AntiOffhandCrash before using this");
setEnabled(false);
}
}
@Override
public void disable() {
@Override public void disable() {
}
@Override
public String getContext() {
@Override public String getContext() {
return (a.getValue() * 20) + "";
}
@Override
public void onWorldRender(MatrixStack matrices) {
@Override public void onWorldRender(MatrixStack matrices) {
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
}
}

View file

@ -23,19 +23,10 @@ import java.util.List;
public class PingSpoof extends Module {
final List<PacketEntry> entries = new ArrayList<>();
final List<Packet<?>> dontRepeat = new ArrayList<>();
final DoubleSetting delay = this.config.create(new DoubleSetting.Builder(50)
.name("Delay")
.description("How much to spoof your ping by")
.min(0)
.max(1000)
.precision(0)
.get());
final EnumSetting<Mode> mode = this.config.create(new EnumSetting.Builder<>(Mode.Spoof)
.name("Mode")
.description("How to spoof ping. Delay actually delays, Spoof pretends to")
.get());
final List<PacketEntry> entries = new ArrayList<>();
final List<Packet<?>> dontRepeat = new ArrayList<>();
final DoubleSetting delay = this.config.create(new DoubleSetting.Builder(50).name("Delay").description("How much to spoof your ping by").min(0).max(1000).precision(0).get());
final EnumSetting<Mode> mode = this.config.create(new EnumSetting.Builder<>(Mode.Spoof).name("Mode").description("How to spoof ping. Delay actually delays, Spoof pretends to").get());
public PingSpoof() {
super("PingSpoof", "Tells the server you have extreme network lag", ModuleType.EXPLOIT);
@ -61,38 +52,31 @@ public class PingSpoof extends Module {
}
}
@Override
public void tick() {
@Override public void tick() {
}
@Override
public void enable() {
@Override public void enable() {
entries.clear();
dontRepeat.clear();
}
@Override
public void disable() {
@Override public void disable() {
}
@Override
public String getContext() {
@Override public String getContext() {
return delay.getValue() + " ms";
}
@Override
public void onWorldRender(MatrixStack matrices) {
@Override public void onWorldRender(MatrixStack matrices) {
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
}
@Override
public void onFastTick_NWC() {
@Override public void onFastTick_NWC() {
if (CoffeeClientMain.client.getNetworkHandler() == null) {
setEnabled(false);
return;

View file

@ -13,35 +13,29 @@ public class SkinChangeExploit extends Module {
super("SkinChangeExploit", "Exploits the skin handler to set skins of everyone to a specific skin", ModuleType.EXPLOIT);
}
@Override
public void tick() {
@Override public void tick() {
}
@Override
public void enable() {
@Override public void enable() {
if (skinId == null) {
Notification.create(6000, "Skin exploit", Notification.Type.INFO, "Set the skin first by doing .skinexploit <skin link>");
setEnabled(false);
}
}
@Override
public void disable() {
@Override public void disable() {
}
@Override
public String getContext() {
@Override public String getContext() {
return null;
}
@Override
public void onWorldRender(MatrixStack matrices) {
@Override public void onWorldRender(MatrixStack matrices) {
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
}
}

View file

@ -41,33 +41,27 @@ public class VanillaSpoof extends Module {
});
}
@Override
public void tick() {
@Override public void tick() {
}
@Override
public void enable() {
@Override public void enable() {
}
@Override
public void disable() {
@Override public void disable() {
}
@Override
public String getContext() {
@Override public String getContext() {
return null;
}
@Override
public void onWorldRender(MatrixStack matrices) {
@Override public void onWorldRender(MatrixStack matrices) {
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
}
}

View file

@ -16,13 +16,14 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3d;
import java.awt.*;
import java.awt.Color;
import java.util.Arrays;
import java.util.Objects;
public class AutoTrap extends Module {
static final double[][] buildOffsetsSmall = new double[][]{new double[]{0, 2, 0}, new double[]{1, 1, 0}, new double[]{0, 1, 1}, new double[]{-1, 1, 0}, new double[]{0, 1, -1}, new double[]{0, -1, 0}};
static final double[][] buildOffsetsBig = new double[][]{
static final double[][] buildOffsetsSmall = new double[][]{new double[]{0, 2, 0}, new double[]{1, 1, 0}, new double[]{0, 1, 1}, new double[]{-1, 1, 0}, new double[]{0, 1, -1},
new double[]{0, -1, 0}};
static final double[][] buildOffsetsBig = new double[][]{
// begin bottom
new double[]{-.5, -1, -.5}, new double[]{-.5, -1, .5}, new double[]{.5, -1, .5}, new double[]{.5, -1, -.5},
@ -79,8 +80,7 @@ public class AutoTrap extends Module {
return attacker.getCameraPosVec(1f).distanceTo(pos) <= Objects.requireNonNull(CoffeeClientMain.client.interactionManager).getReachDistance() + .5;
}
@Override
public void onFastTick() {
@Override public void onFastTick() {
for (Entity player : Objects.requireNonNull(CoffeeClientMain.client.world).getPlayers()) {
if (player.equals(CoffeeClientMain.client.player)) {
continue;
@ -136,28 +136,23 @@ public class AutoTrap extends Module {
}
}
@Override
public void tick() {
@Override public void tick() {
}
@Override
public void enable() {
@Override public void enable() {
}
@Override
public void disable() {
@Override public void disable() {
}
@Override
public String getContext() {
@Override public String getContext() {
return null;
}
@Override
public void onWorldRender(MatrixStack matrices) {
@Override public void onWorldRender(MatrixStack matrices) {
if (isDebuggerEnabled()) {
for (Entity player : Objects.requireNonNull(CoffeeClientMain.client.world).getPlayers()) {
if (player.equals(CoffeeClientMain.client.player)) {
@ -195,8 +190,7 @@ public class AutoTrap extends Module {
}
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
}
}

View file

@ -15,33 +15,27 @@ public class Deadmau5 extends Module {
super("Deadmau5", "Shows the Deadmau5 skin ears for every player", ModuleType.FUN);
}
@Override
public void tick() {
@Override public void tick() {
}
@Override
public void enable() {
@Override public void enable() {
}
@Override
public void disable() {
@Override public void disable() {
}
@Override
public String getContext() {
@Override public String getContext() {
return null;
}
@Override
public void onWorldRender(MatrixStack matrices) {
@Override public void onWorldRender(MatrixStack matrices) {
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
}
}

View file

@ -46,8 +46,7 @@ public class FakeHacker extends Module {
});
}
@Override
public void tick() {
@Override public void tick() {
if (target != null) {
Iterable<Entity> entities = Objects.requireNonNull(CoffeeClientMain.client.world).getEntities();
List<Entity> entities1 = new ArrayList<>(StreamSupport.stream(entities.spliterator(), false).toList());
@ -64,29 +63,24 @@ public class FakeHacker extends Module {
}
}
@Override
public void enable() {
@Override public void enable() {
target = null;
Notification.create(6000, "", true, Notification.Type.INFO, "Middle click a player to select them");
}
@Override
public void disable() {
@Override public void disable() {
}
@Override
public String getContext() {
@Override public String getContext() {
return target == null ? null : target.getEntityName();
}
@Override
public void onWorldRender(MatrixStack matrices) {
@Override public void onWorldRender(MatrixStack matrices) {
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
}
}

View file

@ -19,46 +19,34 @@ import java.util.Objects;
public class Spinner extends Module {
final double r = 0;
final double r = 0;
// final SliderValue speed = (SliderValue) this.config.create("Timeout", 5, 0, 100, 0).description("How much to wait between rotations");
final DoubleSetting speed = this.config.create(new DoubleSetting.Builder(5)
.name("Delay")
.description("How much to wait when spinning")
.min(0)
.max(100)
.precision(0)
.get());
final DoubleSetting speed = this.config.create(new DoubleSetting.Builder(5).name("Delay").description("How much to wait when spinning").min(0).max(100).precision(0).get());
int timeout = 0;
public Spinner() {
super("Spinner", "Spins around like a maniac and throws whatever you have", ModuleType.FUN);
}
@Override
public void tick() {
@Override public void tick() {
}
@Override
public void enable() {
@Override public void enable() {
}
@Override
public void disable() {
@Override public void disable() {
}
@Override
public String getContext() {
@Override public String getContext() {
return null;
}
@Override
public void onWorldRender(MatrixStack matrices) {
@Override public void onWorldRender(MatrixStack matrices) {
}
@Override
public void onFastTick() {
@Override public void onFastTick() {
timeout--; // decrease timeout
if (timeout > 0) {
return; // if timeout isn't expired, do nothing
@ -72,8 +60,7 @@ public class Spinner extends Module {
CoffeeClientMain.client.getNetworkHandler().sendPacket(p1);
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
}
}

View file

@ -5,13 +5,19 @@ import me.x150.coffee.CoffeeClientMain;
import me.x150.coffee.feature.module.Module;
import me.x150.coffee.feature.module.ModuleType;
import me.x150.coffee.helper.util.Utils;
import net.minecraft.client.render.*;
import net.minecraft.client.render.BufferBuilder;
import net.minecraft.client.render.BufferRenderer;
import net.minecraft.client.render.Camera;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.render.Tessellator;
import net.minecraft.client.render.VertexFormat;
import net.minecraft.client.render.VertexFormats;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.Matrix4f;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.Vec3f;
import java.awt.*;
import java.awt.Color;
public class Test extends Module {
@ -19,42 +25,37 @@ public class Test extends Module {
super("Test", "Testing stuff with the client, can be ignored", ModuleType.FUN);
}
@Override
public void tick() {
@Override public void tick() {
}
@Override
public void enable() {
@Override public void enable() {
}
@Override
public void disable() {
@Override public void disable() {
}
@Override
public String getContext() {
@Override public String getContext() {
return null;
}
@Override
public void onWorldRender(MatrixStack s) {
@Override public void onWorldRender(MatrixStack s) {
Vec3d start = Utils.getInterpolatedEntityPosition(CoffeeClientMain.client.player).add(0, 4, 0);
Camera camera = CoffeeClientMain.client.gameRenderer.getCamera();
Vec3d camPos = camera.getPos();
start = start.subtract(camPos);
MatrixStack stack = new MatrixStack();
stack.push();
// stack.translate(start.x, start.y, start.z);
// stack.translate(start.x, start.y, start.z);
stack.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(camera.getPitch()));
stack.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(camera.getYaw() + 180.0F));
stack.translate(-camPos.x, -camPos.y, -camPos.z);
// PlayerEntityRenderer ple = ((PlayerEntityRenderer) CoffeeClientMain.client.getEntityRenderDispatcher().getRenderer(CoffeeClientMain.client.player));
// ple.getModel().body.rotate(stack);
// ple.getModel().head.rotate(stack);
// PlayerEntityRenderer ple = ((PlayerEntityRenderer) CoffeeClientMain.client.getEntityRenderDispatcher().getRenderer(CoffeeClientMain.client.player));
// ple.getModel().body.rotate(stack);
// ple.getModel().head.rotate(stack);
RenderSystem.disableCull();
RenderSystem.disableDepthTest();
RenderSystem.defaultBlendFunc();
@ -92,8 +93,7 @@ public class Test extends Module {
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
}
}

View file

@ -21,18 +21,18 @@ import net.minecraft.util.math.Box;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Vec3d;
import java.awt.*;
import java.awt.Color;
import java.util.Objects;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicBoolean;
public class TpRange extends Module {
static final ExecutorService esv = Executors.newFixedThreadPool(1);
final EnumSetting<Mode> mode = this.config.create(new EnumSetting.Builder<>(Mode.PaperBypass).name("Mode")
static final ExecutorService esv = Executors.newFixedThreadPool(1);
final EnumSetting<Mode> mode = this.config.create(new EnumSetting.Builder<>(Mode.PaperBypass).name("Mode")
.description("How to exploit the range, Instant works on vanilla, PaperBypass on almost everything").get());
final AtomicBoolean running = new AtomicBoolean(false);
Vec3d spoofedPos = null;
final AtomicBoolean running = new AtomicBoolean(false);
Vec3d spoofedPos = null;
Vec3d previousSpoofedPos = null;
public TpRange() {
@ -118,35 +118,29 @@ public class TpRange extends Module {
spoofedPos = null;
}
@Override
public void tick() {
@Override public void tick() {
}
@Override
public void enable() {
@Override public void enable() {
}
@Override
public void disable() {
@Override public void disable() {
}
@Override
public String getContext() {
@Override public String getContext() {
return null;
}
@Override
public void onWorldRender(MatrixStack matrices) {
@Override public void onWorldRender(MatrixStack matrices) {
if (isDebuggerEnabled() && spoofedPos != null && previousSpoofedPos != null) {
Renderer.R3D.renderLine(spoofedPos, previousSpoofedPos, Color.RED, matrices);
}
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
}

View file

@ -15,33 +15,27 @@ public class AllowFormatCodes extends Module {
super("AllowFormatCodes", "Allows you to type format codes with the paragraph symbol", ModuleType.MISC);
}
@Override
public void tick() {
@Override public void tick() {
}
@Override
public void enable() {
@Override public void enable() {
}
@Override
public void disable() {
@Override public void disable() {
}
@Override
public String getContext() {
@Override public String getContext() {
return null;
}
@Override
public void onWorldRender(MatrixStack matrices) {
@Override public void onWorldRender(MatrixStack matrices) {
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
}
}

View file

@ -31,33 +31,27 @@ public class AntiOffhandCrash extends Module {
});
}
@Override
public void tick() {
@Override public void tick() {
}
@Override
public void enable() {
@Override public void enable() {
}
@Override
public void disable() {
@Override public void disable() {
}
@Override
public String getContext() {
@Override public String getContext() {
return null;
}
@Override
public void onWorldRender(MatrixStack matrices) {
@Override public void onWorldRender(MatrixStack matrices) {
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
}
}

View file

@ -15,33 +15,27 @@ public class AntiPacketKick extends Module {
super("AntiPacketKick", "Prevents a client disconnect caused by an internal exception", ModuleType.MISC);
}
@Override
public void tick() {
@Override public void tick() {
}
@Override
public void enable() {
@Override public void enable() {
}
@Override
public void disable() {
@Override public void disable() {
}
@Override
public String getContext() {
@Override public String getContext() {
return null;
}
@Override
public void onWorldRender(MatrixStack matrices) {
@Override public void onWorldRender(MatrixStack matrices) {
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
}
}

View file

@ -15,13 +15,13 @@ import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
import net.minecraft.util.math.Vec2f;
import net.minecraft.util.math.Vec3d;
import java.awt.*;
import java.awt.Color;
import java.util.Objects;
public class FireballDeflector extends Module {
final EnumSetting<Mode> mode = this.config.create(new EnumSetting.Builder<>(Mode.DeflectSomewhere).name("Mode")
final EnumSetting<Mode> mode = this.config.create(new EnumSetting.Builder<>(Mode.DeflectSomewhere).name("Mode")
.description("How to change the fireball's motion (ReflectBack = reflect back at shooter, DeflectSomewhere = idc get it away)").get());
final BooleanSetting checkVel = this.config.create(new BooleanSetting.Builder(false).name("Check velocity")
final BooleanSetting checkVel = this.config.create(new BooleanSetting.Builder(false).name("Check velocity")
.description("Checks if the fireball is actually approaching before hitting. Can get funky with a lot of them").get());
public FireballDeflector() {
@ -56,8 +56,7 @@ public class FireballDeflector extends Module {
return attacker.getCameraPosVec(1f).distanceTo(target.getPos().add(0, target.getHeight() / 2, 0)) <= Objects.requireNonNull(CoffeeClientMain.client.interactionManager).getReachDistance();
}
@Override
public void onFastTick() {
@Override public void onFastTick() {
for (Entity entity : Objects.requireNonNull(CoffeeClientMain.client.world).getEntities()) {
if (entity instanceof FireballEntity fe) {
if (inHitRange(Objects.requireNonNull(CoffeeClientMain.client.player), fe) && isApproaching(CoffeeClientMain.client.player.getPos(), fe.getPos(), fe.getVelocity())) {
@ -67,28 +66,23 @@ public class FireballDeflector extends Module {
}
}
@Override
public void tick() {
@Override public void tick() {
}
@Override
public void enable() {
@Override public void enable() {
}
@Override
public void disable() {
@Override public void disable() {
}
@Override
public String getContext() {
@Override public String getContext() {
return null;
}
@Override
public void onWorldRender(MatrixStack matrices) {
@Override public void onWorldRender(MatrixStack matrices) {
if (isDebuggerEnabled()) {
for (Entity entity : Objects.requireNonNull(CoffeeClientMain.client.world).getEntities()) {
if (entity instanceof FireballEntity fe) {
@ -106,8 +100,7 @@ public class FireballDeflector extends Module {
}
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
}

View file

@ -15,33 +15,27 @@ public class InfChatLength extends Module {
super("InfChatLength", "Completely removes the length limit for the chat (Server side too, be careful!)", ModuleType.MISC);
}
@Override
public void tick() {
@Override public void tick() {
}
@Override
public void enable() {
@Override public void enable() {
}
@Override
public void disable() {
@Override public void disable() {
}
@Override
public String getContext() {
@Override public String getContext() {
return null;
}
@Override
public void onWorldRender(MatrixStack matrices) {
@Override public void onWorldRender(MatrixStack matrices) {
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
}
}

View file

@ -14,7 +14,9 @@ public class MinehutAdBlocker extends Module {
public MinehutAdBlocker() {
super("MinehutAdBlocker", "Blocks the /ad command on minehut from sending to you", ModuleType.MISC);
Events.registerEventHandler(EventType.PACKET_RECEIVE, event -> {
if (!this.isEnabled()) return;
if (!this.isEnabled()) {
return;
}
PacketEvent pe = (PacketEvent) event;
if (pe.getPacket() instanceof GameMessageS2CPacket msg) {
if (msg.getMessage().getString().contains("[AD]")) {
@ -25,33 +27,27 @@ public class MinehutAdBlocker extends Module {
});
}
@Override
public void tick() {
@Override public void tick() {
}
@Override
public void enable() {
@Override public void enable() {
}
@Override
public void disable() {
@Override public void disable() {
}
@Override
public String getContext() {
@Override public String getContext() {
return blocked + "";
}
@Override
public void onWorldRender(MatrixStack matrices) {
@Override public void onWorldRender(MatrixStack matrices) {
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
}
}

View file

@ -18,7 +18,7 @@ import net.minecraft.network.packet.s2c.play.TitleFadeS2CPacket;
import net.minecraft.network.packet.s2c.play.TitleS2CPacket;
public class NoTitles extends Module {
long blocked = 0L;
long blocked = 0L;
Notification lastShown = null;
public NoTitles() {
@ -46,32 +46,26 @@ public class NoTitles extends Module {
});
}
@Override
public void tick() {
@Override public void tick() {
}
@Override
public void enable() {
@Override public void enable() {
}
@Override
public void disable() {
@Override public void disable() {
}
@Override
public String getContext() {
@Override public String getContext() {
return null;
}
@Override
public void onWorldRender(MatrixStack matrices) {
@Override public void onWorldRender(MatrixStack matrices) {
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
}
}

View file

@ -15,33 +15,27 @@ public class PortalGUI extends Module {
super("PortalGUI", "Allows you to open GUIs while being inside a portal", ModuleType.MISC);
}
@Override
public void tick() {
@Override public void tick() {
}
@Override
public void enable() {
@Override public void enable() {
}
@Override
public void disable() {
@Override public void disable() {
}
@Override
public String getContext() {
@Override public String getContext() {
return null;
}
@Override
public void onWorldRender(MatrixStack matrices) {
@Override public void onWorldRender(MatrixStack matrices) {
}
@Override
public void onHudRender() {
@Override public void onHudRender() {
}
}

Some files were not shown because too many files have changed in this diff Show more