Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #3 from Utility-Client/dcrp
Final Commit for 2.2
  • Loading branch information
sam302rk committed Sep 13, 2020
2 parents 824902f + b02a254 commit a8f3179
Show file tree
Hide file tree
Showing 27 changed files with 91 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.md
@@ -0,0 +1,4 @@
# Utility Client v2

### Credits
Thanks to [Maurice Wohlkönig](https://github.com/whlk) for his [BOM-Remover Tool](https://www.mannaz.at/codebase/utf-byte-order-mark-bom-remover).
2 changes: 2 additions & 0 deletions UtilityClient.iml
Expand Up @@ -22,6 +22,7 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: com.github.Vatuu:discord-rpc:1.6.2" level="project" />
<orderEntry type="library" name="Maven: net.minecraft:minecraft:1.8.8" level="project" />
<orderEntry type="library" name="Maven: oshi-project:oshi-core:1.1" level="project" />
<orderEntry type="library" name="Maven: net.java.dev.jna:jna:3.4.0" level="project" />
Expand Down Expand Up @@ -52,5 +53,6 @@
<orderEntry type="library" name="Maven: com.mojang:realms:1.7.39" level="project" />
<orderEntry type="library" name="Maven: com.mojang:authlib:1.5.21" level="project" />
<orderEntry type="library" name="Maven: tv.twitch:twitch:6.5" level="project" />
<orderEntry type="library" name="Maven: com.github.Vatuu:discord-rpc:1.6.2" level="project" />
</component>
</module>
Binary file added bomremover.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion bundle.cmd
@@ -1,4 +1,4 @@
cd bundle_with_jar
jar uf ../target/UtilityClient-2.1-1.8.8.jar *
jar uf ../target/UtilityClient.jar *
pause
exit
Binary file added bundle_with_jar/linux/libdiscord-rpc.so
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added bundle_with_jar/net/arikia/dev/drpc/OSUtil.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added bundle_with_jar/win-x64/discord-rpc.dll
Binary file not shown.
Binary file added bundle_with_jar/win-x86/discord-rpc.dll
Binary file not shown.
8 changes: 8 additions & 0 deletions pom.xml
Expand Up @@ -36,6 +36,8 @@
</repositories>

<dependencies>


<dependency>
<groupId>net.minecraft</groupId>
<artifactId>minecraft</artifactId>
Expand Down Expand Up @@ -215,6 +217,12 @@
<artifactId>twitch</artifactId>
<version>6.5</version>
</dependency>

<dependency>
<groupId>com.github.Vatuu</groupId>
<artifactId>discord-rpc</artifactId>
<version>1.6.2</version>
</dependency>
</dependencies>


Expand Down
6 changes: 5 additions & 1 deletion src/main/java/de/gamingcraft/UtilityClient.java
@@ -1,6 +1,7 @@
package de.gamingcraft;

import de.gamingcraft.config.ConfigManager;
import de.gamingcraft.discord.DiscordRP;
import de.gamingcraft.macro.MacroManager;
import de.gamingcraft.overlay.ModuleHandler;
import de.gamingcraft.overlay.Theme;
Expand All @@ -23,14 +24,16 @@ public class UtilityClient {

public static final CPSThread CPS_THREAD_INSTANCE = new CPSThread();

public static final DiscordRP DISCORD_INSTANCE = new DiscordRP();

public static Theme CURRENT_THEME = Theme.RED;

public static boolean renderOverlay = true;

public static boolean capesEnabled = true;

public static void startup() throws IOException {
//DISCORD_INSTANCE.start();
DISCORD_INSTANCE.start();
CPS_THREAD_INSTANCE.start();
ModuleHandler.start();
ConfigManager.start();
Expand All @@ -41,6 +44,7 @@ public static void startup() throws IOException {
}

public static void loop() {
DISCORD_INSTANCE.loop();
if(keyBinds.get(0).isKeyDown()) fovModifier = 0.15f; else fovModifier = 1.0f;
if(keyBinds.get(1).isPressed()) if(Minecraft.getMinecraft().gameSettings.gammaSetting == 1.0f) Minecraft.getMinecraft().gameSettings.gammaSetting = 999999; else Minecraft.getMinecraft().gameSettings.gammaSetting = 1.0f;
MacroManager.loop();
Expand Down
68 changes: 68 additions & 0 deletions src/main/java/de/gamingcraft/discord/DiscordRP.java
@@ -0,0 +1,68 @@
package de.gamingcraft.discord;

import de.gamingcraft.UtilityClient;
import net.arikia.dev.drpc.DiscordEventHandlers;
import net.arikia.dev.drpc.DiscordRPC;
import net.arikia.dev.drpc.DiscordRichPresence;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.*;

public class DiscordRP extends Thread {

private static boolean shouldRun = false;

@Override
public void run() {
super.run();


DiscordEventHandlers handlers = new DiscordEventHandlers.Builder().setReadyEventHandler((user) -> {
System.out.println("[--:--:--] [DiscordWebhook/INFO]: Welcome " + user.username + "#" + user.discriminator + "!");
}).build();
DiscordRPC.discordInitialize("742760119984455701", handlers, true);
shouldRun = true;

Runtime.getRuntime().addShutdownHook(new Thread(() -> {
System.out.println("Closing Discord hook.");
DiscordRPC.discordShutdown();
}));
}

public void loop() {

if(!shouldRun) return;

if(Minecraft.getMinecraft().isSingleplayer()) {
setRichPresence("Playing Singleplayer", "");
}

if((!Minecraft.getMinecraft().isSingleplayer())) {
if(Minecraft.getMinecraft().theWorld != null) {
if(Minecraft.getMinecraft().theWorld.playerEntities.size() > 1) {
setRichPresence("Playing Multiplayer", Minecraft.getMinecraft().getCurrentServerData().serverName);
}
}
}

if(Minecraft.getMinecraft().currentScreen instanceof GuiMainMenu) {
setRichPresence("In Menus", "Main Menu");
}

if(Minecraft.getMinecraft().currentScreen instanceof GuiMultiplayer) {
setRichPresence("In Menus", "Server List");
}

if(Minecraft.getMinecraft().currentScreen instanceof GuiSelectWorld) {
setRichPresence("In Menus", "World List");
}

DiscordRPC.discordRunCallbacks();
}

public void setRichPresence(String topText, String bottomText) {
DiscordRichPresence.Builder presence = new DiscordRichPresence.Builder(bottomText);
presence.setBigImage("utilityclient", UtilityClient.getName() + " " + UtilityClient.getVersion());
presence.setDetails(topText);
DiscordRPC.discordUpdatePresence(presence.build());
}
}
2 changes: 2 additions & 0 deletions src/main/java/net/minecraft/Start.java
@@ -1,3 +1,5 @@
package net.minecraft;

import net.minecraft.client.main.Main;

import java.util.Arrays;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/minecraft/client/main/Main.java
Expand Up @@ -39,7 +39,7 @@ public static void main(String[] p_main_0_)
OptionSpec<Integer> optionspec6 = optionparser.accepts("proxyPort").withRequiredArg().defaultsTo("8080", new String[0]).<Integer>ofType(Integer.class);
OptionSpec<String> optionspec7 = optionparser.accepts("proxyUser").withRequiredArg();
OptionSpec<String> optionspec8 = optionparser.accepts("proxyPass").withRequiredArg();
OptionSpec<String> optionspec9 = optionparser.accepts("username").withRequiredArg().defaultsTo("Player", new String[0]);
OptionSpec<String> optionspec9 = optionparser.accepts("username").withRequiredArg().defaultsTo("ILikeTrains", new String[0]);

OptionSpec<String> optionspec10 = optionparser.accepts("uuid").withRequiredArg();
OptionSpec<String> optionspec11 = optionparser.accepts("accessToken").withRequiredArg().required();
Expand Down

0 comments on commit a8f3179

Please sign in to comment.