├── .gitignore ├── LICENSE ├── README.md ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src └── main ├── java ├── com │ └── ja │ │ └── dupermen │ │ ├── Dupermen.java │ │ ├── command │ │ ├── Command.java │ │ ├── CommandManager.java │ │ └── commands │ │ │ ├── Bind.java │ │ │ ├── Set.java │ │ │ └── Toggle.java │ │ ├── event │ │ ├── PacketEvent.java │ │ └── TickEvent.java │ │ ├── gui │ │ └── click │ │ │ ├── ClickGui.java │ │ │ └── component │ │ │ ├── BooleanButton.java │ │ │ ├── Button.java │ │ │ ├── Frame.java │ │ │ ├── KeybindButton.java │ │ │ ├── ModeButton.java │ │ │ └── Slider.java │ │ ├── mixin │ │ ├── MixinLoader.java │ │ └── mixins │ │ │ ├── MixinEntityPlayerSP.java │ │ │ └── MixinNetworkManager.java │ │ ├── module │ │ ├── Category.java │ │ ├── Module.java │ │ ├── ModuleManager.java │ │ └── client │ │ │ ├── AutoDuper.java │ │ │ └── ClickGUI.java │ │ ├── setting │ │ └── Setting.java │ │ └── util │ │ ├── BlockUtils.java │ │ ├── ColourUtils.java │ │ ├── MessageUtils.java │ │ ├── PlayerUtils.java │ │ └── Timer.java └── me │ └── bush │ └── eventbus │ ├── annotation │ ├── EventListener.java │ └── ListenerPriority.java │ ├── bus │ └── EventBus.java │ ├── event │ └── Event.java │ ├── handler │ ├── DynamicHandler.java │ ├── Handler.java │ └── handlers │ │ ├── ASMHandler.java │ │ ├── LambdaHandler.java │ │ └── ReflectHandler.java │ └── util │ └── Util.java └── resources ├── dupermen_at.cfg ├── mcmod.info └── mixins.dupermen.json /.gitignore: -------------------------------------------------------------------------------- 1 | # User-specific stuff 2 | .idea/ 3 | 4 | *.iml 5 | *.ipr 6 | *.iws 7 | 8 | # IntelliJ 9 | out/ 10 | # mpeltonen/sbt-idea plugin 11 | .idea_modules/ 12 | 13 | # JIRA plugin 14 | atlassian-ide-plugin.xml 15 | 16 | # Compiled class file 17 | *.class 18 | 19 | # Log file 20 | *.log 21 | 22 | # BlueJ files 23 | *.ctxt 24 | 25 | # Package Files # 26 | *.jar 27 | *.war 28 | *.nar 29 | *.ear 30 | *.zip 31 | *.tar.gz 32 | *.rar 33 | 34 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 35 | hs_err_pid* 36 | 37 | *~ 38 | 39 | # temporary files which can be created if a process still has a handle open of a deleted file 40 | .fuse_hidden* 41 | 42 | # KDE directory preferences 43 | .directory 44 | 45 | # Linux trash folder which might appear on any partition or disk 46 | .Trash-* 47 | 48 | # .nfs files are created when an open file is removed but is still being accessed 49 | .nfs* 50 | 51 | # General 52 | .DS_Store 53 | .AppleDouble 54 | .LSOverride 55 | 56 | # Icon must end with two \r 57 | Icon 58 | 59 | # Thumbnails 60 | ._* 61 | 62 | # Files that might appear in the root of a volume 63 | .DocumentRevisions-V100 64 | .fseventsd 65 | .Spotlight-V100 66 | .TemporaryItems 67 | .Trashes 68 | .VolumeIcon.icns 69 | .com.apple.timemachine.donotpresent 70 | 71 | # Directories potentially created on remote AFP share 72 | .AppleDB 73 | .AppleDesktop 74 | Network Trash Folder 75 | Temporary Items 76 | .apdisk 77 | 78 | # Windows thumbnail cache files 79 | Thumbs.db 80 | Thumbs.db:encryptable 81 | ehthumbs.db 82 | ehthumbs_vista.db 83 | 84 | # Dump file 85 | *.stackdump 86 | 87 | # Folder config file 88 | [Dd]esktop.ini 89 | 90 | # Recycle Bin used on file shares 91 | $RECYCLE.BIN/ 92 | 93 | # Windows Installer files 94 | *.cab 95 | *.msi 96 | *.msix 97 | *.msm 98 | *.msp 99 | 100 | # Windows shortcuts 101 | *.lnk 102 | 103 | .gradle 104 | build/ 105 | 106 | # Ignore Gradle GUI config 107 | gradle-app.setting 108 | 109 | # Cache of project 110 | .gradletasknamecache 111 | 112 | **/build/ 113 | 114 | # Common working directory 115 | run/ 116 | 117 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 118 | !gradle-wrapper.jar 119 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 JAV1F 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dupermen 1.12.2 2 | A forge mod for 1.12.2 used for duping 3 | #Setup 4 | Install forge. After installing forge place the release jar into your mods folder and launch your minecraft forge client then join a server and press O to open the GUI now you can bind/edit anything you want. -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | jcenter() 4 | maven { 5 | name = "" + 6 | "" 7 | url = "https://files.minecraftforge.net/maven" 8 | } 9 | maven { 10 | name = 'SpongePowered' 11 | url = 'https://repo.spongepowered.org/maven' 12 | } 13 | } 14 | dependencies { 15 | classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' 16 | classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT' 17 | classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3' 18 | } 19 | } 20 | 21 | apply plugin: 'net.minecraftforge.gradle.forge' 22 | apply plugin: 'org.spongepowered.mixin' 23 | apply plugin: 'com.github.johnrengelman.shadow' 24 | 25 | version = "1.0" 26 | group = "com.ja.dupermen" 27 | 28 | minecraft { 29 | version = project.forgeVersion 30 | runDir = "run" 31 | mappings = project.mcpVersion 32 | coreMod = 'com.ja.dupermen.mixin.MixinLoader' 33 | makeObfSourceJar = false 34 | } 35 | 36 | repositories { 37 | maven { 38 | name = 'impactdevelopment-repo' 39 | url = 'https://impactdevelopment.github.io/maven/' 40 | } 41 | maven { 42 | name = "jitpack.io" 43 | url = "https://jitpack.io" 44 | } 45 | maven { 46 | name = 'spongepowered-repo' 47 | url = 'https://repo.spongepowered.org/repository/maven-public/' 48 | } 49 | maven { 50 | name = 'swt-repo' 51 | url = "http://maven-eclipse.github.io/maven" 52 | } 53 | 54 | mavenCentral() 55 | jcenter() 56 | } 57 | 58 | dependencies { 59 | compile("org.spongepowered:mixin:0.7.11-SNAPSHOT") { 60 | exclude module: 'commons-io' 61 | exclude module: 'gson' 62 | exclude module: 'guava' 63 | exclude module: 'launchwrapper' 64 | exclude module: 'log4j-core' 65 | } 66 | compile group: "com.googlecode.json-simple", name: "json-simple", version: "1.1.1" 67 | } 68 | 69 | processResources { 70 | inputs.property "version", project.version 71 | inputs.property "mcversion", project.minecraft.version 72 | 73 | from(sourceSets.main.resources.srcDirs) { 74 | include "mcmod.info" 75 | expand "version": project.version, "mcversion": project.minecraft.version 76 | } 77 | 78 | from(sourceSets.main.resources.srcDirs) { 79 | exclude "mcmod.info" 80 | } 81 | 82 | rename "(.+_at.cfg)", 'META-INF/$1' 83 | } 84 | 85 | mixin { 86 | defaultObfuscationEnv searge 87 | add sourceSets.main, 'mixins.dupermen.refmap.json' 88 | } 89 | 90 | reobf { 91 | shadowJar { 92 | mappingType = 'SEARGE' 93 | classpath = sourceSets.main.compileClasspath 94 | } 95 | } 96 | 97 | jar { 98 | manifest { 99 | attributes( 100 | 'MixinConfigs': 'mixins.dupermen.json', 101 | 'tweakClass': 'org.spongepowered.asm.launch.MixinTweaker', 102 | 'TweakOrder': 0, 103 | 'FMLCorePluginContainsFMLMod': 'true', 104 | 'FMLCorePlugin': 'com.ja.dupermen.mixin.MixinLoader', 105 | 'ForceLoadAsMod': 'true', 106 | 'FMLAT': 'dupermen_at.cfg' 107 | ) 108 | } 109 | } 110 | 111 | shadowJar { 112 | dependencies { 113 | include(dependency('org.spongepowered:mixin')) 114 | include(dependency('com.googlecode.json-simple:json-simple:1.1.1')) 115 | } 116 | exclude 'dummyThing', 'LICENSE.txt', 'org/**/*.html', 'META-INF/maven/**' 117 | classifier = 'release' 118 | } 119 | 120 | build.dependsOn(shadowJar) 121 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx3G 2 | org.gradle.daemon=false 3 | 4 | forgeVersion=1.12.2-14.23.5.2768 5 | mcpVersion=stable_39 6 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/JAV1F/Project-Dupermen/454ba64cf7897111d1911641f99b29a27a4fda1b/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ]; do 14 | ls=$(ls -ld "$PRG") 15 | link=$(expr "$ls" : '.*-> \(.*\)$') 16 | if expr "$link" : '/.*' >/dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=$(dirname "$PRG")"/$link" 20 | fi 21 | done 22 | SAVED="$(pwd)" 23 | cd "$(dirname \"$PRG\")/" >/dev/null 24 | APP_HOME="$(pwd -P)" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=$(basename "$0") 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn() { 37 | echo "$*" 38 | } 39 | 40 | die() { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "$(uname)" in 53 | CYGWIN*) 54 | cygwin=true 55 | ;; 56 | Darwin*) 57 | darwin=true 58 | ;; 59 | MINGW*) 60 | msys=true 61 | ;; 62 | NONSTOP*) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ]; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ]; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ]; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ]; then 93 | MAX_FD_LIMIT=$(ulimit -H -n) 94 | if [ $? -eq 0 ]; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ]; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin; then 114 | APP_HOME=$(cygpath --path --mixed "$APP_HOME") 115 | CLASSPATH=$(cygpath --path --mixed "$CLASSPATH") 116 | JAVACMD=$(cygpath --unix "$JAVACMD") 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=$(find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null) 120 | SEP="" 121 | for dir in $ROOTDIRSRAW; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ]; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@"; do 133 | CHECK=$(echo "$arg" | egrep -c "$OURCYGPATTERN" -) 134 | CHECK2=$(echo "$arg" | egrep -c "^-") ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ]; then ### Added a condition 137 | eval $(echo args$i)=$(cygpath --path --ignore --mixed "$arg") 138 | else 139 | eval $(echo args$i)="\"$arg\"" 140 | fi 141 | i=$((i + 1)) 142 | done 143 | case $i in 144 | 0) set -- ;; 145 | 1) set -- "$args0" ;; 146 | 2) set -- "$args0" "$args1" ;; 147 | 3) set -- "$args0" "$args1" "$args2" ;; 148 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save() { 159 | for i; do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/"; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'dupermen' 2 | -------------------------------------------------------------------------------- /src/main/java/com/ja/dupermen/Dupermen.java: -------------------------------------------------------------------------------- 1 | package com.ja.dupermen; 2 | 3 | import com.ja.dupermen.command.CommandManager; 4 | import com.ja.dupermen.gui.click.ClickGui; 5 | import com.ja.dupermen.module.ModuleManager; 6 | import me.bush.eventbus.bus.EventBus; 7 | import net.minecraft.client.Minecraft; 8 | import net.minecraftforge.fml.common.Mod; 9 | import net.minecraftforge.fml.common.event.FMLInitializationEvent; 10 | 11 | @net.minecraftforge.fml.common.Mod(modid = Dupermen.MOD_ID, name = Dupermen.NAME, version = Dupermen.VERSION) 12 | public class Dupermen { 13 | public static Minecraft mc; 14 | public static final String NAME = "Dupermen Client"; 15 | public static final String MOD_ID = "dupermen"; 16 | public static final String VERSION = "1.0"; 17 | public static final String TITLE = NAME + " " + VERSION; 18 | 19 | public static EventBus EVENT_BUS; 20 | public static ModuleManager moduleManager; 21 | public static CommandManager commandManager; 22 | public static ClickGui clickGui; 23 | 24 | @Mod.EventHandler 25 | public void init(FMLInitializationEvent event) { 26 | mc = Minecraft.getMinecraft(); 27 | EVENT_BUS = new EventBus(); 28 | moduleManager = new ModuleManager(); 29 | commandManager = new CommandManager(); 30 | clickGui = new ClickGui(); 31 | EVENT_BUS.subscribe(moduleManager); 32 | EVENT_BUS.subscribe(commandManager); 33 | } 34 | } -------------------------------------------------------------------------------- /src/main/java/com/ja/dupermen/command/Command.java: -------------------------------------------------------------------------------- 1 | package com.ja.dupermen.command; 2 | 3 | import net.minecraft.client.Minecraft; 4 | 5 | public class Command { 6 | public Minecraft mc = Minecraft.getMinecraft(); 7 | String command; 8 | String usage; 9 | public int args; 10 | boolean drawn, shorten; 11 | 12 | public Command(String command, String usage, int args, boolean drawn, boolean shorten) { 13 | this.command = command; 14 | this.usage = usage; 15 | this.args = args; 16 | this.drawn = drawn; 17 | this.shorten = shorten; 18 | } 19 | 20 | public void execute(String[] args) { 21 | } 22 | 23 | public boolean nullCheck() { 24 | return mc.player == null; 25 | } 26 | 27 | public boolean fullNullCheck() { 28 | return mc.player == null || mc.world == null; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/com/ja/dupermen/command/CommandManager.java: -------------------------------------------------------------------------------- 1 | package com.ja.dupermen.command; 2 | 3 | import com.ja.dupermen.command.commands.Bind; 4 | import com.ja.dupermen.command.commands.Toggle; 5 | import com.ja.dupermen.event.PacketEvent; 6 | import com.ja.dupermen.util.MessageUtils; 7 | import me.bush.eventbus.annotation.EventListener; 8 | import net.minecraft.client.Minecraft; 9 | import net.minecraft.network.Packet; 10 | import net.minecraft.network.play.client.CPacketChatMessage; 11 | 12 | import java.util.ArrayList; 13 | 14 | public class CommandManager { 15 | public Minecraft mc = Minecraft.getMinecraft(); 16 | ArrayList commands = new ArrayList<>(); 17 | char prefix; 18 | 19 | //TODO add a command prediction system 20 | public CommandManager() { 21 | this.prefix = ';'; 22 | commands.add(new Toggle()); 23 | commands.add(new Bind()); 24 | } 25 | 26 | public char getPrefix() {return prefix;} 27 | 28 | public void setPrefix(char prefix) { 29 | this.prefix = prefix; 30 | } 31 | 32 | @EventListener 33 | public void onPacketSend(PacketEvent.Send event) { 34 | Packet packet = event.getPacket(); 35 | if (packet instanceof CPacketChatMessage) { 36 | String[] args = ((CPacketChatMessage) packet).message.substring(1).split("\\s+"); 37 | if (((CPacketChatMessage) packet).message.startsWith(String.valueOf(prefix))) event.setCancelled(true); 38 | for (Command command : commands) if (event.isCancelled() && args[0].equalsIgnoreCase(command.command) || command.shorten && args[0].equalsIgnoreCase(String.valueOf(command.command.charAt(0)))) if (args.length > command.args) { 39 | command.execute(args); 40 | } else { 41 | MessageUtils.sendSuffixMessage(mc.player, "Usage : " + command.usage); 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/ja/dupermen/command/commands/Bind.java: -------------------------------------------------------------------------------- 1 | package com.ja.dupermen.command.commands; 2 | 3 | import com.ja.dupermen.Dupermen; 4 | import com.ja.dupermen.command.Command; 5 | import com.ja.dupermen.module.Module; 6 | import com.ja.dupermen.util.MessageUtils; 7 | import org.lwjgl.input.Keyboard; 8 | 9 | public class Bind extends Command { 10 | public Bind() { 11 | super("bind", "bind ", 2, true, true); 12 | } 13 | 14 | public void execute(String[] args) { 15 | for (Module module : Dupermen.moduleManager.getModules()) if (args[1].replaceAll("-", " ").equalsIgnoreCase(module.getName().trim())) { 16 | module.setKey(Keyboard.getKeyIndex(args[2].toUpperCase())); 17 | MessageUtils.sendSuffixMessage(mc.player, "Binded " + module.getName() + " To " + Keyboard.getKeyName(module.getKey())); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/java/com/ja/dupermen/command/commands/Set.java: -------------------------------------------------------------------------------- 1 | package com.ja.dupermen.command.commands; 2 | 3 | import com.ja.dupermen.Dupermen; 4 | import com.ja.dupermen.command.Command; 5 | import com.ja.dupermen.module.Module; 6 | import com.ja.dupermen.setting.Setting; 7 | 8 | public class Set extends Command { 9 | public Set() { 10 | super("set", "set ", 3, true, false); 11 | } 12 | 13 | public void execute(String[] args) { 14 | for (Module module : Dupermen.moduleManager.getModules()) if (args[1].replace('-', ' ').equalsIgnoreCase(module.getName().trim())) for (Setting setting : module.getSettings()) if (args[2].equalsIgnoreCase(setting.getName())) setSetting(setting, args[3]); 15 | } 16 | 17 | public void setSetting(Setting setting, String value) { 18 | if (setting.isMVal()) setting.setMode(value); 19 | if (setting.isBVal() && (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("false"))) setting.setBVal(Boolean.parseBoolean(value)); 20 | if (setting.isDVal() || setting.isIntVal()) setting.setDVal(Double.parseDouble(value)); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/ja/dupermen/command/commands/Toggle.java: -------------------------------------------------------------------------------- 1 | package com.ja.dupermen.command.commands; 2 | 3 | import com.ja.dupermen.Dupermen; 4 | import com.ja.dupermen.command.Command; 5 | import com.ja.dupermen.module.Module; 6 | import com.ja.dupermen.util.MessageUtils; 7 | 8 | public class Toggle extends Command { 9 | public Toggle() { 10 | super("toggle", "toggle ", 1, true, true); 11 | } 12 | 13 | public void execute(String[] args) { 14 | for (Module module : Dupermen.moduleManager.getModules()) if (args[1].replaceAll("-", " ").equalsIgnoreCase(module.getName().trim())) { 15 | module.toggle(); 16 | MessageUtils.sendSuffixMessage(mc.player, "Toggled " + module.getName()); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/ja/dupermen/event/PacketEvent.java: -------------------------------------------------------------------------------- 1 | package com.ja.dupermen.event; 2 | 3 | import me.bush.eventbus.event.Event; 4 | import net.minecraft.network.Packet; 5 | 6 | public class PacketEvent extends Event { 7 | private final Packet packet; 8 | 9 | public PacketEvent(Packet packet) { 10 | super(); 11 | this.packet = packet; 12 | } 13 | 14 | protected boolean isCancellable() { 15 | return true; 16 | } 17 | 18 | public Packet getPacket() { 19 | return this.packet; 20 | } 21 | 22 | public static class Receive extends PacketEvent { 23 | public Receive(Packet packet) { 24 | super(packet); 25 | } 26 | } 27 | 28 | public static class Send extends PacketEvent { 29 | public Send(Packet packet) { 30 | super(packet); 31 | } 32 | } 33 | 34 | public static class PostReceive extends PacketEvent { 35 | public PostReceive(Packet packet) { 36 | super(packet); 37 | } 38 | } 39 | 40 | public static class PostSend extends PacketEvent { 41 | public PostSend(Packet packet) { 42 | super(packet); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/ja/dupermen/event/TickEvent.java: -------------------------------------------------------------------------------- 1 | package com.ja.dupermen.event; 2 | 3 | import me.bush.eventbus.event.Event; 4 | 5 | public class TickEvent extends Event { 6 | public static class Pre extends TickEvent {} 7 | public static class Post extends TickEvent {} 8 | 9 | protected boolean isCancellable() { 10 | return false; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/com/ja/dupermen/gui/click/ClickGui.java: -------------------------------------------------------------------------------- 1 | package com.ja.dupermen.gui.click; 2 | 3 | import com.ja.dupermen.gui.click.component.Frame; 4 | import com.ja.dupermen.gui.click.component.KeybindButton; 5 | import com.ja.dupermen.module.Category; 6 | import com.ja.dupermen.util.ColourUtils; 7 | import net.minecraft.client.gui.GuiScreen; 8 | import org.lwjgl.input.Mouse; 9 | 10 | import java.util.ArrayList; 11 | 12 | public class ClickGui extends GuiScreen { 13 | ArrayList frames; 14 | KeybindButton selectedKeybindButton; 15 | int frameColour, buttonColour, enabledButtonColour, frameTextColour, buttonTextColour, enabledButtonTextColour, bg, textYOffset, yOffset, frameWidth = 115, frameHeight = 20, x, y, yVel = 0; 16 | 17 | public ClickGui() { 18 | textYOffset = 5; 19 | yOffset = 0; 20 | frameColour = ColourUtils.ColorUtils.toRGBA(100, 50, 255, 200); 21 | frameTextColour = ColourUtils.ColorUtils.toRGBA(255, 255, 255, 255); 22 | enabledButtonColour = ColourUtils.ColorUtils.toRGBA(100, 100, 255, 200); 23 | enabledButtonTextColour = ColourUtils.ColorUtils.toRGBA(255, 255, 255, 255); 24 | buttonTextColour = ColourUtils.ColorUtils.toRGBA(200, 200, 200, 255); 25 | bg = ColourUtils.ColorUtils.toRGBA(155, 155, 155, 155); 26 | frames = new ArrayList<>(); 27 | x = 3; 28 | y = 5; 29 | for (Category category : Category.values()) { 30 | frames.add(new Frame(category, x, y, this.frameWidth, this.frameHeight)); 31 | x += frameWidth + 3; 32 | } 33 | } 34 | 35 | public int getTextYOffset() { 36 | return textYOffset; 37 | } 38 | 39 | @Override 40 | public void drawScreen(int mouseX, int mouseY, float partialTicks) { 41 | this.drawDefaultBackground(); 42 | int dWheel = Mouse.getDWheel(); 43 | if (dWheel < 0) { 44 | yOffset -= 10; 45 | } else if (dWheel > 0) { 46 | yOffset += 10; 47 | } else 48 | if (yOffset > 0) this.yOffset = 0; 49 | 50 | 51 | for (int i = frames.size() - 1; i > -1; i--) frames.get(i).render(mouseX, mouseY); 52 | } 53 | 54 | @Override 55 | protected void mouseClicked(int mouseX, int mouseY, int mouseButton) { 56 | for (Frame frame : frames) { 57 | frame.mouseClicked(mouseX, mouseY, mouseButton); 58 | if (frame.isOver(mouseX, mouseY)) { 59 | frame.select(mouseX, mouseY, mouseButton); 60 | frames.remove(frame); 61 | frames.add(0, frame); 62 | break; 63 | } 64 | } 65 | } 66 | 67 | @Override 68 | protected void mouseReleased(int mouseX, int mouseY, int state) { 69 | for (Frame frame : frames) frame.mouseReleased(state); 70 | } 71 | 72 | @Override 73 | protected void keyTyped(char typedChar, int keyCode) { 74 | if (keyCode == 1) mc.displayGuiScreen(null); 75 | for (Frame frame : frames) frame.keyTyped(keyCode); 76 | 77 | selectedKeybindButton = null; 78 | } 79 | 80 | public KeybindButton getSelectedKeybindButton() { 81 | return selectedKeybindButton; 82 | } 83 | 84 | public void setSelectedKeybindButton(KeybindButton selectedKeybindButton) { 85 | this.selectedKeybindButton = selectedKeybindButton; 86 | } 87 | 88 | public int getButtonColour() { 89 | return buttonColour; 90 | } 91 | 92 | public int getEnabledButtonColour() { 93 | return enabledButtonColour; 94 | } 95 | 96 | public int getButtonTextColour() { 97 | return buttonTextColour; 98 | } 99 | 100 | public int getFrameColour() { 101 | return frameColour; 102 | } 103 | 104 | public int getFrameTextColour() { 105 | return frameTextColour; 106 | } 107 | 108 | public void setButtonColour(int buttonColour) { 109 | this.buttonColour = buttonColour; 110 | } 111 | 112 | public void setEnabledButtonColour(int enabledButtonColour) { 113 | this.enabledButtonColour = enabledButtonColour; 114 | } 115 | 116 | public void setButtonTextColour(int buttonTextColour) { 117 | this.buttonTextColour = buttonTextColour; 118 | } 119 | 120 | public void setFrameColour(int frameColour) { 121 | this.frameColour = frameColour; 122 | } 123 | 124 | public void setFrameTextColour(int frameTextColour) { 125 | this.frameTextColour = frameTextColour; 126 | } 127 | 128 | public int getYOffset() { 129 | return yOffset; 130 | } 131 | 132 | public void setYOffset(int yOffset) { this.yOffset = yOffset; } 133 | 134 | public int getEnabledButtonTextColour() { 135 | return enabledButtonTextColour; 136 | } 137 | 138 | public void setEnabledButtonTextColour(int enabledButtonTextColour) { 139 | this.enabledButtonTextColour = enabledButtonTextColour; 140 | } 141 | 142 | public void setBg(int bg) { 143 | this.bg = bg; 144 | } 145 | 146 | public int getBg() { 147 | return bg; 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /src/main/java/com/ja/dupermen/gui/click/component/BooleanButton.java: -------------------------------------------------------------------------------- 1 | package com.ja.dupermen.gui.click.component; 2 | 3 | import com.ja.dupermen.Dupermen; 4 | import com.ja.dupermen.setting.Setting; 5 | import com.ja.dupermen.util.ColourUtils; 6 | import net.minecraft.client.gui.Gui; 7 | 8 | public class BooleanButton { 9 | Button button; 10 | Setting setting; 11 | int width, height, x, y; 12 | 13 | public BooleanButton(Button button, Setting setting, int x, int y, int width, int height) { 14 | this.button = button; 15 | this.setting = setting; 16 | this.width = width; 17 | this.height = height; 18 | this.x = x; 19 | this.y = y; 20 | } 21 | 22 | public void render(int mouseX, int mouseY, int x, int y) { 23 | if (button.open) { 24 | this.x = x; 25 | this.y = y; 26 | if (setting.getBVal()) { 27 | Gui.drawRect(this.x, this.y + Dupermen.clickGui.getYOffset(), this.x + this.width, this.y + this.height + Dupermen.clickGui.getYOffset() - 1, Dupermen.clickGui.getEnabledButtonColour()); 28 | Dupermen.clickGui.drawString(Dupermen.clickGui.mc.fontRenderer, setting.getName(), this.x + 3, (this.y + this.height / 2) + Dupermen.clickGui.getYOffset() - Dupermen.clickGui.getTextYOffset(), Dupermen.clickGui.getEnabledButtonTextColour()); 29 | } else { 30 | Gui.drawRect(this.x, this.y + Dupermen.clickGui.getYOffset(), this.x + this.width, this.y + this.height + Dupermen.clickGui.getYOffset() - 1, Dupermen.clickGui.getButtonColour()); 31 | Dupermen.clickGui.drawString(Dupermen.clickGui.mc.fontRenderer, setting.getName(), this.x + 3, (this.y + this.height / 2) + Dupermen.clickGui.getYOffset() - Dupermen.clickGui.getTextYOffset(), Dupermen.clickGui.getButtonTextColour()); 32 | } 33 | 34 | if (isOver(mouseX, mouseY)) 35 | Gui.drawRect(this.x, this.y + Dupermen.clickGui.getYOffset(), this.x + this.width, this.y + this.height + Dupermen.clickGui.getYOffset() - 1, ColourUtils.ColorUtils.toRGBA(255, 255, 255, 50)); 36 | } 37 | } 38 | 39 | public void mouseClicked(int mouseX, int mouseY, int mouseButton) { 40 | if (button.open && mouseButton == 0 && isOver(mouseX, mouseY) && button.open) setting.setBVal(!setting.getBVal()); 41 | } 42 | 43 | public boolean isOver(int x, int y) { 44 | return x >= this.x && y > this.y + Dupermen.clickGui.getYOffset() && x <= this.x + this.width && y <= this.y + this.height + Dupermen.clickGui.getYOffset(); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/ja/dupermen/gui/click/component/Button.java: -------------------------------------------------------------------------------- 1 | package com.ja.dupermen.gui.click.component; 2 | 3 | import com.ja.dupermen.Dupermen; 4 | import com.ja.dupermen.module.Module; 5 | import com.ja.dupermen.setting.Setting; 6 | import com.ja.dupermen.util.ColourUtils; 7 | import net.minecraft.client.gui.Gui; 8 | 9 | import java.util.ArrayList; 10 | 11 | public class Button { 12 | ArrayList modeButtons; 13 | ArrayList booleanButtons; 14 | ArrayList sliders; 15 | Frame frame; 16 | Module module; 17 | boolean open; 18 | int width, height, x, y; 19 | KeybindButton keybindButton; 20 | 21 | public Button(Module module, Frame frame, int x, int y, int width, int height) { 22 | modeButtons = new ArrayList<>(); 23 | booleanButtons = new ArrayList<>(); 24 | sliders = new ArrayList<>(); 25 | this.frame = frame; 26 | this.module = module; 27 | this.open = false; 28 | this.width = width; 29 | this.height = height; 30 | this.x = x; 31 | this.y = y; 32 | for (Setting setting : module.getSettings()) { 33 | if (setting.isMVal()) 34 | modeButtons.add(new ModeButton(this, setting, this.x + 1, this.y, this.width - 2, this.height)); 35 | if (setting.isBVal()) 36 | booleanButtons.add(new BooleanButton(this, setting, this.x + 1, this.y, this.width - 2, this.height)); 37 | if (setting.isDVal() || setting.isIntVal()) 38 | sliders.add(new Slider(setting, this, this.x + 1, this.y, this.width - 2, this.height)); 39 | } 40 | keybindButton = new KeybindButton(this, this.x + 1, this.y, this.width - 2, this.height); 41 | } 42 | 43 | public void render(int mouseX, int mouseY, int x, int y) { 44 | if (frame.open) { 45 | this.x = x; 46 | this.y = y; 47 | if (module.isToggled()) { 48 | Gui.drawRect(this.x, this.y + Dupermen.clickGui.getYOffset(), this.x + this.width, this.y + this.height + Dupermen.clickGui.getYOffset() - 1, Dupermen.clickGui.getEnabledButtonColour()); 49 | Dupermen.clickGui.drawString(Dupermen.clickGui.mc.fontRenderer, module.getName(), this.x + 3, (this.y + this.height / 2) + Dupermen.clickGui.getYOffset() - Dupermen.clickGui.getTextYOffset(), Dupermen.clickGui.getEnabledButtonTextColour()); 50 | } else { 51 | Gui.drawRect(this.x, this.y + Dupermen.clickGui.getYOffset(), this.x + this.width, this.y + height + Dupermen.clickGui.getYOffset() - 1, Dupermen.clickGui.getButtonColour()); 52 | Dupermen.clickGui.drawString(Dupermen.clickGui.mc.fontRenderer, module.getName(), this.x + 3, (y + this.height / 2) + Dupermen.clickGui.getYOffset() - Dupermen.clickGui.getTextYOffset(), Dupermen.clickGui.getButtonTextColour()); 53 | } 54 | 55 | if (isOver(mouseX, mouseY)) { 56 | Gui.drawRect(this.x, this.y + Dupermen.clickGui.getYOffset(), this.x + this.width, this.y + this.height + Dupermen.clickGui.getYOffset() - 1, ColourUtils.ColorUtils.toRGBA(255, 255, 255, 50)); 57 | } int offset = y + height; 58 | 59 | for (ModeButton modeButton : modeButtons) { 60 | modeButton.render(mouseX, mouseY, this.x + 1, offset); 61 | offset += height; 62 | } 63 | 64 | for (BooleanButton booleanButton : booleanButtons) { 65 | booleanButton.render(mouseX, mouseY, this.x + 1, offset); 66 | offset += height; 67 | } 68 | 69 | for (Slider slider : sliders) { 70 | slider.render(mouseX, mouseY, this.x + 1, offset); 71 | offset += height; 72 | } 73 | 74 | keybindButton.render(mouseX, mouseY, this.x + 1, offset); 75 | } 76 | } 77 | 78 | public void mouseClicked(int mouseX, int mouseY, int mouseButton) { 79 | if (frame.open) { 80 | if (mouseButton == 0) { 81 | if (isOver(mouseX, mouseY)) module.toggle(); 82 | } else if (mouseButton == 1 && isOver(mouseX, mouseY)) open = !open; 83 | 84 | for (ModeButton modeButton : modeButtons) modeButton.mouseClicked(mouseX, mouseY, mouseButton); 85 | for (BooleanButton booleanButton : booleanButtons) booleanButton.mouseClicked(mouseX, mouseY, mouseButton); 86 | for (Slider slider : sliders) slider.mouseClicked(mouseX, mouseY, mouseButton); 87 | } 88 | 89 | keybindButton.mouseClicked(mouseX, mouseY, mouseButton); 90 | } 91 | 92 | public void mouseReleased(int state) { 93 | for (Slider slider : sliders) slider.mouseReleased(state); 94 | } 95 | 96 | public void keyTyped(int keyCode) { 97 | keybindButton.keyTyped(keyCode); 98 | } 99 | 100 | public boolean isOver(int x, int y) { 101 | return x >= this.x && y > this.y + Dupermen.clickGui.getYOffset() && x <= this.x + this.width && y < this.y + this.height + Dupermen.clickGui.getYOffset(); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /src/main/java/com/ja/dupermen/gui/click/component/Frame.java: -------------------------------------------------------------------------------- 1 | package com.ja.dupermen.gui.click.component; 2 | 3 | import com.ja.dupermen.Dupermen; 4 | import com.ja.dupermen.module.Category; 5 | import com.ja.dupermen.module.Module; 6 | import net.minecraft.client.gui.Gui; 7 | 8 | import java.util.ArrayList; 9 | 10 | public class Frame { 11 | ArrayList