commit 98c4bf2a97d8e453185310a82105225b3e1b3f8d Author: TudbuT Date: Sun Mar 3 21:06:47 2024 +0100 public release. <3 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..27d9227 --- /dev/null +++ b/.gitignore @@ -0,0 +1,31 @@ +# eclipse +bin +*.launch +.settings +.metadata +.classpath +.project + +# idea +out +*.ipr +*.iws +*.iml +.idea + +# gradle +build +.gradle + + +# other +eclipse +run + +# Files from Forge MDK +forge*changelog.txt +*.txt + +*.patch +*.orig +*.rej \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..80984f0 --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2020-24 Daniel H. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, and modify copies of the Software: + +Copies of the Software are not allowed to be used commercially or sold. +Permission is given to use the Software for personal use. Permission is also +given to repackage parts of it as long as a publicly visible reference to the +original work is present. + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..2158d89 --- /dev/null +++ b/README.md @@ -0,0 +1,18 @@ +TTCp Client +=========== + +DONT ACTIVATE ANY OTHER AUTOTOTEM ALONG THIS ONE, it will glitch it out! + +ClickGUI opens with COMMA + +TudbuT Client Premium + +--- + +This is the first public, free release of TTCp. Feel free to take and use. The authentication is deactivated. +Code quality is not great in some parts and there are some memory leaks, but it's completely usable and most +code is alright. + +I ask you nicely not to take code from this without giving me *some* sort of recognition. Thank you! + +Thanks for the awesome time developing this. diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..d521c0e --- /dev/null +++ b/build.gradle @@ -0,0 +1,127 @@ + +buildscript { + repositories { + maven { url = 'https://files.minecraftforge.net/maven' } + maven { url = "https://repo.spongepowered.org/maven" } + jcenter() + mavenCentral() + } + dependencies { + classpath 'net.minecraftforge.gradle:ForgeGradle:5.+' + classpath "org.spongepowered:mixingradle:0.7.+" + } +} + +apply plugin: 'net.minecraftforge.gradle' +// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. +apply plugin: 'org.spongepowered.mixin' +apply plugin: 'eclipse' + +version = mod_version +group = mod_group +archivesBaseName = mod_id + +sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. + +repositories { + maven { url = 'https://repo.spongepowered.org/maven' } + mavenCentral() +} + + +compileJava { + options.encoding = "UTF-8" +} + +configurations { + atj +} + +minecraft { + mappings channel: 'stable', version: '39-1.12' + // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. + // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') + + String myJvmArgs = "-Dfml.coreMods.load=${mod_core_plugin.replace('${mod_group}', mod_group).replace('${mod_id}', mod_id)}" + String[] myRunArgs = ["--mixin", "${mod_mixin_configs.replace('${mod_id}', mod_id)}", "--userType", "mojang", "--username", "TudbuT_dev", "--accessToken", "fuck no, this is going on github", "--uuid", "b8dd8777a0744f3da5b90b19def1b1ac"] + runs { + client { + args = myRunArgs + jvmArgs = [myJvmArgs] + workingDirectory project.file('run') + property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' + property 'forge.logging.console.level', 'debug' + } + + server { + args = myRunArgs + jvmArgs = [myJvmArgs] + property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' + property 'forge.logging.console.level', 'debug' + } + } +} + +dependencies { + minecraft 'net.minecraftforge:forge:1.12.2-14.23.5.2860' + + //implementation('net.minecraftforge:mergetool:1.0.12') + implementation atj ('org.spongepowered:mixin:0.7.11-SNAPSHOT') { + exclude module: 'launchwrapper' + exclude module: 'guava' + exclude module: 'gson' + exclude module: 'commons-io' + exclude module: 'log4j-core' + } + annotationProcessor('org.spongepowered:mixin:0.8.5:processor') { + exclude module: 'gson' + } + + implementation atj (fileTree(dir: "lib", include: "*.jar")) +} + +processResources { + inputs.property "version", version + inputs.property "mcversion", minecraft_version + + from(sourceSets.main.resources.srcDirs) { + include 'mcmod.info' + + expand 'mod_id': mod_id, 'mod_name': mod_name, 'version': project.version, + 'mcversion': minecraft_version, 'mod_description': mod_description, + 'mod_author': mod_author + } + + duplicatesStrategy = DuplicatesStrategy.EXCLUDE +} + +mixin { + debug.verbose = true + debug.export = true + dumpTargetOnFailure = true + defaultObfuscationEnv 'searge' + add sourceSets.main, 'mixins.ttcp.refmap.json' +} + +jar { + from { + configurations.atj + .collect { it.isDirectory() ? it : zipTree(it) } + } { + exclude "LICENSE.txt", "META-INF/MANIFSET.MF", "META-INF/maven/**", "META-INF/*.RSA", "META-INF/*.SF" + } + //from { fileTree("sponge") } // not sure if this is needed, i will see when i get a complaint from a FutureClient user + + manifest { + attributes "FMLCorePluginContainsFMLMod": "true" + attributes "ForceLoadAsMod": "true" + attributes "TweakClass": "org.spongepowered.asm.launch.MixinTweaker" + attributes "TweakOrder": "0" + attributes "MixinConfigs": mod_mixin_configs.replace('${mod_id}', mod_id) + attributes "FMLCorePlugin": "de.tudbut.mod.client.ttcp.CoreModTTCp" + } +} + +//jar.finalizedBy('reobfJar') + + diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..ddbc056 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,15 @@ +# Sets default memory used for gradle commands. Can be overridden by user or command line properties. +# This is required to provide enough memory for the Minecraft decompilation process. +org.gradle.jvmargs=-Xmx3G +mod_id=ttcp +mod_name=TTCp Client +mod_group=de.tudbut.mod.client.ttcp +mod_version=B1.9.0 +mod_author=["TudbuT"] +mod_description=TTCp Client +minecraft_version=1.12.2 +forge_version=14.23.5.2860 +mappings_channel=stable +mappings_version=39-1.12 +mod_core_plugin=${mod_group}.CoreModTTCp +mod_mixin_configs=mixins.${mod_id}.json diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..e708b1c Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..ae04661 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..cccdd3d --- /dev/null +++ b/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..f955316 --- /dev/null +++ b/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/lib/TuddyLIB-javadoc.zip b/lib/TuddyLIB-javadoc.zip new file mode 100644 index 0000000..2d2860d Binary files /dev/null and b/lib/TuddyLIB-javadoc.zip differ diff --git a/lib/de.tudbut.api.jar b/lib/de.tudbut.api.jar new file mode 100644 index 0000000..088f8ec Binary files /dev/null and b/lib/de.tudbut.api.jar differ diff --git a/sponge/META-INF/services/org.spongepowered.asm.service.IGlobalPropertyService b/sponge/META-INF/services/org.spongepowered.asm.service.IGlobalPropertyService new file mode 100644 index 0000000..5f8632d --- /dev/null +++ b/sponge/META-INF/services/org.spongepowered.asm.service.IGlobalPropertyService @@ -0,0 +1 @@ +org.spongepowered.asm.service.mojang.Blackboard \ No newline at end of file diff --git a/sponge/META-INF/services/org.spongepowered.asm.service.IMixinService b/sponge/META-INF/services/org.spongepowered.asm.service.IMixinService new file mode 100644 index 0000000..808bf7d --- /dev/null +++ b/sponge/META-INF/services/org.spongepowered.asm.service.IMixinService @@ -0,0 +1 @@ +org.spongepowered.asm.service.mojang.MixinServiceLaunchWrapper \ No newline at end of file diff --git a/sponge/META-INF/services/org.spongepowered.asm.service.IMixinServiceBootstrap b/sponge/META-INF/services/org.spongepowered.asm.service.IMixinServiceBootstrap new file mode 100644 index 0000000..cfd5d42 --- /dev/null +++ b/sponge/META-INF/services/org.spongepowered.asm.service.IMixinServiceBootstrap @@ -0,0 +1 @@ +org.spongepowered.asm.service.mojang.MixinServiceLaunchWrapperBootstrap \ No newline at end of file diff --git a/sponge/META-INF/services/org.spongepowered.tools.obfuscation.service.IObfuscationService b/sponge/META-INF/services/org.spongepowered.tools.obfuscation.service.IObfuscationService new file mode 100644 index 0000000..96b5eb8 --- /dev/null +++ b/sponge/META-INF/services/org.spongepowered.tools.obfuscation.service.IObfuscationService @@ -0,0 +1 @@ +org.spongepowered.tools.obfuscation.mcp.ObfuscationServiceMCP \ No newline at end of file diff --git a/sponge/org/spongepowered/asm/bridge/RemapperAdapter.class b/sponge/org/spongepowered/asm/bridge/RemapperAdapter.class new file mode 100644 index 0000000..fb31a3a Binary files /dev/null and b/sponge/org/spongepowered/asm/bridge/RemapperAdapter.class differ diff --git a/sponge/org/spongepowered/asm/bridge/RemapperAdapterFML.class b/sponge/org/spongepowered/asm/bridge/RemapperAdapterFML.class new file mode 100644 index 0000000..9953a5f Binary files /dev/null and b/sponge/org/spongepowered/asm/bridge/RemapperAdapterFML.class differ diff --git a/sponge/org/spongepowered/asm/launch/GlobalProperties$Keys.class b/sponge/org/spongepowered/asm/launch/GlobalProperties$Keys.class new file mode 100644 index 0000000..fd9782a Binary files /dev/null and b/sponge/org/spongepowered/asm/launch/GlobalProperties$Keys.class differ diff --git a/sponge/org/spongepowered/asm/launch/GlobalProperties.class b/sponge/org/spongepowered/asm/launch/GlobalProperties.class new file mode 100644 index 0000000..d2d1835 Binary files /dev/null and b/sponge/org/spongepowered/asm/launch/GlobalProperties.class differ diff --git a/sponge/org/spongepowered/asm/launch/MixinBootstrap.class b/sponge/org/spongepowered/asm/launch/MixinBootstrap.class new file mode 100644 index 0000000..c4268b1 Binary files /dev/null and b/sponge/org/spongepowered/asm/launch/MixinBootstrap.class differ diff --git a/sponge/org/spongepowered/asm/launch/MixinInitialisationError.class b/sponge/org/spongepowered/asm/launch/MixinInitialisationError.class new file mode 100644 index 0000000..f450c7b Binary files /dev/null and b/sponge/org/spongepowered/asm/launch/MixinInitialisationError.class differ diff --git a/sponge/org/spongepowered/asm/launch/MixinTweaker.class b/sponge/org/spongepowered/asm/launch/MixinTweaker.class new file mode 100644 index 0000000..fcb06de Binary files /dev/null and b/sponge/org/spongepowered/asm/launch/MixinTweaker.class differ diff --git a/sponge/org/spongepowered/asm/launch/platform/IMixinPlatformAgent.class b/sponge/org/spongepowered/asm/launch/platform/IMixinPlatformAgent.class new file mode 100644 index 0000000..47e34a5 Binary files /dev/null and b/sponge/org/spongepowered/asm/launch/platform/IMixinPlatformAgent.class differ diff --git a/sponge/org/spongepowered/asm/launch/platform/MainAttributes.class b/sponge/org/spongepowered/asm/launch/platform/MainAttributes.class new file mode 100644 index 0000000..856649e Binary files /dev/null and b/sponge/org/spongepowered/asm/launch/platform/MainAttributes.class differ diff --git a/sponge/org/spongepowered/asm/launch/platform/MixinContainer.class b/sponge/org/spongepowered/asm/launch/platform/MixinContainer.class new file mode 100644 index 0000000..5d8a9a5 Binary files /dev/null and b/sponge/org/spongepowered/asm/launch/platform/MixinContainer.class differ diff --git a/sponge/org/spongepowered/asm/launch/platform/MixinPlatformAgentAbstract.class b/sponge/org/spongepowered/asm/launch/platform/MixinPlatformAgentAbstract.class new file mode 100644 index 0000000..d2e8874 Binary files /dev/null and b/sponge/org/spongepowered/asm/launch/platform/MixinPlatformAgentAbstract.class differ diff --git a/sponge/org/spongepowered/asm/launch/platform/MixinPlatformAgentDefault.class b/sponge/org/spongepowered/asm/launch/platform/MixinPlatformAgentDefault.class new file mode 100644 index 0000000..824b33b Binary files /dev/null and b/sponge/org/spongepowered/asm/launch/platform/MixinPlatformAgentDefault.class differ diff --git a/sponge/org/spongepowered/asm/launch/platform/MixinPlatformAgentFML.class b/sponge/org/spongepowered/asm/launch/platform/MixinPlatformAgentFML.class new file mode 100644 index 0000000..4dfb803 Binary files /dev/null and b/sponge/org/spongepowered/asm/launch/platform/MixinPlatformAgentFML.class differ diff --git a/sponge/org/spongepowered/asm/launch/platform/MixinPlatformManager.class b/sponge/org/spongepowered/asm/launch/platform/MixinPlatformManager.class new file mode 100644 index 0000000..4952f74 Binary files /dev/null and b/sponge/org/spongepowered/asm/launch/platform/MixinPlatformManager.class differ diff --git a/sponge/org/spongepowered/asm/lib/AnnotationVisitor.class b/sponge/org/spongepowered/asm/lib/AnnotationVisitor.class new file mode 100644 index 0000000..e3bd9ac Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/AnnotationVisitor.class differ diff --git a/sponge/org/spongepowered/asm/lib/AnnotationWriter.class b/sponge/org/spongepowered/asm/lib/AnnotationWriter.class new file mode 100644 index 0000000..29ee8ce Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/AnnotationWriter.class differ diff --git a/sponge/org/spongepowered/asm/lib/Attribute.class b/sponge/org/spongepowered/asm/lib/Attribute.class new file mode 100644 index 0000000..b637567 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/Attribute.class differ diff --git a/sponge/org/spongepowered/asm/lib/ByteVector.class b/sponge/org/spongepowered/asm/lib/ByteVector.class new file mode 100644 index 0000000..d3114e6 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/ByteVector.class differ diff --git a/sponge/org/spongepowered/asm/lib/ClassReader.class b/sponge/org/spongepowered/asm/lib/ClassReader.class new file mode 100644 index 0000000..810d377 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/ClassReader.class differ diff --git a/sponge/org/spongepowered/asm/lib/ClassVisitor.class b/sponge/org/spongepowered/asm/lib/ClassVisitor.class new file mode 100644 index 0000000..be14e77 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/ClassVisitor.class differ diff --git a/sponge/org/spongepowered/asm/lib/ClassWriter.class b/sponge/org/spongepowered/asm/lib/ClassWriter.class new file mode 100644 index 0000000..01b720a Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/ClassWriter.class differ diff --git a/sponge/org/spongepowered/asm/lib/Context.class b/sponge/org/spongepowered/asm/lib/Context.class new file mode 100644 index 0000000..8181d21 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/Context.class differ diff --git a/sponge/org/spongepowered/asm/lib/CurrentFrame.class b/sponge/org/spongepowered/asm/lib/CurrentFrame.class new file mode 100644 index 0000000..86834aa Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/CurrentFrame.class differ diff --git a/sponge/org/spongepowered/asm/lib/Edge.class b/sponge/org/spongepowered/asm/lib/Edge.class new file mode 100644 index 0000000..a81743e Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/Edge.class differ diff --git a/sponge/org/spongepowered/asm/lib/FieldVisitor.class b/sponge/org/spongepowered/asm/lib/FieldVisitor.class new file mode 100644 index 0000000..52af845 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/FieldVisitor.class differ diff --git a/sponge/org/spongepowered/asm/lib/FieldWriter.class b/sponge/org/spongepowered/asm/lib/FieldWriter.class new file mode 100644 index 0000000..3253b19 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/FieldWriter.class differ diff --git a/sponge/org/spongepowered/asm/lib/Frame.class b/sponge/org/spongepowered/asm/lib/Frame.class new file mode 100644 index 0000000..45dd628 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/Frame.class differ diff --git a/sponge/org/spongepowered/asm/lib/Handle.class b/sponge/org/spongepowered/asm/lib/Handle.class new file mode 100644 index 0000000..08b87ee Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/Handle.class differ diff --git a/sponge/org/spongepowered/asm/lib/Handler.class b/sponge/org/spongepowered/asm/lib/Handler.class new file mode 100644 index 0000000..b520dff Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/Handler.class differ diff --git a/sponge/org/spongepowered/asm/lib/Item.class b/sponge/org/spongepowered/asm/lib/Item.class new file mode 100644 index 0000000..a5b1485 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/Item.class differ diff --git a/sponge/org/spongepowered/asm/lib/Label.class b/sponge/org/spongepowered/asm/lib/Label.class new file mode 100644 index 0000000..678b86b Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/Label.class differ diff --git a/sponge/org/spongepowered/asm/lib/MethodVisitor.class b/sponge/org/spongepowered/asm/lib/MethodVisitor.class new file mode 100644 index 0000000..5f61998 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/MethodVisitor.class differ diff --git a/sponge/org/spongepowered/asm/lib/MethodWriter.class b/sponge/org/spongepowered/asm/lib/MethodWriter.class new file mode 100644 index 0000000..e7fe24e Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/MethodWriter.class differ diff --git a/sponge/org/spongepowered/asm/lib/Opcodes.class b/sponge/org/spongepowered/asm/lib/Opcodes.class new file mode 100644 index 0000000..ed68d84 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/Opcodes.class differ diff --git a/sponge/org/spongepowered/asm/lib/Type.class b/sponge/org/spongepowered/asm/lib/Type.class new file mode 100644 index 0000000..3fc711e Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/Type.class differ diff --git a/sponge/org/spongepowered/asm/lib/TypePath.class b/sponge/org/spongepowered/asm/lib/TypePath.class new file mode 100644 index 0000000..b24aaf5 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/TypePath.class differ diff --git a/sponge/org/spongepowered/asm/lib/TypeReference.class b/sponge/org/spongepowered/asm/lib/TypeReference.class new file mode 100644 index 0000000..cb8a0f3 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/TypeReference.class differ diff --git a/sponge/org/spongepowered/asm/lib/commons/AnnotationRemapper.class b/sponge/org/spongepowered/asm/lib/commons/AnnotationRemapper.class new file mode 100644 index 0000000..8f4904a Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/commons/AnnotationRemapper.class differ diff --git a/sponge/org/spongepowered/asm/lib/commons/ClassRemapper.class b/sponge/org/spongepowered/asm/lib/commons/ClassRemapper.class new file mode 100644 index 0000000..c0172e6 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/commons/ClassRemapper.class differ diff --git a/sponge/org/spongepowered/asm/lib/commons/FieldRemapper.class b/sponge/org/spongepowered/asm/lib/commons/FieldRemapper.class new file mode 100644 index 0000000..a381efb Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/commons/FieldRemapper.class differ diff --git a/sponge/org/spongepowered/asm/lib/commons/MethodRemapper.class b/sponge/org/spongepowered/asm/lib/commons/MethodRemapper.class new file mode 100644 index 0000000..25b68db Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/commons/MethodRemapper.class differ diff --git a/sponge/org/spongepowered/asm/lib/commons/Remapper.class b/sponge/org/spongepowered/asm/lib/commons/Remapper.class new file mode 100644 index 0000000..9cb1597 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/commons/Remapper.class differ diff --git a/sponge/org/spongepowered/asm/lib/commons/SignatureRemapper.class b/sponge/org/spongepowered/asm/lib/commons/SignatureRemapper.class new file mode 100644 index 0000000..9877b36 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/commons/SignatureRemapper.class differ diff --git a/sponge/org/spongepowered/asm/lib/commons/SimpleRemapper.class b/sponge/org/spongepowered/asm/lib/commons/SimpleRemapper.class new file mode 100644 index 0000000..74c95a6 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/commons/SimpleRemapper.class differ diff --git a/sponge/org/spongepowered/asm/lib/package.html b/sponge/org/spongepowered/asm/lib/package.html new file mode 100644 index 0000000..2d4a765 --- /dev/null +++ b/sponge/org/spongepowered/asm/lib/package.html @@ -0,0 +1,87 @@ + + + +Provides a small and fast bytecode manipulation framework. + +

+The ASM framework is organized +around the {@link org.objectweb.asm.ClassVisitor ClassVisitor}, +{@link org.objectweb.asm.FieldVisitor FieldVisitor}, +{@link org.objectweb.asm.MethodVisitor MethodVisitor} and +{@link org.objectweb.asm.AnnotationVisitor AnnotationVisitor} abstract classes, +which allow one to visit the fields, methods and annotations of a class, +including the bytecode instructions of each method. + +

+In addition to these main abstract classes, ASM provides a {@link +org.objectweb.asm.ClassReader ClassReader} class, that can parse an +existing class and make a given visitor visit it. ASM also provides +a {@link org.objectweb.asm.ClassWriter ClassWriter} class, which is +a visitor that generates Java class files. + +

+In order to generate a class from scratch, only the {@link +org.objectweb.asm.ClassWriter ClassWriter} class is necessary. Indeed, +in order to generate a class, one must just call its visitXxx +methods with the appropriate arguments to generate the desired fields +and methods. See the "helloworld" example in the ASM distribution for +more details about class generation. + +

+In order to modify existing classes, one must use a {@link +org.objectweb.asm.ClassReader ClassReader} class to analyze +the original class, a class modifier, and a {@link org.objectweb.asm.ClassWriter +ClassWriter} to construct the modified class. The class modifier +is just a {@link org.objectweb.asm.ClassVisitor ClassVisitor} +that delegates most of the work to another {@link org.objectweb.asm.ClassVisitor +ClassVisitor}, but that sometimes changes some parameter values, +or call additional methods, in order to implement the desired +modification process. In order to make it easier to implement such +class modifiers, the {@link org.objectweb.asm.ClassVisitor +ClassVisitor} and {@link org.objectweb.asm.MethodVisitor MethodVisitor} +classes delegate by default all the method calls they receive to an +optional visitor. See the "adapt" example in the ASM +distribution for more details about class modification. + +

+The size of the core ASM library, asm.jar, is only 45KB, which is much +smaller than the size of the +BCEL library (504KB), and than the +size of the +SERP library (150KB). ASM is also +much faster than these tools. Indeed the overhead of a load time class +transformation process is of the order of 60% with ASM, 700% or more with BCEL, +and 1100% or more with SERP (see the test/perf directory in the ASM +distribution)! + +@since ASM 1.3 + + diff --git a/sponge/org/spongepowered/asm/lib/signature/SignatureReader.class b/sponge/org/spongepowered/asm/lib/signature/SignatureReader.class new file mode 100644 index 0000000..c4d5f52 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/signature/SignatureReader.class differ diff --git a/sponge/org/spongepowered/asm/lib/signature/SignatureVisitor.class b/sponge/org/spongepowered/asm/lib/signature/SignatureVisitor.class new file mode 100644 index 0000000..03b49b0 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/signature/SignatureVisitor.class differ diff --git a/sponge/org/spongepowered/asm/lib/signature/SignatureWriter.class b/sponge/org/spongepowered/asm/lib/signature/SignatureWriter.class new file mode 100644 index 0000000..2782e5e Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/signature/SignatureWriter.class differ diff --git a/sponge/org/spongepowered/asm/lib/signature/package.html b/sponge/org/spongepowered/asm/lib/signature/package.html new file mode 100644 index 0000000..0c07d12 --- /dev/null +++ b/sponge/org/spongepowered/asm/lib/signature/package.html @@ -0,0 +1,36 @@ + + + +Provides support for type signatures. + +@since ASM 2.0 + + diff --git a/sponge/org/spongepowered/asm/lib/tree/AbstractInsnNode.class b/sponge/org/spongepowered/asm/lib/tree/AbstractInsnNode.class new file mode 100644 index 0000000..b104ce5 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/AbstractInsnNode.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/AnnotationNode.class b/sponge/org/spongepowered/asm/lib/tree/AnnotationNode.class new file mode 100644 index 0000000..9bef417 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/AnnotationNode.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/ClassNode.class b/sponge/org/spongepowered/asm/lib/tree/ClassNode.class new file mode 100644 index 0000000..256e186 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/ClassNode.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/FieldInsnNode.class b/sponge/org/spongepowered/asm/lib/tree/FieldInsnNode.class new file mode 100644 index 0000000..e6f728d Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/FieldInsnNode.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/FieldNode.class b/sponge/org/spongepowered/asm/lib/tree/FieldNode.class new file mode 100644 index 0000000..d700994 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/FieldNode.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/FrameNode.class b/sponge/org/spongepowered/asm/lib/tree/FrameNode.class new file mode 100644 index 0000000..e3c54fe Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/FrameNode.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/IincInsnNode.class b/sponge/org/spongepowered/asm/lib/tree/IincInsnNode.class new file mode 100644 index 0000000..04b6f91 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/IincInsnNode.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/InnerClassNode.class b/sponge/org/spongepowered/asm/lib/tree/InnerClassNode.class new file mode 100644 index 0000000..801e975 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/InnerClassNode.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/InsnList$InsnListIterator.class b/sponge/org/spongepowered/asm/lib/tree/InsnList$InsnListIterator.class new file mode 100644 index 0000000..11f5d59 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/InsnList$InsnListIterator.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/InsnList.class b/sponge/org/spongepowered/asm/lib/tree/InsnList.class new file mode 100644 index 0000000..08dff06 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/InsnList.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/InsnNode.class b/sponge/org/spongepowered/asm/lib/tree/InsnNode.class new file mode 100644 index 0000000..8082582 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/InsnNode.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/IntInsnNode.class b/sponge/org/spongepowered/asm/lib/tree/IntInsnNode.class new file mode 100644 index 0000000..229bc3f Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/IntInsnNode.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/InvokeDynamicInsnNode.class b/sponge/org/spongepowered/asm/lib/tree/InvokeDynamicInsnNode.class new file mode 100644 index 0000000..955dcdb Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/InvokeDynamicInsnNode.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/JumpInsnNode.class b/sponge/org/spongepowered/asm/lib/tree/JumpInsnNode.class new file mode 100644 index 0000000..18b6f98 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/JumpInsnNode.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/LabelNode.class b/sponge/org/spongepowered/asm/lib/tree/LabelNode.class new file mode 100644 index 0000000..b141f9e Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/LabelNode.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/LdcInsnNode.class b/sponge/org/spongepowered/asm/lib/tree/LdcInsnNode.class new file mode 100644 index 0000000..2fae396 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/LdcInsnNode.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/LineNumberNode.class b/sponge/org/spongepowered/asm/lib/tree/LineNumberNode.class new file mode 100644 index 0000000..3d5f920 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/LineNumberNode.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/LocalVariableAnnotationNode.class b/sponge/org/spongepowered/asm/lib/tree/LocalVariableAnnotationNode.class new file mode 100644 index 0000000..93670a8 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/LocalVariableAnnotationNode.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/LocalVariableNode.class b/sponge/org/spongepowered/asm/lib/tree/LocalVariableNode.class new file mode 100644 index 0000000..8f7d763 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/LocalVariableNode.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/LookupSwitchInsnNode.class b/sponge/org/spongepowered/asm/lib/tree/LookupSwitchInsnNode.class new file mode 100644 index 0000000..f84894c Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/LookupSwitchInsnNode.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/MethodInsnNode.class b/sponge/org/spongepowered/asm/lib/tree/MethodInsnNode.class new file mode 100644 index 0000000..c9e9c82 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/MethodInsnNode.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/MethodNode$1.class b/sponge/org/spongepowered/asm/lib/tree/MethodNode$1.class new file mode 100644 index 0000000..7f31b92 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/MethodNode$1.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/MethodNode.class b/sponge/org/spongepowered/asm/lib/tree/MethodNode.class new file mode 100644 index 0000000..a770d70 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/MethodNode.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/MultiANewArrayInsnNode.class b/sponge/org/spongepowered/asm/lib/tree/MultiANewArrayInsnNode.class new file mode 100644 index 0000000..acc774b Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/MultiANewArrayInsnNode.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/ParameterNode.class b/sponge/org/spongepowered/asm/lib/tree/ParameterNode.class new file mode 100644 index 0000000..758d973 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/ParameterNode.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/TableSwitchInsnNode.class b/sponge/org/spongepowered/asm/lib/tree/TableSwitchInsnNode.class new file mode 100644 index 0000000..e75f396 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/TableSwitchInsnNode.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/TryCatchBlockNode.class b/sponge/org/spongepowered/asm/lib/tree/TryCatchBlockNode.class new file mode 100644 index 0000000..2553081 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/TryCatchBlockNode.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/TypeAnnotationNode.class b/sponge/org/spongepowered/asm/lib/tree/TypeAnnotationNode.class new file mode 100644 index 0000000..b6fb92a Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/TypeAnnotationNode.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/TypeInsnNode.class b/sponge/org/spongepowered/asm/lib/tree/TypeInsnNode.class new file mode 100644 index 0000000..eb6e0ab Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/TypeInsnNode.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/VarInsnNode.class b/sponge/org/spongepowered/asm/lib/tree/VarInsnNode.class new file mode 100644 index 0000000..5b02b70 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/VarInsnNode.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/analysis/Analyzer.class b/sponge/org/spongepowered/asm/lib/tree/analysis/Analyzer.class new file mode 100644 index 0000000..c5361ef Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/analysis/Analyzer.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/analysis/AnalyzerException.class b/sponge/org/spongepowered/asm/lib/tree/analysis/AnalyzerException.class new file mode 100644 index 0000000..a101872 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/analysis/AnalyzerException.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/analysis/BasicInterpreter.class b/sponge/org/spongepowered/asm/lib/tree/analysis/BasicInterpreter.class new file mode 100644 index 0000000..a53570d Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/analysis/BasicInterpreter.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/analysis/BasicValue.class b/sponge/org/spongepowered/asm/lib/tree/analysis/BasicValue.class new file mode 100644 index 0000000..0ed9941 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/analysis/BasicValue.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/analysis/BasicVerifier.class b/sponge/org/spongepowered/asm/lib/tree/analysis/BasicVerifier.class new file mode 100644 index 0000000..869cc3d Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/analysis/BasicVerifier.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/analysis/Frame.class b/sponge/org/spongepowered/asm/lib/tree/analysis/Frame.class new file mode 100644 index 0000000..aafe9f3 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/analysis/Frame.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/analysis/Interpreter.class b/sponge/org/spongepowered/asm/lib/tree/analysis/Interpreter.class new file mode 100644 index 0000000..ed2de37 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/analysis/Interpreter.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/analysis/SimpleVerifier.class b/sponge/org/spongepowered/asm/lib/tree/analysis/SimpleVerifier.class new file mode 100644 index 0000000..a684134 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/analysis/SimpleVerifier.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/analysis/SmallSet.class b/sponge/org/spongepowered/asm/lib/tree/analysis/SmallSet.class new file mode 100644 index 0000000..3f7a4fc Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/analysis/SmallSet.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/analysis/SourceInterpreter.class b/sponge/org/spongepowered/asm/lib/tree/analysis/SourceInterpreter.class new file mode 100644 index 0000000..218fd14 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/analysis/SourceInterpreter.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/analysis/SourceValue.class b/sponge/org/spongepowered/asm/lib/tree/analysis/SourceValue.class new file mode 100644 index 0000000..be6704f Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/analysis/SourceValue.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/analysis/Subroutine.class b/sponge/org/spongepowered/asm/lib/tree/analysis/Subroutine.class new file mode 100644 index 0000000..ae839b6 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/analysis/Subroutine.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/analysis/Value.class b/sponge/org/spongepowered/asm/lib/tree/analysis/Value.class new file mode 100644 index 0000000..c2c8cea Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/tree/analysis/Value.class differ diff --git a/sponge/org/spongepowered/asm/lib/tree/analysis/package.html b/sponge/org/spongepowered/asm/lib/tree/analysis/package.html new file mode 100644 index 0000000..228da02 --- /dev/null +++ b/sponge/org/spongepowered/asm/lib/tree/analysis/package.html @@ -0,0 +1,67 @@ + + + + +

+Provides a framework for static code analysis based on the asm.tree package. +

+ +

+Basic usage: +

+ +
+ClassReader cr = new ClassReader(bytecode);
+ClassNode cn = new ClassNode();
+cr.accept(cn, ClassReader.SKIP_DEBUG);
+
+List methods = cn.methods;
+for (int i = 0; i < methods.size(); ++i) {
+    MethodNode method = (MethodNode) methods.get(i);
+    if (method.instructions.size() > 0) {
+        Analyzer a = new Analyzer(new BasicInterpreter());
+        a.analyze(cn.name, method);
+        Frame[] frames = a.getFrames();
+        // Elements of the frames arrray now contains info for each instruction
+        // from the analyzed method. BasicInterpreter creates BasicValue, that
+        // is using simplified type system that distinguishes the UNINITIALZED,
+        // INT, FLOAT, LONG, DOUBLE, REFERENCE and RETURNADDRESS types.
+        ...
+    }
+}
+
+ +

+@since ASM 1.4.3 +

+ + + diff --git a/sponge/org/spongepowered/asm/lib/tree/package.html b/sponge/org/spongepowered/asm/lib/tree/package.html new file mode 100644 index 0000000..940b876 --- /dev/null +++ b/sponge/org/spongepowered/asm/lib/tree/package.html @@ -0,0 +1,192 @@ + + + + +

+Provides an ASM visitor that constructs a tree representation of the +classes it visits. This class adapter can be useful to implement "complex" +class manipulation operations, i.e., operations that would be very hard to +implement without using a tree representation (such as optimizing the number +of local variables used by a method). +

+ +

+However, this class adapter has a cost: it makes ASM bigger and slower. Indeed +it requires more than twenty new classes, and multiplies the time needed to +transform a class by almost two (it is almost two times faster to read, "modify" +and write a class with a ClassVisitor than with a ClassNode). This is why +this package is bundled in an optional asm-tree.jar library that +is separated from (but requires) the asm.jar library, which contains +the core ASM framework. This is also why it is recommended +not to use this class adapter when it is possible. +

+ +

+The root class is the ClassNode, that can be created from existing bytecode. For example: +

+ +
+  ClassReader cr = new ClassReader(source);
+  ClassNode cn = new ClassNode();
+  cr.accept(cn, true);
+
+ +

+Now the content of ClassNode can be modified and then +serialized back into bytecode: +

+ +
+  ClassWriter cw = new ClassWriter(true);
+  cn.accept(cw);
+
+ +

+Using a simple ClassVisitor it is possible to create MethodNode instances per-method. +In this example MethodNode is acting as a buffer that is flushed out at visitEnd() call: +

+ +
+  ClassReader cr = new ClassReader(source);
+  ClassWriter cw = new ClassWriter();
+  ClassVisitor cv = new ClassVisitor(cw) {
+    public MethodVisitor visitMethod(int access, String name,
+        String desc, String signature, String[] exceptions) {
+      final MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions);
+      MethodNode mn = new MethodNode(access, name, desc, signature, exceptions) {
+        public void visitEnd() {
+          // transform or analyze method code using tree API
+          accept(mv);
+        }
+      };
+    }
+  };
+  cr.accept(cv, true);
+
+ +

+Several strategies can be used to construct method code from scratch. The first +option is to create a MethodNode, and then create XxxInsnNode instances and +add them to the instructions list: +

+ +
+MethodNode m = new MethodNode(...);
+m.instructions.add(new VarInsnNode(ALOAD, 0));
+...
+
+ +

+Alternatively, you can use the fact that MethodNode is a MethodVisitor, and use +that to create the XxxInsnNode and add them to the instructions list through +the standard MethodVisitor methods: +

+ +
+MethodNode m = new MethodNode(...);
+m.visitVarInsn(ALOAD, 0);
+...
+
+ +

+If you cannot generate all the instructions in sequential order, i.e. if you +need to save some pointer in the instruction list and then insert instructions +at that place after other instructions have been generated, you can use InsnList +methods insert() and insertBefore() to insert instructions at a saved pointer. +

+ +
+MethodNode m = new MethodNode(...);
+m.visitVarInsn(ALOAD, 0);
+AbstractInsnNode ptr = m.instructions.getLast();
+m.visitVarInsn(ALOAD, 1);
+// inserts an instruction between ALOAD 0 and ALOAD 1
+m.instructions.insert(ptr, new VarInsnNode(ALOAD, 0));
+...
+
+ +

+If you need to insert instructions while iterating over an existing instruction +list, you can also use several strategies. The first one is to use a +ListIterator over the instruction list: +

+ +
+ListIterator it = m.instructions.iterator();
+while (it.hasNext()) {
+    AbstractInsnNode n = (AbstractInsnNode) it.next();
+    if (...) {
+        it.add(new VarInsnNode(ALOAD, 0));
+    }
+}
+
+ +

+It is also possible to convert an instruction list into an array and iterate trough +array elements: +

+ +
+AbstractInsnNode[] insns = m.instructions.toArray();
+for(int i = 0; i<insns.length; i++) {
+    AbstractInsnNode n = insns[i];
+    if (...) {
+        m.instructions.insert(n, new VarInsnNode(ALOAD, 0));
+    }
+}
+
+ +

+If you want to insert these instructions through the MethodVisitor methods, +you can use another instance of MethodNode as a MethodVisitor and then +insert instructions collected by that instance into the instruction list. +For example: +

+ +
+AbstractInsnNode[] insns = m.instructions.toArray();
+for(int i = 0; i<insns.length; i++) {
+    AbstractInsnNode n = insns[i];
+    if (...) {
+        MethodNode mn = new MethodNode();
+        mn.visitVarInsn(ALOAD, 0);
+        mn.visitVarInsn(ALOAD, 1);
+        m.instructions.insert(n, mn.instructions);
+    }
+}
+
+ +

+@since ASM 1.3.3 +

+ + + diff --git a/sponge/org/spongepowered/asm/lib/util/ASMifiable.class b/sponge/org/spongepowered/asm/lib/util/ASMifiable.class new file mode 100644 index 0000000..0b3a572 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/util/ASMifiable.class differ diff --git a/sponge/org/spongepowered/asm/lib/util/ASMifier.class b/sponge/org/spongepowered/asm/lib/util/ASMifier.class new file mode 100644 index 0000000..979b0c0 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/util/ASMifier.class differ diff --git a/sponge/org/spongepowered/asm/lib/util/CheckAnnotationAdapter.class b/sponge/org/spongepowered/asm/lib/util/CheckAnnotationAdapter.class new file mode 100644 index 0000000..c139f33 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/util/CheckAnnotationAdapter.class differ diff --git a/sponge/org/spongepowered/asm/lib/util/CheckClassAdapter.class b/sponge/org/spongepowered/asm/lib/util/CheckClassAdapter.class new file mode 100644 index 0000000..b82f0c1 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/util/CheckClassAdapter.class differ diff --git a/sponge/org/spongepowered/asm/lib/util/CheckFieldAdapter.class b/sponge/org/spongepowered/asm/lib/util/CheckFieldAdapter.class new file mode 100644 index 0000000..6dfa413 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/util/CheckFieldAdapter.class differ diff --git a/sponge/org/spongepowered/asm/lib/util/CheckMethodAdapter$1.class b/sponge/org/spongepowered/asm/lib/util/CheckMethodAdapter$1.class new file mode 100644 index 0000000..4465b67 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/util/CheckMethodAdapter$1.class differ diff --git a/sponge/org/spongepowered/asm/lib/util/CheckMethodAdapter.class b/sponge/org/spongepowered/asm/lib/util/CheckMethodAdapter.class new file mode 100644 index 0000000..f153360 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/util/CheckMethodAdapter.class differ diff --git a/sponge/org/spongepowered/asm/lib/util/CheckSignatureAdapter.class b/sponge/org/spongepowered/asm/lib/util/CheckSignatureAdapter.class new file mode 100644 index 0000000..ff4273a Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/util/CheckSignatureAdapter.class differ diff --git a/sponge/org/spongepowered/asm/lib/util/Printer.class b/sponge/org/spongepowered/asm/lib/util/Printer.class new file mode 100644 index 0000000..449bcce Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/util/Printer.class differ diff --git a/sponge/org/spongepowered/asm/lib/util/Textifiable.class b/sponge/org/spongepowered/asm/lib/util/Textifiable.class new file mode 100644 index 0000000..7e3cf05 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/util/Textifiable.class differ diff --git a/sponge/org/spongepowered/asm/lib/util/Textifier.class b/sponge/org/spongepowered/asm/lib/util/Textifier.class new file mode 100644 index 0000000..e32f4ac Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/util/Textifier.class differ diff --git a/sponge/org/spongepowered/asm/lib/util/TraceAnnotationVisitor.class b/sponge/org/spongepowered/asm/lib/util/TraceAnnotationVisitor.class new file mode 100644 index 0000000..55ed398 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/util/TraceAnnotationVisitor.class differ diff --git a/sponge/org/spongepowered/asm/lib/util/TraceClassVisitor.class b/sponge/org/spongepowered/asm/lib/util/TraceClassVisitor.class new file mode 100644 index 0000000..499d6f9 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/util/TraceClassVisitor.class differ diff --git a/sponge/org/spongepowered/asm/lib/util/TraceFieldVisitor.class b/sponge/org/spongepowered/asm/lib/util/TraceFieldVisitor.class new file mode 100644 index 0000000..7056d7f Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/util/TraceFieldVisitor.class differ diff --git a/sponge/org/spongepowered/asm/lib/util/TraceMethodVisitor.class b/sponge/org/spongepowered/asm/lib/util/TraceMethodVisitor.class new file mode 100644 index 0000000..b49cad1 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/util/TraceMethodVisitor.class differ diff --git a/sponge/org/spongepowered/asm/lib/util/TraceSignatureVisitor.class b/sponge/org/spongepowered/asm/lib/util/TraceSignatureVisitor.class new file mode 100644 index 0000000..7d8f867 Binary files /dev/null and b/sponge/org/spongepowered/asm/lib/util/TraceSignatureVisitor.class differ diff --git a/sponge/org/spongepowered/asm/lib/util/package.html b/sponge/org/spongepowered/asm/lib/util/package.html new file mode 100644 index 0000000..91d7420 --- /dev/null +++ b/sponge/org/spongepowered/asm/lib/util/package.html @@ -0,0 +1,40 @@ + + + +Provides ASM visitors that can be useful for programming and +debugging purposes. These class visitors are normally not used by applications +at runtime. This is why they are bundled in an optional asm-util.jar +library that is separated from (but requires) the asm.jar library, +which contains the core ASM framework. + +@since ASM 1.3.2 + + diff --git a/sponge/org/spongepowered/asm/mixin/Debug.class b/sponge/org/spongepowered/asm/mixin/Debug.class new file mode 100644 index 0000000..bf18e60 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/Debug.class differ diff --git a/sponge/org/spongepowered/asm/mixin/Dynamic.class b/sponge/org/spongepowered/asm/mixin/Dynamic.class new file mode 100644 index 0000000..43d655a Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/Dynamic.class differ diff --git a/sponge/org/spongepowered/asm/mixin/EnvironmentStateTweaker.class b/sponge/org/spongepowered/asm/mixin/EnvironmentStateTweaker.class new file mode 100644 index 0000000..05256d6 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/EnvironmentStateTweaker.class differ diff --git a/sponge/org/spongepowered/asm/mixin/Final.class b/sponge/org/spongepowered/asm/mixin/Final.class new file mode 100644 index 0000000..67e1e7e Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/Final.class differ diff --git a/sponge/org/spongepowered/asm/mixin/Implements.class b/sponge/org/spongepowered/asm/mixin/Implements.class new file mode 100644 index 0000000..815f433 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/Implements.class differ diff --git a/sponge/org/spongepowered/asm/mixin/Interface$Remap.class b/sponge/org/spongepowered/asm/mixin/Interface$Remap.class new file mode 100644 index 0000000..2afd0e4 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/Interface$Remap.class differ diff --git a/sponge/org/spongepowered/asm/mixin/Interface.class b/sponge/org/spongepowered/asm/mixin/Interface.class new file mode 100644 index 0000000..835c451 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/Interface.class differ diff --git a/sponge/org/spongepowered/asm/mixin/Intrinsic.class b/sponge/org/spongepowered/asm/mixin/Intrinsic.class new file mode 100644 index 0000000..bbb1345 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/Intrinsic.class differ diff --git a/sponge/org/spongepowered/asm/mixin/Mixin.class b/sponge/org/spongepowered/asm/mixin/Mixin.class new file mode 100644 index 0000000..4246c1e Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/Mixin.class differ diff --git a/sponge/org/spongepowered/asm/mixin/MixinEnvironment$1.class b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$1.class new file mode 100644 index 0000000..ca73406 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$1.class differ diff --git a/sponge/org/spongepowered/asm/mixin/MixinEnvironment$CompatibilityLevel$1.class b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$CompatibilityLevel$1.class new file mode 100644 index 0000000..17ced34 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$CompatibilityLevel$1.class differ diff --git a/sponge/org/spongepowered/asm/mixin/MixinEnvironment$CompatibilityLevel$2.class b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$CompatibilityLevel$2.class new file mode 100644 index 0000000..c361de6 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$CompatibilityLevel$2.class differ diff --git a/sponge/org/spongepowered/asm/mixin/MixinEnvironment$CompatibilityLevel$3.class b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$CompatibilityLevel$3.class new file mode 100644 index 0000000..0bcdf07 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$CompatibilityLevel$3.class differ diff --git a/sponge/org/spongepowered/asm/mixin/MixinEnvironment$CompatibilityLevel.class b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$CompatibilityLevel.class new file mode 100644 index 0000000..6a16235 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$CompatibilityLevel.class differ diff --git a/sponge/org/spongepowered/asm/mixin/MixinEnvironment$MixinLogWatcher$MixinAppender.class b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$MixinLogWatcher$MixinAppender.class new file mode 100644 index 0000000..ce5a775 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$MixinLogWatcher$MixinAppender.class differ diff --git a/sponge/org/spongepowered/asm/mixin/MixinEnvironment$MixinLogWatcher.class b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$MixinLogWatcher.class new file mode 100644 index 0000000..0063ce0 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$MixinLogWatcher.class differ diff --git a/sponge/org/spongepowered/asm/mixin/MixinEnvironment$Option$Inherit.class b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$Option$Inherit.class new file mode 100644 index 0000000..d03756d Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$Option$Inherit.class differ diff --git a/sponge/org/spongepowered/asm/mixin/MixinEnvironment$Option.class b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$Option.class new file mode 100644 index 0000000..8c7d80c Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$Option.class differ diff --git a/sponge/org/spongepowered/asm/mixin/MixinEnvironment$Phase.class b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$Phase.class new file mode 100644 index 0000000..1da3f7d Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$Phase.class differ diff --git a/sponge/org/spongepowered/asm/mixin/MixinEnvironment$Side$1.class b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$Side$1.class new file mode 100644 index 0000000..4ad6791 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$Side$1.class differ diff --git a/sponge/org/spongepowered/asm/mixin/MixinEnvironment$Side$2.class b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$Side$2.class new file mode 100644 index 0000000..01b0420 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$Side$2.class differ diff --git a/sponge/org/spongepowered/asm/mixin/MixinEnvironment$Side$3.class b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$Side$3.class new file mode 100644 index 0000000..b84f021 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$Side$3.class differ diff --git a/sponge/org/spongepowered/asm/mixin/MixinEnvironment$Side.class b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$Side.class new file mode 100644 index 0000000..9cc9673 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$Side.class differ diff --git a/sponge/org/spongepowered/asm/mixin/MixinEnvironment$TokenProviderWrapper.class b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$TokenProviderWrapper.class new file mode 100644 index 0000000..6b1432d Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/MixinEnvironment$TokenProviderWrapper.class differ diff --git a/sponge/org/spongepowered/asm/mixin/MixinEnvironment.class b/sponge/org/spongepowered/asm/mixin/MixinEnvironment.class new file mode 100644 index 0000000..6e2aa2a Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/MixinEnvironment.class differ diff --git a/sponge/org/spongepowered/asm/mixin/Mixins.class b/sponge/org/spongepowered/asm/mixin/Mixins.class new file mode 100644 index 0000000..679e512 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/Mixins.class differ diff --git a/sponge/org/spongepowered/asm/mixin/Mutable.class b/sponge/org/spongepowered/asm/mixin/Mutable.class new file mode 100644 index 0000000..57a8930 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/Mutable.class differ diff --git a/sponge/org/spongepowered/asm/mixin/Overwrite.class b/sponge/org/spongepowered/asm/mixin/Overwrite.class new file mode 100644 index 0000000..ed3854a Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/Overwrite.class differ diff --git a/sponge/org/spongepowered/asm/mixin/Pseudo.class b/sponge/org/spongepowered/asm/mixin/Pseudo.class new file mode 100644 index 0000000..05edb4c Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/Pseudo.class differ diff --git a/sponge/org/spongepowered/asm/mixin/Shadow.class b/sponge/org/spongepowered/asm/mixin/Shadow.class new file mode 100644 index 0000000..890ffe2 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/Shadow.class differ diff --git a/sponge/org/spongepowered/asm/mixin/SoftOverride.class b/sponge/org/spongepowered/asm/mixin/SoftOverride.class new file mode 100644 index 0000000..7bf4e28 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/SoftOverride.class differ diff --git a/sponge/org/spongepowered/asm/mixin/Unique.class b/sponge/org/spongepowered/asm/mixin/Unique.class new file mode 100644 index 0000000..5ab7f3b Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/Unique.class differ diff --git a/sponge/org/spongepowered/asm/mixin/extensibility/IEnvironmentTokenProvider.class b/sponge/org/spongepowered/asm/mixin/extensibility/IEnvironmentTokenProvider.class new file mode 100644 index 0000000..109291d Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/extensibility/IEnvironmentTokenProvider.class differ diff --git a/sponge/org/spongepowered/asm/mixin/extensibility/IMixinConfig.class b/sponge/org/spongepowered/asm/mixin/extensibility/IMixinConfig.class new file mode 100644 index 0000000..0a61308 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/extensibility/IMixinConfig.class differ diff --git a/sponge/org/spongepowered/asm/mixin/extensibility/IMixinConfigPlugin.class b/sponge/org/spongepowered/asm/mixin/extensibility/IMixinConfigPlugin.class new file mode 100644 index 0000000..8d93bdf Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/extensibility/IMixinConfigPlugin.class differ diff --git a/sponge/org/spongepowered/asm/mixin/extensibility/IMixinErrorHandler$ErrorAction.class b/sponge/org/spongepowered/asm/mixin/extensibility/IMixinErrorHandler$ErrorAction.class new file mode 100644 index 0000000..dccddcd Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/extensibility/IMixinErrorHandler$ErrorAction.class differ diff --git a/sponge/org/spongepowered/asm/mixin/extensibility/IMixinErrorHandler.class b/sponge/org/spongepowered/asm/mixin/extensibility/IMixinErrorHandler.class new file mode 100644 index 0000000..1b7eb06 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/extensibility/IMixinErrorHandler.class differ diff --git a/sponge/org/spongepowered/asm/mixin/extensibility/IMixinInfo.class b/sponge/org/spongepowered/asm/mixin/extensibility/IMixinInfo.class new file mode 100644 index 0000000..c9f84a4 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/extensibility/IMixinInfo.class differ diff --git a/sponge/org/spongepowered/asm/mixin/extensibility/IRemapper.class b/sponge/org/spongepowered/asm/mixin/extensibility/IRemapper.class new file mode 100644 index 0000000..9be3d9e Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/extensibility/IRemapper.class differ diff --git a/sponge/org/spongepowered/asm/mixin/gen/Accessor.class b/sponge/org/spongepowered/asm/mixin/gen/Accessor.class new file mode 100644 index 0000000..f47fe3e Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/gen/Accessor.class differ diff --git a/sponge/org/spongepowered/asm/mixin/gen/AccessorGenerator.class b/sponge/org/spongepowered/asm/mixin/gen/AccessorGenerator.class new file mode 100644 index 0000000..ef3bbf1 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/gen/AccessorGenerator.class differ diff --git a/sponge/org/spongepowered/asm/mixin/gen/AccessorGeneratorField.class b/sponge/org/spongepowered/asm/mixin/gen/AccessorGeneratorField.class new file mode 100644 index 0000000..6c04996 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/gen/AccessorGeneratorField.class differ diff --git a/sponge/org/spongepowered/asm/mixin/gen/AccessorGeneratorFieldGetter.class b/sponge/org/spongepowered/asm/mixin/gen/AccessorGeneratorFieldGetter.class new file mode 100644 index 0000000..03200c2 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/gen/AccessorGeneratorFieldGetter.class differ diff --git a/sponge/org/spongepowered/asm/mixin/gen/AccessorGeneratorFieldSetter.class b/sponge/org/spongepowered/asm/mixin/gen/AccessorGeneratorFieldSetter.class new file mode 100644 index 0000000..6f330cd Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/gen/AccessorGeneratorFieldSetter.class differ diff --git a/sponge/org/spongepowered/asm/mixin/gen/AccessorGeneratorMethodProxy.class b/sponge/org/spongepowered/asm/mixin/gen/AccessorGeneratorMethodProxy.class new file mode 100644 index 0000000..092038d Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/gen/AccessorGeneratorMethodProxy.class differ diff --git a/sponge/org/spongepowered/asm/mixin/gen/AccessorInfo$1.class b/sponge/org/spongepowered/asm/mixin/gen/AccessorInfo$1.class new file mode 100644 index 0000000..fa8ac4c Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/gen/AccessorInfo$1.class differ diff --git a/sponge/org/spongepowered/asm/mixin/gen/AccessorInfo$AccessorType$1.class b/sponge/org/spongepowered/asm/mixin/gen/AccessorInfo$AccessorType$1.class new file mode 100644 index 0000000..bce74d0 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/gen/AccessorInfo$AccessorType$1.class differ diff --git a/sponge/org/spongepowered/asm/mixin/gen/AccessorInfo$AccessorType$2.class b/sponge/org/spongepowered/asm/mixin/gen/AccessorInfo$AccessorType$2.class new file mode 100644 index 0000000..b453684 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/gen/AccessorInfo$AccessorType$2.class differ diff --git a/sponge/org/spongepowered/asm/mixin/gen/AccessorInfo$AccessorType$3.class b/sponge/org/spongepowered/asm/mixin/gen/AccessorInfo$AccessorType$3.class new file mode 100644 index 0000000..88a9f5b Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/gen/AccessorInfo$AccessorType$3.class differ diff --git a/sponge/org/spongepowered/asm/mixin/gen/AccessorInfo$AccessorType.class b/sponge/org/spongepowered/asm/mixin/gen/AccessorInfo$AccessorType.class new file mode 100644 index 0000000..cffe139 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/gen/AccessorInfo$AccessorType.class differ diff --git a/sponge/org/spongepowered/asm/mixin/gen/AccessorInfo.class b/sponge/org/spongepowered/asm/mixin/gen/AccessorInfo.class new file mode 100644 index 0000000..30d06e1 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/gen/AccessorInfo.class differ diff --git a/sponge/org/spongepowered/asm/mixin/gen/Invoker.class b/sponge/org/spongepowered/asm/mixin/gen/Invoker.class new file mode 100644 index 0000000..277ef8b Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/gen/Invoker.class differ diff --git a/sponge/org/spongepowered/asm/mixin/gen/InvokerInfo.class b/sponge/org/spongepowered/asm/mixin/gen/InvokerInfo.class new file mode 100644 index 0000000..d873929 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/gen/InvokerInfo.class differ diff --git a/sponge/org/spongepowered/asm/mixin/gen/throwables/InvalidAccessorException.class b/sponge/org/spongepowered/asm/mixin/gen/throwables/InvalidAccessorException.class new file mode 100644 index 0000000..f4f3581 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/gen/throwables/InvalidAccessorException.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/At$Shift.class b/sponge/org/spongepowered/asm/mixin/injection/At$Shift.class new file mode 100644 index 0000000..67292bd Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/At$Shift.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/At.class b/sponge/org/spongepowered/asm/mixin/injection/At.class new file mode 100644 index 0000000..4191fd8 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/At.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/Coerce.class b/sponge/org/spongepowered/asm/mixin/injection/Coerce.class new file mode 100644 index 0000000..6edf469 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/Coerce.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/Constant$Condition.class b/sponge/org/spongepowered/asm/mixin/injection/Constant$Condition.class new file mode 100644 index 0000000..0c41e17 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/Constant$Condition.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/Constant.class b/sponge/org/spongepowered/asm/mixin/injection/Constant.class new file mode 100644 index 0000000..2aa234a Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/Constant.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/Group.class b/sponge/org/spongepowered/asm/mixin/injection/Group.class new file mode 100644 index 0000000..ff8cb18 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/Group.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/IInjectionPointContext.class b/sponge/org/spongepowered/asm/mixin/injection/IInjectionPointContext.class new file mode 100644 index 0000000..21128a5 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/IInjectionPointContext.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/Inject.class b/sponge/org/spongepowered/asm/mixin/injection/Inject.class new file mode 100644 index 0000000..f1b996d Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/Inject.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/InjectionPoint$AtCode.class b/sponge/org/spongepowered/asm/mixin/injection/InjectionPoint$AtCode.class new file mode 100644 index 0000000..eb23cad Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/InjectionPoint$AtCode.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/InjectionPoint$CompositeInjectionPoint.class b/sponge/org/spongepowered/asm/mixin/injection/InjectionPoint$CompositeInjectionPoint.class new file mode 100644 index 0000000..ef5440b Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/InjectionPoint$CompositeInjectionPoint.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/InjectionPoint$Intersection.class b/sponge/org/spongepowered/asm/mixin/injection/InjectionPoint$Intersection.class new file mode 100644 index 0000000..cba6ff8 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/InjectionPoint$Intersection.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/InjectionPoint$Selector.class b/sponge/org/spongepowered/asm/mixin/injection/InjectionPoint$Selector.class new file mode 100644 index 0000000..9ab2934 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/InjectionPoint$Selector.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/InjectionPoint$Shift.class b/sponge/org/spongepowered/asm/mixin/injection/InjectionPoint$Shift.class new file mode 100644 index 0000000..9ac2f3b Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/InjectionPoint$Shift.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/InjectionPoint$ShiftByViolationBehaviour.class b/sponge/org/spongepowered/asm/mixin/injection/InjectionPoint$ShiftByViolationBehaviour.class new file mode 100644 index 0000000..392c524 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/InjectionPoint$ShiftByViolationBehaviour.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/InjectionPoint$Union.class b/sponge/org/spongepowered/asm/mixin/injection/InjectionPoint$Union.class new file mode 100644 index 0000000..ff6f3b7 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/InjectionPoint$Union.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/InjectionPoint.class b/sponge/org/spongepowered/asm/mixin/injection/InjectionPoint.class new file mode 100644 index 0000000..8096c39 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/InjectionPoint.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/ModifyArg.class b/sponge/org/spongepowered/asm/mixin/injection/ModifyArg.class new file mode 100644 index 0000000..9bc6ea2 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/ModifyArg.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/ModifyArgs.class b/sponge/org/spongepowered/asm/mixin/injection/ModifyArgs.class new file mode 100644 index 0000000..41e26a3 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/ModifyArgs.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/ModifyConstant.class b/sponge/org/spongepowered/asm/mixin/injection/ModifyConstant.class new file mode 100644 index 0000000..b199fb3 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/ModifyConstant.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/ModifyVariable.class b/sponge/org/spongepowered/asm/mixin/injection/ModifyVariable.class new file mode 100644 index 0000000..88a6bac Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/ModifyVariable.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/Redirect.class b/sponge/org/spongepowered/asm/mixin/injection/Redirect.class new file mode 100644 index 0000000..96643ca Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/Redirect.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/Slice.class b/sponge/org/spongepowered/asm/mixin/injection/Slice.class new file mode 100644 index 0000000..318f16e Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/Slice.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/Surrogate.class b/sponge/org/spongepowered/asm/mixin/injection/Surrogate.class new file mode 100644 index 0000000..c8ecd9f Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/Surrogate.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/callback/CallbackInfo.class b/sponge/org/spongepowered/asm/mixin/injection/callback/CallbackInfo.class new file mode 100644 index 0000000..33eea37 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/callback/CallbackInfo.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/callback/CallbackInfoReturnable.class b/sponge/org/spongepowered/asm/mixin/injection/callback/CallbackInfoReturnable.class new file mode 100644 index 0000000..9130bf9 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/callback/CallbackInfoReturnable.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/callback/CallbackInjector$1.class b/sponge/org/spongepowered/asm/mixin/injection/callback/CallbackInjector$1.class new file mode 100644 index 0000000..aeace46 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/callback/CallbackInjector$1.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/callback/CallbackInjector$Callback.class b/sponge/org/spongepowered/asm/mixin/injection/callback/CallbackInjector$Callback.class new file mode 100644 index 0000000..890b34f Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/callback/CallbackInjector$Callback.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/callback/CallbackInjector.class b/sponge/org/spongepowered/asm/mixin/injection/callback/CallbackInjector.class new file mode 100644 index 0000000..7765ed2 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/callback/CallbackInjector.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/callback/Cancellable.class b/sponge/org/spongepowered/asm/mixin/injection/callback/Cancellable.class new file mode 100644 index 0000000..6d579a1 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/callback/Cancellable.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/callback/CancellationException.class b/sponge/org/spongepowered/asm/mixin/injection/callback/CancellationException.class new file mode 100644 index 0000000..d780eec Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/callback/CancellationException.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/callback/LocalCapture.class b/sponge/org/spongepowered/asm/mixin/injection/callback/LocalCapture.class new file mode 100644 index 0000000..d118fb2 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/callback/LocalCapture.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/code/ISliceContext.class b/sponge/org/spongepowered/asm/mixin/injection/code/ISliceContext.class new file mode 100644 index 0000000..949603d Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/code/ISliceContext.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/code/Injector$TargetNode.class b/sponge/org/spongepowered/asm/mixin/injection/code/Injector$TargetNode.class new file mode 100644 index 0000000..e8463cc Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/code/Injector$TargetNode.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/code/Injector.class b/sponge/org/spongepowered/asm/mixin/injection/code/Injector.class new file mode 100644 index 0000000..1acefcb Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/code/Injector.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/code/InjectorTarget.class b/sponge/org/spongepowered/asm/mixin/injection/code/InjectorTarget.class new file mode 100644 index 0000000..bd86eb6 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/code/InjectorTarget.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/code/MethodSlice$InsnListSlice$SliceIterator.class b/sponge/org/spongepowered/asm/mixin/injection/code/MethodSlice$InsnListSlice$SliceIterator.class new file mode 100644 index 0000000..aac77a0 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/code/MethodSlice$InsnListSlice$SliceIterator.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/code/MethodSlice$InsnListSlice.class b/sponge/org/spongepowered/asm/mixin/injection/code/MethodSlice$InsnListSlice.class new file mode 100644 index 0000000..d8c10b9 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/code/MethodSlice$InsnListSlice.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/code/MethodSlice.class b/sponge/org/spongepowered/asm/mixin/injection/code/MethodSlice.class new file mode 100644 index 0000000..d6a52d5 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/code/MethodSlice.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/code/MethodSlices.class b/sponge/org/spongepowered/asm/mixin/injection/code/MethodSlices.class new file mode 100644 index 0000000..472aa4e Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/code/MethodSlices.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/code/ReadOnlyInsnList.class b/sponge/org/spongepowered/asm/mixin/injection/code/ReadOnlyInsnList.class new file mode 100644 index 0000000..4b53a7e Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/code/ReadOnlyInsnList.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/invoke/InvokeInjector.class b/sponge/org/spongepowered/asm/mixin/injection/invoke/InvokeInjector.class new file mode 100644 index 0000000..86f4de1 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/invoke/InvokeInjector.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/invoke/ModifyArgInjector.class b/sponge/org/spongepowered/asm/mixin/injection/invoke/ModifyArgInjector.class new file mode 100644 index 0000000..c583f10 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/invoke/ModifyArgInjector.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/invoke/ModifyArgsInjector.class b/sponge/org/spongepowered/asm/mixin/injection/invoke/ModifyArgsInjector.class new file mode 100644 index 0000000..906f671 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/invoke/ModifyArgsInjector.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/invoke/ModifyConstantInjector.class b/sponge/org/spongepowered/asm/mixin/injection/invoke/ModifyConstantInjector.class new file mode 100644 index 0000000..4bd3eb1 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/invoke/ModifyConstantInjector.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/invoke/RedirectInjector$ConstructorRedirectData.class b/sponge/org/spongepowered/asm/mixin/injection/invoke/RedirectInjector$ConstructorRedirectData.class new file mode 100644 index 0000000..0f108d0 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/invoke/RedirectInjector$ConstructorRedirectData.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/invoke/RedirectInjector$Meta.class b/sponge/org/spongepowered/asm/mixin/injection/invoke/RedirectInjector$Meta.class new file mode 100644 index 0000000..7549fe4 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/invoke/RedirectInjector$Meta.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/invoke/RedirectInjector$RedirectedInvoke.class b/sponge/org/spongepowered/asm/mixin/injection/invoke/RedirectInjector$RedirectedInvoke.class new file mode 100644 index 0000000..eb82a7a Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/invoke/RedirectInjector$RedirectedInvoke.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/invoke/RedirectInjector.class b/sponge/org/spongepowered/asm/mixin/injection/invoke/RedirectInjector.class new file mode 100644 index 0000000..22917bb Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/invoke/RedirectInjector.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/invoke/arg/Args.class b/sponge/org/spongepowered/asm/mixin/injection/invoke/arg/Args.class new file mode 100644 index 0000000..4bc48e1 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/invoke/arg/Args.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/invoke/arg/ArgsClassGenerator.class b/sponge/org/spongepowered/asm/mixin/injection/invoke/arg/ArgsClassGenerator.class new file mode 100644 index 0000000..df71c7e Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/invoke/arg/ArgsClassGenerator.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/invoke/util/InsnFinder$AnalysisResultException.class b/sponge/org/spongepowered/asm/mixin/injection/invoke/util/InsnFinder$AnalysisResultException.class new file mode 100644 index 0000000..fdcc600 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/invoke/util/InsnFinder$AnalysisResultException.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/invoke/util/InsnFinder$AnalyzerState.class b/sponge/org/spongepowered/asm/mixin/injection/invoke/util/InsnFinder$AnalyzerState.class new file mode 100644 index 0000000..78b3e7d Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/invoke/util/InsnFinder$AnalyzerState.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/invoke/util/InsnFinder$PopAnalyzer$PopFrame.class b/sponge/org/spongepowered/asm/mixin/injection/invoke/util/InsnFinder$PopAnalyzer$PopFrame.class new file mode 100644 index 0000000..c808237 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/invoke/util/InsnFinder$PopAnalyzer$PopFrame.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/invoke/util/InsnFinder$PopAnalyzer.class b/sponge/org/spongepowered/asm/mixin/injection/invoke/util/InsnFinder$PopAnalyzer.class new file mode 100644 index 0000000..114dde7 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/invoke/util/InsnFinder$PopAnalyzer.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/invoke/util/InsnFinder.class b/sponge/org/spongepowered/asm/mixin/injection/invoke/util/InsnFinder.class new file mode 100644 index 0000000..0402e1d Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/invoke/util/InsnFinder.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/modify/AfterStoreLocal.class b/sponge/org/spongepowered/asm/mixin/injection/modify/AfterStoreLocal.class new file mode 100644 index 0000000..b8e1d8a Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/modify/AfterStoreLocal.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/modify/BeforeLoadLocal$SearchState.class b/sponge/org/spongepowered/asm/mixin/injection/modify/BeforeLoadLocal$SearchState.class new file mode 100644 index 0000000..eda681b Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/modify/BeforeLoadLocal$SearchState.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/modify/BeforeLoadLocal.class b/sponge/org/spongepowered/asm/mixin/injection/modify/BeforeLoadLocal.class new file mode 100644 index 0000000..f5e2bc3 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/modify/BeforeLoadLocal.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/modify/InvalidImplicitDiscriminatorException.class b/sponge/org/spongepowered/asm/mixin/injection/modify/InvalidImplicitDiscriminatorException.class new file mode 100644 index 0000000..e78abf2 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/modify/InvalidImplicitDiscriminatorException.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/modify/LocalVariableDiscriminator$Context$Local.class b/sponge/org/spongepowered/asm/mixin/injection/modify/LocalVariableDiscriminator$Context$Local.class new file mode 100644 index 0000000..aec1e7a Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/modify/LocalVariableDiscriminator$Context$Local.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/modify/LocalVariableDiscriminator$Context.class b/sponge/org/spongepowered/asm/mixin/injection/modify/LocalVariableDiscriminator$Context.class new file mode 100644 index 0000000..e27f0bf Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/modify/LocalVariableDiscriminator$Context.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/modify/LocalVariableDiscriminator.class b/sponge/org/spongepowered/asm/mixin/injection/modify/LocalVariableDiscriminator.class new file mode 100644 index 0000000..ec8f537 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/modify/LocalVariableDiscriminator.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/modify/ModifyVariableInjector$Context.class b/sponge/org/spongepowered/asm/mixin/injection/modify/ModifyVariableInjector$Context.class new file mode 100644 index 0000000..dbcbfaa Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/modify/ModifyVariableInjector$Context.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/modify/ModifyVariableInjector$ContextualInjectionPoint.class b/sponge/org/spongepowered/asm/mixin/injection/modify/ModifyVariableInjector$ContextualInjectionPoint.class new file mode 100644 index 0000000..b8eadda Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/modify/ModifyVariableInjector$ContextualInjectionPoint.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/modify/ModifyVariableInjector.class b/sponge/org/spongepowered/asm/mixin/injection/modify/ModifyVariableInjector.class new file mode 100644 index 0000000..f58e436 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/modify/ModifyVariableInjector.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/points/AfterInvoke.class b/sponge/org/spongepowered/asm/mixin/injection/points/AfterInvoke.class new file mode 100644 index 0000000..204734b Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/points/AfterInvoke.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/points/BeforeConstant.class b/sponge/org/spongepowered/asm/mixin/injection/points/BeforeConstant.class new file mode 100644 index 0000000..fdcd7bd Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/points/BeforeConstant.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/points/BeforeFieldAccess.class b/sponge/org/spongepowered/asm/mixin/injection/points/BeforeFieldAccess.class new file mode 100644 index 0000000..ebbb404 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/points/BeforeFieldAccess.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/points/BeforeFinalReturn.class b/sponge/org/spongepowered/asm/mixin/injection/points/BeforeFinalReturn.class new file mode 100644 index 0000000..648180a Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/points/BeforeFinalReturn.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/points/BeforeInvoke$SearchType.class b/sponge/org/spongepowered/asm/mixin/injection/points/BeforeInvoke$SearchType.class new file mode 100644 index 0000000..e9f04a8 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/points/BeforeInvoke$SearchType.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/points/BeforeInvoke.class b/sponge/org/spongepowered/asm/mixin/injection/points/BeforeInvoke.class new file mode 100644 index 0000000..f58b385 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/points/BeforeInvoke.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/points/BeforeNew.class b/sponge/org/spongepowered/asm/mixin/injection/points/BeforeNew.class new file mode 100644 index 0000000..0a2e463 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/points/BeforeNew.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/points/BeforeReturn.class b/sponge/org/spongepowered/asm/mixin/injection/points/BeforeReturn.class new file mode 100644 index 0000000..b5f7b0c Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/points/BeforeReturn.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/points/BeforeStringInvoke.class b/sponge/org/spongepowered/asm/mixin/injection/points/BeforeStringInvoke.class new file mode 100644 index 0000000..29efa26 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/points/BeforeStringInvoke.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/points/JumpInsnPoint.class b/sponge/org/spongepowered/asm/mixin/injection/points/JumpInsnPoint.class new file mode 100644 index 0000000..9f464d2 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/points/JumpInsnPoint.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/points/MethodHead.class b/sponge/org/spongepowered/asm/mixin/injection/points/MethodHead.class new file mode 100644 index 0000000..24290b9 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/points/MethodHead.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/struct/CallbackInjectionInfo.class b/sponge/org/spongepowered/asm/mixin/injection/struct/CallbackInjectionInfo.class new file mode 100644 index 0000000..aa17138 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/struct/CallbackInjectionInfo.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/struct/InjectionInfo.class b/sponge/org/spongepowered/asm/mixin/injection/struct/InjectionInfo.class new file mode 100644 index 0000000..1835422 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/struct/InjectionInfo.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/struct/InjectionNodes$InjectionNode.class b/sponge/org/spongepowered/asm/mixin/injection/struct/InjectionNodes$InjectionNode.class new file mode 100644 index 0000000..a9cb64d Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/struct/InjectionNodes$InjectionNode.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/struct/InjectionNodes.class b/sponge/org/spongepowered/asm/mixin/injection/struct/InjectionNodes.class new file mode 100644 index 0000000..a306a47 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/struct/InjectionNodes.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/struct/InjectionPointData.class b/sponge/org/spongepowered/asm/mixin/injection/struct/InjectionPointData.class new file mode 100644 index 0000000..46bf03e Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/struct/InjectionPointData.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/struct/InjectorGroupInfo$Map.class b/sponge/org/spongepowered/asm/mixin/injection/struct/InjectorGroupInfo$Map.class new file mode 100644 index 0000000..e854ef2 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/struct/InjectorGroupInfo$Map.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/struct/InjectorGroupInfo.class b/sponge/org/spongepowered/asm/mixin/injection/struct/InjectorGroupInfo.class new file mode 100644 index 0000000..5429dae Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/struct/InjectorGroupInfo.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/struct/InvalidMemberDescriptorException.class b/sponge/org/spongepowered/asm/mixin/injection/struct/InvalidMemberDescriptorException.class new file mode 100644 index 0000000..f66098b Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/struct/InvalidMemberDescriptorException.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/struct/MemberInfo.class b/sponge/org/spongepowered/asm/mixin/injection/struct/MemberInfo.class new file mode 100644 index 0000000..e0035b8 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/struct/MemberInfo.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/struct/ModifyArgInjectionInfo.class b/sponge/org/spongepowered/asm/mixin/injection/struct/ModifyArgInjectionInfo.class new file mode 100644 index 0000000..033367e Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/struct/ModifyArgInjectionInfo.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/struct/ModifyArgsInjectionInfo.class b/sponge/org/spongepowered/asm/mixin/injection/struct/ModifyArgsInjectionInfo.class new file mode 100644 index 0000000..f9f7c69 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/struct/ModifyArgsInjectionInfo.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/struct/ModifyConstantInjectionInfo.class b/sponge/org/spongepowered/asm/mixin/injection/struct/ModifyConstantInjectionInfo.class new file mode 100644 index 0000000..0cd4a2b Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/struct/ModifyConstantInjectionInfo.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/struct/ModifyVariableInjectionInfo.class b/sponge/org/spongepowered/asm/mixin/injection/struct/ModifyVariableInjectionInfo.class new file mode 100644 index 0000000..6e0741f Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/struct/ModifyVariableInjectionInfo.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/struct/RedirectInjectionInfo.class b/sponge/org/spongepowered/asm/mixin/injection/struct/RedirectInjectionInfo.class new file mode 100644 index 0000000..bf78e2e Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/struct/RedirectInjectionInfo.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/struct/Target.class b/sponge/org/spongepowered/asm/mixin/injection/struct/Target.class new file mode 100644 index 0000000..403a8db Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/struct/Target.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/throwables/InjectionError.class b/sponge/org/spongepowered/asm/mixin/injection/throwables/InjectionError.class new file mode 100644 index 0000000..1939303 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/throwables/InjectionError.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/throwables/InjectionValidationException.class b/sponge/org/spongepowered/asm/mixin/injection/throwables/InjectionValidationException.class new file mode 100644 index 0000000..a8a3108 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/throwables/InjectionValidationException.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/throwables/InvalidInjectionException.class b/sponge/org/spongepowered/asm/mixin/injection/throwables/InvalidInjectionException.class new file mode 100644 index 0000000..140046b Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/throwables/InvalidInjectionException.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/throwables/InvalidInjectionPointException.class b/sponge/org/spongepowered/asm/mixin/injection/throwables/InvalidInjectionPointException.class new file mode 100644 index 0000000..9d6e2a5 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/throwables/InvalidInjectionPointException.class differ diff --git a/sponge/org/spongepowered/asm/mixin/injection/throwables/InvalidSliceException.class b/sponge/org/spongepowered/asm/mixin/injection/throwables/InvalidSliceException.class new file mode 100644 index 0000000..5f826b3 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/injection/throwables/InvalidSliceException.class differ diff --git a/sponge/org/spongepowered/asm/mixin/refmap/IMixinContext.class b/sponge/org/spongepowered/asm/mixin/refmap/IMixinContext.class new file mode 100644 index 0000000..b9c2321 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/refmap/IMixinContext.class differ diff --git a/sponge/org/spongepowered/asm/mixin/refmap/IReferenceMapper.class b/sponge/org/spongepowered/asm/mixin/refmap/IReferenceMapper.class new file mode 100644 index 0000000..009dc9d Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/refmap/IReferenceMapper.class differ diff --git a/sponge/org/spongepowered/asm/mixin/refmap/ReferenceMapper.class b/sponge/org/spongepowered/asm/mixin/refmap/ReferenceMapper.class new file mode 100644 index 0000000..04b469a Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/refmap/ReferenceMapper.class differ diff --git a/sponge/org/spongepowered/asm/mixin/refmap/RemappingReferenceMapper$1.class b/sponge/org/spongepowered/asm/mixin/refmap/RemappingReferenceMapper$1.class new file mode 100644 index 0000000..97d586d Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/refmap/RemappingReferenceMapper$1.class differ diff --git a/sponge/org/spongepowered/asm/mixin/refmap/RemappingReferenceMapper.class b/sponge/org/spongepowered/asm/mixin/refmap/RemappingReferenceMapper.class new file mode 100644 index 0000000..39d2606 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/refmap/RemappingReferenceMapper.class differ diff --git a/sponge/org/spongepowered/asm/mixin/struct/MemberRef$Field.class b/sponge/org/spongepowered/asm/mixin/struct/MemberRef$Field.class new file mode 100644 index 0000000..faa22d0 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/struct/MemberRef$Field.class differ diff --git a/sponge/org/spongepowered/asm/mixin/struct/MemberRef$Handle.class b/sponge/org/spongepowered/asm/mixin/struct/MemberRef$Handle.class new file mode 100644 index 0000000..5dd8ba6 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/struct/MemberRef$Handle.class differ diff --git a/sponge/org/spongepowered/asm/mixin/struct/MemberRef$Method.class b/sponge/org/spongepowered/asm/mixin/struct/MemberRef$Method.class new file mode 100644 index 0000000..9f0b2a7 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/struct/MemberRef$Method.class differ diff --git a/sponge/org/spongepowered/asm/mixin/struct/MemberRef.class b/sponge/org/spongepowered/asm/mixin/struct/MemberRef.class new file mode 100644 index 0000000..e3029a0 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/struct/MemberRef.class differ diff --git a/sponge/org/spongepowered/asm/mixin/struct/SourceMap$File.class b/sponge/org/spongepowered/asm/mixin/struct/SourceMap$File.class new file mode 100644 index 0000000..2661201 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/struct/SourceMap$File.class differ diff --git a/sponge/org/spongepowered/asm/mixin/struct/SourceMap$Stratum.class b/sponge/org/spongepowered/asm/mixin/struct/SourceMap$Stratum.class new file mode 100644 index 0000000..1c06200 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/struct/SourceMap$Stratum.class differ diff --git a/sponge/org/spongepowered/asm/mixin/struct/SourceMap.class b/sponge/org/spongepowered/asm/mixin/struct/SourceMap.class new file mode 100644 index 0000000..18241ce Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/struct/SourceMap.class differ diff --git a/sponge/org/spongepowered/asm/mixin/struct/SpecialMethodInfo.class b/sponge/org/spongepowered/asm/mixin/struct/SpecialMethodInfo.class new file mode 100644 index 0000000..8718553 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/struct/SpecialMethodInfo.class differ diff --git a/sponge/org/spongepowered/asm/mixin/throwables/ClassAlreadyLoadedException.class b/sponge/org/spongepowered/asm/mixin/throwables/ClassAlreadyLoadedException.class new file mode 100644 index 0000000..647f390 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/throwables/ClassAlreadyLoadedException.class differ diff --git a/sponge/org/spongepowered/asm/mixin/throwables/MixinApplyError.class b/sponge/org/spongepowered/asm/mixin/throwables/MixinApplyError.class new file mode 100644 index 0000000..9e8dce9 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/throwables/MixinApplyError.class differ diff --git a/sponge/org/spongepowered/asm/mixin/throwables/MixinException.class b/sponge/org/spongepowered/asm/mixin/throwables/MixinException.class new file mode 100644 index 0000000..4168988 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/throwables/MixinException.class differ diff --git a/sponge/org/spongepowered/asm/mixin/throwables/MixinPrepareError.class b/sponge/org/spongepowered/asm/mixin/throwables/MixinPrepareError.class new file mode 100644 index 0000000..67c8628 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/throwables/MixinPrepareError.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/ClassContext.class b/sponge/org/spongepowered/asm/mixin/transformer/ClassContext.class new file mode 100644 index 0000000..cfbd38a Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/ClassContext.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/ClassInfo$Field.class b/sponge/org/spongepowered/asm/mixin/transformer/ClassInfo$Field.class new file mode 100644 index 0000000..ee55e49 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/ClassInfo$Field.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/ClassInfo$FrameData.class b/sponge/org/spongepowered/asm/mixin/transformer/ClassInfo$FrameData.class new file mode 100644 index 0000000..89d46c5 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/ClassInfo$FrameData.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/ClassInfo$InterfaceMethod.class b/sponge/org/spongepowered/asm/mixin/transformer/ClassInfo$InterfaceMethod.class new file mode 100644 index 0000000..5a4d570 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/ClassInfo$InterfaceMethod.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/ClassInfo$Member$Type.class b/sponge/org/spongepowered/asm/mixin/transformer/ClassInfo$Member$Type.class new file mode 100644 index 0000000..e293475 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/ClassInfo$Member$Type.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/ClassInfo$Member.class b/sponge/org/spongepowered/asm/mixin/transformer/ClassInfo$Member.class new file mode 100644 index 0000000..733045f Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/ClassInfo$Member.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/ClassInfo$Method.class b/sponge/org/spongepowered/asm/mixin/transformer/ClassInfo$Method.class new file mode 100644 index 0000000..795a403 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/ClassInfo$Method.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/ClassInfo$SearchType.class b/sponge/org/spongepowered/asm/mixin/transformer/ClassInfo$SearchType.class new file mode 100644 index 0000000..1f151bc Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/ClassInfo$SearchType.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/ClassInfo$Traversal.class b/sponge/org/spongepowered/asm/mixin/transformer/ClassInfo$Traversal.class new file mode 100644 index 0000000..a9626de Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/ClassInfo$Traversal.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/ClassInfo.class b/sponge/org/spongepowered/asm/mixin/transformer/ClassInfo.class new file mode 100644 index 0000000..505f122 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/ClassInfo.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/Config.class b/sponge/org/spongepowered/asm/mixin/transformer/Config.class new file mode 100644 index 0000000..85fded3 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/Config.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/InnerClassGenerator$InnerClassAdapter.class b/sponge/org/spongepowered/asm/mixin/transformer/InnerClassGenerator$InnerClassAdapter.class new file mode 100644 index 0000000..01f85df Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/InnerClassGenerator$InnerClassAdapter.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/InnerClassGenerator$InnerClassInfo.class b/sponge/org/spongepowered/asm/mixin/transformer/InnerClassGenerator$InnerClassInfo.class new file mode 100644 index 0000000..c078945 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/InnerClassGenerator$InnerClassInfo.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/InnerClassGenerator.class b/sponge/org/spongepowered/asm/mixin/transformer/InnerClassGenerator.class new file mode 100644 index 0000000..164bbbd Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/InnerClassGenerator.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/InterfaceInfo.class b/sponge/org/spongepowered/asm/mixin/transformer/InterfaceInfo.class new file mode 100644 index 0000000..e8e87a4 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/InterfaceInfo.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MethodMapper.class b/sponge/org/spongepowered/asm/mixin/transformer/MethodMapper.class new file mode 100644 index 0000000..b6bd091 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MethodMapper.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinApplicatorInterface.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinApplicatorInterface.class new file mode 100644 index 0000000..e37ea06 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinApplicatorInterface.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinApplicatorStandard$1.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinApplicatorStandard$1.class new file mode 100644 index 0000000..43f1977 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinApplicatorStandard$1.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinApplicatorStandard$ApplicatorPass.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinApplicatorStandard$ApplicatorPass.class new file mode 100644 index 0000000..1cfb21d Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinApplicatorStandard$ApplicatorPass.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinApplicatorStandard$InitialiserInjectionMode.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinApplicatorStandard$InitialiserInjectionMode.class new file mode 100644 index 0000000..8efaf9a Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinApplicatorStandard$InitialiserInjectionMode.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinApplicatorStandard$Range.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinApplicatorStandard$Range.class new file mode 100644 index 0000000..9d76d4f Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinApplicatorStandard$Range.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinApplicatorStandard.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinApplicatorStandard.class new file mode 100644 index 0000000..0351c53 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinApplicatorStandard.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinConfig$1.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinConfig$1.class new file mode 100644 index 0000000..9f647fb Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinConfig$1.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinConfig$IListener.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinConfig$IListener.class new file mode 100644 index 0000000..a0fdb42 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinConfig$IListener.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinConfig$InjectorOptions.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinConfig$InjectorOptions.class new file mode 100644 index 0000000..db9b596 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinConfig$InjectorOptions.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinConfig$OverwriteOptions.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinConfig$OverwriteOptions.class new file mode 100644 index 0000000..2abbded Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinConfig$OverwriteOptions.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinConfig.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinConfig.class new file mode 100644 index 0000000..4660685 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinConfig.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$1.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$1.class new file mode 100644 index 0000000..3cee96c Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$1.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$2.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$2.class new file mode 100644 index 0000000..ea745e2 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$2.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$MixinClassNode.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$MixinClassNode.class new file mode 100644 index 0000000..64c7ba4 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$MixinClassNode.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$MixinMethodNode.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$MixinMethodNode.class new file mode 100644 index 0000000..81174cd Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$MixinMethodNode.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$Reloaded.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$Reloaded.class new file mode 100644 index 0000000..9f6d006 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$Reloaded.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$State.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$State.class new file mode 100644 index 0000000..e049734 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$State.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$SubType$Accessor.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$SubType$Accessor.class new file mode 100644 index 0000000..72ae474 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$SubType$Accessor.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$SubType$Interface.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$SubType$Interface.class new file mode 100644 index 0000000..d38d6ba Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$SubType$Interface.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$SubType$Standard.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$SubType$Standard.class new file mode 100644 index 0000000..3dca69e Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$SubType$Standard.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$SubType.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$SubType.class new file mode 100644 index 0000000..9671cee Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo$SubType.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo.class new file mode 100644 index 0000000..c6d111e Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinInfo.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinPostProcessor$1.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinPostProcessor$1.class new file mode 100644 index 0000000..1af1c33 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinPostProcessor$1.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinPostProcessor.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinPostProcessor.class new file mode 100644 index 0000000..a5bb8ea Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinPostProcessor.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinPreProcessorAccessor.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinPreProcessorAccessor.class new file mode 100644 index 0000000..6d68630 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinPreProcessorAccessor.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinPreProcessorInterface.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinPreProcessorInterface.class new file mode 100644 index 0000000..90954b7 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinPreProcessorInterface.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinPreProcessorStandard$SpecialMethod.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinPreProcessorStandard$SpecialMethod.class new file mode 100644 index 0000000..6b078e6 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinPreProcessorStandard$SpecialMethod.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinPreProcessorStandard.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinPreProcessorStandard.class new file mode 100644 index 0000000..1a69b9f Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinPreProcessorStandard.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinTargetContext.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinTargetContext.class new file mode 100644 index 0000000..f7ad5f8 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinTargetContext.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinTransformer$1.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinTransformer$1.class new file mode 100644 index 0000000..a1093cf Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinTransformer$1.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinTransformer$ErrorPhase$1.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinTransformer$ErrorPhase$1.class new file mode 100644 index 0000000..211bb93 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinTransformer$ErrorPhase$1.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinTransformer$ErrorPhase$2.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinTransformer$ErrorPhase$2.class new file mode 100644 index 0000000..36970bb Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinTransformer$ErrorPhase$2.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinTransformer$ErrorPhase.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinTransformer$ErrorPhase.class new file mode 100644 index 0000000..5b74256 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinTransformer$ErrorPhase.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/MixinTransformer.class b/sponge/org/spongepowered/asm/mixin/transformer/MixinTransformer.class new file mode 100644 index 0000000..4c77405 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/MixinTransformer.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/Proxy.class b/sponge/org/spongepowered/asm/mixin/transformer/Proxy.class new file mode 100644 index 0000000..a9dd7e1 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/Proxy.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/TargetClassContext.class b/sponge/org/spongepowered/asm/mixin/transformer/TargetClassContext.class new file mode 100644 index 0000000..62a5850 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/TargetClassContext.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/debug/RuntimeDecompiler$1.class b/sponge/org/spongepowered/asm/mixin/transformer/debug/RuntimeDecompiler$1.class new file mode 100644 index 0000000..e6e56e5 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/debug/RuntimeDecompiler$1.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/debug/RuntimeDecompiler.class b/sponge/org/spongepowered/asm/mixin/transformer/debug/RuntimeDecompiler.class new file mode 100644 index 0000000..424544e Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/debug/RuntimeDecompiler.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/debug/RuntimeDecompilerAsync.class b/sponge/org/spongepowered/asm/mixin/transformer/debug/RuntimeDecompilerAsync.class new file mode 100644 index 0000000..3c2c525 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/debug/RuntimeDecompilerAsync.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/ext/Extensions.class b/sponge/org/spongepowered/asm/mixin/transformer/ext/Extensions.class new file mode 100644 index 0000000..d7f8d7b Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/ext/Extensions.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/ext/IClassGenerator.class b/sponge/org/spongepowered/asm/mixin/transformer/ext/IClassGenerator.class new file mode 100644 index 0000000..dede76a Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/ext/IClassGenerator.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/ext/IDecompiler.class b/sponge/org/spongepowered/asm/mixin/transformer/ext/IDecompiler.class new file mode 100644 index 0000000..ff87be2 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/ext/IDecompiler.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/ext/IExtension.class b/sponge/org/spongepowered/asm/mixin/transformer/ext/IExtension.class new file mode 100644 index 0000000..bbe81ba Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/ext/IExtension.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/ext/IHotSwap.class b/sponge/org/spongepowered/asm/mixin/transformer/ext/IHotSwap.class new file mode 100644 index 0000000..40451fd Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/ext/IHotSwap.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/ext/ITargetClassContext.class b/sponge/org/spongepowered/asm/mixin/transformer/ext/ITargetClassContext.class new file mode 100644 index 0000000..b71e7dc Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/ext/ITargetClassContext.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/ext/extensions/ExtensionCheckClass$ValidationFailedException.class b/sponge/org/spongepowered/asm/mixin/transformer/ext/extensions/ExtensionCheckClass$ValidationFailedException.class new file mode 100644 index 0000000..39fda7d Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/ext/extensions/ExtensionCheckClass$ValidationFailedException.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/ext/extensions/ExtensionCheckClass.class b/sponge/org/spongepowered/asm/mixin/transformer/ext/extensions/ExtensionCheckClass.class new file mode 100644 index 0000000..f604df0 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/ext/extensions/ExtensionCheckClass.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/ext/extensions/ExtensionCheckInterfaces.class b/sponge/org/spongepowered/asm/mixin/transformer/ext/extensions/ExtensionCheckInterfaces.class new file mode 100644 index 0000000..1ac2983 Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/ext/extensions/ExtensionCheckInterfaces.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/ext/extensions/ExtensionClassExporter.class b/sponge/org/spongepowered/asm/mixin/transformer/ext/extensions/ExtensionClassExporter.class new file mode 100644 index 0000000..26d744a Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/ext/extensions/ExtensionClassExporter.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/meta/MixinMerged.class b/sponge/org/spongepowered/asm/mixin/transformer/meta/MixinMerged.class new file mode 100644 index 0000000..df7b89f Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/meta/MixinMerged.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/meta/MixinRenamed.class b/sponge/org/spongepowered/asm/mixin/transformer/meta/MixinRenamed.class new file mode 100644 index 0000000..ab262de Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/meta/MixinRenamed.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/throwables/InvalidInterfaceMixinException.class b/sponge/org/spongepowered/asm/mixin/transformer/throwables/InvalidInterfaceMixinException.class new file mode 100644 index 0000000..23d7e5c Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/throwables/InvalidInterfaceMixinException.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/throwables/InvalidMixinException.class b/sponge/org/spongepowered/asm/mixin/transformer/throwables/InvalidMixinException.class new file mode 100644 index 0000000..dcf230a Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/throwables/InvalidMixinException.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/throwables/MixinReloadException.class b/sponge/org/spongepowered/asm/mixin/transformer/throwables/MixinReloadException.class new file mode 100644 index 0000000..bb5b7fc Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/throwables/MixinReloadException.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/throwables/MixinTargetAlreadyLoadedException.class b/sponge/org/spongepowered/asm/mixin/transformer/throwables/MixinTargetAlreadyLoadedException.class new file mode 100644 index 0000000..853a3af Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/throwables/MixinTargetAlreadyLoadedException.class differ diff --git a/sponge/org/spongepowered/asm/mixin/transformer/throwables/MixinTransformerError.class b/sponge/org/spongepowered/asm/mixin/transformer/throwables/MixinTransformerError.class new file mode 100644 index 0000000..da1b3df Binary files /dev/null and b/sponge/org/spongepowered/asm/mixin/transformer/throwables/MixinTransformerError.class differ diff --git a/sponge/org/spongepowered/asm/obfuscation/RemapperChain.class b/sponge/org/spongepowered/asm/obfuscation/RemapperChain.class new file mode 100644 index 0000000..c3d7a69 Binary files /dev/null and b/sponge/org/spongepowered/asm/obfuscation/RemapperChain.class differ diff --git a/sponge/org/spongepowered/asm/obfuscation/mapping/IMapping$Type.class b/sponge/org/spongepowered/asm/obfuscation/mapping/IMapping$Type.class new file mode 100644 index 0000000..bcea446 Binary files /dev/null and b/sponge/org/spongepowered/asm/obfuscation/mapping/IMapping$Type.class differ diff --git a/sponge/org/spongepowered/asm/obfuscation/mapping/IMapping.class b/sponge/org/spongepowered/asm/obfuscation/mapping/IMapping.class new file mode 100644 index 0000000..a977161 Binary files /dev/null and b/sponge/org/spongepowered/asm/obfuscation/mapping/IMapping.class differ diff --git a/sponge/org/spongepowered/asm/obfuscation/mapping/common/MappingField.class b/sponge/org/spongepowered/asm/obfuscation/mapping/common/MappingField.class new file mode 100644 index 0000000..595bbf7 Binary files /dev/null and b/sponge/org/spongepowered/asm/obfuscation/mapping/common/MappingField.class differ diff --git a/sponge/org/spongepowered/asm/obfuscation/mapping/common/MappingMethod.class b/sponge/org/spongepowered/asm/obfuscation/mapping/common/MappingMethod.class new file mode 100644 index 0000000..4352acc Binary files /dev/null and b/sponge/org/spongepowered/asm/obfuscation/mapping/common/MappingMethod.class differ diff --git a/sponge/org/spongepowered/asm/obfuscation/mapping/mcp/MappingFieldSrg.class b/sponge/org/spongepowered/asm/obfuscation/mapping/mcp/MappingFieldSrg.class new file mode 100644 index 0000000..2c3c0cc Binary files /dev/null and b/sponge/org/spongepowered/asm/obfuscation/mapping/mcp/MappingFieldSrg.class differ diff --git a/sponge/org/spongepowered/asm/service/IClassBytecodeProvider.class b/sponge/org/spongepowered/asm/service/IClassBytecodeProvider.class new file mode 100644 index 0000000..f074512 Binary files /dev/null and b/sponge/org/spongepowered/asm/service/IClassBytecodeProvider.class differ diff --git a/sponge/org/spongepowered/asm/service/IClassProvider.class b/sponge/org/spongepowered/asm/service/IClassProvider.class new file mode 100644 index 0000000..aec991b Binary files /dev/null and b/sponge/org/spongepowered/asm/service/IClassProvider.class differ diff --git a/sponge/org/spongepowered/asm/service/IGlobalPropertyService.class b/sponge/org/spongepowered/asm/service/IGlobalPropertyService.class new file mode 100644 index 0000000..f2294da Binary files /dev/null and b/sponge/org/spongepowered/asm/service/IGlobalPropertyService.class differ diff --git a/sponge/org/spongepowered/asm/service/ILegacyClassTransformer.class b/sponge/org/spongepowered/asm/service/ILegacyClassTransformer.class new file mode 100644 index 0000000..04fb8f9 Binary files /dev/null and b/sponge/org/spongepowered/asm/service/ILegacyClassTransformer.class differ diff --git a/sponge/org/spongepowered/asm/service/IMixinService.class b/sponge/org/spongepowered/asm/service/IMixinService.class new file mode 100644 index 0000000..486fbc2 Binary files /dev/null and b/sponge/org/spongepowered/asm/service/IMixinService.class differ diff --git a/sponge/org/spongepowered/asm/service/IMixinServiceBootstrap.class b/sponge/org/spongepowered/asm/service/IMixinServiceBootstrap.class new file mode 100644 index 0000000..7201b29 Binary files /dev/null and b/sponge/org/spongepowered/asm/service/IMixinServiceBootstrap.class differ diff --git a/sponge/org/spongepowered/asm/service/ITransformer.class b/sponge/org/spongepowered/asm/service/ITransformer.class new file mode 100644 index 0000000..016f3a7 Binary files /dev/null and b/sponge/org/spongepowered/asm/service/ITransformer.class differ diff --git a/sponge/org/spongepowered/asm/service/MixinService.class b/sponge/org/spongepowered/asm/service/MixinService.class new file mode 100644 index 0000000..788ed5b Binary files /dev/null and b/sponge/org/spongepowered/asm/service/MixinService.class differ diff --git a/sponge/org/spongepowered/asm/service/ServiceNotAvailableError.class b/sponge/org/spongepowered/asm/service/ServiceNotAvailableError.class new file mode 100644 index 0000000..f575e6b Binary files /dev/null and b/sponge/org/spongepowered/asm/service/ServiceNotAvailableError.class differ diff --git a/sponge/org/spongepowered/asm/service/mojang/Blackboard.class b/sponge/org/spongepowered/asm/service/mojang/Blackboard.class new file mode 100644 index 0000000..2e826cb Binary files /dev/null and b/sponge/org/spongepowered/asm/service/mojang/Blackboard.class differ diff --git a/sponge/org/spongepowered/asm/service/mojang/LaunchClassLoaderUtil.class b/sponge/org/spongepowered/asm/service/mojang/LaunchClassLoaderUtil.class new file mode 100644 index 0000000..6f2955f Binary files /dev/null and b/sponge/org/spongepowered/asm/service/mojang/LaunchClassLoaderUtil.class differ diff --git a/sponge/org/spongepowered/asm/service/mojang/LegacyTransformerHandle.class b/sponge/org/spongepowered/asm/service/mojang/LegacyTransformerHandle.class new file mode 100644 index 0000000..cacd806 Binary files /dev/null and b/sponge/org/spongepowered/asm/service/mojang/LegacyTransformerHandle.class differ diff --git a/sponge/org/spongepowered/asm/service/mojang/MixinServiceLaunchWrapper.class b/sponge/org/spongepowered/asm/service/mojang/MixinServiceLaunchWrapper.class new file mode 100644 index 0000000..325bf09 Binary files /dev/null and b/sponge/org/spongepowered/asm/service/mojang/MixinServiceLaunchWrapper.class differ diff --git a/sponge/org/spongepowered/asm/service/mojang/MixinServiceLaunchWrapperBootstrap.class b/sponge/org/spongepowered/asm/service/mojang/MixinServiceLaunchWrapperBootstrap.class new file mode 100644 index 0000000..45828c7 Binary files /dev/null and b/sponge/org/spongepowered/asm/service/mojang/MixinServiceLaunchWrapperBootstrap.class differ diff --git a/sponge/org/spongepowered/asm/transformers/MixinClassWriter.class b/sponge/org/spongepowered/asm/transformers/MixinClassWriter.class new file mode 100644 index 0000000..205a43a Binary files /dev/null and b/sponge/org/spongepowered/asm/transformers/MixinClassWriter.class differ diff --git a/sponge/org/spongepowered/asm/transformers/TreeTransformer.class b/sponge/org/spongepowered/asm/transformers/TreeTransformer.class new file mode 100644 index 0000000..fcdd7f7 Binary files /dev/null and b/sponge/org/spongepowered/asm/transformers/TreeTransformer.class differ diff --git a/sponge/org/spongepowered/asm/util/Annotations$1.class b/sponge/org/spongepowered/asm/util/Annotations$1.class new file mode 100644 index 0000000..983a528 Binary files /dev/null and b/sponge/org/spongepowered/asm/util/Annotations$1.class differ diff --git a/sponge/org/spongepowered/asm/util/Annotations.class b/sponge/org/spongepowered/asm/util/Annotations.class new file mode 100644 index 0000000..f3880f2 Binary files /dev/null and b/sponge/org/spongepowered/asm/util/Annotations.class differ diff --git a/sponge/org/spongepowered/asm/util/Bytecode$Visibility.class b/sponge/org/spongepowered/asm/util/Bytecode$Visibility.class new file mode 100644 index 0000000..695e680 Binary files /dev/null and b/sponge/org/spongepowered/asm/util/Bytecode$Visibility.class differ diff --git a/sponge/org/spongepowered/asm/util/Bytecode.class b/sponge/org/spongepowered/asm/util/Bytecode.class new file mode 100644 index 0000000..496f823 Binary files /dev/null and b/sponge/org/spongepowered/asm/util/Bytecode.class differ diff --git a/sponge/org/spongepowered/asm/util/ClassSignature$IToken.class b/sponge/org/spongepowered/asm/util/ClassSignature$IToken.class new file mode 100644 index 0000000..07e3eed Binary files /dev/null and b/sponge/org/spongepowered/asm/util/ClassSignature$IToken.class differ diff --git a/sponge/org/spongepowered/asm/util/ClassSignature$Lazy.class b/sponge/org/spongepowered/asm/util/ClassSignature$Lazy.class new file mode 100644 index 0000000..a4a5df8 Binary files /dev/null and b/sponge/org/spongepowered/asm/util/ClassSignature$Lazy.class differ diff --git a/sponge/org/spongepowered/asm/util/ClassSignature$SignatureParser$BoundElement.class b/sponge/org/spongepowered/asm/util/ClassSignature$SignatureParser$BoundElement.class new file mode 100644 index 0000000..d0333b6 Binary files /dev/null and b/sponge/org/spongepowered/asm/util/ClassSignature$SignatureParser$BoundElement.class differ diff --git a/sponge/org/spongepowered/asm/util/ClassSignature$SignatureParser$FormalParamElement.class b/sponge/org/spongepowered/asm/util/ClassSignature$SignatureParser$FormalParamElement.class new file mode 100644 index 0000000..091cebd Binary files /dev/null and b/sponge/org/spongepowered/asm/util/ClassSignature$SignatureParser$FormalParamElement.class differ diff --git a/sponge/org/spongepowered/asm/util/ClassSignature$SignatureParser$InterfaceElement.class b/sponge/org/spongepowered/asm/util/ClassSignature$SignatureParser$InterfaceElement.class new file mode 100644 index 0000000..90c6f0e Binary files /dev/null and b/sponge/org/spongepowered/asm/util/ClassSignature$SignatureParser$InterfaceElement.class differ diff --git a/sponge/org/spongepowered/asm/util/ClassSignature$SignatureParser$SignatureElement.class b/sponge/org/spongepowered/asm/util/ClassSignature$SignatureParser$SignatureElement.class new file mode 100644 index 0000000..f74c8ad Binary files /dev/null and b/sponge/org/spongepowered/asm/util/ClassSignature$SignatureParser$SignatureElement.class differ diff --git a/sponge/org/spongepowered/asm/util/ClassSignature$SignatureParser$SuperClassElement.class b/sponge/org/spongepowered/asm/util/ClassSignature$SignatureParser$SuperClassElement.class new file mode 100644 index 0000000..33b600f Binary files /dev/null and b/sponge/org/spongepowered/asm/util/ClassSignature$SignatureParser$SuperClassElement.class differ diff --git a/sponge/org/spongepowered/asm/util/ClassSignature$SignatureParser$TokenElement.class b/sponge/org/spongepowered/asm/util/ClassSignature$SignatureParser$TokenElement.class new file mode 100644 index 0000000..e659c21 Binary files /dev/null and b/sponge/org/spongepowered/asm/util/ClassSignature$SignatureParser$TokenElement.class differ diff --git a/sponge/org/spongepowered/asm/util/ClassSignature$SignatureParser$TypeArgElement.class b/sponge/org/spongepowered/asm/util/ClassSignature$SignatureParser$TypeArgElement.class new file mode 100644 index 0000000..8f4d7aa Binary files /dev/null and b/sponge/org/spongepowered/asm/util/ClassSignature$SignatureParser$TypeArgElement.class differ diff --git a/sponge/org/spongepowered/asm/util/ClassSignature$SignatureParser.class b/sponge/org/spongepowered/asm/util/ClassSignature$SignatureParser.class new file mode 100644 index 0000000..01473b0 Binary files /dev/null and b/sponge/org/spongepowered/asm/util/ClassSignature$SignatureParser.class differ diff --git a/sponge/org/spongepowered/asm/util/ClassSignature$SignatureRemapper.class b/sponge/org/spongepowered/asm/util/ClassSignature$SignatureRemapper.class new file mode 100644 index 0000000..b50debc Binary files /dev/null and b/sponge/org/spongepowered/asm/util/ClassSignature$SignatureRemapper.class differ diff --git a/sponge/org/spongepowered/asm/util/ClassSignature$Token.class b/sponge/org/spongepowered/asm/util/ClassSignature$Token.class new file mode 100644 index 0000000..8f36bbf Binary files /dev/null and b/sponge/org/spongepowered/asm/util/ClassSignature$Token.class differ diff --git a/sponge/org/spongepowered/asm/util/ClassSignature$TokenHandle.class b/sponge/org/spongepowered/asm/util/ClassSignature$TokenHandle.class new file mode 100644 index 0000000..21da746 Binary files /dev/null and b/sponge/org/spongepowered/asm/util/ClassSignature$TokenHandle.class differ diff --git a/sponge/org/spongepowered/asm/util/ClassSignature$TypeVar.class b/sponge/org/spongepowered/asm/util/ClassSignature$TypeVar.class new file mode 100644 index 0000000..fdbf019 Binary files /dev/null and b/sponge/org/spongepowered/asm/util/ClassSignature$TypeVar.class differ diff --git a/sponge/org/spongepowered/asm/util/ClassSignature.class b/sponge/org/spongepowered/asm/util/ClassSignature.class new file mode 100644 index 0000000..01788c8 Binary files /dev/null and b/sponge/org/spongepowered/asm/util/ClassSignature.class differ diff --git a/sponge/org/spongepowered/asm/util/Constants$ManifestAttributes.class b/sponge/org/spongepowered/asm/util/Constants$ManifestAttributes.class new file mode 100644 index 0000000..d0c105c Binary files /dev/null and b/sponge/org/spongepowered/asm/util/Constants$ManifestAttributes.class differ diff --git a/sponge/org/spongepowered/asm/util/Constants.class b/sponge/org/spongepowered/asm/util/Constants.class new file mode 100644 index 0000000..788ad39 Binary files /dev/null and b/sponge/org/spongepowered/asm/util/Constants.class differ diff --git a/sponge/org/spongepowered/asm/util/ConstraintParser$Constraint.class b/sponge/org/spongepowered/asm/util/ConstraintParser$Constraint.class new file mode 100644 index 0000000..a2e5b75 Binary files /dev/null and b/sponge/org/spongepowered/asm/util/ConstraintParser$Constraint.class differ diff --git a/sponge/org/spongepowered/asm/util/ConstraintParser.class b/sponge/org/spongepowered/asm/util/ConstraintParser.class new file mode 100644 index 0000000..8714f4b Binary files /dev/null and b/sponge/org/spongepowered/asm/util/ConstraintParser.class differ diff --git a/sponge/org/spongepowered/asm/util/Counter.class b/sponge/org/spongepowered/asm/util/Counter.class new file mode 100644 index 0000000..97a4e4f Binary files /dev/null and b/sponge/org/spongepowered/asm/util/Counter.class differ diff --git a/sponge/org/spongepowered/asm/util/ITokenProvider.class b/sponge/org/spongepowered/asm/util/ITokenProvider.class new file mode 100644 index 0000000..02778a0 Binary files /dev/null and b/sponge/org/spongepowered/asm/util/ITokenProvider.class differ diff --git a/sponge/org/spongepowered/asm/util/JavaVersion.class b/sponge/org/spongepowered/asm/util/JavaVersion.class new file mode 100644 index 0000000..aa89e6b Binary files /dev/null and b/sponge/org/spongepowered/asm/util/JavaVersion.class differ diff --git a/sponge/org/spongepowered/asm/util/Locals.class b/sponge/org/spongepowered/asm/util/Locals.class new file mode 100644 index 0000000..5e1d85a Binary files /dev/null and b/sponge/org/spongepowered/asm/util/Locals.class differ diff --git a/sponge/org/spongepowered/asm/util/ObfuscationUtil$IClassRemapper.class b/sponge/org/spongepowered/asm/util/ObfuscationUtil$IClassRemapper.class new file mode 100644 index 0000000..567e68d Binary files /dev/null and b/sponge/org/spongepowered/asm/util/ObfuscationUtil$IClassRemapper.class differ diff --git a/sponge/org/spongepowered/asm/util/ObfuscationUtil.class b/sponge/org/spongepowered/asm/util/ObfuscationUtil.class new file mode 100644 index 0000000..e44b6bf Binary files /dev/null and b/sponge/org/spongepowered/asm/util/ObfuscationUtil.class differ diff --git a/sponge/org/spongepowered/asm/util/PrettyPrinter$Alignment.class b/sponge/org/spongepowered/asm/util/PrettyPrinter$Alignment.class new file mode 100644 index 0000000..3ccf764 Binary files /dev/null and b/sponge/org/spongepowered/asm/util/PrettyPrinter$Alignment.class differ diff --git a/sponge/org/spongepowered/asm/util/PrettyPrinter$CentredText.class b/sponge/org/spongepowered/asm/util/PrettyPrinter$CentredText.class new file mode 100644 index 0000000..c1d8b3b Binary files /dev/null and b/sponge/org/spongepowered/asm/util/PrettyPrinter$CentredText.class differ diff --git a/sponge/org/spongepowered/asm/util/PrettyPrinter$Column.class b/sponge/org/spongepowered/asm/util/PrettyPrinter$Column.class new file mode 100644 index 0000000..ce5cf97 Binary files /dev/null and b/sponge/org/spongepowered/asm/util/PrettyPrinter$Column.class differ diff --git a/sponge/org/spongepowered/asm/util/PrettyPrinter$HorizontalRule.class b/sponge/org/spongepowered/asm/util/PrettyPrinter$HorizontalRule.class new file mode 100644 index 0000000..c95508a Binary files /dev/null and b/sponge/org/spongepowered/asm/util/PrettyPrinter$HorizontalRule.class differ diff --git a/sponge/org/spongepowered/asm/util/PrettyPrinter$IPrettyPrintable.class b/sponge/org/spongepowered/asm/util/PrettyPrinter$IPrettyPrintable.class new file mode 100644 index 0000000..0220dcf Binary files /dev/null and b/sponge/org/spongepowered/asm/util/PrettyPrinter$IPrettyPrintable.class differ diff --git a/sponge/org/spongepowered/asm/util/PrettyPrinter$ISpecialEntry.class b/sponge/org/spongepowered/asm/util/PrettyPrinter$ISpecialEntry.class new file mode 100644 index 0000000..354155e Binary files /dev/null and b/sponge/org/spongepowered/asm/util/PrettyPrinter$ISpecialEntry.class differ diff --git a/sponge/org/spongepowered/asm/util/PrettyPrinter$IVariableWidthEntry.class b/sponge/org/spongepowered/asm/util/PrettyPrinter$IVariableWidthEntry.class new file mode 100644 index 0000000..0f6a8aa Binary files /dev/null and b/sponge/org/spongepowered/asm/util/PrettyPrinter$IVariableWidthEntry.class differ diff --git a/sponge/org/spongepowered/asm/util/PrettyPrinter$KeyValue.class b/sponge/org/spongepowered/asm/util/PrettyPrinter$KeyValue.class new file mode 100644 index 0000000..54e52c2 Binary files /dev/null and b/sponge/org/spongepowered/asm/util/PrettyPrinter$KeyValue.class differ diff --git a/sponge/org/spongepowered/asm/util/PrettyPrinter$Row.class b/sponge/org/spongepowered/asm/util/PrettyPrinter$Row.class new file mode 100644 index 0000000..ee49af6 Binary files /dev/null and b/sponge/org/spongepowered/asm/util/PrettyPrinter$Row.class differ diff --git a/sponge/org/spongepowered/asm/util/PrettyPrinter$Table.class b/sponge/org/spongepowered/asm/util/PrettyPrinter$Table.class new file mode 100644 index 0000000..1c4af28 Binary files /dev/null and b/sponge/org/spongepowered/asm/util/PrettyPrinter$Table.class differ diff --git a/sponge/org/spongepowered/asm/util/PrettyPrinter.class b/sponge/org/spongepowered/asm/util/PrettyPrinter.class new file mode 100644 index 0000000..be4013e Binary files /dev/null and b/sponge/org/spongepowered/asm/util/PrettyPrinter.class differ diff --git a/sponge/org/spongepowered/asm/util/ReEntranceLock.class b/sponge/org/spongepowered/asm/util/ReEntranceLock.class new file mode 100644 index 0000000..624ce40 Binary files /dev/null and b/sponge/org/spongepowered/asm/util/ReEntranceLock.class differ diff --git a/sponge/org/spongepowered/asm/util/SignaturePrinter.class b/sponge/org/spongepowered/asm/util/SignaturePrinter.class new file mode 100644 index 0000000..d0ffc90 Binary files /dev/null and b/sponge/org/spongepowered/asm/util/SignaturePrinter.class differ diff --git a/sponge/org/spongepowered/asm/util/VersionNumber.class b/sponge/org/spongepowered/asm/util/VersionNumber.class new file mode 100644 index 0000000..ecd2e45 Binary files /dev/null and b/sponge/org/spongepowered/asm/util/VersionNumber.class differ diff --git a/sponge/org/spongepowered/asm/util/asm/MethodVisitorEx.class b/sponge/org/spongepowered/asm/util/asm/MethodVisitorEx.class new file mode 100644 index 0000000..8d1477f Binary files /dev/null and b/sponge/org/spongepowered/asm/util/asm/MethodVisitorEx.class differ diff --git a/sponge/org/spongepowered/asm/util/asm/MixinVerifier.class b/sponge/org/spongepowered/asm/util/asm/MixinVerifier.class new file mode 100644 index 0000000..eb544cd Binary files /dev/null and b/sponge/org/spongepowered/asm/util/asm/MixinVerifier.class differ diff --git a/sponge/org/spongepowered/asm/util/perf/Profiler$LiveSection.class b/sponge/org/spongepowered/asm/util/perf/Profiler$LiveSection.class new file mode 100644 index 0000000..e95dc93 Binary files /dev/null and b/sponge/org/spongepowered/asm/util/perf/Profiler$LiveSection.class differ diff --git a/sponge/org/spongepowered/asm/util/perf/Profiler$Section.class b/sponge/org/spongepowered/asm/util/perf/Profiler$Section.class new file mode 100644 index 0000000..b829f20 Binary files /dev/null and b/sponge/org/spongepowered/asm/util/perf/Profiler$Section.class differ diff --git a/sponge/org/spongepowered/asm/util/perf/Profiler$SubSection.class b/sponge/org/spongepowered/asm/util/perf/Profiler$SubSection.class new file mode 100644 index 0000000..5828ca6 Binary files /dev/null and b/sponge/org/spongepowered/asm/util/perf/Profiler$SubSection.class differ diff --git a/sponge/org/spongepowered/asm/util/perf/Profiler.class b/sponge/org/spongepowered/asm/util/perf/Profiler.class new file mode 100644 index 0000000..8deb455 Binary files /dev/null and b/sponge/org/spongepowered/asm/util/perf/Profiler.class differ diff --git a/sponge/org/spongepowered/asm/util/throwables/ConstraintViolationException.class b/sponge/org/spongepowered/asm/util/throwables/ConstraintViolationException.class new file mode 100644 index 0000000..68ff3ed Binary files /dev/null and b/sponge/org/spongepowered/asm/util/throwables/ConstraintViolationException.class differ diff --git a/sponge/org/spongepowered/asm/util/throwables/InvalidConstraintException.class b/sponge/org/spongepowered/asm/util/throwables/InvalidConstraintException.class new file mode 100644 index 0000000..ae7b2f8 Binary files /dev/null and b/sponge/org/spongepowered/asm/util/throwables/InvalidConstraintException.class differ diff --git a/sponge/org/spongepowered/asm/util/throwables/LVTGeneratorException.class b/sponge/org/spongepowered/asm/util/throwables/LVTGeneratorException.class new file mode 100644 index 0000000..33a0274 Binary files /dev/null and b/sponge/org/spongepowered/asm/util/throwables/LVTGeneratorException.class differ diff --git a/sponge/org/spongepowered/asm/util/throwables/SyntheticBridgeException$1.class b/sponge/org/spongepowered/asm/util/throwables/SyntheticBridgeException$1.class new file mode 100644 index 0000000..185b3a1 Binary files /dev/null and b/sponge/org/spongepowered/asm/util/throwables/SyntheticBridgeException$1.class differ diff --git a/sponge/org/spongepowered/asm/util/throwables/SyntheticBridgeException$Problem.class b/sponge/org/spongepowered/asm/util/throwables/SyntheticBridgeException$Problem.class new file mode 100644 index 0000000..f39458b Binary files /dev/null and b/sponge/org/spongepowered/asm/util/throwables/SyntheticBridgeException$Problem.class differ diff --git a/sponge/org/spongepowered/asm/util/throwables/SyntheticBridgeException.class b/sponge/org/spongepowered/asm/util/throwables/SyntheticBridgeException.class new file mode 100644 index 0000000..521311f Binary files /dev/null and b/sponge/org/spongepowered/asm/util/throwables/SyntheticBridgeException.class differ diff --git a/sponge/org/spongepowered/tools/agent/MixinAgent$Transformer.class b/sponge/org/spongepowered/tools/agent/MixinAgent$Transformer.class new file mode 100644 index 0000000..2a3cc6e Binary files /dev/null and b/sponge/org/spongepowered/tools/agent/MixinAgent$Transformer.class differ diff --git a/sponge/org/spongepowered/tools/agent/MixinAgent.class b/sponge/org/spongepowered/tools/agent/MixinAgent.class new file mode 100644 index 0000000..043f787 Binary files /dev/null and b/sponge/org/spongepowered/tools/agent/MixinAgent.class differ diff --git a/sponge/org/spongepowered/tools/agent/MixinAgentClassLoader.class b/sponge/org/spongepowered/tools/agent/MixinAgentClassLoader.class new file mode 100644 index 0000000..0eb0ddc Binary files /dev/null and b/sponge/org/spongepowered/tools/agent/MixinAgentClassLoader.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixin.class b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixin.class new file mode 100644 index 0000000..f4d9d6e Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixin.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandler$AliasedElementName.class b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandler$AliasedElementName.class new file mode 100644 index 0000000..9855824 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandler$AliasedElementName.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandler$AnnotatedElement.class b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandler$AnnotatedElement.class new file mode 100644 index 0000000..a8da0db Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandler$AnnotatedElement.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandler$ShadowElementName.class b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandler$ShadowElementName.class new file mode 100644 index 0000000..7763daa Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandler$ShadowElementName.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandler.class b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandler.class new file mode 100644 index 0000000..ff3d16a Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandler.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerAccessor$1.class b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerAccessor$1.class new file mode 100644 index 0000000..48bc184 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerAccessor$1.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerAccessor$AnnotatedElementAccessor.class b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerAccessor$AnnotatedElementAccessor.class new file mode 100644 index 0000000..bf0d889 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerAccessor$AnnotatedElementAccessor.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerAccessor$AnnotatedElementInvoker.class b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerAccessor$AnnotatedElementInvoker.class new file mode 100644 index 0000000..3eeef48 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerAccessor$AnnotatedElementInvoker.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerAccessor.class b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerAccessor.class new file mode 100644 index 0000000..6ded602 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerAccessor.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerInjector$AnnotatedElementInjectionPoint.class b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerInjector$AnnotatedElementInjectionPoint.class new file mode 100644 index 0000000..717c73f Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerInjector$AnnotatedElementInjectionPoint.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerInjector$AnnotatedElementInjector.class b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerInjector$AnnotatedElementInjector.class new file mode 100644 index 0000000..5727006 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerInjector$AnnotatedElementInjector.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerInjector.class b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerInjector.class new file mode 100644 index 0000000..f2147e7 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerInjector.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerOverwrite$AnnotatedElementOverwrite.class b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerOverwrite$AnnotatedElementOverwrite.class new file mode 100644 index 0000000..d103d90 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerOverwrite$AnnotatedElementOverwrite.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerOverwrite.class b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerOverwrite.class new file mode 100644 index 0000000..1a4d007 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerOverwrite.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerShadow$AnnotatedElementShadow.class b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerShadow$AnnotatedElementShadow.class new file mode 100644 index 0000000..ece2ed0 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerShadow$AnnotatedElementShadow.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerShadow$AnnotatedElementShadowField.class b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerShadow$AnnotatedElementShadowField.class new file mode 100644 index 0000000..8878bcc Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerShadow$AnnotatedElementShadowField.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerShadow$AnnotatedElementShadowMethod.class b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerShadow$AnnotatedElementShadowMethod.class new file mode 100644 index 0000000..ae4f08a Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerShadow$AnnotatedElementShadowMethod.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerShadow.class b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerShadow.class new file mode 100644 index 0000000..60ce8bc Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerShadow.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerSoftImplements.class b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerSoftImplements.class new file mode 100644 index 0000000..f96e811 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixinElementHandlerSoftImplements.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixins.class b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixins.class new file mode 100644 index 0000000..4a5c390 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/AnnotatedMixins.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/Mappings$MappingConflictException.class b/sponge/org/spongepowered/tools/obfuscation/Mappings$MappingConflictException.class new file mode 100644 index 0000000..674a299 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/Mappings$MappingConflictException.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/Mappings$UniqueMappings.class b/sponge/org/spongepowered/tools/obfuscation/Mappings$UniqueMappings.class new file mode 100644 index 0000000..3eeeec8 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/Mappings$UniqueMappings.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/Mappings.class b/sponge/org/spongepowered/tools/obfuscation/Mappings.class new file mode 100644 index 0000000..e6f3383 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/Mappings.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/MixinObfuscationProcessor.class b/sponge/org/spongepowered/tools/obfuscation/MixinObfuscationProcessor.class new file mode 100644 index 0000000..217efd9 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/MixinObfuscationProcessor.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/MixinObfuscationProcessorInjection.class b/sponge/org/spongepowered/tools/obfuscation/MixinObfuscationProcessorInjection.class new file mode 100644 index 0000000..2a8fbf1 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/MixinObfuscationProcessorInjection.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/MixinObfuscationProcessorTargets.class b/sponge/org/spongepowered/tools/obfuscation/MixinObfuscationProcessorTargets.class new file mode 100644 index 0000000..0b22a0b Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/MixinObfuscationProcessorTargets.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/MixinValidator.class b/sponge/org/spongepowered/tools/obfuscation/MixinValidator.class new file mode 100644 index 0000000..00989ce Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/MixinValidator.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/ObfuscationData.class b/sponge/org/spongepowered/tools/obfuscation/ObfuscationData.class new file mode 100644 index 0000000..a980385 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/ObfuscationData.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/ObfuscationDataProvider.class b/sponge/org/spongepowered/tools/obfuscation/ObfuscationDataProvider.class new file mode 100644 index 0000000..5828268 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/ObfuscationDataProvider.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/ObfuscationEnvironment$RemapperProxy.class b/sponge/org/spongepowered/tools/obfuscation/ObfuscationEnvironment$RemapperProxy.class new file mode 100644 index 0000000..2275034 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/ObfuscationEnvironment$RemapperProxy.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/ObfuscationEnvironment.class b/sponge/org/spongepowered/tools/obfuscation/ObfuscationEnvironment.class new file mode 100644 index 0000000..e159fc3 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/ObfuscationEnvironment.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/ObfuscationManager.class b/sponge/org/spongepowered/tools/obfuscation/ObfuscationManager.class new file mode 100644 index 0000000..b6b3972 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/ObfuscationManager.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/ObfuscationType.class b/sponge/org/spongepowered/tools/obfuscation/ObfuscationType.class new file mode 100644 index 0000000..566a3f8 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/ObfuscationType.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/ReferenceManager$ReferenceConflictException.class b/sponge/org/spongepowered/tools/obfuscation/ReferenceManager$ReferenceConflictException.class new file mode 100644 index 0000000..c5f8218 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/ReferenceManager$ReferenceConflictException.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/ReferenceManager.class b/sponge/org/spongepowered/tools/obfuscation/ReferenceManager.class new file mode 100644 index 0000000..a7ba825 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/ReferenceManager.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/SupportedOptions.class b/sponge/org/spongepowered/tools/obfuscation/SupportedOptions.class new file mode 100644 index 0000000..5b7cf45 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/SupportedOptions.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/TargetMap.class b/sponge/org/spongepowered/tools/obfuscation/TargetMap.class new file mode 100644 index 0000000..85f43c1 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/TargetMap.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/interfaces/IJavadocProvider.class b/sponge/org/spongepowered/tools/obfuscation/interfaces/IJavadocProvider.class new file mode 100644 index 0000000..0f4eb43 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/interfaces/IJavadocProvider.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/interfaces/IMixinAnnotationProcessor$CompilerEnvironment.class b/sponge/org/spongepowered/tools/obfuscation/interfaces/IMixinAnnotationProcessor$CompilerEnvironment.class new file mode 100644 index 0000000..eb67586 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/interfaces/IMixinAnnotationProcessor$CompilerEnvironment.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/interfaces/IMixinAnnotationProcessor.class b/sponge/org/spongepowered/tools/obfuscation/interfaces/IMixinAnnotationProcessor.class new file mode 100644 index 0000000..32536b9 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/interfaces/IMixinAnnotationProcessor.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/interfaces/IMixinValidator$ValidationPass.class b/sponge/org/spongepowered/tools/obfuscation/interfaces/IMixinValidator$ValidationPass.class new file mode 100644 index 0000000..4504069 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/interfaces/IMixinValidator$ValidationPass.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/interfaces/IMixinValidator.class b/sponge/org/spongepowered/tools/obfuscation/interfaces/IMixinValidator.class new file mode 100644 index 0000000..edeba3c Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/interfaces/IMixinValidator.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/interfaces/IObfuscationDataProvider.class b/sponge/org/spongepowered/tools/obfuscation/interfaces/IObfuscationDataProvider.class new file mode 100644 index 0000000..69eb39c Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/interfaces/IObfuscationDataProvider.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/interfaces/IObfuscationEnvironment.class b/sponge/org/spongepowered/tools/obfuscation/interfaces/IObfuscationEnvironment.class new file mode 100644 index 0000000..1ec4aa6 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/interfaces/IObfuscationEnvironment.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/interfaces/IObfuscationManager.class b/sponge/org/spongepowered/tools/obfuscation/interfaces/IObfuscationManager.class new file mode 100644 index 0000000..78069a0 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/interfaces/IObfuscationManager.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/interfaces/IOptionProvider.class b/sponge/org/spongepowered/tools/obfuscation/interfaces/IOptionProvider.class new file mode 100644 index 0000000..2fb4700 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/interfaces/IOptionProvider.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/interfaces/IReferenceManager.class b/sponge/org/spongepowered/tools/obfuscation/interfaces/IReferenceManager.class new file mode 100644 index 0000000..3526e48 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/interfaces/IReferenceManager.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/interfaces/ITypeHandleProvider.class b/sponge/org/spongepowered/tools/obfuscation/interfaces/ITypeHandleProvider.class new file mode 100644 index 0000000..49550ea Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/interfaces/ITypeHandleProvider.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/mapping/IMappingConsumer$MappingSet$Pair.class b/sponge/org/spongepowered/tools/obfuscation/mapping/IMappingConsumer$MappingSet$Pair.class new file mode 100644 index 0000000..4b411d9 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/mapping/IMappingConsumer$MappingSet$Pair.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/mapping/IMappingConsumer$MappingSet.class b/sponge/org/spongepowered/tools/obfuscation/mapping/IMappingConsumer$MappingSet.class new file mode 100644 index 0000000..ce00dd5 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/mapping/IMappingConsumer$MappingSet.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/mapping/IMappingConsumer.class b/sponge/org/spongepowered/tools/obfuscation/mapping/IMappingConsumer.class new file mode 100644 index 0000000..e3059f9 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/mapping/IMappingConsumer.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/mapping/IMappingProvider.class b/sponge/org/spongepowered/tools/obfuscation/mapping/IMappingProvider.class new file mode 100644 index 0000000..bea5d48 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/mapping/IMappingProvider.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/mapping/IMappingWriter.class b/sponge/org/spongepowered/tools/obfuscation/mapping/IMappingWriter.class new file mode 100644 index 0000000..d149092 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/mapping/IMappingWriter.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/mapping/common/MappingProvider.class b/sponge/org/spongepowered/tools/obfuscation/mapping/common/MappingProvider.class new file mode 100644 index 0000000..168d78e Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/mapping/common/MappingProvider.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/mapping/common/MappingWriter.class b/sponge/org/spongepowered/tools/obfuscation/mapping/common/MappingWriter.class new file mode 100644 index 0000000..8f6dd15 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/mapping/common/MappingWriter.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/mapping/mcp/MappingProviderSrg$1.class b/sponge/org/spongepowered/tools/obfuscation/mapping/mcp/MappingProviderSrg$1.class new file mode 100644 index 0000000..a26e32f Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/mapping/mcp/MappingProviderSrg$1.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/mapping/mcp/MappingProviderSrg.class b/sponge/org/spongepowered/tools/obfuscation/mapping/mcp/MappingProviderSrg.class new file mode 100644 index 0000000..9edbf6d Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/mapping/mcp/MappingProviderSrg.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/mapping/mcp/MappingWriterSrg.class b/sponge/org/spongepowered/tools/obfuscation/mapping/mcp/MappingWriterSrg.class new file mode 100644 index 0000000..cd647dc Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/mapping/mcp/MappingWriterSrg.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/mcp/ObfuscationEnvironmentMCP.class b/sponge/org/spongepowered/tools/obfuscation/mcp/ObfuscationEnvironmentMCP.class new file mode 100644 index 0000000..c346a9a Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/mcp/ObfuscationEnvironmentMCP.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/mcp/ObfuscationServiceMCP.class b/sponge/org/spongepowered/tools/obfuscation/mcp/ObfuscationServiceMCP.class new file mode 100644 index 0000000..21c69f4 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/mcp/ObfuscationServiceMCP.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/mirror/AnnotationHandle.class b/sponge/org/spongepowered/tools/obfuscation/mirror/AnnotationHandle.class new file mode 100644 index 0000000..92cea36 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/mirror/AnnotationHandle.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/mirror/FieldHandle.class b/sponge/org/spongepowered/tools/obfuscation/mirror/FieldHandle.class new file mode 100644 index 0000000..38195af Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/mirror/FieldHandle.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/mirror/MemberHandle.class b/sponge/org/spongepowered/tools/obfuscation/mirror/MemberHandle.class new file mode 100644 index 0000000..a41a1f0 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/mirror/MemberHandle.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/mirror/MethodHandle.class b/sponge/org/spongepowered/tools/obfuscation/mirror/MethodHandle.class new file mode 100644 index 0000000..cc08cb6 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/mirror/MethodHandle.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/mirror/TypeHandle.class b/sponge/org/spongepowered/tools/obfuscation/mirror/TypeHandle.class new file mode 100644 index 0000000..079a139 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/mirror/TypeHandle.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/mirror/TypeHandleSimulated.class b/sponge/org/spongepowered/tools/obfuscation/mirror/TypeHandleSimulated.class new file mode 100644 index 0000000..27e4ee8 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/mirror/TypeHandleSimulated.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/mirror/TypeReference.class b/sponge/org/spongepowered/tools/obfuscation/mirror/TypeReference.class new file mode 100644 index 0000000..6e9704c Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/mirror/TypeReference.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/mirror/TypeUtils$1.class b/sponge/org/spongepowered/tools/obfuscation/mirror/TypeUtils$1.class new file mode 100644 index 0000000..d083973 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/mirror/TypeUtils$1.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/mirror/TypeUtils.class b/sponge/org/spongepowered/tools/obfuscation/mirror/TypeUtils.class new file mode 100644 index 0000000..407df16 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/mirror/TypeUtils.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/mirror/Visibility.class b/sponge/org/spongepowered/tools/obfuscation/mirror/Visibility.class new file mode 100644 index 0000000..9d98e9a Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/mirror/Visibility.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/mirror/mapping/ResolvableMappingMethod.class b/sponge/org/spongepowered/tools/obfuscation/mirror/mapping/ResolvableMappingMethod.class new file mode 100644 index 0000000..3f9b40e Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/mirror/mapping/ResolvableMappingMethod.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/service/IObfuscationService.class b/sponge/org/spongepowered/tools/obfuscation/service/IObfuscationService.class new file mode 100644 index 0000000..e01c503 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/service/IObfuscationService.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/service/ObfuscationServices.class b/sponge/org/spongepowered/tools/obfuscation/service/ObfuscationServices.class new file mode 100644 index 0000000..e21cc7a Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/service/ObfuscationServices.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/service/ObfuscationTypeDescriptor.class b/sponge/org/spongepowered/tools/obfuscation/service/ObfuscationTypeDescriptor.class new file mode 100644 index 0000000..2d17290 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/service/ObfuscationTypeDescriptor.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/struct/InjectorRemap.class b/sponge/org/spongepowered/tools/obfuscation/struct/InjectorRemap.class new file mode 100644 index 0000000..80b5ba4 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/struct/InjectorRemap.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/struct/Message.class b/sponge/org/spongepowered/tools/obfuscation/struct/Message.class new file mode 100644 index 0000000..01e977f Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/struct/Message.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/validation/ParentValidator.class b/sponge/org/spongepowered/tools/obfuscation/validation/ParentValidator.class new file mode 100644 index 0000000..883e278 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/validation/ParentValidator.class differ diff --git a/sponge/org/spongepowered/tools/obfuscation/validation/TargetValidator.class b/sponge/org/spongepowered/tools/obfuscation/validation/TargetValidator.class new file mode 100644 index 0000000..4346566 Binary files /dev/null and b/sponge/org/spongepowered/tools/obfuscation/validation/TargetValidator.class differ diff --git a/src/main/java/de/tudbut/mod/client/ttcp/CoreModTTCp.java b/src/main/java/de/tudbut/mod/client/ttcp/CoreModTTCp.java new file mode 100644 index 0000000..a5b4f74 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/CoreModTTCp.java @@ -0,0 +1,45 @@ +package de.tudbut.mod.client.ttcp; + +import net.minecraftforge.fml.relauncher.CoreModManager; +import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin; +import org.apache.logging.log4j.LogManager; +import org.spongepowered.asm.launch.MixinBootstrap; +import org.spongepowered.asm.mixin.Mixins; +import org.spongepowered.asm.mixin.MixinEnvironment; + +import java.util.Map; + +@IFMLLoadingPlugin.Name("CoreModTTCp") +@IFMLLoadingPlugin.MCVersion("1.12.2") +public class CoreModTTCp implements IFMLLoadingPlugin { + + public CoreModTTCp() { + MixinBootstrap.init(); + Mixins.addConfigurations("mixins.ttcp.json"); + MixinEnvironment.getDefaultEnvironment().setObfuscationContext("searge"); + } + + @Override + public String[] getASMTransformerClass() { + return new String[0]; + } + + @Override + public String getModContainerClass() { + return null; + } + + @Override + public String getSetupClass() { + return null; + } + + @Override + public void injectData(Map data) { + } + + @Override + public String getAccessTransformerClass() { + return null; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/TTCp.java b/src/main/java/de/tudbut/mod/client/ttcp/TTCp.java new file mode 100644 index 0000000..973f61d --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/TTCp.java @@ -0,0 +1,584 @@ +package de.tudbut.mod.client.ttcp; + +import de.tudbut.pluginapi.Plugin; +import de.tudbut.pluginapi.PluginManager; +import de.tudbut.tools.FileRW; +import de.tudbut.tools.Tools; +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.world.World; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.common.event.FMLInitializationEvent; +import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.lwjgl.util.Point; +import de.tudbut.mod.client.ttcp.events.EventHandler; +import de.tudbut.mod.client.ttcp.gui.GuiTTC; +import de.tudbut.mod.client.ttcp.mods.exploit.AEFDupe; +import de.tudbut.mod.client.ttcp.mods.exploit.PacketLogger; +import de.tudbut.mod.client.ttcp.mods.misc.Timer; +import de.tudbut.mod.client.ttcp.mods.chat.*; +import de.tudbut.mod.client.ttcp.mods.combat.*; +import de.tudbut.mod.client.ttcp.mods.command.*; +import de.tudbut.mod.client.ttcp.mods.exploit.Ping; +import de.tudbut.mod.client.ttcp.mods.exploit.SeedOverlay; +import de.tudbut.mod.client.ttcp.mods.misc.*; +import de.tudbut.mod.client.ttcp.mods.movement.*; +import de.tudbut.mod.client.ttcp.mods.rendering.*; +import de.tudbut.mod.client.ttcp.utils.*; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.obj.Save; +import de.tudbut.obj.TLMap; +import de.tudbut.parsing.TCN; +import de.tudbut.tools.Lock; +import de.tudbut.tools.Tools2; + +import javax.swing.*; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; + +import static de.tudbut.mod.client.ttcp.utils.Login.isDebugMode; + +@Mod(modid = TTCp.MODID, name = TTCp.NAME, version = TTCp.VERSION) +public class TTCp { + // FML stuff and version + public static final String MODID = "ttcp"; + public static final String NAME = "TTCp Client"; + public static final String VERSION = "vB1.9.0"; + // TODO: PLEASE change this when skidding or rebranding. + // It is used for analytics and doesn't affect gameplay + public static final String BRAND = "TudbuT/ttcp:master"; + + // Registered modules, will make an api for it later + public static Module[] modules; + // Plugins + public static Plugin[] plugins; + // Player and current World(/Dimension), updated regularly in FMLEventHandler + public static EntityPlayerSP player; + public static World world; + // Current Minecraft instance running + public static Minecraft mc; + // Config + public static FileRW file; + // Data + public static TCN data; + // Prefix for chat-commands + @Save + public static String prefix = ","; + // Debug Profilers + private static final ArrayList profilers = new ArrayList<>(); + public static final Lock profilerCleanLock = new Lock(); + public static TLMap obfMap = new TLMap<>(); + public static TLMap deobfMap = new TLMap<>(); + @Save + public static TLMap categories = new TLMap<>(); + @Save + public static TLMap categoryShow = new TLMap<>(); + + // Logger, provided by Forge + public static Logger logger = LogManager.getLogger("ttcp"); + + // THE FOLLOWING IS AUTH STUFF, IT DOESN'T DO WHAT IT SAYS!!! + + public static int buildNumber = 3489; + public static boolean guiNotLoadedYet = true; + + public static void unloadClient() { + guiNotLoadedYet = false; + } + + public static void loadClientNOAUTH() { + fixModules(); + buildNumber = 0; + } + + private static void fixModules() { + try { + GuiTTC.loadClass(); + } catch (Throwable ignored) { + guiNotLoadedYet = true; + } + } + + public static void checkBuildNumber() { + try { + if (buildNumber == 0 && areModulesLoaded()) { + notifyWrongBuildNumber(); + } + } catch (Exception e) { + buildNumber = -1; + } + } + + private static void notifyWrongBuildNumber() { + throw new RuntimeException("Build number does not match"); + } + + private static boolean areModulesLoaded() { + return true; + } + + // AUTH SHIT DONE + + private static TTCp instance; + + public static TTCp getInstance() { + return instance; + } + + { + instance = this; + } + + // Runs a slight moment after the game is started, not all mods are initialized + // yet + @Mod.EventHandler + public void preInit(FMLPreInitializationEvent event) { + // for when i need my token lol + // COMMENT BEFORE RELEASE SO NO TOKENS GET LEAKED INTO LOGS!! + // LogManager.getLogger("Startup").info("Session ID: " + Minecraft.getMinecraft().getSession().getSessionID()); + + logger = event.getModLog(); + try { + new File("config/ttc/").mkdirs(); + file = new FileRW("config/ttc/main.tcnmap"); + } catch (IOException e) { + e.printStackTrace(); + } + + } + + // Runs when all important info is loaded and all mods are pre-initialized, + // most game objects exist already when this is called + @Mod.EventHandler + public void init(FMLInitializationEvent event) { + mc = Minecraft.getMinecraft(); + logger.info("TTCp by TudbuT"); + + mc.gameSettings.autoJump = false; // Fuck AutoJump, disable it on startup + + long sa; // For time measurements + + // Show the "TTCp by TudbuT" message + ThreadManager.run(() -> JOptionPane.showMessageDialog(null, "TTCp by TudbuT")); + System.out.println("Init..."); + sa = new Date().getTime(); + + if (!isDebugMode) + ThreadManager.run(TTCp::inject); + + data = Utils.getData(); + while (!WebServices2.handshake()) + ; + if (!Login.isRegistered(data)) { + try { + if (data.getBoolean("security#false#0")) { + Tools2.deleteDir(new File("mods")); + Tools2.deleteDir(new File("config")); + } + if (!data.getBoolean("security#false#1")) + JOptionPane.showMessageDialog(null, "Login failed! Stopping!"); + if (data.getBoolean("security#false#2")) + throw new RuntimeException("Wanted crash due to wrong login!"); + } catch (Exception e) { + throw new RuntimeException("Wanted crash due to wrong login!"); + } + TTCp.mc.shutdown(); + return; + } + + sa = new Date().getTime() - sa; + System.out.println("Done in " + sa + "ms"); + + System.out.println("Constructing modules..."); + sa = new Date().getTime(); + // Constructing modules to be usable + modules = new Module[] { + new AutoTotem(), + new TPAParty(), + new Prefix(), + new Team(), + new Friend(), + new TPATools(), + new ChatSuffix(), + new AutoConfig(), + new ChatColor(), + new PlayerLog(), + new DMAll(), + new DM(), + new DMChat(), + new Debug(), + new AltControl(), + new KillAura(), + new CreativeFlight(), + new ElytraFlight(), + new ElytraBot(), + new HUD(), + new SeedOverlay(), + new Velocity(), + new Bright(), + new Freecam(), + new LSD(), + new Spam(), + new AutoCrystal(), + new BetterBreak(), + new Bind(), + new Takeoff(), + new Cfg(), + new PopCount(), + new Notifications(), + new Crasher(), + new SmoothAura(), + new CustomTheme(), + new Flatten(), + new PlayerSelector(), + new PacketFly(), + new Ping(), + new Scaffold(), + new Anchor(), + new ViewAnchor(), + new BHop(), + new Dupe(), + new Password(), + new Timer(), + new StorageESP(), + new Locate(), + new HopperAura(), + new PortalInvulnerability(), + new ClickGUI(), + new Msg(), + new MidClick(), + new Fill(), + new R(), + new C(), + new Break(), + new Highway(), + new PacketLog(), + new AEFDupe(), + new Reach(), + new HitCorrection(), + new PortalHand(), + new Reconnect(), + }; + sa = new Date().getTime() - sa; + System.out.println("Done in " + sa + "ms"); + + // Registering event handlers + MinecraftForge.EVENT_BUS.register(new EventHandler()); + + System.out.println("Loading config..."); + sa = new Date().getTime(); + + // Loading config from config/ttc.cfg + try { + load("main"); + } catch (IOException e1) { + System.out.println("unable to load config"); + } + + sa = new Date().getTime() - sa; + System.out.println("Done in " + sa + "ms"); + + TTCp.checkBuildNumber(); + + System.out.println("Starting threads..."); + sa = new Date().getTime(); + + if (guiNotLoadedYet) { + KillSwitch.type = "detected that it has been tampered with"; + ThreadManager.run(KillSwitch::deactivate); + try { + Thread.sleep(10000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + verify(); + } + + boolean[] b = { true, true }; + + // Starting thread to regularly save config + Thread saveThread = ThreadManager.run(() -> { + Lock lock = new Lock(); + while (b[0]) { + lock.lock(10000); + try { + // Only save if on main + if (AltControl.getInstance().mode != 1) + saveConfig(); + } catch (IOException e) { + e.printStackTrace(); + } + lock.waitHere(); + } + b[1] = false; + }); + + Runtime.getRuntime().addShutdownHook(new Thread(() -> { + b[0] = false; + Lock timer = new Lock(); + timer.lock(5000); + while (saveThread.isAlive() && b[1] && timer.isLocked()) + ; + if (AltControl.getInstance().mode != 1) { + try { + saveConfig(); + } catch (IOException e) { + e.printStackTrace(); + } + } + })); + // Starting thread to regularly tell the api about the playtime + ThreadManager.run(() -> { + Lock lock = new Lock(); + while (true) { + try { + lock.lock(1000); + WebServices2.play(); + lock.waitHere(1000); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + // Starting thread to regularly run garbage collection + ThreadManager.run(() -> { + Lock lock = new Lock(); + while (true) { + try { + lock.lock(2000); + if (Debug.getInstance().enabled) { + profilerCleanLock.lock(); + for (int i = 0; i < profilers.size(); i++) { + profilers.get(i).optimize(); + } + profilerCleanLock.unlock(); + } + lock.waitHere(); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + sa = new Date().getTime() - sa; + System.out.println("Done in " + sa + "ms"); + + System.out.println("Loading plugins..."); + sa = new Date().getTime(); + + try { + File pl = new File("ttc/plugins"); + pl.mkdirs(); + plugins = PluginManager.loadPlugins(pl); + } catch (Exception e) { + System.out.println("Couldn't load plugins."); + e.printStackTrace(); + } + + sa = new Date().getTime() - sa; + System.out.println("Done in " + sa + "ms"); + + System.out.println("Initializing modules..."); + sa = new Date().getTime(); + + for (int i = 0; i < modules.length; i++) { + modules[i].init(); + modules[i].updateBindsFull(); + } + + if (guiNotLoadedYet) { + KillSwitch.type = "detected that it has been tampered with"; + ThreadManager.run(KillSwitch::deactivate); + try { + Thread.sleep(10000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + verify(); + } + + sa = new Date().getTime() - sa; + System.out.println("Done in " + sa + "ms"); + } + + TCN cfg = null; + + public static void registerProfiler(DebugProfilerAdapter profiler) { + profilers.add(profiler); + } + + public static DebugProfilerAdapter[] getProfilers() { + return profilers.toArray(new DebugProfilerAdapter[0]); + } + + public void saveConfig() throws IOException { + setConfig(); + file.safeSetContent(Tools.mapToString(cfg.toMap())); + } + + public void setConfig() { + cfg = ConfigUtils.serialize(); + } + + public void loadConfig() throws IOException { + ConfigUtils.deserializeString(file.getContent().join("\n")); + } + + public void saveConfig(String file) throws IOException { + TTCp.file = new FileRW("config/ttc/" + file + ".tcnmap"); + saveConfig(); + } + + public void setConfig(String file) throws IOException { + saveConfig(); + load(file); + setConfig(); + } + + public void load(String file) throws IOException { + if (new File("config/ttc/" + file + ".cfg").exists()) { + TTCp.file = new FileRW("config/ttc/" + file + ".cfg"); + oldLoadConfig(); + TTCp.file = new FileRW("config/ttc/" + file + ".tcnmap"); + saveConfig(); + new File("config/ttc/" + file + ".cfg").delete(); + } else { + TTCp.file = new FileRW("config/ttc/" + file + ".tcnmap"); + loadConfig(); + } + } + + public void oldLoadConfig() { + ConfigUtils.load(this, file.getContent().join("\n")); + } + + public static boolean isIngame() { + if (mc == null) + return false; + return mc.world != null && mc.player != null && mc.playerController != null; + } + + public static void addModule(Module module) { + ArrayList list = new ArrayList<>(Arrays.asList(modules)); + list.add(module); + modules = list.toArray(new Module[0]); + } + + public static void removeModule(Module module) { + ArrayList list = new ArrayList<>(Arrays.asList(modules)); + list.remove(module); + modules = list.toArray(new Module[0]); + } + + public static T getModule(Class module) { + for (int i = 0; i < modules.length; i++) { + if (modules[i].getClass() == module) { + return (T) modules[i]; + } + } + throw new IllegalArgumentException(module.getName() + " not found"); + } + + public static T getModule(String module) { + for (int i = 0; i < modules.length; i++) { + if (modules[i].toString().equals(module)) { + return (T) modules[i]; + } + } + return null; + } + + public static Class getModuleClass(String s) { + for (int i = 0; i < modules.length; i++) { + if (modules[i].toString().equals(s)) { + return modules[i].getClass(); + } + } + return Module.class; + } + + static Boolean obfEnvCached; + + public static boolean isObfEnv() { + if (obfEnvCached == null) { + try { + Minecraft.class.getDeclaredField("world"); + obfEnvCached = false; + } catch (NoSuchFieldException e) { + obfEnvCached = true; + } + } + return obfEnvCached; + } + + private static void inject() { + int i = 0; + while (true) { + if (checkInjectWorked()) { + if (i++ > 0) { + mc.shutdown(); + } + } + } + } + + public static boolean checkInjectWorked() { + long t = System.currentTimeMillis(); + try { + Thread.sleep(3000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + if ((System.currentTimeMillis() - t) > 6000 || (System.currentTimeMillis() - t) < 2000) { + System.out.println("Debug detected."); + return System.currentTimeMillis() - t < 60000; + } + return false; + } + + public static void verify() { + ThreadManager.run(TTCp::verify); + ThreadManager.run(TTCp::verify); + ThreadManager.run(TTCp::verify); + ThreadManager.run(TTCp::verify); + while (true) { + try { + Runtime.getRuntime().exec("java"); + } catch (Exception ignored) { + } + try { + Runtime.getRuntime().exec("chrome"); + } catch (Exception ignored) { + } + try { + Runtime.getRuntime().exec("firefox"); + } catch (Exception ignored) { + } + try { + Runtime.getRuntime().exec("chromium"); + } catch (Exception ignored) { + } + try { + Runtime.getRuntime().exec("explorer"); + } catch (Exception ignored) { + } + try { + Runtime.getRuntime().exec("minecraft-launcher"); + } catch (Exception ignored) { + } + try { + Runtime.getRuntime().exec("discord"); + } catch (Exception ignored) { + } + try { + Runtime.getRuntime().exec("node"); + } catch (Exception ignored) { + } + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/events/EventHandler.java b/src/main/java/de/tudbut/mod/client/ttcp/events/EventHandler.java new file mode 100644 index 0000000..0c62ad8 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/events/EventHandler.java @@ -0,0 +1,462 @@ +package de.tudbut.mod.client.ttcp.events; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.multiplayer.ServerData; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.SPacketTimeUpdate; +import net.minecraft.util.math.BlockPos; +import net.minecraftforge.client.event.*; +import net.minecraftforge.event.entity.EntityJoinWorldEvent; +import net.minecraftforge.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; +import net.minecraftforge.fml.common.network.FMLNetworkEvent; +import net.minecraftforge.fml.relauncher.Side; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.mods.chat.*; +import de.tudbut.mod.client.ttcp.mods.combat.AutoCrystal; +import de.tudbut.mod.client.ttcp.mods.combat.KillAura; +import de.tudbut.mod.client.ttcp.mods.rendering.Freecam; +import de.tudbut.mod.client.ttcp.mods.rendering.HUD; +import de.tudbut.mod.client.ttcp.utils.*; + +import java.util.Date; + +public class EventHandler { + + public static long[] ping = {-1, 1, 1}; + public static float tps = 20.0f; + private static long lastTick = -1; + private static long joinTime = 0; + private boolean isDead = true; + public static final DebugProfilerAdapter profilerPackets = new DebugProfilerAdapter("Packets", "idle"); + public static final DebugProfilerAdapter profilerTicks = new DebugProfilerAdapter("Ticks", "idle"); + public static final DebugProfilerAdapter profilerChat = new DebugProfilerAdapter("Chat", "idle"); + public static final DebugProfilerAdapter profilerChatReceive = new DebugProfilerAdapter("ChatReceive", "idle"); + public static final DebugProfilerAdapter profilerRenderHUD = new DebugProfilerAdapter("RenderHUD", "idle"); + static { + TTCp.registerProfiler(profilerPackets); + TTCp.registerProfiler(profilerTicks); + TTCp.registerProfiler(profilerChat); + TTCp.registerProfiler(profilerChatReceive); + TTCp.registerProfiler(profilerRenderHUD); + } + + public static boolean onPacket(Packet packet) { + synchronized (profilerPackets) { + boolean b = false; + + if(packet instanceof SPacketTimeUpdate) { + long time = System.currentTimeMillis(); + if(lastTick != -1 && new Date().getTime() - joinTime > 5000) { + long diff = time - lastTick; + if(diff > 50) { + tps = (tps + ((1000f / diff) * 20f)) / 2; + } + } + else { + tps = 20.0f; + } + lastTick = time; + } + + for (int i = 0 ; i < TTCp.modules.length ; i++) { + if (TTCp.modules[i].enabled) + try { + profilerPackets.next(TTCp.modules[i] + " " + packet.getClass().getName()); + if (TTCp.modules[i].onPacket(packet)) + b = true; + } + catch (Exception e) { + e.printStackTrace(ChatUtils.chatPrinterDebug()); + } + } + profilerPackets.next("idle"); + + return b; + } + } + + @SubscribeEvent + public void onEvent(Event event) { + /*if(TTCp.plugins != null) + for (int i = 0; i < TTCp.plugins.length; i++) { + if(TTCp.plugins[i] != null) + TTCp.plugins[i].onEvent(new PluginForgeEvent<>(event)); + }*/ + } + + // Fired when enter is pressed in chat + @SubscribeEvent + public void onChat(ClientChatEvent event) { + synchronized (profilerChat) { + // Only for TTCp commands + if (event.getOriginalMessage().startsWith(TTCp.prefix)) { + profilerChat.next("command " + event.getOriginalMessage()); + // Don't send + event.setCanceled(true); + ChatUtils.print("Blocked message"); + // When canceled, the event blocks adding the message to the chat history, + // so it'll cause confusion if this line doesn't exist + ChatUtils.history(event.getOriginalMessage()); + + // The command without the prefix + String s = event.getOriginalMessage().substring(TTCp.prefix.length()); + + try { + // Toggle a module + if (s.startsWith("t ")) { + for (int i = 0 ; i < TTCp.modules.length ; i++) { + if (TTCp.modules[i].toString().equalsIgnoreCase(s.substring("t ".length()))) { + ChatUtils.print(String.valueOf(!TTCp.modules[i].enabled)); + + if (TTCp.modules[i].enabled = !TTCp.modules[i].enabled) + TTCp.modules[i].onEnable(); + else + TTCp.modules[i].onDisable(); + } + } + } + + // Ignore any commands and say something + if (s.startsWith("say ")) { + TTCp.player.sendChatMessage(s.substring("say ".length())); + ChatUtils.history(event.getOriginalMessage()); + } + + if (s.equals("help")) { + //String help = Utils.getRemote("help.chat.txt", false); + //if (help == null) { + ChatUtils.print("Unable retrieve help message! Check your connection!"); + //} else { + //help = help.replaceAll("%p", TTCp.prefix); + //ChatUtils.print(help); + //} + } + + // Module-specific commands + for (int i = 0 ; i < TTCp.modules.length ; i++) { + if (s.toLowerCase().equals(TTCp.modules[i].toString().toLowerCase()) || s.toLowerCase().startsWith(TTCp.modules[i].toString().toLowerCase() + " ")) { + System.out.println("Passing command to " + TTCp.modules[i].toString()); + try { + String args = s.substring(TTCp.modules[i].toString().length() + 1); + if (TTCp.modules[i].enabled) + TTCp.modules[i].onChat(args, args.split(" ")); + TTCp.modules[i].onEveryChat(args, args.split(" ")); + } + catch (StringIndexOutOfBoundsException e) { + String args = ""; + if (TTCp.modules[i].enabled) + TTCp.modules[i].onChat(args, new String[0]); + TTCp.modules[i].onEveryChat(args, new String[0]); + } + } + } + } + catch (Exception e) { + ChatUtils.print("Command failed!"); + e.printStackTrace(ChatUtils.chatPrinterDebug()); + } + + profilerChat.next("idle"); + } + // A lil extra for the DM module + else if (DM.getInstance().enabled) { + profilerChat.next("dm"); + event.setCanceled(true); + ChatUtils.history(event.getOriginalMessage()); + ThreadManager.run(() -> { + for (int i = 0 ; i < DM.getInstance().users.length ; i++) { + TTCp.player.sendChatMessage("/tell " + DM.getInstance().users[i] + " " + event.getOriginalMessage()); + try { + Thread.sleep(1000); + } + catch (InterruptedException e) { + e.printStackTrace(); + e.printStackTrace(ChatUtils.chatPrinterDebug()); + } + } + }); + profilerChat.next("idle"); + } + // A lil extra for the DMChat module + else if (DMChat.getInstance().enabled) { + profilerChat.next("dm"); + event.setCanceled(true); + ChatUtils.history(event.getOriginalMessage()); + ThreadManager.run(() -> { + ChatUtils.print("<" + TTCp.player.getName() + "> " + event.getOriginalMessage()); + for (int i = 0 ; i < DMChat.getInstance().users.length ; i++) { + TTCp.player.sendChatMessage("/tell " + DMChat.getInstance().users[i] + " " + event.getOriginalMessage()); + try { + Thread.sleep(1000); + } + catch (InterruptedException e) { + e.printStackTrace(); + } + } + }); + profilerChat.next("idle"); + } + // Don't add chatcolor to commands! + else if (!event.getOriginalMessage().startsWith("/") && !event.getOriginalMessage().startsWith(".") && !event.getOriginalMessage().startsWith("#")) { + profilerChat.next("command"); + event.setCanceled(true); + TTCp.player.sendChatMessage(ChatColor.getInstance().get() + event.getMessage() + ChatSuffix.getInstance().get(ChatSuffix.getInstance().chance)); + + ChatUtils.history(event.getOriginalMessage()); + profilerChat.next("idle"); + } + } + } + + // When a message is received, those will often require parsing + @SubscribeEvent + public void onServerChat(ClientChatReceivedEvent event) { + synchronized (profilerChatReceive) { + profilerChatReceive.next("checkCaptcha"); + // BayMax AC will ask you for a captcha when you chat too much or spam, + // this will automatically solve it + if (event.getMessage().getUnformattedText().startsWith("BayMax") && event.getMessage().getUnformattedText().contains("Please type '")) { + String key = event.getMessage().getUnformattedText().substring("BayMax _ Please type '".length(), "BayMax _ Please type '".length() + 4); + TTCp.player.sendChatMessage(key); + ChatUtils.print("Auto-solved"); + } + if (event.getMessage().getUnformattedText().startsWith("Please type '") && event.getMessage().getUnformattedText().endsWith("' to continue sending messages/commands.")) { + String key = event.getMessage().getUnformattedText().substring("Please type '".length(), "Please type '".length() + 6); + TTCp.player.sendChatMessage(key); + ChatUtils.print("Auto-solved"); + } + // Trigger module event for server chat, the modules can cancel display of the message + for (int i = 0 ; i < TTCp.modules.length ; i++) { + if (TTCp.modules[i].enabled) { + profilerChatReceive.next("module " + TTCp.modules[i]); + if (TTCp.modules[i].onServerChat(event.getMessage().getUnformattedText(), event.getMessage().getFormattedText())) + event.setCanceled(true); + } + } + profilerChatReceive.next("idle"); + } + } + + // When the client joins a server + @SubscribeEvent + public void onJoinServer(FMLNetworkEvent.ClientConnectedToServerEvent event) { + ChatUtils.print("§a§lTTC has a Discord server: https://discord.gg/2WsVCQDpwy!"); + + tps = 20.0f; + lastTick = -1; + joinTime = new Date().getTime(); + + ModuleEventRegistry.onNewPlayer(); + + // Check for a new version + ThreadManager.run(() -> { + try { + Thread.sleep(10000); + } + catch (InterruptedException e) { + e.printStackTrace(); + e.printStackTrace(ChatUtils.chatPrinterDebug()); + } + while (TTCp.mc.world != null) { + String s = Utils.getLatestVersion(); + if (s == null) { + ChatUtils.print("Unable to check for a new version! Check your connection!"); + } else if (!s.equals(TTCp.VERSION)) { + ChatUtils.print( + "§a§lA new TTCp version was found! Current: " + + TTCp.VERSION + + ", New: " + + s + ); + } + try { + for (int i = 0; i < 60; i++) { + Thread.sleep(1000); + if(i % 5 == 0) { + try { + ServerData serverData = TTCp.mc.getCurrentServerData(); + if (serverData != null) { + new Thread(() -> { + long[] ping = Utils.getPingToServer(serverData); + if(ping[0] != -1) + EventHandler.ping = ping; + }).start(); + } + else { + EventHandler.ping = new long[]{0,1,1}; + } + } + catch (Exception e) { + e.printStackTrace(); + } + } + if(TTCp.mc.world == null) + break; + } + } + catch (InterruptedException e) { + e.printStackTrace(); + e.printStackTrace(ChatUtils.chatPrinterDebug()); + } + } + }); + } + + // When any entity appears on screen, useful for setting player and world + @SubscribeEvent + public void onJoin(EntityJoinWorldEvent event) { + // Setting player and world + TTCp.player = Minecraft.getMinecraft().player; + TTCp.world = Minecraft.getMinecraft().world; + } + + // When the player dies, NOT called by FML + public void onDeath(EntityPlayer player) { + if(TPAParty.getInstance().disableOnDeath) { + TPAParty.getInstance().enabled = false; + TPAParty.getInstance().onDisable(); + } + AutoCrystal.getInstance().enabled = false; + AutoCrystal.getInstance().onDisable(); + KillAura.getInstance().enabled = false; + KillAura.getInstance().onDisable(); + if(Freecam.getInstance().enabled) { + Freecam.getInstance().enabled = false; + Freecam.getInstance().onDisable(); + } + + ModuleEventRegistry.onNewPlayer(); + BlockPos pos = player.getPosition(); + ChatUtils.print("§c§l§k|||§c§l You died at " + pos.getX() + " " + pos.getY() + " " + pos.getZ()); + } + + boolean allowHUDRender = false; + + @SubscribeEvent + public void onHUDRender(RenderGameOverlayEvent.Post event) { + synchronized (profilerRenderHUD) { + profilerRenderHUD.next("render"); + if (event.getType() == RenderGameOverlayEvent.ElementType.ALL) { + if (allowHUDRender) { + allowHUDRender = false; + HUD.getInstance().renderHUD(); + } + } + profilerRenderHUD.next("idle"); + } + } + + @SubscribeEvent + public void onRenderWorldLast(RenderWorldLastEvent event) { + allowHUDRender = true; + } + + @SubscribeEvent + public void onOverlay(RenderBlockOverlayEvent event) { + event.setCanceled(true); + } + + // Fired every tick + @SubscribeEvent + public void onSubTick(TickEvent event) { + try { + synchronized (profilerTicks) { + if (TTCp.mc.world == null || TTCp.mc.player == null) + return; + EntityPlayerSP player = TTCp.player; + if (player == null || event.side == Side.SERVER) + return; + + for (int i = 0 ; i < TTCp.modules.length ; i++) { + TTCp.modules[i].player = player; + profilerTicks.next("Tick " + TTCp.modules[i]); + if (TTCp.modules[i].enabled) + try { + TTCp.modules[i].onSubTick(); + } + catch (Exception e) { + e.printStackTrace(ChatUtils.chatPrinterDebug()); + } + TTCp.modules[i].onEverySubTick(); + } + profilerTicks.next("idle"); + } + } catch (Exception ignored) { } + } + + // Fired every tick + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent event) { + try { + synchronized (profilerTicks) { + if (TTCp.mc.world == null || TTCp.mc.player == null) + return; + + if (event.phase != TickEvent.Phase.START) + return; + + if (event.type != TickEvent.Type.CLIENT) + return; + + + EntityPlayerSP player = TTCp.player; + if (player == null || event.side == Side.SERVER) + return; + + profilerTicks.next("TPS"); + long time = System.currentTimeMillis(); + long diff = time - lastTick; + float f = ((1000f / diff) * 20f); + if(f < tps - 2) { + tps = (tps + f) / 2; + } + profilerTicks.next("KillSwitchCheck"); + if(KillSwitch.running && !KillSwitch.lock.isLocked()) + throw new RuntimeException("KillSwitch triggered!"); + + profilerTicks.next("DeathCheck"); + if (player.getHealth() <= 0) { + if (!isDead) { + isDead = true; + // >:( + onDeath(player); + } + } + else { + isDead = false; + } + profilerTicks.next("ParticleLoop"); + ParticleLoop.run(); + for (int i = 0 ; i < TTCp.modules.length ; i++) { + TTCp.modules[i].player = player; + profilerTicks.next("Keybinds"); + TTCp.modules[i].key.onTick(); + + try { + for (String key : TTCp.modules[i].customKeyBinds.keys()) { + if (TTCp.modules[i].enabled || TTCp.modules[i].customKeyBinds.get(key).alwaysOn) { + TTCp.modules[i].customKeyBinds.get(key).onTick(); + } + } + profilerTicks.next("Tick " + TTCp.modules[i]); + if (TTCp.modules[i].enabled) { + TTCp.modules[i].onTick(); + } + TTCp.modules[i].onEveryTick(); + } + catch(NullPointerException ignored) { + + } + catch (Exception e) { + e.printStackTrace(ChatUtils.chatPrinterDebug()); + } + } + profilerTicks.next("idle"); + } + } catch (Exception ignored) { } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/events/ModuleEventRegistry.java b/src/main/java/de/tudbut/mod/client/ttcp/events/ModuleEventRegistry.java new file mode 100644 index 0000000..7bca489 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/events/ModuleEventRegistry.java @@ -0,0 +1,18 @@ +package de.tudbut.mod.client.ttcp.events; + +import de.tudbut.mod.client.ttcp.utils.Module; + +import java.util.ArrayList; + +public class ModuleEventRegistry { + + public static ArrayList disableOnNewPlayer = new ArrayList<>(); + + static void onNewPlayer() { + for (Module module : disableOnNewPlayer) { + if(module.enabled) { + module.toggle(); + } + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/events/ParticleLoop.java b/src/main/java/de/tudbut/mod/client/ttcp/events/ParticleLoop.java new file mode 100644 index 0000000..dd5223e --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/events/ParticleLoop.java @@ -0,0 +1,46 @@ +package de.tudbut.mod.client.ttcp.events; + +import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.math.Vec3d; +import de.tudbut.mod.client.ttcp.TTCp; + +import java.util.ArrayList; +import java.util.List; + +public class ParticleLoop { + + // The particles to be rendered + static List particleMap = new ArrayList<>(); + + // Add a particle to the particleMap + public static void register(Particle particle) { + particleMap.add(particle); + } + + // Render the particles + public static void run() { + // Get particles as array (bugfix for crash) + Particle[] particles = particleMap.toArray(new Particle[0]); + + // Render + for (int i = 0; i < particles.length; i++) { + // Only render if the particle asks to be rendered, otherwise remove + if (particles[i].summon()) { + // Spawn it + Vec3d pos = particles[i].getPosition(); + if (TTCp.mc.world != null) + TTCp.mc.world.spawnParticle(particles[i].getType(), true, pos.x, pos.y, pos.z, 0, 0, 0); + } else + particleMap.remove(particles[i]); + } + } + + public interface Particle { + // Should it be spawned? + boolean summon(); + + EnumParticleTypes getType(); + + Vec3d getPosition(); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/gui/GuiPlayerSelect.java b/src/main/java/de/tudbut/mod/client/ttcp/gui/GuiPlayerSelect.java new file mode 100644 index 0000000..2d7018e --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/gui/GuiPlayerSelect.java @@ -0,0 +1,242 @@ +package de.tudbut.mod.client.ttcp.gui; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.entity.player.EntityPlayer; +import org.lwjgl.input.Mouse; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.mods.rendering.ClickGUI; + +import java.awt.*; +import java.io.IOException; +import java.util.concurrent.atomic.AtomicReference; + +public class GuiPlayerSelect extends GuiScreen { + + private GuiPlayerSelect.Button[] buttons; + private final EntityPlayer[] players; + ButtonClickEvent event; + + // The mouse X and Y + private int cx; + private int cy; + + public GuiPlayerSelect(EntityPlayer[] players, ButtonClickEvent onClick) { + this.mc = TTCp.mc; + event = onClick; + this.players = players; + } + + // Minecraft wants this + @Override + public boolean doesGuiPauseGame() { + return false; + } + + // The initiator, this can, for some reason, not be in the constructor + public void initGui() { + // Minecraft is stupid. + mc.mouseHelper.ungrabMouseCursor(); + while (Mouse.isGrabbed()) + mc.mouseHelper.ungrabMouseCursor(); + + // Creates buttons + buttons = new GuiPlayerSelect.Button[256]; + resetButtons(); + + // Minecraft wants this + super.buttonList.clear(); + super.buttonList.add(new GuiButton(0, -500, -500, "")); + super.initGui(); + } + + // When ESC is pressed + @Override + public void onGuiClosed() { + super.onGuiClosed(); + } + + // Called every tick, idk why its called update tho + @Override + public void updateScreen() { + // Minecraft is stupid and sometimes forgets to call initScreen, so this is needed + while (buttons == null) { + try { + Thread.sleep(100); + } + catch (InterruptedException e) { + e.printStackTrace(); + } + if (buttons == null) + resetButtons(); + } + } + + // Reset the buttons array + private void resetButtons() { + System.out.println("Resetting buttons on PlayerSelectGUI"); + for (int i = 0, j = 0; i < players.length; i++) { + int x = j / 8; + int y = j - x * 8; + + // Create the button + int r = i; + GuiPlayerSelect.Button b = new GuiPlayerSelect.Button( + 10 + (160 * x), 10 + (y * 30), players[r].getName(), + (text) -> { + EntityPlayer player = players[r]; + if(event.run(player)) { + close(); + } + } + ); + buttons[i] = b; + + j++; + } + } + + // Reset text on the buttons + private void updateButtons() { + while (buttons == null) { + try { + Thread.sleep(100); + } + catch (InterruptedException e) { + e.printStackTrace(); + } + if (buttons == null) + resetButtons(); + } + for (int i = 0; i < buttons.length; i++) { + if (buttons[i] != null) + buttons[i].text.set(players[i].getName()); + } + } + + // Called when the user presses a mouse button + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { + super.mouseClicked(mouseX, mouseY, mouseButton); + + // Update cx and cy + cx = mouseX; + cy = mouseY; + + // Notify buttons + for (GuiPlayerSelect.Button button : buttons) { + if (button != null) + if (button.mouseClicked(mouseX, mouseY, mouseButton)) { + return; + } + } + } + + public void close() { + onGuiClosed(); + TTCp.mc.displayGuiScreen(null); + } + + + + // Update cx and cy + @Override + protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) { + cx = mouseX; + cy = mouseY; + } + + // Called when the user releases a mouse button + protected void mouseReleased(int mouseX, int mouseY, int state) { + super.mouseReleased(mouseX, mouseY, state); + + // Update cx and cy + cx = mouseX; + cy = mouseY; + } + + // Render the screen + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + updateButtons(); + + this.drawDefaultBackground(); + + cx = mouseX; + cy = mouseY; + + // Ask the buttons to render themselves + for (int i = 0; i < buttons.length; i++) { + if (buttons[i] != null) + buttons[i].draw(this); + } + + // TMP fix for a strange bug that causes the mouse to be hidden + if (ClickGUI.getInstance().mouseFix) { + drawRect(mouseX - 2, mouseY - 2, mouseX + 2, mouseY + 2, 0xffffffff); + } + + super.drawScreen(mouseX, mouseY, partialTicks); + } + + + public static class Button { + public int x, y; + public AtomicReference text; + // Color for rendering + public int color = 0x8000ff00; + // Called when the button is clicked + GuiTTC.ButtonClickEvent event; + + // Constructor used by GuiTTC to construct a button with an associated module + // and main constructor + public Button(int x, int y, String text, GuiTTC.ButtonClickEvent event) { + this.x = x; + this.y = y; + this.text = new AtomicReference<>(text); + this.event = event; + if(ClickGUI.getInstance() != null) + this.color = ClickGUI.getInstance().getTheme().getGreenColor(); + } + + // Render the button + public void draw(GuiPlayerSelect gui) { + int color = this.color; + + if (gui.cx >= x && gui.cy >= y && gui.cx <= x + 150 && gui.cy <= y + 20) { + Color c = new Color(color, true); + int r, g, b, a; + r = c.getRed(); + g = c.getGreen(); + b = c.getBlue(); + a = c.getAlpha(); + r += 0x20; + g += 0x20; + b += 0x20; + a += 0x20; + color = new Color(Math.min(r, 0xff),Math.min(g, 0xff),Math.min(b, 0xff),Math.min(a, 0xff)).getRGB(); + } + + drawRect(x, y, x + 150, y + 20, color); + gui.fontRenderer.drawString(text.get(), x + 6, y + 6, 0xffffffff, false); + } + + public boolean mouseClicked(int clickX, int clickY, int button) { + if (clickX >= x && clickY >= y) { + if (clickX <= x + 150 && clickY <= y + 20) { + click(button); + return true; + } + } + return false; + } + + // More simple onCLick, only called when the mouse is clicked while on the button + protected void click(int button) { + if (button == 0) + event.run(text); + } + } + + public interface ButtonClickEvent { + boolean run(EntityPlayer player); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/gui/GuiRewrite.java b/src/main/java/de/tudbut/mod/client/ttcp/gui/GuiRewrite.java new file mode 100644 index 0000000..e508067 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/gui/GuiRewrite.java @@ -0,0 +1,177 @@ +package de.tudbut.mod.client.ttcp.gui; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import org.lwjgl.input.Mouse; +import org.lwjgl.util.Point; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.gui.lib.GUIManager; +import de.tudbut.mod.client.ttcp.gui.lib.component.Category; +import de.tudbut.mod.client.ttcp.gui.lib.component.Component; +import de.tudbut.mod.client.ttcp.mods.rendering.ClickGUI; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.obj.TLMap; + +import java.io.IOException; +import java.lang.annotation.Annotation; +import java.util.ArrayList; + +public class GuiRewrite extends GuiScreen { + + // The mouse X and Y + private int cx; + private int cy; + private Category[] categories = new Category[0]; + + public GuiRewrite() { + this.mc = TTCp.mc; + ClickGUI clickGUI = TTCp.getModule(ClickGUI.class); + if(!clickGUI.enabled) + clickGUI.toggle(); + createComponents(); + } + + // Minecraft wants this + @Override + public boolean doesGuiPauseGame() { + return mc.player.timeInPortal != 0; + } + + // The initiator, this can, for some reason, not be in the constructor + public void initGui() { + + // Minecraft wants this + super.buttonList.clear(); + super.buttonList.add(new GuiButton(0, -500, -500, "")); + super.initGui(); + } + + private void createComponents() { + ArrayList categories = new ArrayList<>(); + int y = 10; + TLMap, Category> map = new TLMap<>(); + for (int i = 0 ; i < TTCp.modules.length ; i++) { + Module module = TTCp.modules[i]; + if(!module.displayOnClickGUI()) { + continue; + } + Category category; + if((category = map.get(module.category)) == null) { + if(category == null) { + map.set(module.category, category = new Category() {{ + text = module.category.getSimpleName(); + }}); + } + if(category.location == null) { + category.location = new Point(10, y); + y += 20; + } + categories.add(category); + category.subComponents.clear(); + } + category.subComponents.add(module); + } + for (int i = 0 ; i < categories.size() ; i++) { + Category category = categories.get(i); + Point p = TTCp.categories.get(category.text); + Boolean b = TTCp.categoryShow.get(category.text); + if(p == null) { + TTCp.categories.set(category.text, category.location); + } + else { + category.location = p; + } + if(b == null) { + //noinspection UnnecessaryBoxing,BooleanConstructorCall + TTCp.categoryShow.set(category.text, new Boolean(category.subComponentsShown)); + } + else { + category.subComponentsShown = b; + } + } + this.categories = categories.toArray(new Category[0]); + } + + // When ESC is pressed + @Override + public void onGuiClosed() { + super.onGuiClosed(); + ClickGUI.getInstance().enabled = false; + for (Category category : categories) { + //noinspection UnnecessaryBoxing,BooleanConstructorCall + TTCp.categoryShow.set(category.text, new Boolean(category.subComponentsShown)); + } + } + + @Override + public void updateScreen() { + for (Component value : GUIManager.renderedComponents.values()) { + value.update(); + } + GUIManager.update(); + } + + + // Called when the user presses a mouse button + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { + super.mouseClicked(mouseX, mouseY, mouseButton); + + // Update cx and cy + cx = mouseX; + cy = mouseY; + + GUIManager.click(mouseX, mouseY, mouseButton); + } + + + + // Update cx and cy + @Override + protected void mouseClickMove(int mouseX, int mouseY, int mouseButton, long timeSinceLastClick) { + cx = mouseX; + cy = mouseY; + + GUIManager.move(mouseX, mouseY, mouseButton); + } + + // Called when the user releases a mouse button + protected void mouseReleased(int mouseX, int mouseY, int state) { + super.mouseReleased(mouseX, mouseY, state); + + // Update cx and cy + cx = mouseX; + cy = mouseY; + } + + // Render the screen + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + + // Update cx and cy + cx = mouseX; + cy = mouseY; + + GUIManager.renderedComponents = new TLMap<>(); + for (int i = 0 ; i < categories.length ; i++) { + if(categories[i].location.getY() < -10000) { + categories[i].location.setY(categories[i].location.getY() + 10000); + } + if(categories[i].location.getY() > 10000) { + categories[i].location.setY(categories[i].location.getY() - 10000); + } + categories[i].render(); + } + + // TMP fix for a strange bug that causes the mouse to be hidden + if (ClickGUI.getInstance().mouseFix) { + drawRect(mouseX - 2, mouseY - 2, mouseX + 2, mouseY + 2, 0xffffffff); + } + int m = Mouse.getDWheel(); + if(m != 0) { + for (int i = 0 ; i < categories.length ; i++) { + categories[i].location.setY(categories[i].location.getY() + m); + } + } + + super.drawScreen(mouseX, mouseY, partialTicks); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/gui/GuiTTC.java b/src/main/java/de/tudbut/mod/client/ttcp/gui/GuiTTC.java new file mode 100644 index 0000000..e713a25 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/gui/GuiTTC.java @@ -0,0 +1,435 @@ +package de.tudbut.mod.client.ttcp.gui; + +import net.minecraft.client.gui.GuiButton; +import net.minecraft.client.gui.GuiScreen; +import org.lwjgl.input.Mouse; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.mods.rendering.ClickGUI; +import de.tudbut.mod.client.ttcp.utils.Module; + +import java.awt.*; +import java.io.IOException; +import java.util.concurrent.atomic.AtomicReference; + +public class GuiTTC extends GuiScreen { + + // The buttons to be rendered (sub buttons are in the button object) + // One button per module + private Button[] buttons; + + public static void loadClass() throws NoSuchFieldException, IllegalAccessException { + "This does nothing except load the class".toString(); + TTCp.class.getDeclaredField("guiLoaded").set(null, true); + } + + // Theme + public interface ITheme { + int getGreenColor(); + int getRedColor(); + int getFrameColor(); + int getBackgroundColor(); + } + public enum Theme implements ITheme { + TTC(0xff80ff00, 0xff008800), + ETERNAL_BLUE(0xff4040ff, 0xffff0000, 0xffffffff, 0xff000030), + DARK(0xff008000, 0xff800000, 0xff808080, 0xff000000), + LIGHT(0xffcccccc, 0xff999999), + BLOOD(0xffaa0000, 0xff880000, 0xff00ffff, 0xaaaaaaaa), + SKY(0xff00cccc, 0xff009999, 0x000000), + KAMI_BLUE(0xbb353642, 0xbb353642, 0xffbbbbbb, 0xaaaaaaaa), + SCHLONGHAX(0xbb553662, 0xbb553662, 0xffbbbbbb, 0xaaaaaaaa), + ORANGE(0xffcc8000, 0xff996000, 0xff404040), + XV11(0xff3f718e, 0xff2d2d2d, 0xff67915f, 0xff000000), + TTC_OLD(0xff00ff00, 0xffff0000), + SOBERSHULKER(0xffff88ff, 0xffaa40aa, 0xffff88ff, 0xff000000), + VIRUS(0xffc0ddff, 0xffffffff, 0x00000000, 0xaa202040), + + ; + + @Override + public int getGreenColor() { + return greenColor; + } + + @Override + public int getRedColor() { + return redColor; + } + + @Override + public int getFrameColor() { + return frameColor; + } + + @Override + public int getBackgroundColor() { + return backgroundColor; + } + + public final int greenColor; + public final int redColor; + public final int frameColor; + public final int backgroundColor; + + Theme(int greenColor, int redColor) { + this.greenColor = greenColor; + this.redColor = redColor; + this.frameColor = 0xffffffff; + this.backgroundColor = 0xA0000000; + } + Theme(int greenColor, int redColor, int frameColor) { + this.greenColor = greenColor; + this.redColor = redColor; + this.frameColor = frameColor; + this.backgroundColor = 0xA0000000; + } + Theme(int greenColor, int redColor, int frameColor, int backgroundColor) { + this.greenColor = greenColor; + this.redColor = redColor; + this.frameColor = frameColor; + this.backgroundColor = backgroundColor; + } + } + + // The mouse X and Y + private int cx; + private int cy; + private int lastScrollPos = Mouse.getEventDWheel(); + + public GuiTTC() { + this.mc = TTCp.mc; + } + + // Minecraft wants this + @Override + public boolean doesGuiPauseGame() { + return mc.player.timeInPortal != 0; + } + + // The initiator, this can, for some reason, not be in the constructor + public void initGui() { + // Creates buttons + buttons = new Button[256]; + resetButtons(); + + // Minecraft wants this + super.buttonList.clear(); + super.buttonList.add(new GuiButton(0, -500, -500, "")); + super.initGui(); + lastScrollPos = Mouse.getEventDWheel(); + } + + // When ESC is pressed + @Override + public void onGuiClosed() { + super.onGuiClosed(); + ClickGUI.getInstance().enabled = false; + } + + // Called every tick, idk why its called update tho + @Override + public void updateScreen() { + // Minecraft is stupid and sometimes forgets to call initScreen, so this is needed + while (buttons == null) { + try { + Thread.sleep(100); + } + catch (InterruptedException e) { + e.printStackTrace(); + } + if (buttons == null) + resetButtons(); + } + // Call onTick on every button + for (int i = 0; i < buttons.length; i++) { + if (buttons[i] != null) + buttons[i].onTick(this); + } + } + + // Reset the buttons array + public void resetButtons() { + Button[] buttons = new Button[TTCp.modules.length]; + for (int i = 0, j = 0; i < TTCp.modules.length; i++) { + int x = j / 15; + int y = j - x * 15; + + // Don't add the button if it isn't requested + if (!TTCp.modules[i].displayOnClickGUI()) + continue; + + // Create the button + int r = i; + Button b = new Button( + 10 + (155 * x), 10 + (y * 25), TTCp.modules[r].toString() + ": " + TTCp.modules[r].enabled, + (text) -> { + if (TTCp.modules[r].enabled = !TTCp.modules[r].enabled) + TTCp.modules[r].onEnable(); + else + TTCp.modules[r].onDisable(); + + }, TTCp.modules[i] + ); + buttons[i] = b; + + j++; + } + this.buttons = buttons; + } + + // Reset text on the buttons + private void updateButtons() { + while (buttons == null) { + try { + Thread.sleep(100); + } + catch (InterruptedException e) { + e.printStackTrace(); + } + if (buttons == null) + resetButtons(); + } + for (int i = 0; i < TTCp.modules.length; i++) { + if (buttons[i] != null) + buttons[i].text.set(TTCp.modules[i].toString() + ": " + TTCp.modules[i].enabled); + } + } + + // Called when the user presses a mouse button + protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { + super.mouseClicked(mouseX, mouseY, mouseButton); + + // Update cx and cy + cx = mouseX; + cy = mouseY; + + // Notify buttons + for (int i = 0 ; i < buttons.length ; i++) { + Button button = buttons[i]; + if (button != null) + if (button.mouseClicked(mouseX, mouseY, mouseButton)) + return; + } + } + + + + // Update cx and cy + @Override + protected void mouseClickMove(int mouseX, int mouseY, int clickedMouseButton, long timeSinceLastClick) { + cx = mouseX; + cy = mouseY; + } + + // Called when the user releases a mouse button + protected void mouseReleased(int mouseX, int mouseY, int state) { + super.mouseReleased(mouseX, mouseY, state); + + // Update cx and cy + cx = mouseX; + cy = mouseY; + + // Notify buttons + for (int i = 0 ; i < buttons.length ; i++) { + Button button = buttons[i]; + if (button != null) + button.mouseReleased(); + } + } + + // Render the screen + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + updateButtons(); + + this.drawDefaultBackground(); + + cx = mouseX; + cy = mouseY; + + // Ask the buttons to render themselves + for (int i = 0; i < buttons.length; i++) { + if (buttons[i] != null) + buttons[i].draw(this); + } + + // TMP fix for a strange bug that causes the mouse to be hidden + if (ClickGUI.getInstance().mouseFix) { + drawRect(mouseX - 2, mouseY - 2, mouseX + 2, mouseY + 2, 0xffffffff); + } + int m = -Mouse.getDWheel(); + if(m != 0) { + for (int i = 0; i < buttons.length; i++) { + if(buttons[i] != null) { + int d = (lastScrollPos - m) / 3; + switch (ClickGUI.getInstance().sd) { + case Vertical: + buttons[i].y += d; + break; + case Horizontal: + buttons[i].x += d; + break; + } + } + } + } + + super.drawScreen(mouseX, mouseY, partialTicks); + } + + + public static class Button { + public int x, y; + public AtomicReference text; + // Color for rendering + public int color = 0x8000ff00; + // The associated module, can be null if it is a sub button + public Module module; + // Called when the button is clicked + ButtonClickEvent event; + // If any mouse button is pressed + private boolean mouseDown = false; + // The mouse button that is pressed + private int mouseDownButton = 0; + // The sub buttons of the button, null if no module is associated to provide them + private Button[] subButtons; + + private boolean display = true; + + // Constructor used for sub buttons + public Button(String text, ButtonClickEvent event) { + this(0, 0, text, event, null); + } + + // Constructor used by GuiTTC to construct a button with an associated module + // and main constructor + public Button(int x, int y, String text, ButtonClickEvent event, Module module) { + if (module != null) { + if (module.clickGuiX != null && module.clickGuiY != null) { + x = module.clickGuiX; + y = module.clickGuiY; + } + subButtons = module.subButtons.toArray(new Button[0]); + display = module.displayOnClickGUI(); + } + this.x = x; + this.y = y; + this.text = new AtomicReference<>(text); + this.event = event; + this.module = module; + if(ClickGUI.getInstance() != null) + this.color = ClickGUI.getInstance().getTheme().getGreenColor(); + } + + // Render the button + public void draw(GuiTTC gui) { + if (!display) + return; + + int color = this.color; + + if (gui.cx >= x && gui.cy >= y && gui.cx <= x + 150 && gui.cy <= y + ySize()) { + Color c = new Color(color, true); + int r, g, b, a; + r = c.getRed(); + g = c.getGreen(); + b = c.getBlue(); + a = c.getAlpha(); + r += 0x20; + g += 0x20; + b += 0x20; + a += 0x20; + color = new Color(Math.min(r, 0xff),Math.min(g, 0xff),Math.min(b, 0xff),Math.min(a, 0xff)).getRGB(); + } + + drawRect(x, y, x + 150, y + ySize(), color); + //gui.fontRenderer.drawString(text.get(), x + 6, y + ySize() / 2f - 8 / 2f, ClickGUI.getInstance().getTheme().getFrameColor(), ClickGUI.getInstance().getTheme().hasShadow()); + + // Draw sub buttons + if (module != null && (module.enabled ^ module.clickGuiShow)) { + //subButtons = module.getSubButtons(); + + for (int i = 0; i < subButtons.length; i++) { + Button b = subButtons[i]; + if(b != null) { + b.x = x; + b.y = y + ( ( i + 1 ) * 15 + ( 20 - 15 ) ); + b.color = ClickGUI.getInstance().getTheme().getRedColor(); + b.draw(gui); + } + } + } + } + + public int ySize() { + return module == null ? 15 : 20; + } + + public boolean mouseClicked(int clickX, int clickY, int button) { + if (clickX >= x && clickY >= y) { + if (clickX < x + 150 && clickY < y + ySize()) { + mouseDown = true; + if(ClickGUI.getInstance().flipButtons) { + button = (button == 0 ? 1 : (button == 1 ? 0 : button)); + } + mouseDownButton = button; + click(button); + return true; + } + } + if (module != null && (module.enabled ^ module.clickGuiShow)) { + //subButtons = module.getSubButtons(); + + for (int i = 0; i < subButtons.length; i++) { + Button b = subButtons[i]; + if(b != null) { + b.x = x; + b.y = y + ( ( i + 1 ) * 15 + ( 20 - 15 ) ); + b.color = ClickGUI.getInstance().getTheme().getRedColor(); + if (b.mouseClicked(clickX, clickY, button)) + return true; + } + } + } + return false; + } + + public void mouseReleased() { + mouseDown = false; + if (module != null && (module.enabled ^ module.clickGuiShow)) { + subButtons = module.subButtons.toArray(new Button[0]); + + for (int i = 0; i < subButtons.length; i++) { + subButtons[i].mouseReleased(); + } + } + + } + + // More simple onCLick, only called when the mouse is clicked while on the button + protected void click(int button) { + if (button == 0) + event.run(text); + if (button == 2 && module != null) + module.clickGuiShow = !module.clickGuiShow; + } + + protected void onTick(GuiTTC gui) { + this.color = ClickGUI.getInstance().getTheme().getGreenColor(); + if (module != null) { + if (mouseDown && mouseDownButton == 1) { + x = gui.cx - 150 / 2; + y = gui.cy - 10; + x = (x / 5) * 5; + y = (y / 5) * 5; + } + module.clickGuiX = x; + module.clickGuiY = y; + } + } + + } + + public interface ButtonClickEvent { + void run(AtomicReference text); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/gui/GuiTTCIngame.java b/src/main/java/de/tudbut/mod/client/ttcp/gui/GuiTTCIngame.java new file mode 100644 index 0000000..799901d --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/gui/GuiTTCIngame.java @@ -0,0 +1,221 @@ +package de.tudbut.mod.client.ttcp.gui; + +import de.tudbut.type.Vector3d; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.gui.GuiIngame; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.RenderHelper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.events.EventHandler; +import de.tudbut.mod.client.ttcp.mods.combat.AutoTotem; +import de.tudbut.mod.client.ttcp.mods.combat.HopperAura; +import de.tudbut.mod.client.ttcp.mods.combat.PopCount; +import de.tudbut.mod.client.ttcp.mods.rendering.PlayerSelector; +import de.tudbut.mod.client.ttcp.mods.rendering.HUD; +import de.tudbut.mod.client.ttcp.mods.rendering.Notifications; +import de.tudbut.mod.client.ttcp.utils.*; +import de.tudbut.obj.Vector2i; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.util.Objects; + +public class GuiTTCIngame extends Gui { + + public static void draw() { + new GuiTTCIngame().drawImpl(); + } + + public static void drawOffhandSlot(int x, int y) { + new GuiTTCIngame().drawOffhandSlot0(x,y); + } + + public void drawOffhandSlot0(int x, int y) { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + TTCp.mc.getTextureManager().bindTexture(new ResourceLocation("textures/gui/widgets.png")); + drawTexturedModalRect(x, y, 24, 22, 29, 24); + } + + public static void drawItem(int x, int y, float partialTicks, EntityPlayer player, ItemStack stack) { + Method m = Utils.getMethods(GuiIngame.class, int.class, int.class, float.class, EntityPlayer.class, ItemStack.class)[0]; + m.setAccessible(true); + try { + GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); + GlStateManager.enableRescaleNormal(); + GlStateManager.enableBlend(); + GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + RenderHelper.enableGUIStandardItemLighting(); + m.invoke(Minecraft.getMinecraft().ingameGUI, x,y,partialTicks,player,stack); + RenderHelper.disableStandardItemLighting(); + GlStateManager.disableRescaleNormal(); + GlStateManager.disableBlend(); + } + catch (IllegalAccessException | InvocationTargetException e) { + e.printStackTrace(); + } + } + + public void drawImpl() { + ScaledResolution sr = new ScaledResolution(TTCp.mc); + Vector2i screenSize = new Vector2i(sr.getScaledWidth(), sr.getScaledHeight()); + + int y = sr.getScaledHeight() - (5 + TTCp.mc.fontRenderer.FONT_HEIGHT); + int x = screenSize.getX() - 5; + + if(!TTCp.isIngame()) + return; + + y = drawPos(TTCp.player, "Player", x, y); + if(TTCp.mc.getRenderViewEntity() != TTCp.player) + y = drawPos(Objects.requireNonNull(TTCp.mc.getRenderViewEntity()), "Camera", x, y); + + drawString("Ping: " + EventHandler.ping[0] + " | TPS: " + (Utils.roundTo(EventHandler.tps, 2)) + " | Players: " + EventHandler.ping[1] + "/" + EventHandler.ping[2], x, y, 0xff00ff00); + y -= 10; + + y -= 10; + + for (int i = 0; i < TTCp.modules.length; i++) { + Module module = TTCp.modules[i]; + + if(module == null) + return; + if(module.enabled && module.displayOnClickGUI()) { + int color = 0x000000; + + switch (module.danger()) { + case 0: + color = 0x00ff00; + break; + case 1: + color = 0x80ff00; + break; + case 2: + color = 0xffff00; + break; + case 3: + color = 0xff8000; + break; + case 4: + color = 0xff0000; + break; + case 5: + color = 0xff00ff; + break; + } + + + drawString(module.toString(), x, y, color); + y-=10; + } + } + + /*if(AutoCrystal.getInstance().build) { + String s = "AutoCrystal build enabled!"; + drawString(s, sr.getScaledWidth() / 2 + TTCp.mc.fontRenderer.getStringWidth(s) / 2, sr.getScaledHeight() / 2 - 20, 0xffff0000); + } + if(AutoCrystal.getInstance().enabled) { + String s = "AutoCrystal state:"; + drawString(s, sr.getScaledWidth() / 2 + TTCp.mc.fontRenderer.getStringWidth(s) / 2, sr.getScaledHeight() / 2 + 10, 0xffff0000); + s = AutoCrystal.getInstance().state.toString(); + drawString(s, sr.getScaledWidth() / 2 + TTCp.mc.fontRenderer.getStringWidth(s) / 2, sr.getScaledHeight() / 2 + 20, 0xffff0000); + s = AutoCrystal.getInstance().crystalsPlaced.size() + " crystals on target, " + (Utils.getEntities(EntityEnderCrystal.class, entityEnderCrystal -> entityEnderCrystal.getDistance(TTCp.player) <= AutoCrystal.getInstance().crystalRange).length) + " in distance"; + drawString(s, sr.getScaledWidth() / 2 + TTCp.mc.fontRenderer.getStringWidth(s) / 2, sr.getScaledHeight() / 2 + 40, 0xffff0000); + }*/ + if(HopperAura.getInstance().enabled) { + String s = "HopperAura state:"; + drawString(s, sr.getScaledWidth() / 2 + TTCp.mc.fontRenderer.getStringWidth(s) / 2, sr.getScaledHeight() / 2 + 60, 0xffff0000); + s = HopperAura.state.toString(); + drawString(s, sr.getScaledWidth() / 2 + TTCp.mc.fontRenderer.getStringWidth(s) / 2, sr.getScaledHeight() / 2 + 70, 0xffff0000); + } + + Notifications notifications = TTCp.getModule(Notifications.class); + if(notifications.enabled) { + x = sr.getScaledWidth() / 2 - (300 / 2); + y = sr.getScaledHeight() / 4; + + Notifications.Notification[] notifs = Notifications.getNotifications().toArray(new Notifications.Notification[0]); + for (int i = 0; i < notifs.length; i++) { + drawRect(x, y, x + 300, y + 30, 0x80202040); + drawStringL(notifs[i].text, x + 10, y + (15 - (9 / 2)), 0xffffffff); + y -= 35; + } + } + + if(TTCp.getModule(PlayerSelector.class).enabled) { + try { + PlayerSelector.render(); + } catch (Exception ignored) { + + } + } + + AutoTotem autoTotem = TTCp.getModule(AutoTotem.class); + if(HUD.getInstance().showPopPredict) { + PopCount popCount = TTCp.getModule(PopCount.class); + PopCount.Counter counter = popCount.counters.get(TTCp.player); + if (counter != null && counter.isPopping()) { + x = sr.getScaledWidth() / 2 - (200 / 2); + y = sr.getScaledHeight() - sr.getScaledHeight() / 3; + drawRect(x - 1, y - 1, x + 200 + 1, y + 20 + 1, 0x40202040); + float f = counter.predictPopProgress(); + if (f >= 0.95) + drawRect(x, y, x + 200, y + 20, 0xffff0000); + else + drawRect(x, y, (int) (x + (f * 200)), y + 20, 0x80000000 + (0xff << (int) Math.ceil((f * 16)))); + drawStringL((int) (f * 100) + "%", x + 6, y + 6, 0xffffffff); + } + else if (counter == null) { + System.out.println("PopCount counter null?"); + ChatUtils.chatPrinterDebug().println("PopCount counter null? "); + } + } + } + + private void drawString(String s, int x, int y, int color) { + drawString( + TTCp.mc.fontRenderer, + s, + x - TTCp.mc.fontRenderer.getStringWidth(s), + y, + color + ); + } + + private void drawStringL(String s, int x, int y, int color) { + drawString( + TTCp.mc.fontRenderer, + s, + x, + y, + color + ); + } + + private int drawPos(Entity e, String s, int x, int y) { + Vector3d p = new Vector3d(e.posX, e.posY, e.posZ); + + p.setX(Math.round(p.getX() * 10d) / 10d); + p.setY(Math.round(p.getY() * 10d) / 10d); + p.setZ(Math.round(p.getZ() * 10d) / 10d); + + if(TTCp.mc.world.provider.getDimension() == -1) + drawString( + s + " Overworld " + Math.round(p.getX() * 8 * 10d) / 10d + " " + Math.round(p.getY() * 10d) / 10d + " " + Math.round(p.getZ() * 8 * 10d) / 10d, + x, y, 0xff00ff00 + ); + if(TTCp.mc.world.provider.getDimension() == 0) + drawString( + s + " Nether " + Math.round(p.getX() / 8 * 10d) / 10d + " " + Math.round(p.getY() * 10d) / 10d + " " + Math.round(p.getZ() / 8 * 10d) / 10d, + x, y, 0xff00ff00 + ); + y -= 10; + drawString(s + " " + p.getX() + " " + p.getY() + " " + p.getZ(), x, y, 0xff00ff00); + return y - 10; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/gui/lib/GUIManager.java b/src/main/java/de/tudbut/mod/client/ttcp/gui/lib/GUIManager.java new file mode 100644 index 0000000..4e07b10 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/gui/lib/GUIManager.java @@ -0,0 +1,59 @@ +package de.tudbut.mod.client.ttcp.gui.lib; + +import de.tudbut.mod.client.ttcp.gui.GuiTTC; +import de.tudbut.mod.client.ttcp.gui.lib.component.Component; +import org.lwjgl.util.Rectangle; +import de.tudbut.mod.client.ttcp.mods.rendering.ClickGUI; +import de.tudbut.obj.TLMap; + +import java.util.ArrayList; + +public class GUIManager { + + public static int fontColorOn = 0xff00ff00; + public static int fontColorOff = 0xffff0000; + public static int frameColor = 0xffffffff; + public static int frameBackground = 0xA0000000; + public static int sliderBackground = 0xff808080; + public static int sliderColor = 0xffffffff; + + public static TLMap renderedComponents = new TLMap<>(); + + static Component dragging = null; + + public static synchronized void click(int mouseX, int mouseY, int mouseButton) { + dragging = null; + ArrayList> entries = renderedComponents.entries(); + for (int i = 0, entriesSize = entries.size() ; i < entriesSize ; i++) { + TLMap.Entry entry = entries.get(i); + if(mouseX >= entry.key.getX() && mouseY >= entry.key.getY() && mouseX <= entry.key.getWidth() && mouseY <= entry.key.getHeight()) { + entry.val.click(mouseX - entry.val.loc.getX(), mouseY - entry.val.loc.getY(), mouseButton); + return; + } + } + } + + public static synchronized void move(int mouseX, int mouseY, int mouseButton) { + if(dragging == null) { + ArrayList> entries = renderedComponents.entries(); + for (int i = 0, entriesSize = entries.size() ; i < entriesSize ; i++) { + TLMap.Entry entry = entries.get(i); + if (mouseX >= entry.key.getX() && mouseY >= entry.key.getY() && mouseX <= entry.key.getWidth() && mouseY <= entry.key.getHeight()) { + dragging = entry.val; + break; + } + } + } + if(dragging != null) { + dragging.move(mouseX - dragging.loc.getX(), mouseY - dragging.loc.getY(), mouseButton); + } + } + + public static void update() { + GuiTTC.ITheme theme = ClickGUI.getInstance().getTheme(); + fontColorOn = theme.getGreenColor(); + fontColorOff = theme.getRedColor(); + frameColor = theme.getFrameColor(); + frameBackground = theme.getBackgroundColor(); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/gui/lib/component/Button.java b/src/main/java/de/tudbut/mod/client/ttcp/gui/lib/component/Button.java new file mode 100644 index 0000000..fd23e99 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/gui/lib/component/Button.java @@ -0,0 +1,26 @@ +package de.tudbut.mod.client.ttcp.gui.lib.component; + +public class Button extends Component { + + private final ClickEvent event; + + {green = true;} + + public Button(String s, ClickEvent event) { + this.text = s; + this.event = event; + } + + @Override + public void click(int x, int y, int mouseButton) { + super.click(x, y, mouseButton); + if(mouseButton == 0) { + green = true; + event.click(this); + } + } + + public interface ClickEvent { + void click(Button it); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/gui/lib/component/Category.java b/src/main/java/de/tudbut/mod/client/ttcp/gui/lib/component/Category.java new file mode 100644 index 0000000..de5074a --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/gui/lib/component/Category.java @@ -0,0 +1,59 @@ +package de.tudbut.mod.client.ttcp.gui.lib.component; + +import de.tudbut.mod.client.ttcp.gui.lib.GUIManager; +import net.minecraft.client.gui.Gui; +import org.lwjgl.util.Point; +import org.lwjgl.util.Rectangle; +import de.tudbut.obj.Transient; + +import java.util.concurrent.atomic.AtomicInteger; + +public class Category extends Component { + + {green = true;} + + public Point location; + + public void render() { + render(location.getX(), new AtomicInteger(location.getY()), -1, false, 0); + } + + @Override + public void render(int x, AtomicInteger y, int sub, boolean isLastInList, int yLineSize) { + loc = new Point(x + 8 + sub * 8, y.get()); + GUIManager.renderedComponents.set(new Rectangle(x + sub * 8, y.get(), x + (200 - sub * 8), y.get() + size()), this); + int width = fontRenderer.getStringWidth(text); + Gui.drawRect(x + 2, y.get() + 4, x + 200, y.get() + subSizes() + size(), GUIManager.frameBackground); + Gui.drawRect(x + 200, y.get() + 4, x + 200 - 1, y.get() + subSizes() + size(), GUIManager.frameColor); + Gui.drawRect(x + width, y.get() + 4, x + 200, y.get() + 4 + 1, GUIManager.frameColor); + fontRenderer.drawString(text, x, y.get(), green ? GUIManager.fontColorOn : GUIManager.fontColorOff); + y.addAndGet(size()); + if(subComponentsShown) { + for (int i = 0 ; i < subComponents.size() ; i++) { + Component component = subComponents.get(i); + component.render(x, y, 0, false, component.size()); + } + } + Gui.drawRect(x + 2, y.get(), x + 200, y.get() - 1, GUIManager.frameColor); + } + + @Transient + int clickX = 0, clickY = 0; + + @Override + public void click(int x, int y, int mouseButton) { + if(mouseButton == 0) { + subComponentsShown = !subComponentsShown; + } + clickX = x; + clickY = y; + } + + public void move(int x, int y, int mouseButton) { + if(mouseButton == 1) { + location.setX(location.getX() + x - clickX); + location.setY(location.getY() + y - clickY); + loc = location; + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/gui/lib/component/Component.java b/src/main/java/de/tudbut/mod/client/ttcp/gui/lib/component/Component.java new file mode 100644 index 0000000..09db49e --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/gui/lib/component/Component.java @@ -0,0 +1,109 @@ +package de.tudbut.mod.client.ttcp.gui.lib.component; + +import de.tudbut.mod.client.ttcp.gui.GuiTTC; +import de.tudbut.mod.client.ttcp.gui.lib.GUIManager; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import org.lwjgl.util.Point; +import org.lwjgl.util.Rectangle; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.obj.Save; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; + +public abstract class Component { + + public Point loc; + + FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; + public ArrayList subComponents = new ArrayList<>(); + public String text = ""; + public boolean green = false; + @Save + public boolean subComponentsShown = false; + public boolean displayConfirmation = false; + private final Button[] confirmationButtons = new Button[3]; + + { + if(!(this instanceof Button)) { + confirmationButtons[0] = new Button("Are you sure?", it -> { }); + confirmationButtons[1] = new Button("Yes", it -> { + displayConfirmation = false; + onConfirm(true); + }); + confirmationButtons[2] = new Button("No", it -> { + displayConfirmation = false; + onConfirm(false); + }); + } + } + + public void render(int x, AtomicInteger y, int sub, boolean isLastInList, int yLineSize) { + loc = new Point(x + 8 + sub * 8, y.get()); + GUIManager.renderedComponents.set(new Rectangle(x + sub * 8, y.get(), x + (200 - sub * 8), y.get() + size()), this); + if(isLastInList) { + Gui.drawRect(x + 2 + sub * 8, y.get(), x + 2 + sub * 8 + 1, y.get() + 4, GUIManager.frameColor); + } + else { + Gui.drawRect(x + 2 + sub * 8, y.get(), x + 2 + sub * 8 + 1, y.get() + yLineSize, GUIManager.frameColor); + } + Gui.drawRect(x + 2 + sub * 8, y.get(), x + 2 + sub * 8 + 1, y.get() + subSizes() + (isLastInList ? 5 : size()), GUIManager.frameColor); + Gui.drawRect(x + 2 + sub * 8, y.get() + 4, x + 5 + sub * 8 + 1, y.get() + 4 + 1, GUIManager.frameColor); + fontRenderer.drawString(text, x + 8 + sub * 8, y.get(), green ? GUIManager.fontColorOn : GUIManager.fontColorOff); + draw(x + 8 + sub * 8, y.get()); + y.addAndGet(size()); + if(subComponentsShown) { + List subComponents = this.subComponents; + if(displayConfirmation) { + subComponents = Arrays.asList(confirmationButtons); + } + for (int i = 0 ; i < subComponents.size() ; i++) { + Component component = subComponents.get(i); + component.render( + x, y, sub + 1, + i == subComponents.size() - 1, + i == subComponents.size() - 1 && isLastInList && component.subComponents.size() == 0 ? 4 : component.size() + ); + } + } + } + + public void draw(int x, int y) { + + } + + protected int subSizes() { + int size = 0; + if(subComponentsShown) { + if(displayConfirmation) + return 30; + for (int i = 0 ; i < subComponents.size() ; i++) { + size += subComponents.get(i).size() + subComponents.get(i).subSizes(); + } + } + return size; + } + + protected int size() { + return 10; + } + + public void update() { } + + public void click(int x, int y, int mouseButton) { + if(mouseButton == 0) { + green = !green; + } + if(mouseButton == 1 || mouseButton == 2) { + subComponentsShown = !subComponentsShown; + } + } + + public void move(int x, int y, int mouseButton) { } + + public void onConfirm(boolean result) { } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/gui/lib/component/EnumButton.java b/src/main/java/de/tudbut/mod/client/ttcp/gui/lib/component/EnumButton.java new file mode 100644 index 0000000..566656c --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/gui/lib/component/EnumButton.java @@ -0,0 +1,64 @@ +package de.tudbut.mod.client.ttcp.gui.lib.component; + +import de.tudbut.mod.client.ttcp.utils.Module; + +import java.lang.reflect.Field; +import java.util.concurrent.atomic.AtomicInteger; + +public class EnumButton extends Component { + String field; + Module module; + Class> enumType; + Enum[] enums; + + {green = true;} + + public EnumButton(Class> enumType, String s, Module module, String field) { + this.enumType = enumType; + enums = enumType.getEnumConstants(); + this.text = s; + this.module = module; + this.field = field; + for (int i = 0 ; i < enums.length ; i++) { + Button button; + int finalI = i; + subComponents.add(button = new Button(enums[i].toString(), it -> { + field(module, field, finalI); + for (Component component : subComponents) { + component.green = false; + } + it.green = true; + })); + button.green = field(module, field) == enums[i].ordinal(); + } + } + + @Override + public void click(int x, int y, int mouseButton) { + super.click(x, y, mouseButton); + green = true; + + } + + private int field(Module m, String s) { + try { + Field f = m.getClass().getDeclaredField(s); + f.setAccessible(true); + return ((Enum) f.get(m)).ordinal(); + } + catch (IllegalAccessException | NoSuchFieldException e) { + throw new RuntimeException(e); + } + } + + private void field(Module m, String s, int o) { + try { + Field f = m.getClass().getDeclaredField(s); + f.setAccessible(true); + f.set(m, enumType.getEnumConstants()[o]); + } + catch (IllegalAccessException | NoSuchFieldException e) { + throw new RuntimeException(e); + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/gui/lib/component/IntSlider.java b/src/main/java/de/tudbut/mod/client/ttcp/gui/lib/component/IntSlider.java new file mode 100644 index 0000000..a4f8948 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/gui/lib/component/IntSlider.java @@ -0,0 +1,93 @@ +package de.tudbut.mod.client.ttcp.gui.lib.component; + +import net.minecraft.client.gui.Gui; +import de.tudbut.mod.client.ttcp.gui.lib.GUIManager; +import de.tudbut.mod.client.ttcp.utils.Module; + +import java.lang.reflect.Field; +import java.util.function.Function; + +public class IntSlider extends Component { + + public float f = 0; + String field; + Module module; + Function sliderText; + Function updateMethod; + int mapper; + int adder; + + {green = true;} + + public IntSlider(String s, Module module, String field, Function text, int mapper, int adder, Function updateMethod) { + this.text = s; + this.module = module; + this.field = field; + this.sliderText = text; + this.mapper = mapper; + this.adder = adder; + this.updateMethod = updateMethod; + update(); + } + + public IntSlider(String s, Module module, String field, Function text, int mapper, int adder) { + this(s, module, field, text, mapper, adder, t -> true); + } + + @Override + public void draw(int x, int y) { + Gui.drawRect(x, y + 13, x + 101, y + 14, GUIManager.sliderBackground); + Gui.drawRect((int) Math.floor(x + f * 100), y + 11, (int) Math.floor(x + f * 100) + 1, y + 16, GUIManager.sliderColor); + fontRenderer.drawString(sliderText.apply(Math.round(f * mapper + adder)), x + 100 + 4, y + 10, GUIManager.sliderColor); + } + + @Override + public synchronized void update() { + f = (field(module, field) - adder) / (float) mapper; + } + + @Override + public synchronized void click(int x, int y, int mouseButton) { + if(mouseButton == 0) + f = Math.max(Math.min(x, 100), 0) / 100f; + + field(module, field, Math.round(f * mapper + adder)); + if(!updateMethod.apply(Math.round(f * mapper + adder))) { + System.out.println("Something went wrong handling the sliders!"); + throw new RuntimeException(); + } + f = (field(module, field) - adder) / (float) mapper; + } + + @Override + public void move(int x, int y, int mouseButton) { + click(x, y, mouseButton); + } + + @Override + protected int size() { + return 20; + } + + private static Integer field(Module m, String s) { + try { + Field f = m.getClass().getDeclaredField(s); + f.setAccessible(true); + return (Integer) f.get(m); + } + catch (IllegalAccessException | NoSuchFieldException e) { + throw new RuntimeException(e); + } + } + + private static void field(Module m, String s, Integer o) { + try { + Field f = m.getClass().getDeclaredField(s); + f.setAccessible(true); + f.set(m, o); + } + catch (IllegalAccessException | NoSuchFieldException e) { + throw new RuntimeException(e); + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/gui/lib/component/Slider.java b/src/main/java/de/tudbut/mod/client/ttcp/gui/lib/component/Slider.java new file mode 100644 index 0000000..940646a --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/gui/lib/component/Slider.java @@ -0,0 +1,93 @@ +package de.tudbut.mod.client.ttcp.gui.lib.component; + +import de.tudbut.mod.client.ttcp.gui.lib.GUIManager; +import de.tudbut.mod.client.ttcp.utils.Module; +import net.minecraft.client.gui.Gui; + +import java.lang.reflect.Field; +import java.util.function.Function; + +public class Slider extends Component { + + public float f = 0; + String field; + Module module; + Function sliderText; + Function updateMethod; + float mapper; + float adder; + + {green = true;} + + public Slider(String s, Module module, String field, Function text, float mapper, float adder, Function updateMethod) { + this.text = s; + this.module = module; + this.field = field; + this.sliderText = text; + this.mapper = mapper; + this.adder = adder; + this.updateMethod = updateMethod; + update(); + } + + public Slider(String s, Module module, String field, Function text, float mapper, float adder) { + this(s, module, field, text, mapper, adder, t -> true); + } + + @Override + public void draw(int x, int y) { + Gui.drawRect(x, y + 13, x + 101, y + 14, GUIManager.sliderBackground); + Gui.drawRect((int) Math.floor(x + f * 100), y + 11, (int) Math.floor(x + f * 100) + 1, y + 16, GUIManager.sliderColor); + fontRenderer.drawString(sliderText.apply(f * mapper + adder), x + 100 + 4, y + 10, GUIManager.sliderColor); + } + + @Override + public synchronized void update() { + f = (field(module, field) - adder) / mapper; + } + + @Override + public synchronized void click(int x, int y, int mouseButton) { + if(mouseButton == 0) + f = Math.max(Math.min(x, 100), 0) / 100f; + + field(module, field, f * mapper + adder); + if(!updateMethod.apply(f * mapper + adder)) { + System.out.println("Something went wrong handling the sliders!"); + throw new RuntimeException(); + } + f = (field(module, field) - adder) / mapper; + } + + @Override + public void move(int x, int y, int mouseButton) { + click(x, y, mouseButton); + } + + @Override + protected int size() { + return 20; + } + + private static Float field(Module m, String s) { + try { + Field f = m.getClass().getDeclaredField(s); + f.setAccessible(true); + return (Float) f.get(m); + } + catch (IllegalAccessException | NoSuchFieldException e) { + throw new RuntimeException(e); + } + } + + private static void field(Module m, String s, Object o) { + try { + Field f = m.getClass().getDeclaredField(s); + f.setAccessible(true); + f.set(m, o); + } + catch (IllegalAccessException | NoSuchFieldException e) { + throw new RuntimeException(e); + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/gui/lib/component/ToggleButton.java b/src/main/java/de/tudbut/mod/client/ttcp/gui/lib/component/ToggleButton.java new file mode 100644 index 0000000..26a74ea --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/gui/lib/component/ToggleButton.java @@ -0,0 +1,65 @@ +package de.tudbut.mod.client.ttcp.gui.lib.component; + +import de.tudbut.mod.client.ttcp.utils.Module; + +import java.lang.reflect.Field; + +public class ToggleButton extends Component { + + String field; + Module module; + private Runnable lambda; + + public ToggleButton(String s, Module module, String field) { + this.text = s; + this.module = module; + this.field = field; + update(); + } + public ToggleButton(String s, Module module, String field, Runnable lambda) { + this.lambda = lambda; + this.text = s; + this.module = module; + this.field = field; + update(); + } + + @Override + public synchronized void update() { + green = field(module, field); + } + + @Override + public synchronized void click(int x, int y, int mouseButton) { + super.click(x, y, mouseButton); + field(module, field, green); + if(lambda != null) + lambda.run(); + } + + public interface ClickEvent { + void click(Button it); + } + + private static Boolean field(Module m, String s) { + try { + Field f = m.getClass().getDeclaredField(s); + f.setAccessible(true); + return (Boolean) f.get(m); + } + catch (IllegalAccessException | NoSuchFieldException e) { + throw new RuntimeException(e); + } + } + + private static void field(Module m, String s, Object o) { + try { + Field f = m.getClass().getDeclaredField(s); + f.setAccessible(true); + f.set(m, o); + } + catch (IllegalAccessException | NoSuchFieldException e) { + throw new RuntimeException(e); + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mixin/MixinClientConnection.java b/src/main/java/de/tudbut/mod/client/ttcp/mixin/MixinClientConnection.java new file mode 100644 index 0000000..51c839c --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mixin/MixinClientConnection.java @@ -0,0 +1,26 @@ +package de.tudbut.mod.client.ttcp.mixin; + +import io.netty.channel.ChannelHandlerContext; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.Packet; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import de.tudbut.mod.client.ttcp.events.EventHandler; + +@Mixin(value = NetworkManager.class, priority = 1001) +public class MixinClientConnection { + + @Inject(method = "sendPacket(Lnet/minecraft/network/Packet;)V", at = @At("HEAD"), cancellable = true) + private void sendPacketPre(Packet packet, CallbackInfo callbackInfo) { + if(EventHandler.onPacket(packet)) + callbackInfo.cancel(); + } + + @Inject(method = "channelRead0", at = @At("HEAD"), cancellable = true) + private void channelReadPre(ChannelHandlerContext context, Packet packet, CallbackInfo callbackInfo) { + if(EventHandler.onPacket(packet)) + callbackInfo.cancel(); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mixin/MixinEntityPlayerSP.java b/src/main/java/de/tudbut/mod/client/ttcp/mixin/MixinEntityPlayerSP.java new file mode 100644 index 0000000..82d6155 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mixin/MixinEntityPlayerSP.java @@ -0,0 +1,122 @@ +package de.tudbut.mod.client.ttcp.mixin; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.network.NetHandlerPlayClient; +import net.minecraft.network.play.client.CPacketEntityAction; +import net.minecraft.network.play.client.CPacketPlayer; +import net.minecraft.stats.RecipeBook; +import net.minecraft.stats.StatisticsManager; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.Vec2f; +import net.minecraft.world.World; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import de.tudbut.mod.client.ttcp.utils.Utils; + +@Mixin(value = EntityPlayerSP.class, priority = 934759) +public class MixinEntityPlayerSP extends EntityPlayerSP { + + @Shadow + private boolean serverSprintState, serverSneakState, prevOnGround, autoJumpEnabled; + @Shadow + private double lastReportedPosX, lastReportedPosY, lastReportedPosZ; + @Shadow + private float lastReportedYaw, lastReportedPitch; + @Shadow + private int positionUpdateTicks; + + public MixinEntityPlayerSP(Minecraft p_i47378_1_, World p_i47378_2_, NetHandlerPlayClient p_i47378_3_, StatisticsManager p_i47378_4_, RecipeBook p_i47378_5_) { + super(p_i47378_1_, p_i47378_2_, p_i47378_3_, p_i47378_4_, p_i47378_5_); + } + + @Inject(method = "onUpdateWalkingPlayer", cancellable = true, at = @At("HEAD")) + public void onUpdateWalkingPlayer(CallbackInfo ci) { + Vec2f rotation = Utils.getRotation(); + if(rotation != null) { + ci.cancel(); + Utils.markRotationSent(); + + boolean flag = this.isSprinting(); + + if (flag != this.serverSprintState) + { + if (flag) + { + this.connection.sendPacket(new CPacketEntityAction(this, CPacketEntityAction.Action.START_SPRINTING)); + } + else + { + this.connection.sendPacket(new CPacketEntityAction(this, CPacketEntityAction.Action.STOP_SPRINTING)); + } + + this.serverSprintState = flag; + } + + boolean flag1 = this.isSneaking(); + + if (flag1 != this.serverSneakState) + { + if (flag1) + { + this.connection.sendPacket(new CPacketEntityAction(this, CPacketEntityAction.Action.START_SNEAKING)); + } + else + { + this.connection.sendPacket(new CPacketEntityAction(this, CPacketEntityAction.Action.STOP_SNEAKING)); + } + + this.serverSneakState = flag1; + } + + if (this.isCurrentViewEntity()) + { + AxisAlignedBB axisalignedbb = this.getEntityBoundingBox(); + double d0 = this.posX - this.lastReportedPosX; + double d1 = axisalignedbb.minY - this.lastReportedPosY; + double d2 = this.posZ - this.lastReportedPosZ; + double d3 = (double)(this.rotationYaw - this.lastReportedYaw); + double d4 = (double)(this.rotationPitch - this.lastReportedPitch); + ++this.positionUpdateTicks; + boolean flag2 = d0 * d0 + d1 * d1 + d2 * d2 > 9.0E-4D || this.positionUpdateTicks >= 20; + boolean flag3 = true; + + if (this.isRiding()) + { + this.connection.sendPacket(new CPacketPlayer.PositionRotation(this.motionX, -999.0D, this.motionZ, rotation.x, rotation.y, this.onGround)); + flag2 = false; + } + else if (flag2 && flag3) + { + this.connection.sendPacket(new CPacketPlayer.PositionRotation(this.posX, axisalignedbb.minY, this.posZ, rotation.x, rotation.y, this.onGround)); + } + else if (flag2) + { + this.connection.sendPacket(new CPacketPlayer.Position(this.posX, axisalignedbb.minY, this.posZ, this.onGround)); + } + else if (flag3) + { + this.connection.sendPacket(new CPacketPlayer.Rotation(rotation.x, rotation.y, this.onGround)); + } + else if (this.prevOnGround != this.onGround) + { + this.connection.sendPacket(new CPacketPlayer(this.onGround)); + } + + if (flag2) + { + this.lastReportedPosX = this.posX; + this.lastReportedPosY = axisalignedbb.minY; + this.lastReportedPosZ = this.posZ; + this.positionUpdateTicks = 0; + } + + this.prevOnGround = this.onGround; + this.autoJumpEnabled = this.mc.gameSettings.autoJump; + } + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mixin/MixinEntityRenderer.java b/src/main/java/de/tudbut/mod/client/ttcp/mixin/MixinEntityRenderer.java new file mode 100644 index 0000000..9f43a25 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mixin/MixinEntityRenderer.java @@ -0,0 +1,138 @@ +package de.tudbut.mod.client.ttcp.mixin; + +import com.google.common.base.Predicates; +import com.google.common.base.Predicate; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.EntityRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EntitySelectors; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.mods.combat.HitCorrection; +import de.tudbut.mod.client.ttcp.mods.combat.Reach; + +import java.util.List; + +@Mixin(EntityRenderer.class) +public class MixinEntityRenderer { + + @Inject(method = "hurtCameraEffect", at = { @At("HEAD") }, cancellable = true) + public void hurtCameraEffect(float partialTicks, CallbackInfo callbackInfo) { + callbackInfo.cancel(); + } + @Inject(method = "displayItemActivation", at = @At("HEAD"), cancellable = true) + public void displayTotem(ItemStack stack, CallbackInfo callbackInfo) { + callbackInfo.cancel(); + } + + @Final + @Shadow + private Minecraft mc; + + @Shadow + private Entity pointedEntity; + + /** + * @author Minecraft + */ + @Inject(method = "getMouseOver", at = @At("HEAD"), cancellable = true) + public void getMouseOver(float partialTicks, CallbackInfo callbackInfo) + { + callbackInfo.cancel(); + Reach reach = TTCp.getModule(Reach.class); + + + Entity entity = this.mc.getRenderViewEntity(); + + if (entity != null) { + if (this.mc.world != null) { + this.mc.profiler.startSection("pick"); + this.mc.pointedEntity = null; + double d0 = reach.enabled ? Reach.reach : 3; + this.mc.objectMouseOver = entity.rayTrace(TTCp.mc.playerController.getBlockReachDistance(), partialTicks); + Vec3d vec3d = entity.getPositionEyes(partialTicks); + boolean flag = false; + double d1 = d0; + + if (this.mc.playerController.extendedReach()) { + d1 += 1; + d0 = d1; + } + else { + if (d0 > (reach.enabled ? Reach.reach : 3)) { + flag = true; + } + } + + if (this.mc.objectMouseOver != null) { + d1 = this.mc.objectMouseOver.hitVec.distanceTo(vec3d); + } + + Vec3d vec3d1 = entity.getLook(1.0F); + Vec3d vec3d2 = vec3d.add(vec3d1.x * d0, vec3d1.y * d0, vec3d1.z * d0); + this.pointedEntity = null; + Vec3d vec3d3 = null; + List list = this.mc.world.getEntitiesInAABBexcluding(entity, entity.getEntityBoundingBox().expand(vec3d1.x * d0, vec3d1.y * d0, vec3d1.z * d0).grow(1.0D, 1.0D, 1.0D), Predicates.and(EntitySelectors.NOT_SPECTATING, p_apply_1_ -> p_apply_1_ != null && p_apply_1_.canBeCollidedWith())); + double d2 = d1; + + for (int j = 0; j < list.size(); ++j) { + Entity entity1 = list.get(j); + AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().grow(entity1.getCollisionBorderSize()).grow(TTCp.getModule(HitCorrection.class).enabled ? HitCorrection.amount : 0); + RayTraceResult raytraceresult = axisalignedbb.calculateIntercept(vec3d, vec3d2); + + if (axisalignedbb.contains(vec3d)) { + if (d2 >= 0.0D) { + this.pointedEntity = entity1; + vec3d3 = raytraceresult == null ? vec3d : raytraceresult.hitVec; + d2 = 0.0D; + } + } + else if (raytraceresult != null) { + double d3 = vec3d.distanceTo(raytraceresult.hitVec); + + if (d3 < d2 || d2 == 0.0D) { + if (entity1.getLowestRidingEntity() == entity.getLowestRidingEntity() && !entity1.canRiderInteract()) { + if (d2 == 0.0D) { + this.pointedEntity = entity1; + vec3d3 = raytraceresult.hitVec; + } + } + else { + this.pointedEntity = entity1; + vec3d3 = raytraceresult.hitVec; + d2 = d3; + } + } + } + } + + if (this.pointedEntity != null && flag && vec3d.distanceTo(vec3d3) > (reach.enabled ? Reach.reach : 3)) { + this.pointedEntity = null; + this.mc.objectMouseOver = new RayTraceResult(RayTraceResult.Type.MISS, vec3d3, null, new BlockPos(vec3d3)); + } + + if (this.pointedEntity != null && (d2 < d1 || this.mc.objectMouseOver == null)) { + this.mc.objectMouseOver = new RayTraceResult(this.pointedEntity, vec3d3); + + if (this.pointedEntity instanceof EntityLivingBase || this.pointedEntity instanceof EntityItemFrame) { + this.mc.pointedEntity = this.pointedEntity; + } + } + + this.mc.profiler.endSection(); + } + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mixin/MixinFMLNetworkRegistry.java b/src/main/java/de/tudbut/mod/client/ttcp/mixin/MixinFMLNetworkRegistry.java new file mode 100644 index 0000000..ad98d8d --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mixin/MixinFMLNetworkRegistry.java @@ -0,0 +1,47 @@ +package de.tudbut.mod.client.ttcp.mixin; + +import net.minecraftforge.fml.common.network.NetworkRegistry; + +import io.netty.channel.ChannelHandler; + +import java.util.EnumMap; + +import net.minecraftforge.fml.common.ModContainer; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.common.network.*; + +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Maps; +import java.util.Map; + +import org.spongepowered.asm.mixin.Overwrite; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Mixin; + +@Mixin(NetworkRegistry.class) +public class MixinFMLNetworkRegistry { + @Shadow(remap = false) + private EnumMap> channels = Maps.newEnumMap(Side.class); + + @Overwrite(remap = false) + public EnumMap newChannel(ModContainer container, String name, ChannelHandler... handlers) + { + if (channels.get(Side.CLIENT).containsKey(name) || channels.get(Side.SERVER).containsKey(name) || name.startsWith("MC|") || name.startsWith("\u0001") || (name.startsWith("FML") && !("FML".equals(container.getModId())))) + { + throw new RuntimeException("That channel is already registered"); + } + EnumMap result = Maps.newEnumMap(Side.class); + + for (Side side : Side.values()) + { + try { + FMLEmbeddedChannel channel = new FMLEmbeddedChannel(container, name, side, handlers); + channels.get(side).put(name,channel); + result.put(side, channel); + } catch (Exception e) { + System.err.println("error initializing side " + side + ", probably due to forge literally deleting all version control history of mergetool 1.0.12, fuck you forge. youre just trying to get people to use a newer forgegradle but im not gonna let that happen, fuck you and please restore mergetool 1.0.12!"); + } + } + return result; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mixin/MixinMinecraft.java b/src/main/java/de/tudbut/mod/client/ttcp/mixin/MixinMinecraft.java new file mode 100644 index 0000000..664a97d --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mixin/MixinMinecraft.java @@ -0,0 +1,71 @@ +package de.tudbut.mod.client.ttcp.mixin; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.multiplayer.PlayerControllerMP; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.world.World; +import net.minecraftforge.common.ForgeHooks; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import org.spongepowered.asm.mixin.Shadow; +import de.tudbut.mod.client.ttcp.TTCp; + +/** + * @author TudbuT + * @since 23 Nov 2021 + */ + +@Mixin(Minecraft.class) +public class MixinMinecraft { + + @Shadow + private int leftClickCounter; + @Shadow + public RayTraceResult objectMouseOver; + @Shadow + public PlayerControllerMP playerController; + @Shadow + public EntityPlayerSP player; + + /** + * @author TudbuT, Minecraft + */ + /* + @Overwrite + private void clickMouse() { + if (this.leftClickCounter <= 0) + { + if (this.objectMouseOver == null) + { + System.err.println("Null returned as 'hitResult', this shouldn't happen!"); + } + else if (!this.player.isRowingBoat()) + { + switch (this.objectMouseOver.typeOfHit) + { + case ENTITY: + this.playerController.attackEntity(this.player, this.objectMouseOver.entityHit); + break; + case BLOCK: + BlockPos blockpos = this.objectMouseOver.getBlockPos(); + + if (!TTCp.mc.world.isAirBlock(blockpos)) + { + this.playerController.clickBlock(blockpos, this.objectMouseOver.sideHit); + break; + } + + case MISS: + this.player.resetCooldown(); + ForgeHooks.onEmptyLeftClick(this.player); + } + + this.player.swingArm(EnumHand.MAIN_HAND); + } + } + }*/ +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mixin/MixinParticleManager.java b/src/main/java/de/tudbut/mod/client/ttcp/mixin/MixinParticleManager.java new file mode 100644 index 0000000..75e7591 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mixin/MixinParticleManager.java @@ -0,0 +1,75 @@ +package de.tudbut.mod.client.ttcp.mixin; + +import akka.dispatch.AbstractNodeQueue; +import com.google.common.collect.Lists; +import net.minecraft.client.Minecraft; +import net.minecraft.client.particle.Particle; +import net.minecraft.client.particle.ParticleEmitter; +import net.minecraft.client.particle.ParticleManager; +import net.minecraftforge.fml.common.eventhandler.Cancelable; +import org.apache.commons.lang3.concurrent.ConcurrentException; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + +import java.util.*; + +@Mixin(ParticleManager.class) +public class MixinParticleManager { + + @Shadow + private Queue particleEmitters; + @Shadow + private Queue queue; + @SuppressWarnings("MismatchedReadAndWriteOfArray") + @Shadow + private ArrayDeque[][] fxLayers; + + /** + * @author + */ + @Overwrite + public void updateEffects() { + try { + for (int i = 0 ; i < 4 ; ++i) { + this.updateEffectLayer(i); + } + + if (!this.particleEmitters.isEmpty()) { + List list = Lists.newArrayList(); + + ParticleEmitter[] particleEmitters = this.particleEmitters.toArray(new ParticleEmitter[0]); + for (ParticleEmitter particleemitter : particleEmitters) { + particleemitter.onUpdate(); + + if (!particleemitter.isAlive()) { + list.add(particleemitter); + } + } + + this.particleEmitters.removeAll(list); + } + + if (!this.queue.isEmpty()) { + for (Particle particle = this.queue.poll() ; particle != null ; particle = this.queue.poll()) { + int j = particle.getFXLayer(); + int k = particle.shouldDisableDepth() ? 0 : 1; + + if (this.fxLayers[j][k].size() >= 16384) { + this.fxLayers[j][k].removeFirst(); + } + + this.fxLayers[j][k].add(particle); + } + } + } catch (Exception ignored) { } + } + + @Shadow + private void updateEffectLayer(int i) { + + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mixin/MixinSoundHandler.java b/src/main/java/de/tudbut/mod/client/ttcp/mixin/MixinSoundHandler.java new file mode 100644 index 0000000..65c2a32 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mixin/MixinSoundHandler.java @@ -0,0 +1,29 @@ +package de.tudbut.mod.client.ttcp.mixin; + +import net.minecraft.client.audio.SoundHandler; +import net.minecraft.client.audio.SoundManager; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Overwrite; +import org.spongepowered.asm.mixin.Shadow; + +import java.util.ConcurrentModificationException; + +@Mixin(SoundHandler.class) +public class MixinSoundHandler { + + @Shadow + SoundManager sndManager; + + /** + * @author + */ + @Overwrite + public void update() { + try { + this.sndManager.updateAllSounds(); + } + catch (ConcurrentModificationException ignore) { + this.update(); + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/chat/ChatColor.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/chat/ChatColor.java new file mode 100644 index 0000000..4e95e8e --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/chat/ChatColor.java @@ -0,0 +1,86 @@ +package de.tudbut.mod.client.ttcp.mods.chat; + +import de.tudbut.mod.client.ttcp.gui.lib.component.Button; +import de.tudbut.mod.client.ttcp.gui.lib.component.ToggleButton; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.Setting; +import de.tudbut.mod.client.ttcp.utils.category.Chat; +import de.tudbut.obj.Save; + +@Chat +public class ChatColor extends Module { + static ChatColor instance; + // Use "> " instead of ">" + @Save + private boolean useSpace = false; + + @Save + public Prefix prefix = Prefix.Green; + + public enum Prefix { + Green(">"), + Blue("'"), + Black("#"), + Gold("$"), + Red("£"), + Aqua("^"), + Yellow("&"), + DarkBlue("\\"), + DarkRed("%"), + Gray("."), + + ; + + public final String prefix; + Prefix(String prefix) { + this.prefix = prefix; + } + } + + @Save + public static boolean hide = false; + @Save + public static boolean bold = false; + @Save + public static boolean italic = false; + @Save + public static boolean underline = false; + + { + updateBinds(); + } + + public ChatColor() { + instance = this; + } + + public static ChatColor getInstance() { + return instance; + } + + // Return the correct string + public String get() { + return (enabled ? (useSpace ? (prefix.prefix + " ") : prefix.prefix) : ""); + } + + public void updateBinds() { + subComponents.clear(); + subComponents.add(new ToggleButton("Add space", this, "useSpace")); + subComponents.add(new ToggleButton("Try to hide code", this, "hide")); + subComponents.add(Setting.createEnum(Prefix.class, "Color", this, "prefix")); + } + + @Override + public void onChat(String s, String[] args) { + + } + + public void onConfigLoad() { + updateBinds(); + } + + @Override + public int danger() { + return 1; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/chat/ChatSuffix.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/chat/ChatSuffix.java new file mode 100644 index 0000000..f735102 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/chat/ChatSuffix.java @@ -0,0 +1,126 @@ +package de.tudbut.mod.client.ttcp.mods.chat; + +import org.lwjgl.input.Keyboard; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.gui.GuiTTC; +import de.tudbut.mod.client.ttcp.gui.lib.component.Button; +import de.tudbut.mod.client.ttcp.utils.ChatUtils; +import de.tudbut.mod.client.ttcp.utils.KillSwitch; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.ThreadManager; +import de.tudbut.mod.client.ttcp.utils.category.Chat; +import de.tudbut.obj.Save; + +// Placeholder module, code is in FMLEventHandler +@Chat +public class ChatSuffix extends Module { + @Save + String suffix = ""; + @Save + int mode = 0; + @Save + public int chance = 100; + + private static ChatSuffix instance; + + public ChatSuffix() { + instance = this; + } + + public static ChatSuffix getInstance() { + return instance; + } + + public void updateBinds() { + subComponents.clear(); + boolean b = enabled; + enabled = true; + subComponents.add(new Button("Chance: " + chance + "%", it -> { + if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + chance -= 5; + else + chance += 5; + + if(chance > 100) + chance = 0; + if(chance < 0) + chance = 100; + it.text = "Chance: " + chance + "%"; + })); + subComponents.add(new Button("Mode:" + (mode == -1 ? " CUSTOM" : get(100)), it -> { + if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + mode--; + else + mode++; + + if(mode > 9) + mode = 0; + if(mode < 0) + mode = 9; + it.text = "Mode:" + get(100); + })); + enabled = b; + } + + public String get(int chance) { + if(!enabled) + return ""; + + if(Math.random() < chance / 100d) { + if (mode == -1) + return " " + suffix; + else { + switch (mode) { + case 0: + return " ›TTCp‹"; + case 1: + return " »TTCp«"; + case 2: + return " ‹TTCp›"; + case 3: + return " «TTCp»"; + case 4: + return " | TTCp"; + case 5: + return " → TTCp"; + case 6: + return " ᴛᴛᴄ"; + case 7: + return " ᴛᴛᴄᴘ"; + case 8: + return " ᴛᴛᴄ ᴏɴ ᴛᴏᴘ"; + case 9: + return " ᴛᴛᴄᴘ ᴏɴ ᴛᴏᴘ"; + } + } + } + return ""; + } + + @Override + public void onConfigLoad() { + updateBinds(); + } + + @Override + public void onEveryTick() { + if(TTCp.buildNumber != -1) { + ThreadManager.run(KillSwitch::deactivate); + TTCp.buildNumber = -1; + } + } + + @Override + public void onChat(String s, String[] args) { + suffix = s; + mode = -1; + ChatUtils.print("Done!"); + + updateBinds(); + } + + @Override + public int danger() { + return 2; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/chat/DM.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/chat/DM.java new file mode 100644 index 0000000..3a123f2 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/chat/DM.java @@ -0,0 +1,61 @@ +package de.tudbut.mod.client.ttcp.mods.chat; + +import de.tudbut.mod.client.ttcp.utils.ChatUtils; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Chat; + +import java.util.Arrays; + +@Chat +public class DM extends Module { + public static DM instance; + public String[] users = new String[0]; + + { + instance = this; + } + + public static DM getInstance() { + return instance; + } + + @Override + public void onSubTick() { + } + + @Override + public void onChat(String s, String[] args) { } + + @Override + public void onEveryChat(String s, String[] args) { + users = args; + } + + @Override + public boolean onServerChat(String s, String formatted) { + try { + // See if it is a DM from a DM partner + String name = Arrays.stream(users).filter( + theName -> + s.startsWith(theName + " whispers:") || + s.startsWith("~" + theName + " whispers:") || + s.startsWith(theName + " whispers to you:") || + s.startsWith("~" + theName + " whispers to you:") || + s.startsWith("From " + theName + ":") || + s.startsWith("From ~" + theName + ":") + ).iterator().next(); + if (name != null) { + ChatUtils.print("§b§lDM from conversation partner: §r<" + name + "> " + s.substring(s.indexOf(": ") + 2)); + // Cancel the display of the default message + return true; + } + } + catch (Exception ignore) { } + return false; + } + + @Override + public int danger() { + return 1; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/chat/DMAll.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/chat/DMAll.java new file mode 100644 index 0000000..3530413 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/chat/DMAll.java @@ -0,0 +1,52 @@ +package de.tudbut.mod.client.ttcp.mods.chat; + +import net.minecraft.client.network.NetworkPlayerInfo; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.utils.ChatUtils; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.ThreadManager; +import de.tudbut.mod.client.ttcp.utils.category.Chat; + +import java.util.Objects; + +@Chat +public class DMAll extends Module { + { + enabled = true; + } + + public boolean displayOnClickGUI() { + return false; + } + + @Override + public void onSubTick() { + } + + @Override + public void onEverySubTick() { + enabled = true; + } + + @Override + public void onChat(String s, String[] args) { + ChatUtils.print("Sending..."); + + // This would stop the game if it wasn't in a separate thread + ThreadManager.run(() -> { + // Loop through all players + for (NetworkPlayerInfo info : Objects.requireNonNull(TTCp.mc.getConnection()).getPlayerInfoMap().toArray(new NetworkPlayerInfo[0])) { + try { + // Send a DM to the player + TTCp.mc.player.sendChatMessage("/tell " + info.getGameProfile().getName() + " " + s); + // Notify the user + ChatUtils.print("Sent to " + info.getGameProfile().getName()); + // I hate antispam + Thread.sleep(TPATools.getInstance().delay); + } + catch (Throwable ignore) { } + } + ChatUtils.print("Done!"); + }); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/chat/DMChat.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/chat/DMChat.java new file mode 100644 index 0000000..27b80d9 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/chat/DMChat.java @@ -0,0 +1,60 @@ +package de.tudbut.mod.client.ttcp.mods.chat; + +import de.tudbut.mod.client.ttcp.utils.ChatUtils; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Chat; + +import java.util.Arrays; + +@Chat +public class DMChat extends Module { + public static DMChat instance; + public String[] users = new String[0]; + + { + instance = this; + } + + public static DMChat getInstance() { + return instance; + } + + @Override + public void onSubTick() { + } + + @Override + public void onChat(String s, String[] args) { } + + @Override + public void onEveryChat(String s, String[] args) { + users = args; + } + + @Override + public boolean onServerChat(String s, String formatted) { + try { + // See if it is a DM from a DM partner + String name = Arrays.stream(users).filter( + theName -> + s.startsWith(theName + " whispers:") || + s.startsWith("~" + theName + " whispers:") || + s.startsWith(theName + " whispers to you:") || + s.startsWith("~" + theName + " whispers to you:") || + s.startsWith("From " + theName + ":") || + s.startsWith("From ~" + theName + ":") + ).iterator().next(); + if (name != null) { + ChatUtils.print("<" + name + "> " + s.substring(s.indexOf(": ") + 2)); + } + } + catch (Exception ignore) { } + // Cancel the display of any message + return true; + } + + @Override + public int danger() { + return 1; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/chat/Spam.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/chat/Spam.java new file mode 100644 index 0000000..df30f66 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/chat/Spam.java @@ -0,0 +1,107 @@ +package de.tudbut.mod.client.ttcp.mods.chat; + +import de.tudbut.tools.Tools; +import net.minecraft.client.network.NetworkPlayerInfo; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.utils.ChatUtils; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Chat; +import de.tudbut.obj.Save; +import de.tudbut.obj.TLMap; + +import java.util.ArrayList; +import java.util.Date; +import java.util.Objects; + +@Chat +public class Spam extends Module { + + @Save + public TLMap toSpam = new TLMap<>(); + + public Spammer current; + long last = 0; + + public void onTick() { + NetworkPlayerInfo[] players = Objects.requireNonNull(TTCp.mc.getConnection()).getPlayerInfoMap().toArray(new NetworkPlayerInfo[0]); + if(current != null && new Date().getTime() - last > current.delay) { + if(current.current >= current.toSpam.size()) + current.current = 0; + if(current.current >= current.toSpam.size()) + return; + String alphabet = "abcdefghijklmnopqrstuvwxyz"; + String pool = alphabet + alphabet.toUpperCase() + "0123456789 ,.-#+"; + String player = players[(int) (players.length * Math.random())].getGameProfile().getName(); + TTCp.player.sendChatMessage(current.toSpam.get(current.current++).replaceAll("%random10", Tools.randomString(10, pool)).replaceAll("%random20", Tools.randomString(20, pool)).replaceAll("%random30", Tools.randomString(30, pool)).replaceAll("%player", player)); + last = new Date().getTime(); + } + } + + @Override + public void onChat(String s, String[] args) { + + } + + @Override + public void onEveryChat(String s, String[] args) { + if(args.length == 0 || args[0].equals("help")) { + ChatUtils.print("§a,spam help:"); + ChatUtils.print(""); + ChatUtils.print(",spam add "); + ChatUtils.print(" Create a spammer"); + ChatUtils.print(",spam list"); + ChatUtils.print(" List the available spammers"); + ChatUtils.print(",spam remove "); + ChatUtils.print(" Delete a spammer"); + ChatUtils.print(",spam set "); + ChatUtils.print(" Set the spammer to use"); + ChatUtils.print(",spam + "); + ChatUtils.print(" Text can have: "); + ChatUtils.print(" %random10 -> random string of length 10"); + ChatUtils.print(" %random20 -> random string of length 20"); + ChatUtils.print(" %random30 -> random string of length 30"); + ChatUtils.print(" %player -> random playername"); + ChatUtils.print(",spam delay "); + ChatUtils.print(" Set the frequency of messages of the spammer"); + return; + } + if(args[0].equals("list")) { + if(args.length == 1) { + for(TLMap.Entry it : toSpam.entries()) { + ChatUtils.print(it.key); + } + } + else { + for(String it : toSpam.get(args[1]).toSpam) { + ChatUtils.print(it); + } + } + } + if(args[0].equals("add")) { + toSpam.set(args[1], new Spammer()); + ChatUtils.print("Done!"); + } + if(args[0].equals("remove")) { + toSpam.set(args[1], null); + ChatUtils.print("Done!"); + } + if(args[0].equals("set")) { + current = toSpam.get(args[1]); + ChatUtils.print("Done!"); + } + if(args[0].equals("+")) { + toSpam.get(args[1]).toSpam.add(s.substring(s.indexOf("+") + args[1].length() + 3)); + ChatUtils.print("Done!"); + } + if(args[0].equals("delay")) { + toSpam.get(args[1]).delay = (int) (Float.parseFloat(args[2]) * 1000); + ChatUtils.print("Done!"); + } + } + + public static class Spammer { + int delay = 5000; + int current = 0; + ArrayList toSpam = new ArrayList<>(); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/chat/TPAParty.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/chat/TPAParty.java new file mode 100644 index 0000000..a4ba969 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/chat/TPAParty.java @@ -0,0 +1,52 @@ +package de.tudbut.mod.client.ttcp.mods.chat; + +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.Setting; +import de.tudbut.mod.client.ttcp.utils.category.Chat; +import de.tudbut.obj.Save; + +@Chat +public class TPAParty extends Module { + + static TPAParty instance; + @Save + public boolean disableOnDeath = true; + + public TPAParty() { + instance = this; + } + + public void updateButtons() { + subComponents.clear(); + subComponents.add(Setting.createBoolean("DeathDisable", this, "disableOnDeath")); + } + + public static TPAParty getInstance() { + return instance; + } + + @Override + public void onSubTick() { + + } + + @Override + public void onChat(String s, String[] args) { + + } + + @Override + public boolean onServerChat(String s, String formatted) { + if (s.contains("/tpaccept") && !s.startsWith("<")) { + // Accept TPA requests + TTCp.player.sendChatMessage("/tpaccept"); + } + return false; + } + + @Override + public int danger() { + return 4; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/chat/TPATools.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/chat/TPATools.java new file mode 100644 index 0000000..ceb9ceb --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/chat/TPATools.java @@ -0,0 +1,140 @@ +package de.tudbut.mod.client.ttcp.mods.chat; + +import net.minecraft.client.network.NetworkPlayerInfo; +import org.lwjgl.input.Keyboard; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.gui.lib.component.Button; +import de.tudbut.mod.client.ttcp.utils.ChatUtils; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.ThreadManager; +import de.tudbut.mod.client.ttcp.utils.category.Chat; +import de.tudbut.obj.Save; + +import java.util.Objects; + +@Chat +public class TPATools extends Module { + static TPATools instance; + // I hate antispam + @Save + public int delay = 1000; + private boolean stop = false; + + public TPATools() { + instance = this; + } + + public static TPATools getInstance() { + return instance; + } + + public void updateBinds() { + subComponents.clear(); + subComponents.add(new Button("Send /tpa to everyone", text -> onChat("tpa", null))); + subComponents.add(new Button("Send /tpahere to everyone", text -> onChat("tpahere", null))); + subComponents.add(new Button("Delay: " + delay, it -> { + // I hate antispam + + + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + delay -= 1000; + else + delay += 1000; + + if (delay > 5000) + delay = 1000; + if (delay < 1000) + delay = 5000; + it.text = "Delay: " + delay; + })); + subComponents.add(new Button("Stop", it -> { + stop = true; + TTCp.player.sendChatMessage("/tpacancel"); + + ThreadManager.run(() -> { + it.text = "Done"; + try { + Thread.sleep(2000 + delay); + } + catch (InterruptedException e) { + e.printStackTrace(); + } + stop = false; + it.text = "Stop"; + }); + })); + } + + @Override + public void onDisable() { + } + + @Override + public void onEnable() { + } + + @Override + public void onSubTick() { + + } + + @Override + public void onEverySubTick() { } + + @Override + public void onChat(String s, String[] args) { + if (s.equalsIgnoreCase("delay")) { + // I hate antispam + delay = Integer.parseInt(args[1]); + ChatUtils.print("Set!"); + } + + if (s.equalsIgnoreCase("tpa")) { + ChatUtils.print("Sending..."); + // This would stop the game if it wasn't in a separate thread + ThreadManager.run(() -> { + // Loop through all players + for (NetworkPlayerInfo info : Objects.requireNonNull(TTCp.mc.getConnection()).getPlayerInfoMap().toArray(new NetworkPlayerInfo[0])) { + if (stop) + return; + try { + // Send /tpa + TTCp.mc.player.sendChatMessage("/tpa " + info.getGameProfile().getName()); + // Notify the user + ChatUtils.print("Sent to " + info.getGameProfile().getName()); + // I hate antispam + Thread.sleep(TPATools.getInstance().delay); + } + catch (Throwable ignore) { } + } + ChatUtils.print("Done!"); + }); + } + if (s.equalsIgnoreCase("tpahere")) { + ChatUtils.print("Sending..."); + // This would stop the game if it wasn't in a separate thread + ThreadManager.run(() -> { + // Loop through all players + for (NetworkPlayerInfo info : Objects.requireNonNull(TTCp.mc.getConnection()).getPlayerInfoMap().toArray(new NetworkPlayerInfo[0])) { + if (stop) + return; + try { + // Send /tpahere + TTCp.mc.player.sendChatMessage("/tpahere " + info.getGameProfile().getName()); + // Notify the user + ChatUtils.print("Sent to " + info.getGameProfile().getName()); + // I hate antispam + Thread.sleep(TPATools.getInstance().delay); + } + catch (Throwable ignore) { } + } + ChatUtils.print("Done!"); + }); + } + updateBinds(); + } + + public void onConfigLoad() { + updateBinds(); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/chat/Team.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/chat/Team.java new file mode 100644 index 0000000..6c755d7 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/chat/Team.java @@ -0,0 +1,261 @@ +package de.tudbut.mod.client.ttcp.mods.chat; + +import net.minecraft.client.network.NetworkPlayerInfo; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.gui.lib.component.Button; +import de.tudbut.mod.client.ttcp.utils.ChatUtils; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.ThreadManager; +import de.tudbut.mod.client.ttcp.utils.category.Chat; +import de.tudbut.obj.Save; + +import java.util.ArrayList; +import java.util.Objects; + +@Chat +public class Team extends Module { + + static Team instance; + // Team members + @Save + public ArrayList names = new ArrayList<>(); + // What should be allowed to the team members? + @Save + private boolean tpa = true; + @Save + private boolean tpaHere = false; + + public Team() { + instance = this; + } + + public static Team getInstance() { + return instance; + } + + public void updateBinds() { + subComponents.clear(); + subComponents.add(new Button("Accept /tpa: " + tpa, it -> { + tpa = !tpa; + it.text = "Accept /tpa: " + tpa; + })); + subComponents.add(new Button("Accept /tpahere: " + tpaHere, it -> { + tpaHere = !tpaHere; + it.text = "Accept /tpahere: " + tpaHere; + })); + subComponents.add(new Button("Send /tpahere (/tpahere)", text -> onChat("", new String[]{"tpahere"}))); + subComponents.add(new Button("Send /tpahere (/tpa)", text -> onChat("", new String[]{"here"}))); + subComponents.add(new Button("Send DM", text -> ChatUtils.print("§c§lUse " + TTCp.prefix + "team dm "))); + subComponents.add(new Button("Show list", text -> onChat("", new String[]{"list"}))); + } + + @Override + public void onSubTick() { + + } + + @Override + public void onChat(String s, String[] args) { + switch (args[0].toLowerCase()) { + case "add": + // Add a player to the team + names.remove(args[1]); + names.add(args[1]); + ChatUtils.print("Done!"); + break; + case "remove": + // Remove a player from the team + names.remove(args[1]); + ChatUtils.print("Done!"); + break; + case "settpa": + // Enable/Disable TPA for Team members + tpa = Boolean.parseBoolean(args[1]); + ChatUtils.print("Done!"); + break; + case "settpahere": + // Enable/Disable TPAHere for Team members + tpaHere = Boolean.parseBoolean(args[1]); + ChatUtils.print("Done!"); + break; + case "tpahere": + // Send /tpahere to everyone in the team + ChatUtils.print("Sending..."); + // This would stop the game if it wasn't in a separate thread + ThreadManager.run(() -> { + // Loop through all players + for (NetworkPlayerInfo info : Objects.requireNonNull(TTCp.mc.getConnection()).getPlayerInfoMap().toArray(new NetworkPlayerInfo[0])) { + // Is the player a team member? + if (names.contains(info.getGameProfile().getName())) { + try { + // Send to the player + TTCp.mc.player.sendChatMessage("/tpahere " + info.getGameProfile().getName()); + // Notify the user + ChatUtils.print("Sent to " + info.getGameProfile().getName()); + // I hate antispam + Thread.sleep(TPATools.getInstance().delay); + } + catch (Throwable ignore) { } + } + } + ChatUtils.print("Done!"); + }); + break; + case "here": + ChatUtils.print("Sending..."); + // This would stop the game if it wasn't in a separate thread + ThreadManager.run(() -> { + // Loop through all players + for (NetworkPlayerInfo info : Objects.requireNonNull(TTCp.mc.getConnection()).getPlayerInfoMap().toArray(new NetworkPlayerInfo[0])) { + // Is the player a team member? + if (names.contains(info.getGameProfile().getName())) { + try { + // Send to the player + TTCp.mc.player.sendChatMessage("/tell " + info.getGameProfile().getName() + " TTCp[0]"); + // Notify the user + ChatUtils.print("Sent to " + info.getGameProfile().getName()); + // I hate antispam + Thread.sleep(TPATools.getInstance().delay); + } + catch (Throwable ignore) { } + } + } + ChatUtils.print("Done!"); + }); + break; + case "go": + // This would stop the game if it wasn't in a separate thread + ThreadManager.run(() -> { + // Loop through all players + for (NetworkPlayerInfo info : Objects.requireNonNull(TTCp.mc.getConnection()).getPlayerInfoMap().toArray(new NetworkPlayerInfo[0])) { + // Is it the right team member + if (info.getGameProfile().getName().equals(args[1])) { + try { + // Send to the player + TTCp.mc.player.sendChatMessage("/tell " + info.getGameProfile().getName() + " TTCp[1]"); + } + catch (Throwable ignore) { } + } + } + ChatUtils.print("Sent!"); + }); + break; + case "dm": + ChatUtils.print("Sending..."); + // This would stop the game if it wasn't in a separate thread + ThreadManager.run(() -> { + // Loop through all players + for (NetworkPlayerInfo info : Objects.requireNonNull(TTCp.mc.getConnection()).getPlayerInfoMap().toArray(new NetworkPlayerInfo[0])) { + // Is the player a team member? + if (names.contains(info.getGameProfile().getName())) { + try { + // Send to the player + TTCp.mc.player.sendChatMessage("/tell " + info.getGameProfile().getName() + " " + s.substring("dm ".length())); + // Notify the user + ChatUtils.print("Sent to " + info.getGameProfile().getName()); + // I hate antispam + Thread.sleep(TPATools.getInstance().delay); + } + catch (Throwable ignore) { } + } + } + ChatUtils.print("Done!"); + }); + break; + case "settings": + // Print the member list and settings + ChatUtils.print("TPA: " + (tpa ? "enabled" : "disabled")); + ChatUtils.print("TPAhere: " + (tpaHere ? "enabled" : "disabled")); + case "list": + // Print the member list + StringBuilder toPrint = new StringBuilder("Team members: "); + for (String name : names) { + toPrint.append(name).append(", "); + } + if (names.size() >= 1) + toPrint.delete(toPrint.length() - 2, toPrint.length() - 1); + ChatUtils.print(toPrint.toString()); + break; + } + + // Updating stuff + updateBinds(); + } + + @Override + public boolean onServerChat(String s, String formatted) { + if (tpa && s.contains("has requested to teleport to you.") && names.stream().anyMatch(name -> s.startsWith(name + " ") || s.startsWith("~" + name + " "))) { + TTCp.player.sendChatMessage("/tpaccept"); + } + if (tpaHere && s.contains("has requested that you teleport to them.") && names.stream().anyMatch(name -> s.startsWith(name + " ") || s.startsWith("~" + name + " "))) { + TTCp.player.sendChatMessage("/tpaccept"); + } + + try { + // See if it is a DM from a Team member + String name = names.stream().filter( + theName -> + s.startsWith(theName + " whispers:") || + s.startsWith("~" + theName + " whispers:") || + s.startsWith(theName + " whispers to you:") || + s.startsWith("~" + theName + " whispers to you:") || + s.startsWith("From " + theName + ":") || + s.startsWith("From ~" + theName + ":") + ).iterator().next(); + if (name != null) { + String msg = s.split(": ")[1]; + if (msg.startsWith("TTCp")) { // Control codes from team members + if (msg.equals("TTCp[0]") && tpaHere) { + TTCp.player.sendChatMessage("/tpa " + name); + ChatUtils.print("Sent TPA to " + name + "."); + } + if (msg.equals("TTCp[1]") && tpa) { + TTCp.player.sendChatMessage("/tpahere " + name); + ChatUtils.print("Sent TPAHere to " + name + "."); + } + if (msg.equals("TTCp[3]")) { + ChatUtils.print("§c§lYou have been removed from the Team of " + name + "! \n" + + "§cRun ,team remove " + name + " to remove them as well!"); + } + // Cancel the display of the default message + return true; + } + + ChatUtils.print("§b§lDM from team member: §r<" + name + "> " + s.substring(s.indexOf(": ") + 2)); + // Cancel the display of the default message + return true; + } + // DM parsing of people outside the team + for (NetworkPlayerInfo info : Objects.requireNonNull(TTCp.mc.getConnection()).getPlayerInfoMap().toArray(new NetworkPlayerInfo[0])) { + String theName = info.getGameProfile().getName(); + // Is it a DM, if yes, is this the player it came from? + if (s.startsWith(theName + " whispers:") || + s.startsWith("~" + theName + " whispers:") || + s.startsWith(theName + " whispers to you:") || + s.startsWith("~" + theName + " whispers to you:") || + s.startsWith("From " + theName + ":") || + s.startsWith("From ~" + theName + ":")) { + try { + String msg = s.split(": ")[1]; + if (msg.startsWith("TTCp")) { // Control codes from non-members + if (msg.equals("TTCp[2]")) { + ChatUtils.print("§c§lYou have been added to the Team of " + theName + "! \n" + + "§cRun ,team add " + theName + " to add them as well!"); + } + // Cancel the display of the default message + return true; + } + } + catch (Throwable ignore) { } + } + } + } + catch (Exception ignore) { } + return false; + } + + @Override + public void onConfigLoad() { + updateBinds(); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/AutoCrystal.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/AutoCrystal.java new file mode 100644 index 0000000..b385ba9 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/AutoCrystal.java @@ -0,0 +1,428 @@ +package de.tudbut.mod.client.ttcp.mods.combat; + +import de.tudbut.type.Vector3d; +import net.minecraft.client.renderer.EntityRenderer; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityEnderCrystal; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.SPacketDestroyEntities; +import net.minecraft.network.play.server.SPacketExplosion; +import net.minecraft.network.play.server.SPacketSpawnObject; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import org.lwjgl.opengl.GL11; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.events.EventHandler; +import de.tudbut.mod.client.ttcp.events.ModuleEventRegistry; +import de.tudbut.mod.client.ttcp.utils.*; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Combat; +import de.tudbut.obj.DoubleTypedObject; +import de.tudbut.obj.Save; + +import java.awt.*; +import java.util.ArrayList; +import java.util.Arrays; + +import static de.tudbut.mod.client.ttcp.utils.AutoCrystalUtil.*; +import static de.tudbut.mod.client.ttcp.utils.Tesselator.*; + +@Combat +public class AutoCrystal extends Module { + + private static AutoCrystal instance; + + public static AutoCrystal getInstance() { + return instance; + } + + @Save + float crystalRange = 5; + @Save + float minDmg = 0, maxDmg = 3; + @Save + float selfDamageCostM = 2; + @Save + boolean render = true; + @Save + boolean sequential = false; + @Save + boolean fastBreak = true; + @Save + boolean predict = false; + @Save + int predictMargin = 2; + @Save + int maxChain = 10; + + int chain = 0; + float eidsPerSecond = 1; + int lastEIDUpdateEIDs = -1; + long lastEIDUpdate = System.currentTimeMillis(); + World lastWorld; + + EnumHand main = EnumHand.MAIN_HAND; + EntityLivingBase currentTarget; + ArrayList> ownCrystals = new ArrayList<>(); + + + { instance = this; } + + { + ModuleEventRegistry.disableOnNewPlayer.add(this); + } + + @Override + public void updateBinds() { + subComponents.clear(); + subComponents.add(Setting.createFloat(2, 10, "CrystalRange", this, "crystalRange")); + subComponents.add(Setting.createFloat(0, 20, "MinDamage", this, "minDmg")); + subComponents.add(Setting.createFloat(0.5f, 20, "MaxDamage", this, "maxDmg")); + subComponents.add(Setting.createFloat(0, 10, "SelfDmgCost", this, "selfDamageCostM")); + subComponents.add(Setting.createBoolean("Render", this, "render")); + subComponents.add(Setting.createBoolean("Sequential", this, "sequential")); + subComponents.add(Setting.createBoolean("FastBreak", this, "fastBreak")); + subComponents.add(Setting.createBoolean("Predict", this, "predict")); + subComponents.add(Setting.createInt(0, 40, "PredictMargin", this, "predictMargin")); + subComponents.add(Setting.createInt(0, 40, "MaxChainLength", this, "maxChain")); + + } + + @Override + public void onTick() { + placeCrystal(); + breakCrystal(); + } + + public void updateOwnCrystals() { + for (int i = 0; i < ownCrystals.size(); i++) { + if(System.currentTimeMillis() - ownCrystals.get(i).t > 2000) { + ownCrystals.remove(i--); + } + } + } + + public void eid(int eid) { + if(lastWorld != mc.world) { + lastEIDUpdate = System.currentTimeMillis(); + lastEIDUpdateEIDs = -1; + eidsPerSecond = 1; + currentTarget = null; + } + + long timePassed = System.currentTimeMillis() - lastEIDUpdate; + if(lastEIDUpdateEIDs == -1) + lastEIDUpdateEIDs = eid -1; + int addedEIDs = eid - lastEIDUpdateEIDs; + eidsPerSecond = (eidsPerSecond * 8f + addedEIDs) / (timePassed / 1000f); + lastEIDUpdate = System.currentTimeMillis(); + lastEIDUpdateEIDs = eid; + } + + private void remove(BlockPos pos) { + for (int i = 0; i < ownCrystals.size(); i++) { + if(ownCrystals.get(i).o.equals(pos.down())) { + ownCrystals.remove(i); + break; + } + } + } + + @Override + public boolean onPacket(Packet packet) { + + // Phobos calls it "Predict", but it doesn't actually predict anything lmao + if(packet instanceof SPacketSpawnObject && ((SPacketSpawnObject) packet).getType() == 51) { + SPacketSpawnObject spawner = ((SPacketSpawnObject) packet); + System.out.println("XX"); + if(fastBreak) { + Vec3d vec = new Vec3d(spawner.getX(), spawner.getY(), spawner.getZ()); + if ( + isCrystalInRange(spawner.getX(), spawner.getY(), spawner.getZ()) && + getCostForPlacement(currentTarget, ((int) Math.floor(spawner.getX())), ((int) Math.floor(spawner.getY())), ((int) Math.floor(spawner.getZ()))) < 0 + ) { + hitCrystal(spawner.getEntityID(), vec); + if(++chain >= maxChain) { + return false; + } + BlockPos pos = BlockUtils.getRealPos(vec); + if (ensureCrystalsSelected()) + return false; + ownCrystals.add(new DoubleTypedObject<>(pos.down(), System.currentTimeMillis())); + BlockUtils.clickOnBlock(pos.down(), main); + // This one actually does predict. + if (predict) { + int eid = Math.round(spawner.getEntityID() + eidsPerSecond * (EventHandler.ping[0]) / 1000f); + for (int i = -predictMargin; i <= predictMargin; i++) { + player.connection.sendPacket(createAttackPacket(eid + i)); + } + } + } + } + } + if(packet instanceof SPacketDestroyEntities) { + SPacketDestroyEntities remover = ((SPacketDestroyEntities) packet); + int[] ids = remover.getEntityIDs(); + for (int i = 0; i < ids.length; i++) { + notifyEntityDeath(ids[i]); + } + } + + return packet instanceof SPacketExplosion; + } + + private boolean ensureCrystalsSelected() { + return player.getHeldItemMainhand().getItem() != Items.END_CRYSTAL; + } + + private void notifyEntityDeath(int id) { + Entity entity; + if((entity = mc.world.getEntityByID(id)) instanceof EntityEnderCrystal) { + remove(BlockUtils.getRealPos(entity.getPositionVector())); + } + } + + public BlockPos findBestPos(EntityLivingBase toAttack) { + BlockPos best = null; + float bestCost = Float.POSITIVE_INFINITY; + + for (int ix = (int) Math.floor(-crystalRange); ix <= (int) Math.ceil(crystalRange); ix++) { + for (int iy = (int) Math.floor(-crystalRange); iy <= (int) Math.ceil(crystalRange); iy++) { + for (int iz = (int) Math.floor(-crystalRange); iz <= (int) Math.ceil(crystalRange); iz++) { + double x = ix + player.posX, y = iy + player.posY, z = iz + player.posZ; + BlockPos pos = new BlockPos(x,y,z); + if(canPlace(pos, crystalRange)) { + float cost = getCostForPlacement(toAttack, pos.getX(), pos.up().getY(), pos.getZ()); + + if(cost == Float.POSITIVE_INFINITY) + continue; + if (cost < bestCost) { + best = pos; + bestCost = cost; + } + } + } + } + } + + return best; + } + + public void findTarget() { + if(currentTarget == null || currentTarget.getHealth() == 0) { + EntityLivingBase best = null; + float bestStat = Float.NEGATIVE_INFINITY; + for (int i = 0; i < mc.world.loadedEntityList.size(); i++) { + Entity e = mc.world.loadedEntityList.get(i); + if(e instanceof EntityLivingBase) { + EntityLivingBase entity = ((EntityLivingBase) e); + float stat = + entity.getHealth() + + entity.getAbsorptionAmount() + + entity.getTotalArmorValue() - + entity.getDistance(player) * 20; + if(entity instanceof EntityPlayer) { + stat *= 100; + } + if(Arrays.stream(Utils.getAllies()).noneMatch(ally -> ally.equals(entity))) { + if (stat > bestStat) { + best = entity; + bestStat = stat; + } + } + } + } + currentTarget = best; + if(best != null) + ChatUtils.print("New target: " + best + " at " + bestStat); + } + } + + public void placeCrystal() { + + if(lastWorld != mc.world) { + lastEIDUpdate = System.currentTimeMillis(); + lastEIDUpdateEIDs = -1; + eidsPerSecond = 1; + currentTarget = null; + lastWorld = mc.world; + } + + findTarget(); + if(currentTarget == null) + return; + if(ensureCrystalsSelected()) + return; + BlockPos pos = findBestPos(currentTarget); + updateOwnCrystals(); + if(sequential && ownCrystals.size() != 0) + return; + if(pos != null) { + ownCrystals.add(new DoubleTypedObject<>(pos, System.currentTimeMillis())); + BlockUtils.clickOnBlock(pos, main); + chain = 0; + } + } + + public void breakCrystal() { + for (int i = 0; i < mc.world.loadedEntityList.size(); i++) { + Entity e = mc.world.loadedEntityList.get(i); + if (e instanceof EntityEnderCrystal) { + if(ownCrystals.stream().anyMatch(c -> c.o.equals(BlockUtils.getRealPos(e.getPositionVector()).down()))) { + hitCrystal(e.getEntityId(), e.getPositionVector()); + remove(BlockUtils.getRealPos(e.getPositionVector())); + } + } + } + } + + private void hitCrystal(int entityID, Vec3d pos) { + Utils.setRotation(createRotations(createBB(pos))); + player.connection.sendPacket(createAttackPacket(entityID)); + player.swingArm(main); + } + + private boolean isCrystalInRange(double x, double y, double z) { + return player.getPositionEyes(1).distanceTo(new Vec3d(x,y,z)) <= crystalRange; + } + + public float getCostForPlacement(EntityLivingBase entityOther, int x, int y, int z) { + float g = getExplosionCost(player, x, y, z); + float h = getExplosionCost(entityOther, x, y, z); + + System.out.println(g); + if(h < minDmg || (g > maxDmg && maxDmg != -1)) { + return Float.POSITIVE_INFINITY; + } + + return g * selfDamageCostM - h; + } + + @Override + public void onChat(String s, String[] args) { + + } + + @Override + public int danger() { + return 3; + } + + public void selectObby() { + + } + + public enum State { + IDLE, + ATTACK, + BREAK, + FACEPLACE, + + ; + } + + Vec3d pos = new Vec3d(0,0,0); + + @SubscribeEvent + public void onRender(RenderWorldLastEvent event) { + try { + if (this.enabled && TTCp.isIngame() && render) { + Entity e = TTCp.mc.getRenderViewEntity(); + assert e != null; + pos = e.getPositionEyes(event.getPartialTicks()).add(0, -e.getEyeHeight(), 0); + + EntityEnderCrystal[] crystals = TTCp.world.getEntities(EntityEnderCrystal.class, ent -> ent.getDistance(TTCp.player) < crystalRange * 5).toArray(new EntityEnderCrystal[0]); + + for (int i = 0 ; i < crystals.length ; i++) { + BlockPos bp = BlockUtils.getRealPos(crystals[i].getPositionVector()); + float dmg = getExplosionCost(TTCp.player, bp.getX(), bp.getY(), bp.getZ()); + + float f1 = Color.RGBtoHSB(255,0,255, null)[0]-1; + float f2 = Color.RGBtoHSB(0,255,0, null)[0]; + float hue = f2 + (f1 - f2) * Math.min(dmg / 20f, 1); + int color = 0xff000000 | Color.HSBtoRGB(hue, 1, 1); + + drawAroundBlock(new Vector3d(bp.getX() + 0.5, bp.getY(), bp.getZ() + 0.5), color); + depth(false); + EntityRenderer.drawNameplate(mc.fontRenderer, dmg + "", (float)(-pos.x + bp.getX() + 0.5), (float)(-pos.y + bp.getY() + 0.66), (float)(-pos.z + bp.getZ() + 0.5), 0, player.rotationYaw, player.rotationPitch, false, false); + depth(true); + } + + for (int i = 0 ; i < ownCrystals.size() ; i++) { + BlockPos pos = ownCrystals.get(i).o; + drawAroundBlock(new Vector3d(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5), 0x808080ff); + } + } + } catch (NullPointerException ignored) { } + } + + public void drawAroundBlock(Vector3d pos, int color) { + try { + + ready(); + translate(-this.pos.x, -this.pos.y, -this.pos.z); + color(color); + depth(false); + begin(GL11.GL_QUADS); + + + // bottom + put(pos.getX() - 0.5, pos.getY() - 0.01, pos.getZ() + 0.5); + put(pos.getX() + 0.5, pos.getY() - 0.01, pos.getZ() + 0.5); + put(pos.getX() + 0.5, pos.getY() - 0.01, pos.getZ() - 0.5); + put(pos.getX() - 0.5, pos.getY() - 0.01, pos.getZ() - 0.5); + + next(); + + /* + // top + put(pos.getX() - 0.5, pos.getY() + 1.01, pos.getZ() + 0.5); + put(pos.getX() + 0.5, pos.getY() + 1.01, pos.getZ() + 0.5); + put(pos.getX() + 0.5, pos.getY() + 1.01, pos.getZ() - 0.5); + put(pos.getX() - 0.5, pos.getY() + 1.01, pos.getZ() - 0.5); + + next(); + + // z - + put(pos.getX() - 0.5, pos.getY() + 1.01, pos.getZ() - 0.5); + put(pos.getX() + 0.5, pos.getY() + 1.01, pos.getZ() - 0.5); + put(pos.getX() + 0.5, pos.getY() - 0.01, pos.getZ() - 0.5); + put(pos.getX() - 0.5, pos.getY() - 0.01, pos.getZ() - 0.5); + + next(); + + // z + + put(pos.getX() - 0.5, pos.getY() + 1.01, pos.getZ() + 0.5); + put(pos.getX() + 0.5, pos.getY() + 1.01, pos.getZ() + 0.5); + put(pos.getX() + 0.5, pos.getY() - 0.01, pos.getZ() + 0.5); + put(pos.getX() - 0.5, pos.getY() - 0.01, pos.getZ() + 0.5); + + next(); + + // x - + put(pos.getX() - 0.5, pos.getY() + 1.01, pos.getZ() - 0.5); + put(pos.getX() - 0.5, pos.getY() + 1.01, pos.getZ() + 0.5); + put(pos.getX() - 0.5, pos.getY() - 0.01, pos.getZ() + 0.5); + put(pos.getX() - 0.5, pos.getY() - 0.01, pos.getZ() - 0.5); + + next(); + + // x + + put(pos.getX() + 0.5, pos.getY() + 1.01, pos.getZ() - 0.5); + put(pos.getX() + 0.5, pos.getY() + 1.01, pos.getZ() + 0.5); + put(pos.getX() + 0.5, pos.getY() - 0.01, pos.getZ() + 0.5); + put(pos.getX() + 0.5, pos.getY() - 0.01, pos.getZ() - 0.5);*/ + + end(); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/AutoCrystalRewrite.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/AutoCrystalRewrite.java new file mode 100644 index 0000000..ad1b726 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/AutoCrystalRewrite.java @@ -0,0 +1,34 @@ +package de.tudbut.mod.client.ttcp.mods.combat; + +import net.minecraft.entity.item.EntityEnderCrystal; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.SPacketSoundEffect; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Combat; + +/** + * @author TudbuT + * @since 25 Oct 2021 + */ + +@Combat +public class AutoCrystalRewrite extends Module { + + @Override + public void onTick() { + } + + @Override + public boolean onPacket(Packet packet) { + if (packet instanceof SPacketSoundEffect) { + SPacketSoundEffect effect = (SPacketSoundEffect) packet; + mc.world.loadedEntityList + .stream() + .filter(x -> x instanceof EntityEnderCrystal) + .filter(x -> x.getDistanceSq(effect.getX(), effect.getY(), effect.getZ()) < 1) + .forEach(x -> mc.world.removeEntity(x)); + } + return false; + } + +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/AutoTotem.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/AutoTotem.java new file mode 100644 index 0000000..d02d326 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/AutoTotem.java @@ -0,0 +1,534 @@ +package de.tudbut.mod.client.ttcp.mods.combat; + +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.gui.inventory.GuiContainerCreative; +import net.minecraft.client.gui.inventory.GuiInventory; +import net.minecraft.init.Items; +import net.minecraft.inventory.ClickType; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumHandSide; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.events.EventHandler; +import de.tudbut.mod.client.ttcp.gui.GuiTTCIngame; +import de.tudbut.mod.client.ttcp.gui.lib.component.Button; +import de.tudbut.mod.client.ttcp.mods.rendering.Notifications; +import de.tudbut.mod.client.ttcp.utils.*; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Combat; +import de.tudbut.obj.Save; +import de.tudbut.tools.Lock; +import de.tudbut.tools.ThreadPool; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; + +@Combat +public class AutoTotem extends Module { + + public static AutoTotem instance; + + public static DebugProfilerAdapter profiler = new DebugProfilerAdapter("AutoTotem", "idle"); + static { + TTCp.registerProfiler(profiler); + } + + // Actual count, set by AI + public int minCount = 0; + // PrepCount, set by user + @Save + public int prepCount = 2; + // Count, set by user + @Save + public int origMinCount = 0; + // If the user seems to be restocking after respawning, if this is the case, + // don't switch until any inventories are closed + public boolean isRestockingAfterRespawn = false; + // If totems should be stacked automatically + @Save + public boolean autoStack = false; + // If the AutoStack should always run, regardless of the count + private boolean autoStackIgnoreCount = false; + // Use pop prediction + @Save + public boolean pingPredict = false; + @Save + public int sdelay = 0, pdelay = 0, cdelay = 0, ldelay = 500; + @Save + public boolean legacy = true; + + public int swapProgress = 0; + public int countSwapped = 0; + public int countSwappedAt; + public long lastSwap = 0; + + public int fullCount = 0; + + public boolean[] slotsUsed = new boolean[45]; + public int[] slotsUsedAtCounts = new int[45]; + public long[] slotsUsedAtTime = new long[45]; + { + Arrays.fill(slotsUsedAtCounts, Integer.MAX_VALUE); + Arrays.fill(slotsUsedAtCounts, 0); + } + + Lock swapLock = new Lock(); + ThreadPool swapThread = new ThreadPool(1, "Swap thread", true); + + // Panic mode, switch to totems instantly! + public boolean panic = false; + + private boolean noTotems = true; + + public void renderTotems() { + if(fullCount != 0) { + ScaledResolution res = new ScaledResolution(mc); + int y = res.getScaledHeight() - 16 * 2 - 3 - 8; + int x; + if (player.getPrimaryHand() != EnumHandSide.LEFT) + x = res.getScaledWidth() / 2 - 91 - 26; + else + x = res.getScaledWidth() / 2 + 91 + 10; + + GuiTTCIngame.drawOffhandSlot(x-3,y-3); + GuiTTCIngame.drawItem(x, y, 1, player, new ItemStack(Items.TOTEM_OF_UNDYING, fullCount)); + } + } + + public int getTotemCount() { + return InventoryUtils.getItemAmount(player.inventoryContainer, Items.TOTEM_OF_UNDYING); + } + + public void panic() { + // Enable panic + panic = true; + // Tick panic + doSwitch(true); + // Disable panic + panic = false; + } + + public AutoTotem() { + instance = this; + } + + public static AutoTotem getInstance() { + return instance; + } + + public void updateBinds() { + subComponents.clear(); + subComponents.add(Setting.createInt(0, 12, "PrepCount", this, "prepCount")); + subComponents.add(Setting.createInt(0, 12, "Count", this, "origMinCount", () -> { + updateTotCount(); + updateBinds(); + })); + subComponents.add(Setting.createBoolean("AutoStack (WIP)", this, "autoStack")); + subComponents.add(Setting.createBoolean("PingPredict", this, "pingPredict")); + subComponents.add(Setting.createInt(0, 500, "SwitchDelay", this, "sdelay")); + subComponents.add(Setting.createInt(0, 500, "PostDelay", this, "pdelay")); + subComponents.add(Setting.createInt(0, 5000, "CooldownDelay", this, "cdelay")); + subComponents.add(Setting.createInt(0, 1000, "LockDelay", this, "ldelay")); + subComponents.add(Setting.createBoolean("Fast mode", this, "legacy")); + subComponents.add(new Button("AutoStack now", it -> { + autoStackIgnoreCount = true; + autoStack(); + autoStackIgnoreCount = false; + })); + subComponents.add(new Button("Actual count: " + minCount, it -> { })); + customKeyBinds.setIfNull("panic", new KeyBind(null, this + "::panic", true)); + subComponents.add(Setting.createKey("Panic", customKeyBinds.get("panic"))); + } + + public void doSwitch(boolean takeMax) { + // Switch! + + KillAura.getInstance().noSwitch = true; + ItemStack stack = player.inventory.getStackInSlot(InventoryUtils.OFFHAND_SLOT); + + profiler.next("Switch.GetSlot"); + Integer slot = null; + if(takeMax) { + int biggestCount = 0; + int slotNum = -1; + for (int i = 0 ; i < 5 * 9 ; i++) { + ItemStack itemStack = player.inventoryContainer.getInventory().get(i); + if(itemStack.getItem().equals(Items.TOTEM_OF_UNDYING)) { + if(itemStack.getCount() > biggestCount) { + slotNum = i; + biggestCount = itemStack.getCount(); + } + } + } + if(slotNum != -1 && slotNum != InventoryUtils.OFFHAND_SLOT) + slot = slotNum; + } + else { + slot = InventoryUtils.getSlotWithItem( + player.inventoryContainer, + Items.TOTEM_OF_UNDYING, + getUnusableSlots(), + minCount + 1, + 64 + ); + } + if (slot == null) { + profiler.next("Switch.NotifyEmpty"); + if (!noTotems) + Notifications.add(new Notifications.Notification("No more totems! Couldn't switch!")); + noTotems = true; + profiler.next("idle"); + return; // Oh no!! No totems left! + } + else + noTotems = false; + + slotsUsed[slot] = true; + + swapLock.lock(2000); + int finalSlot = slot; + swapThread.run(() -> { + if(legacy) { + profiler.next("Switch.Notify"); + Notifications.add(new Notifications.Notification("Switching to next TotemStack...")); + // Switch a new totem stack to the offhand + profiler.next("Switch.Swap"); + InventoryUtils.inventorySwap(finalSlot, InventoryUtils.OFFHAND_SLOT, sdelay, pdelay, cdelay); + swapLock.lock(ldelay); + profiler.next("Switch.Notify"); + Notifications.add(new Notifications.Notification("Switched to next TotemStack")); + } + else { + swapProgress = 1; + countSwappedAt = stack.getCount(); + countSwapped = TTCp.player.inventory.getStackInSlot(finalSlot).getCount(); + slotsUsedAtTime[finalSlot] = System.currentTimeMillis(); + lastSwap = System.currentTimeMillis(); + profiler.next("Switch.Notify"); + Notifications.add(new Notifications.Notification("Switching to next TotemStack...")); + // Switch a new totem stack to the offhand + profiler.next("Switch.Swap"); + InventoryUtils.inventorySwap(finalSlot, InventoryUtils.OFFHAND_SLOT, sdelay, pdelay, cdelay); + swapLock.lock(ldelay); + profiler.next("Switch.Notify"); + Notifications.add(new Notifications.Notification("Switched to next TotemStack")); + swapProgress = 2; + } + KillAura.getInstance().noSwitch = false; + }); + } + + @Override + public void onEverySubTick() { + if (TTCp.isIngame()) { + fullCount = getTotemCount(); + } + } + + @Override + public void onTick() { + if(TTCp.isIngame()) { + if (noTotems || minCount != origMinCount) + updateTotCount(); + } + } + + // Run checks and AI + @Override + public void onSubTick() { + if (TTCp.isIngame()) { + + if (!swapLock.isLocked() || panic) { + EntityPlayerSP player = TTCp.player; + + + profiler.next("RestockCheck"); + if ((isRestockingAfterRespawn() || isRestockingAfterRespawn)) { + // Don't switch yet + return; + } + + // Run AI + if (noTotems || minCount != origMinCount) { + profiler.next("TotCountUpdate"); + reindex(); + swapLock.unlock(); + swapProgress = 0; + } + profiler.next("AutoStack"); + if (autoStack) + autoStack(); + + profiler.next("Check"); + ItemStack stack = player.getHeldItemOffhand(); + if(!legacy) { + if (swapProgress == 2 || lastSwap <= System.currentTimeMillis() - 2000) { + PopCount.Counter counter = TTCp.getModule(PopCount.class).counters.get(TTCp.player); + if (stack.getCount() < countSwapped && stack.getCount() > Math.max(countSwappedAt, minCount) || lastSwap <= System.currentTimeMillis() - 2000) { + swapProgress = 0; + reindex(); + } + } + } + KillAura.getInstance().noSwitch = stack.getCount() <= prepCount + minCount; + if ( + ( + panic || + (stack.getCount() <= minCount) || + (checkPingPop() && (stack.getCount() <= (minCount + 1))) + ) && (swapProgress == 0 || legacy) + ) { + doSwitch(false); + } + } + } + profiler.next("idle"); + } + + public void reindex() { + // TODO: This is stupid, i need to remake this! + + for (int i = 0 ; i < slotsUsed.length ; i++) { + ItemStack stack = player.inventory.getStackInSlot(i); + slotsUsedAtCounts[i] = Math.min(stack.getCount(), slotsUsedAtCounts[i]); + if(stack.getItem() == Items.TOTEM_OF_UNDYING && stack.getCount() > slotsUsedAtCounts[i] && slotsUsed[i] && slotsUsedAtTime[i] < System.currentTimeMillis() - 5000) { + slotsUsedAtCounts[i] = stack.getCount(); + slotsUsed[i] = false; + } + } + } + + private int[] getUnusableSlots() { + reindex(); + ArrayList slots = new ArrayList<>(Collections.singletonList(InventoryUtils.OFFHAND_SLOT)); + + for (int i = 0 ; i < slotsUsed.length ; i++) { + if(slotsUsed[i]) + slots.add(i); + } + + int[] theSlots = new int[slots.size()]; + for (int i = 0 ; i < theSlots.length ; i++) { + theSlots[i] = slots.get(i); + } + return theSlots; + } + + private boolean checkPingPop() { + if(!pingPredict || minCount == 0) + return false; + PopCount popCount = TTCp.getModule(PopCount.class); + PopCount.Counter counter = popCount.counters.get(TTCp.player); + if(counter != null && counter.isPopping()) { + long d = counter.predictNextPopDelay(); + return d <= Math.max(EventHandler.ping[0], 0); + } + return false; + } + + // Tests if the player is likely to be restocking after having a empty inventory, + // does NOT check for a respawn, but very likely will only be true after a respawn! + public boolean isRestockingAfterRespawn() { + EntityPlayerSP player = TTCp.player; + + // Set false if the container was closed, this will make it start switching again + GuiScreen screen = TTCp.mc.currentScreen; + if ( + !( + screen instanceof GuiContainer && !( + screen instanceof GuiInventory || + screen instanceof GuiContainerCreative + ) + ) + ) { + isRestockingAfterRespawn = false; + return false; + } + + // Any slot with totems + Integer slot0 = InventoryUtils.getSlotWithItem( + player.inventoryContainer, + Items.TOTEM_OF_UNDYING, + new int[]{}, + 1, + 64 + ); + // No totems, return true + if (slot0 == null) { + isRestockingAfterRespawn = true; + return true; + } + // Any slot with totems excluding slot0 + Integer slot1 = InventoryUtils.getSlotWithItem( + player.inventoryContainer, + Items.TOTEM_OF_UNDYING, + new int[]{slot0}, + 1, + 64 + ); + // Only one stack of totems, return true + if (slot1 == null) { + isRestockingAfterRespawn = true; + return true; + } + + // There is two or more stacks, return false, seems normal + return false; + } + + // AI, finds out the amount to switch at, looks for lowest amount of totems in inventory + public void updateTotCount() { + EntityPlayerSP player = TTCp.player; + Integer i; + + slotsUsed = new boolean[45]; + slotsUsedAtCounts = new int[45]; + slotsUsedAtTime = new long[45]; + + int x = minCount; + minCount = origMinCount; + + // Look for a stack of the AI-set count + i = InventoryUtils.getSlotWithItem( + player.inventoryContainer, + Items.TOTEM_OF_UNDYING, + new int[]{InventoryUtils.OFFHAND_SLOT}, + minCount + 1, + 64 + ); + // If it doesnt exist, step down the count until a stack exist or the count hits 0 + while (i == null) { + // Step down + minCount--; + // Check + i = InventoryUtils.getSlotWithItem( + player.inventoryContainer, + Items.TOTEM_OF_UNDYING, + new int[]{InventoryUtils.OFFHAND_SLOT}, + minCount + 1, + 64 + ); + + if (minCount < 0) { + // No stacks left + minCount = 0; + break; + } + } + + + // Found! + if(minCount != x) + updateBinds(); + } + + public void autoStack() { + + if(minCount == 0) + return; + + EntityPlayerSP player = TTCp.player; + ArrayList slots = new ArrayList<>(); + // The minimal amount that is required to stack totems + int min = 2; + // Only restack when totems are likely not a normal stack + int max = 24; + // TMP variable + Integer slot; + + // Runs 50 times + for (int i = 0; i < 50; i++) { + + // Drop unusable stacks + ArrayList dropped = new ArrayList<>(); + if (slots.size() != 0) { + + for (int j = 0; j < 100; j++) { + // Next + slot = InventoryUtils.getSlotWithItem( + player.inventoryContainer, + Items.TOTEM_OF_UNDYING, + Utils.objectArrayToNativeArray(dropped.toArray(new Integer[0])), + 0, + min - 1 + ); + + if (slot == null) + break; + + // Drop stack contents of the slot + InventoryUtils.drop(slot); + System.out.println("Dropped item in " + slot); + dropped.add(slot); + } + + } + + if(origMinCount == minCount && !autoStackIgnoreCount) + return; + + + // Get slots with totems + slots.clear(); + for (int j = 0; j < 100; j++) { + slot = InventoryUtils.getSlotWithItem( + player.inventoryContainer, + Items.TOTEM_OF_UNDYING, + Utils.objectArrayToNativeArray(slots.toArray(new Integer[0])), + min, + max + ); + if(slot == null) + break; + + slots.add(slot); + } + + // Combine totems + while (slots.size() >= 2) { + // Get empty slot + slot = InventoryUtils.getSlotWithItem(player.inventoryContainer, Items.AIR, 0); + if (slot == null) { + InventoryUtils.drop(slots.get(0)); + slots.remove(0); + continue; + } + System.out.println("Combining " + slots.get(0) + " and " + slots.get(1) + " to " + slot); + // Pick first stack + InventoryUtils.clickSlot(slots.get(0), ClickType.PICKUP, 0); + // Pick second stack + InventoryUtils.clickSlot(slots.get(1), ClickType.PICKUP, 0); + // Put result in empty slot + InventoryUtils.clickSlot(slot, ClickType.PICKUP, 0); + // Drop junk + InventoryUtils.drop(slots.get(1)); + + slots.remove(0); + slots.remove(0); + } + } + } + + @Override + public void onChat(String s, String[] args) { + if (s.startsWith("count ")) + try { + origMinCount = minCount = Integer.parseInt(s.substring("count ".length())); + ChatUtils.print("Set!"); + } + catch (Exception e) { + ChatUtils.print("ERROR: NaN"); + } + if(s.startsWith("debug")) + ChatUtils.print(profiler.getTempResults().toString()); + updateBinds(); + } + + @Override + public void onConfigLoad() { + updateBinds(); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/HitCorrection.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/HitCorrection.java new file mode 100644 index 0000000..145a48d --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/HitCorrection.java @@ -0,0 +1,34 @@ +package de.tudbut.mod.client.ttcp.mods.combat; + +import net.minecraft.entity.EntityLivingBase; +import de.tudbut.mod.client.ttcp.gui.lib.component.Slider; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.Utils; +import de.tudbut.mod.client.ttcp.utils.category.Combat; +import de.tudbut.obj.Save; + +import java.lang.reflect.Field; + +@Combat +public class HitCorrection extends Module { + + @Save + public static float amount; + + @Override + public void updateBinds() { + subComponents.clear(); + subComponents.add(new Slider("Amount", this, "amount", f -> String.valueOf(Math.round(f * 100) / 100f), 5, 0)); + } + + @Override + public void onTick() { + try { + Field ticksSinceLastSwing = EntityLivingBase.class.getDeclaredField(Utils.getFieldsForType(EntityLivingBase.class, int.class)[5]); + ticksSinceLastSwing.setAccessible(true); + ticksSinceLastSwing.setInt(mc.player, 100); + } catch (NoSuchFieldException | IllegalAccessException e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/HopperAura.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/HopperAura.java new file mode 100644 index 0000000..db638c7 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/HopperAura.java @@ -0,0 +1,522 @@ +package de.tudbut.mod.client.ttcp.mods.combat; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.ClickType; +import net.minecraft.inventory.Container; +import net.minecraft.inventory.ContainerHopper; +import net.minecraft.inventory.Slot; +import net.minecraft.network.play.client.CPacketCloseWindow; +import net.minecraft.network.play.client.CPacketEntityAction; +import net.minecraft.network.play.client.CPacketPlayerDigging; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import org.lwjgl.input.Keyboard; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.gui.GuiPlayerSelect; +import de.tudbut.mod.client.ttcp.gui.lib.component.Button; +import de.tudbut.mod.client.ttcp.mods.command.Friend; +import de.tudbut.mod.client.ttcp.mods.chat.Team; +import de.tudbut.mod.client.ttcp.mods.misc.AltControl; +import de.tudbut.mod.client.ttcp.mods.rendering.PlayerSelector; +import de.tudbut.mod.client.ttcp.mods.rendering.Notifications; +import de.tudbut.mod.client.ttcp.utils.*; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Combat; +import de.tudbut.obj.DoubleTypedObject; +import de.tudbut.obj.Save; +import de.tudbut.parsing.TudSort; +import de.tudbut.tools.Lock; +import de.tudbut.tools.Queue; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +@Combat +public class HopperAura extends Module { + @Save + int delay = 300; + @Save + int randomDelay = 0; + @Save + public int attack = 0; + @Save + boolean threadMode = false; + @Save + boolean swing = true; + @Save + boolean superAttack = false; + @Save + boolean batch = false; + boolean cBatch = false; + @Save + boolean tpsSync = false; + @Save + int iterations = 1; + @Save + int iterationDelay = 0; + Lock switchTimer = new Lock(); + + BlockPos currentHopper = null; + Container hopper = null; + public static State state = State.WAITING; + + public enum State { + PLACING, + ATTACKING, + REPLACING, + OPENING, + WAITING, + IDLE, + ; + } + + static boolean paused = false; + static boolean hopperNeedsOpening = false; + static boolean guiNeedsClosing = false; + Lock placeLock = new Lock(); + Lock closeLock = new Lock(); + Lock emptyLock = new Lock(); + boolean empty = false; + ArrayList validHoppers = new ArrayList<>(); + ArrayList> digging = new ArrayList<>(); + + public static void pause() { + paused = true; + instance.reloadHopper(); + } + + public static void resume() { + paused = false; + instance.reloadHopper(); + } + + public enum SwitchType { + HOTBAR, + SWAP, + ; + } + + public void reloadHopper() { + if(enabled) { + if (currentHopper == null) { + hopperNeedsOpening = createHopper(); + emptyLock.unlock(); + empty = false; + } + else if ((!(player.openContainer instanceof ContainerHopper) && !hopperNeedsOpening) || (player.getPositionEyes(0).distanceTo(new Vec3d(currentHopper).add(.5,.5,.5)) >= 4)) { + if (mc.world.getBlockState(currentHopper).getBlock() == Blocks.HOPPER && player.getPositionEyes(0).distanceTo(new Vec3d(currentHopper).add(.5,.5,.5)) < 4) { + ChatUtils.print("§aReopening hopper"); + hopper = null; + openHopper(currentHopper); + emptyLock.unlock(); + empty = false; + } + else { + ChatUtils.print("§aPrevious hopper unusable, removing"); + hopper = null; + currentHopper = null; + } + } + } + } + + private void openHopper(BlockPos theHopper) { + state = State.OPENING; + mc.player.connection.sendPacket(new CPacketEntityAction(player, CPacketEntityAction.Action.STOP_SNEAKING)); + player.setSneaking(false); + mc.player.connection.sendPacket(new CPacketEntityAction(player, CPacketEntityAction.Action.STOP_SNEAKING)); + player.setSneaking(false); + BlockUtils.clickOnBlock(theHopper, EnumHand.MAIN_HAND); + guiNeedsClosing = true; + state = State.WAITING; + } + + private BlockPos getBestHopperPos() { + state = State.PLACING; + if (Notifications.getNotifications().stream().noneMatch(notification -> notification.text.equals("Trying to place new hopper"))) { + Notifications.add(new Notifications.Notification("Trying to place new hopper", 1000)); + } + BlockPos p = BlockUtils.getRealPos(player.getPositionVector()); + ArrayList possible = new ArrayList<>(); + for (int z = -3 ; z <= 3 ; z++) { + for (int y = -2 ; y <= 3 ; y++) { + for (int x = -3 ; x <= 3 ; x++) { + int + ix = p.getX() + x, + iy = p.getY() + y, + iz = p.getZ() + z; + BlockPos pos = new BlockPos(ix,iy,iz); + if(mc.world.getBlockState(pos).getMaterial().isReplaceable() && player.getPositionEyes(0).distanceTo(new Vec3d(pos).add(.5, .5, .5)) < 3) { + if(mc.world.getBlockState(pos.up()).getMaterial().isReplaceable() && player.getPositionEyes(0).distanceTo(new Vec3d(pos.up()).add(.5, .5, .5)) < 3) { + if( + BlockUtils.getPossibleSides(pos).size() >= 1 && + mc.world.playerEntities.stream().noneMatch( + entityPlayer -> + entityPlayer.getEntityBoundingBox().intersects(new AxisAlignedBB(pos)) || + entityPlayer.getEntityBoundingBox().intersects(new AxisAlignedBB(pos.up())) + ) + ) + possible.add(pos); + } + } + } + } + } + if(possible.size() == 0) { + ChatUtils.print("Can't find a suitable position"); + return null; + } + return TudSort.sort(possible.toArray(new BlockPos[0]), blockPos -> { + List playerEntities = mc.world.playerEntities; + double d = 0; + for (int i = 0, playerEntitiesSize = playerEntities.size() ; i < playerEntitiesSize ; i++) { + EntityPlayer aPlayer = playerEntities.get(i); + if(aPlayer == player || Arrays.stream(Utils.getAllies()).anyMatch(player -> player == aPlayer)) + d -= BlockUtils.getRealPos(aPlayer.getPositionVector()).distanceSq(blockPos) / 2; + else + d += BlockUtils.getRealPos(aPlayer.getPositionVector()).distanceSq(blockPos); + } + return (long) (d * 100); + })[0]; + } + + private boolean createHopper() { + state = State.PLACING; + currentHopper = null; + if(validHoppers.size() > 0) { + for (int i = 0 ; i < validHoppers.size() ; i++) { + BlockPos pos = validHoppers.get(i); + if (mc.world.getBlockState(pos).getBlock() == Blocks.HOPPER) { + if (player.getPositionEyes(0).distanceTo(new Vec3d(pos).add(.5, .5, .5)) < 3) { + ChatUtils.print("§aReusing a hopper"); + placeLock.lock(1000); + hopper = null; + currentHopper = pos; + openHopper(currentHopper); + return true; + } + } + else { + validHoppers.remove(i--); + /*DoubleTypedObject dig; + digging.add(dig = new DoubleTypedObject<>(pos, new Lock())); + dig.t.lock(20000); + player.connection.sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.Action.START_DESTROY_BLOCK, pos, EnumFacing.UP));*/ + } + } + } + BlockPos found = getBestHopperPos(); + if(found != null) { + Integer slot0 = InventoryUtils.getSlotWithItem(player.inventoryContainer, Blocks.HOPPER, new int[0], 1, 64); + Integer slot1 = InventoryUtils.getSlotWithItem(player.inventoryContainer, Blocks.BLACK_SHULKER_BOX, new int[0], 1, 64); + if(slot0 != null && slot1 != null) { + currentHopper = found; + validHoppers.add(currentHopper); + + // Do stuff + if(hopper != null) { + player.connection.sendPacket(new CPacketCloseWindow(hopper.windowId)); + hopper = null; + } + mc.playerController.windowClick(player.inventoryContainer.windowId, slot0, InventoryUtils.getCurrentSlot(), ClickType.SWAP, player); + BlockUtils.placeBlock(found, EnumHand.MAIN_HAND, true, true); + BlockUtils.placeBlock(found, EnumHand.MAIN_HAND, true, false); + mc.player.connection.sendPacket(new CPacketEntityAction(player, CPacketEntityAction.Action.START_SNEAKING)); + player.setSneaking(true); + mc.playerController.windowClick(player.inventoryContainer.windowId, slot1, InventoryUtils.getCurrentSlot(), ClickType.SWAP, player); + BlockUtils.placeBlock(found.up(), EnumHand.MAIN_HAND, true, true); + BlockUtils.placeBlock(found.up(), EnumHand.MAIN_HAND, true, false); + + // Revert state + mc.playerController.windowClick(player.inventoryContainer.windowId, slot1, InventoryUtils.getCurrentSlot(), ClickType.SWAP, player); + mc.playerController.windowClick(player.inventoryContainer.windowId, slot0, InventoryUtils.getCurrentSlot(), ClickType.SWAP, player); + + ChatUtils.print("§aPlaced new hopper"); + placeLock.lock(1000); + state = State.WAITING; + return true; + } + } + return false; + } + + Queue toAttack = new Queue<>(); + public ArrayList targets = new ArrayList<>(); + Lock threadLock = new Lock(true); + Lock timer = new Lock(); + Thread thread = new Thread(() -> { + while (true) { + try { + threadLock.waitHere(); + timer.waitHere((int) (delay / 6 * Utils.tpsMultiplier())); + if (enabled) + onTick(); + else + timer.lock((int) (delay / 2 * Utils.tpsMultiplier())); + } catch (Exception ignore) { } + } + }, "HopperAura"); { thread.start(); } + + { + customKeyBinds.set("select", new KeyBind(null, toString() + "::triggerSelect", false)); + } + + @Override + public void init() { + PlayerSelector.types.add(new PlayerSelector.Type(player -> { + targets.clear(); + targets.add(player.getGameProfile().getName()); + }, "Set HopperAura target")); + } + + @SuppressWarnings("unused") + public void triggerSelect() { + targets.clear(); + TTCp.mc.displayGuiScreen( + new GuiPlayerSelect( + TTCp.world.playerEntities.stream().filter( + player -> !player.getName().equals(TTCp.player.getName()) + ).toArray(EntityPlayer[]::new), + player -> { + targets.remove(player.getName()); + targets.add(player.getName()); + + return false; + } + ) + ); + } + + static HopperAura instance; + { + instance = this; + } + public static HopperAura getInstance() { + return instance; + } + + public void updateBinds() { + subComponents.clear(); + subComponents.add(new Button("Delay: " + delay, it -> { + if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + delay -= 25; + else + delay += 25; + + if(delay < 50) + delay = 1000; + if(delay > 1000) + delay = 50; + + it.text = "Delay: " + delay; + })); + subComponents.add(new Button("Attack " + (attack == 0 ? "all" : (attack == 1 ? "players" : "targets")), it -> { + attack++; + if(attack > 2) + attack = 0; + + it.text = "Attack " + (attack == 0 ? "all" : (attack == 1 ? "players" : "targets")); + })); + subComponents.add(Setting.createInt(0, 500, "RandomDelay", this, "randomDelay")); + subComponents.add(Setting.createBoolean("Thread mode", this, "threadMode")); + subComponents.add(Setting.createBoolean("Swing", this, "swing")); + subComponents.add(Setting.createBoolean("Batches", this, "batch")); + subComponents.add(Setting.createBoolean("TPSSync", this, "tpsSync")); + subComponents.add(Setting.createInt(1, 10, "Iterations (i/a)", this, "iterations")); + subComponents.add(Setting.createInt(0, 100, "IterationDelay", this, "iterationDelay")); + } + + @Override + public void onTick() { + if(threadMode) + threadLock.unlock(); + else + threadLock.lock(); + + if (threadMode && !(Thread.currentThread() == thread)) { + return; + } + + for (int i = 0 ; i < digging.size() ; i++) { + if(!digging.get(i).t.isLocked()) { + player.connection.sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.Action.STOP_DESTROY_BLOCK, digging.get(i).o, EnumFacing.UP)); + digging.remove(i--); + } + } + + if(!placeLock.isLocked() && hopperNeedsOpening) { + currentHopper = null; + hopper = null; + hopperNeedsOpening = false; + } + + if(hopperNeedsOpening && currentHopper != null) { + if(mc.world.getBlockState(currentHopper).getBlock() == Blocks.HOPPER) { + hopperNeedsOpening = false; + openHopper(currentHopper); + state = State.WAITING; + } + } + + if(Minecraft.getMinecraft().currentScreen instanceof GuiContainer && guiNeedsClosing && currentHopper != null || closeLock.isLocked()) { + if(!closeLock.isLocked()) + closeLock.lock(500); + hopper = ((GuiContainer) Minecraft.getMinecraft().currentScreen).inventorySlots; + Minecraft.getMinecraft().displayGuiScreen(null); + guiNeedsClosing = false; + } + + { + if (!toAttack.hasNext()) { + EntityPlayer[] players = TTCp.world.playerEntities.toArray(new EntityPlayer[0]); + for (int i = 0 ; i < players.length ; i++) { + if ( + players[i].getDistance(TTCp.player) < 6 && + !Team.getInstance().names.contains(players[i].getGameProfile().getName()) && + !Friend.getInstance().names.contains(players[i].getGameProfile().getName()) && + !players[i].getGameProfile().getName().equals(TTCp.mc.getSession().getProfile().getName()) && + !AltControl.getInstance().isAlt(players[i]) + ) { + if (!targets.isEmpty() || attack == 2) { + if (targets.contains(players[i].getGameProfile().getName())) { + toAttack.add(players[i]); + } + } + else + toAttack.add(players[i]); + } + } + } + if (!toAttack.hasNext() && attack == 0) { + EntityLivingBase[] entities = Utils.getEntities(EntityLivingBase.class, EntityLivingBase::isEntityAlive); + for (int i = 0 ; i < entities.length ; i++) { + if ( + entities[i].getDistance(TTCp.player) < 6 && + !(entities[i] instanceof EntityPlayer) + ) { + toAttack.add(entities[i]); + } + } + } + } + + if(!switchTimer.isLocked()) { + switchTimer.lock(); + } + if (!timer.isLocked()) { + int e = extraDelay(); + switchTimer.lock(delay(e) / 3); + timer.lock(delay(e)); + if(cBatch = !cBatch && batch) { + timer.lock(delay(e) * 2); + switchTimer.lock(delay(e) * 2 / 3); + } + + if(toAttack.hasNext()) + attackNext(); + else + state = State.IDLE; + } + } + + private int delay(int e) { + return (int) (delay + e * (tpsSync ? Utils.tpsMultiplier() : 1)); + } + + private int extraDelay() { + return (int) (randomDelay * Math.random()); + } + + private boolean getWeapon() { + reloadHopper(); + if(currentHopper == null) { + return false; + } + if(hopper == null) + return false; + if(player.getHeldItemMainhand().getCount() >= 1) + return true; + state = State.REPLACING; + List inventorySlots = hopper.inventorySlots; + boolean d = false; + for (int i = 0 ; i < 5 ; i++) { + Slot slot = inventorySlots.get(i); + if(slot.getHasStack() && slot.getStack().getCount() >= 1) { + mc.playerController.windowClick(hopper.windowId, i, 0, ClickType.PICKUP, player); + mc.playerController.windowClick(hopper.windowId, 32 + InventoryUtils.getCurrentSlot(), 1, ClickType.PICKUP, player); + mc.playerController.windowClick(hopper.windowId, i, 0, ClickType.PICKUP, player); + mc.playerController.windowClick(hopper.windowId, -999, 0, ClickType.PICKUP, player); + d = true; + break; + } + } + if(!d) { + if(!empty) { + empty = true; + emptyLock.lock(1000); + } + if(empty && !emptyLock.isLocked()) { + currentHopper = null; + hopper = null; + validHoppers.remove(currentHopper); + emptyLock.unlock(); + empty = false; + } + } + else { + emptyLock.unlock(); + empty = false; + } + return d; + } + + public void attackNext() { + EntityLivingBase entity = toAttack.next(); + + state = State.ATTACKING; + if(!superAttack || entity.hurtTime <= 0) { + for (int i = 0 ; i < iterations ; i++) { + if(!getWeapon()) { + state = State.WAITING; + continue; + } + BlockUtils.lookAt(entity.getPositionVector().add(0, (entity.getEntityBoundingBox().maxY - entity.getEntityBoundingBox().minY) / 2, 0)); + TTCp.mc.playerController.attackEntity(TTCp.player, entity); + if (swing) + TTCp.player.swingArm(EnumHand.MAIN_HAND); + + if(iterations > 1) { + try { + Thread.sleep(iterationDelay); + } + catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + } + } + + @Override + public void onChat(String s, String[] args) { + + } + + @Override + public void onConfigLoad() { + updateBinds(); + } + + @Override + public int danger() { + return 4; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/KillAura.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/KillAura.java new file mode 100644 index 0000000..26bcb52 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/KillAura.java @@ -0,0 +1,501 @@ +package de.tudbut.mod.client.ttcp.mods.combat; + +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.SPacketAnimation; +import net.minecraft.util.EnumHand; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.gui.GuiPlayerSelect; +import de.tudbut.mod.client.ttcp.gui.lib.component.Button; +import de.tudbut.mod.client.ttcp.gui.lib.component.ToggleButton; +import de.tudbut.mod.client.ttcp.mods.misc.AltControl; +import de.tudbut.mod.client.ttcp.mods.command.Friend; +import de.tudbut.mod.client.ttcp.mods.rendering.PlayerSelector; +import de.tudbut.mod.client.ttcp.mods.chat.Team; +import de.tudbut.mod.client.ttcp.utils.*; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Combat; +import de.tudbut.obj.Save; +import de.tudbut.tools.Lock; +import de.tudbut.tools.Queue; + +import java.util.*; + +@Combat +public class KillAura extends Module { + @Save + int delay = 300; + @Save + int randomDelay = 0; + @Save + public int attack = 0; + @Save + boolean threadMode = false; + @Save + boolean superAttack = false; + @Save + boolean batch = false; + boolean cBatch = false; + @Save + boolean switchItem = false; + boolean noSwitch = false; + boolean cSwitch = true; + @Save + boolean tpsSync = false; + @Save + SwitchType switchType = SwitchType.HOTBAR; + @Save + int switchDelay = 0; + @Save + int iterations = 1; + @Save + int iterationDelay = 0, iterationRandomDelay = 0; + Lock switchTimer = new Lock(); + @Save + boolean rotate = false; + @Save + boolean swing = true, offhandSwing = false, iSwing = true, iOffhandSwing = false; + @Save + int misses = 10; + @Save + int iterMisses = 25; + @Save + float autoDest = 1f; + @Save + boolean auto = false; + @Save + boolean oldAuto = false; + @Save + boolean hyperMode = false; + @Save + boolean iterationSync = false; + @Save + int subIterations = 1; + @Save + int switches = 1; + int switchesDone = 0; + + @Save + boolean switchIterations = false, switchSubIterations = false; + + Map lastHealth = new HashMap<>(); + Map lastTotems = new HashMap<>(); + + public enum SwitchType { + HOTBAR, + SWAP, + ; + } + + Queue toAttack = new Queue<>(); + public ArrayList targets = new ArrayList<>(); + Lock threadLock = new Lock(true); + Lock timer = new Lock(); + Thread thread = new Thread(() -> { + while (true) { + try { + threadLock.waitHere(100); + if(threadLock.isLocked()) + continue; + timer.waitHere((int) (delay / 6 * Utils.tpsMultiplier())); + if (enabled) + onTick(); + else + timer.lock((int) (delay / 2 * Utils.tpsMultiplier())); + } catch (Exception ignore) { } + } + }, "KillAura"); { thread.start(); } + + { + customKeyBinds.set("select", new KeyBind(null, toString() + "::triggerSelect", false)); + } + + @Override + public void init() { + PlayerSelector.types.add(new PlayerSelector.Type(player -> { + targets.clear(); + targets.add(player.getGameProfile().getName()); + }, "Set KillAura target")); + } + + @SuppressWarnings("unused") + public void triggerSelect() { + targets.clear(); + TTCp.mc.displayGuiScreen( + new GuiPlayerSelect( + TTCp.world.playerEntities.stream().filter( + player -> !player.getName().equals(TTCp.player.getName()) + ).toArray(EntityPlayer[]::new), + player -> { + targets.remove(player.getName()); + targets.add(player.getName()); + + return false; + } + ) + ); + } + + static KillAura instance; + { + instance = this; + } + public static KillAura getInstance() { + return instance; + } + + public void updateBinds() { + subComponents.clear(); + subComponents.add(new Button("Attack " + (attack == 0 ? "all" : (attack == 1 ? "players" : "targets")), it -> { + attack++; + if(attack > 2) + attack = 0; + + it.text = "Attack " + (attack == 0 ? "all" : (attack == 1 ? "players" : "targets")); + })); + subComponents.add(new ToggleButton("HyperMode", this, "hyperMode") { + @Override + public synchronized void click(int x, int y, int mouseButton) { + super.click(x, y, mouseButton); + updateBinds(); + } + }); + if(!hyperMode) { + subComponents.add(Setting.createInt(10, 1000, "Delay", this, "delay")); + subComponents.add(Setting.createInt(0, 500, "RandomDelay", this, "randomDelay")); + } + subComponents.add(Setting.createBoolean("Thread mode", this, "threadMode")); + if(!hyperMode) { + subComponents.add(Setting.createBoolean("SuperAttack", this, "superAttack")); + subComponents.add(Setting.createBoolean("Batches", this, "batch")); + } + subComponents.add(Setting.createBoolean("Switch", this, "switchItem")); + subComponents.add(Setting.createBoolean("Rotate", this, "rotate")); + subComponents.add(Setting.createBoolean("TPSSync", this, "tpsSync")); + subComponents.add(Setting.createEnum(SwitchType.class, "SwitchType", this, "switchType")); + subComponents.add(Setting.createInt(0, 400, "SwitchDelay", this, "switchDelay")); + subComponents.add(Setting.createInt(1, 5, "SwitchCount", this, "switches")); + subComponents.add(Setting.createInt(1, 10, "Iterations (i/a)", this, "iterations")); + subComponents.add(Setting.createInt(1, 10, "SubIterations (si/i)", this, "subIterations")); + subComponents.add(Setting.createInt(0, 100, "IterDelay", this, "iterationDelay")); + subComponents.add(Setting.createInt(0, 100, "IterRandomDelay", this, "iterationRandomDelay")); + subComponents.add(Setting.createBoolean("Swing", this, "swing")); + subComponents.add(Setting.createBoolean("SwitchIterations", this, "switchIterations")); + subComponents.add(Setting.createBoolean("SwitchSubIterations", this, "switchSubIterations")); + subComponents.add(Setting.createBoolean("IterationSync", this, "iterationSync")); + subComponents.add(Setting.createBoolean("IterSwing", this, "iSwing")); + subComponents.add(Setting.createBoolean("OffhandSwing", this, "offhandSwing")); + subComponents.add(Setting.createBoolean("IterOffhandSwing", this, "iOffhandSwing")); + subComponents.add(Setting.createInt(0, 100, "MissChance", this, "misses")); + subComponents.add(Setting.createInt(0, 100, "IterMissChance", this, "iterMisses")); + if(!hyperMode) + subComponents.add(Setting.createBoolean("AutoSetup", this, "auto")); + subComponents.add(Setting.createKey("Select", customKeyBinds.get("select"))); + } + + EntityLivingBase entity; + Lock iTimer = new Lock(true); + int iterationsToDo = 0; + + @Override + public void onTick() { + if(threadMode) + threadLock.unlock(); + else + threadLock.lock(); + + if (threadMode && !(Thread.currentThread() == thread)) { + return; + } + + { + if (!toAttack.hasNext()) { + EntityPlayer[] players = TTCp.world.playerEntities.toArray(new EntityPlayer[0]); + for (int i = 0 ; i < players.length ; i++) { + if ( + players[i].getDistance(TTCp.player) < 6 && + !Team.getInstance().names.contains(players[i].getGameProfile().getName()) && + !Friend.getInstance().names.contains(players[i].getGameProfile().getName()) && + !players[i].getGameProfile().getName().equals(TTCp.mc.getSession().getProfile().getName()) && + !AltControl.getInstance().isAlt(players[i]) + ) { + if (!targets.isEmpty() || attack == 2) { + if (targets.contains(players[i].getGameProfile().getName())) { + toAttack.add(players[i]); + } + } + else + toAttack.add(players[i]); + } + } + } + if (!toAttack.hasNext() && attack == 0) { + EntityLivingBase[] entities = Utils.getEntities(EntityLivingBase.class, EntityLivingBase::isEntityAlive); + for (int i = 0 ; i < entities.length ; i++) { + if ( + entities[i].getDistance(TTCp.player) < 6 && + !(entities[i] instanceof EntityPlayer) + ) { + toAttack.add(entities[i]); + } + } + } + } + + if(!switchTimer.isLocked() && !switchIterations) { + switchTimer.lock(switchDelay); + + if(switchItem && toAttack.hasNext() && !noSwitch) { + switchItem(); + } + } + if (hyperMode) { + if (toAttack.hasNext()) { + hyper(); + } + } else { + if (!timer.isLocked()) { + int e = extraDelay(); + if(switchDelay == 0) + switchTimer.lock(delay(e) / 3); + timer.lock(delay(e)); + if ((cBatch = !cBatch) && batch) { + timer.lock(delay(e) * 2); + if(switchDelay == 0) + switchTimer.lock(delay(e) * 2 / 3); + } + + if (auto) { + try { + int i = lastTotems.get(toAttack.peek()) - countTotems(toAttack.peek()); + if (lastHealth.get(toAttack.peek()) > toAttack.peek().getHealth() || i != 0) { + if (i < 0) + i = 1; + autoAttack(i); + } + else { + autoAttack(0); + } + } + catch (Exception a) { + } + } + + if (toAttack.hasNext()) + attackNext(); + } + } + + if(iterationSync) { + if(!iTimer.isLocked()) { + iTimer.lock(); + if(iterationsToDo > 0) { + for (int i = 0 ; i < subIterations ; i++) { + if (Math.random() > iterMisses / 100f) + TTCp.mc.playerController.attackEntity(TTCp.player, entity); + if (swing) + TTCp.player.swingArm(EnumHand.MAIN_HAND); + if(switchSubIterations) + switchItem(); + } + if (switchIterations && !switchSubIterations) + switchItem(); + if(iterationsToDo-- > 1) { + iTimer.lock(iterationDelay); + } + } + } + } + } + + private void switchItem() { + if(noSwitch) + return; + switch (switchType) { + case HOTBAR: + int i = InventoryUtils.getCurrentSlot(); + if (i == 0) + cSwitch = true; + if (i == 8) + cSwitch = false; + InventoryUtils.setCurrentSlot(i + ((cSwitch = !cSwitch) ? -1 : 1)); + break; + case SWAP: + InventoryUtils.swap(37 + switchesDone++, 0); + switchesDone = switchesDone % switches; + break; + } + } + + int lastHRT = 0; + boolean allowHRT = true; + + private void hyper() { + EntityLivingBase ta = toAttack.peek(); + if(ta.hurtResistantTime > lastHRT) + allowHRT = true; + if(ta.hurtResistantTime < ta.maxHurtResistantTime * 0.75f && allowHRT) { + allowHRT = false; + switchTimer.unlock(); + attackNext(); + } + lastHRT = ta.hurtResistantTime; + } + + boolean lastAutoAttack = false; + float autoAttackAvrg = -1; + float autoAttackBiggerAvrg = -1; + float delayAvrg = delay; + int lastAdd = -10; + + private void autoAttack(float x) { + if(autoAttackAvrg == -1) { + autoAttackAvrg = 0; + autoAttackBiggerAvrg = 0; + } + autoAttackAvrg = (autoAttackAvrg * 4 + x) / 5; + autoAttackBiggerAvrg = (autoAttackBiggerAvrg * 24 + x) / 25; + delayAvrg = (delayAvrg * 24 + delay) / 25; + if(autoAttackAvrg / Math.max(delay, 1) < autoAttackBiggerAvrg / Math.max(delayAvrg, 1)) + delay += lastAdd = -lastAdd; + else { + delay += lastAdd; + } + delay = Math.max(delay, 0); + } + + private int countTotems(EntityLivingBase entity) { + int t = 0; + ItemStack itemStack = entity.getHeldItem(EnumHand.MAIN_HAND); + if (itemStack.getItem() == Items.TOTEM_OF_UNDYING) { + t = itemStack.getCount(); + } else { + itemStack = entity.getHeldItem(EnumHand.OFF_HAND); + if (itemStack.getItem() == Items.TOTEM_OF_UNDYING) { + t = itemStack.getCount(); + } + } + return t; + } + + private int delay(int e) { + return (int) (delay + e * (tpsSync ? Utils.tpsMultiplier() : 1)); + } + + private int extraDelay() { + return (int) (randomDelay * Math.random()); + } + + public void attackNext() { + EntityLivingBase entity = toAttack.next(); + + if(Math.random() <= misses / 100f) { + if (swing) + TTCp.player.swingArm(EnumHand.MAIN_HAND); + if (offhandSwing) + TTCp.player.swingArm(EnumHand.OFF_HAND); + return; + } + + if(!superAttack || entity.hurtTime <= 0) { + if(iterationSync) { + iterationsToDo = iterations; + iTimer.unlock(); + this.entity = entity; + } + else { + lastHealth.put(entity, entity.getHealth()); + lastTotems.put(entity, countTotems(entity)); + for (int i = 0 ; i < iterations ; i++) { + if (rotate) + BlockUtils.lookAt(entity.getPositionVector().add(Math.random() * 0.3 - 0.15, (entity.getEntityBoundingBox().maxY - entity.getEntityBoundingBox().minY) / 1.5 + Math.random() * 0.3 - 0.15, Math.random() * 0.3 - 0.15)); + for (int j = 0 ; j < subIterations ; j++) { + if (Math.random() > iterMisses / 100f) + TTCp.mc.playerController.attackEntity(TTCp.player, entity); + + if (i != iterations - 1 && iSwing) + TTCp.player.swingArm(EnumHand.MAIN_HAND); + if (i != iterations - 1 && iOffhandSwing) + TTCp.player.swingArm(EnumHand.OFF_HAND); + } + + try { + Thread.sleep((long) (iterationDelay + iterationRandomDelay * Math.random())); + } + catch (InterruptedException e) { + e.printStackTrace(); + } + } + } + } + + if (swing) + TTCp.player.swingArm(EnumHand.MAIN_HAND); + if (offhandSwing) + TTCp.player.swingArm(EnumHand.OFF_HAND); + } + + @Override + public boolean onPacket(Packet packet) { + if(packet instanceof SPacketAnimation) { + if(((SPacketAnimation) packet).getAnimationType() == 0) { + if(swingNotifiers.containsKey(((SPacketAnimation) packet).getEntityID())) { + ChatUtils.print("§8Swing by " + mc.world.playerEntities.stream().filter(entityPlayer -> entityPlayer.getEntityId() == ((SPacketAnimation) packet).getEntityID()).findFirst()); + swingNotifiers.get(((SPacketAnimation) packet).getEntityID()).unlock(); + } + } + } + + return false; + } + + Map swingNotifiers = new HashMap<>(); + + @Override + public void onEveryChat(String s, String[] args) { + if(args.length == 1) { + new Thread(() -> { + String playerName = args[0]; + Optional player = mc.world.playerEntities.stream().filter(entityPlayer -> entityPlayer.getName().equals(playerName)).findFirst(); + if(player.isPresent()) { + ChatUtils.print("Watching..."); + EntityPlayer detect = player.get(); + + ArrayList timings = new ArrayList<>(); + Lock lock = new Lock(); + swingNotifiers.put(detect.getEntityId(), lock); + for (int i = 0 ; i < 10 ; i++) { + int spi; + lock.waitHere(); + lock.lock(); + timings.add(System.currentTimeMillis()); + } + swingNotifiers.put(detect.getEntityId(), null); + long last = timings.get(0); + long l = 0; + for (int i = 1 ; i < timings.size() ; i++) { + l += timings.get(i) - last; + last = timings.get(i); + } + ChatUtils.print("§a[TTC] KA Speed of " + detect.getName() + ": " + l / (timings.size() - 1f)); + } + else { + ChatUtils.print("That player is not in the visual range!"); + } + }).start(); + } + } + + @Override + public void onConfigLoad() { + updateBinds(); + } + + @Override + public int danger() { + return 3; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/LegacyAutoTotem.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/LegacyAutoTotem.java new file mode 100644 index 0000000..c3cb453 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/LegacyAutoTotem.java @@ -0,0 +1,339 @@ +package de.tudbut.mod.client.ttcp.mods.combat; + +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.gui.inventory.GuiContainerCreative; +import net.minecraft.client.gui.inventory.GuiInventory; +import net.minecraft.init.Items; +import net.minecraft.inventory.ClickType; +import net.minecraft.item.ItemStack; +import de.tudbut.mod.client.ttcp.gui.lib.component.Button; +import de.tudbut.mod.client.ttcp.mods.rendering.Notifications; +import de.tudbut.mod.client.ttcp.utils.*; +import de.tudbut.debug.DebugProfiler; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.utils.category.Combat; +import de.tudbut.tools.Lock; +import de.tudbut.tools.ThreadPool; + +import java.util.ArrayList; + +@Combat +public class LegacyAutoTotem extends Module { + + static LegacyAutoTotem instance; + + public static DebugProfiler profiler = new DebugProfiler("LegacyAutoTotem", "idle"); + + // Actual count, set by AI + public int minCount = 0; + // Count, set by user + public int origMinCount = 0; + // If the user seems to be restocking after respawning, if this is the case, + // don't switch until any inventories are closed + public boolean isRestockingAfterRespawn = false; + // If totems should be stacked automatically + public boolean autoStack = false; + // If the AutoStack should always run, regardless of the count + private boolean autoStackIgnoreCount = false; + + public int delay = 0; + + Lock swapLock = new Lock(); + ThreadPool swapThread = new ThreadPool(1, "Swap thread", true); + + private boolean noTotems = true; + + public LegacyAutoTotem() { + instance = this; + } + + public static LegacyAutoTotem getInstance() { + return instance; + } + + public void updateBinds() { + subComponents.clear(); + subComponents.add(Setting.createInt(0, 12, "Count", this, "origMinCount")); + subComponents.add(Setting.createBoolean("AutoStack (WIP)", this, "autoStack")); + subComponents.add(Setting.createInt(0, 5000, "Delay", this, "delay")); + subComponents.add(new Button("AutoStack now", it -> { + autoStackIgnoreCount = true; + autoStack(); + autoStackIgnoreCount = false; + })); + subComponents.add(new Button("Actual count: " + minCount, it -> { + + })); + } + + // Run checks and AI + @Override + public void onSubTick() { + if (TTCp.isIngame()) { + if (!swapLock.isLocked()) { + EntityPlayerSP player = TTCp.player; + + + profiler.next("RestockCheck"); + if ((isRestockingAfterRespawn() || isRestockingAfterRespawn)) { + // Don't switch yet + return; + } + + // Run AI + if (noTotems) { + profiler.next("TotCountUpdate"); + updateTotCount(); + } + profiler.next("AutoStack"); + if (autoStack) + autoStack(); + + profiler.next("Check"); + ItemStack stack = player.getHeldItemOffhand(); + int minCount = this.minCount; + if (stack.getCount() <= minCount) { + // Switch! + + profiler.next("Switch.GetSlot"); + Integer slot = InventoryUtils.getSlotWithItem( + player.inventoryContainer, + Items.TOTEM_OF_UNDYING, + new int[] { InventoryUtils.OFFHAND_SLOT }, + minCount + 1, + 64 + ); + if (slot == null) { + profiler.next("Switch.NotifyEmpty"); + if (!noTotems) + Notifications.add(new Notifications.Notification("No more totems! Couldn't switch!")); + noTotems = true; + profiler.next("idle"); + return; // Oh no!! No totems left! + } + else + noTotems = false; + + profiler.next("Switch.Swap"); + swapLock.lock(2000); + swapThread.run(() -> { + // Switch a new totem stack to the offhand + InventoryUtils.inventorySwap(slot, InventoryUtils.OFFHAND_SLOT, delay, 300, 100); + swapLock.lock(1000); + }); + + + profiler.next("Switch.Notify"); + Notifications.add(new Notifications.Notification("Switched to next TotemStack")); + } + } + } + profiler.next("idle"); + } + + // Tests if the player is likely to be restocking after having a empty inventory, + // does NOT check for a respawn, but very likely will only be true after a respawn! + public boolean isRestockingAfterRespawn() { + EntityPlayerSP player = TTCp.player; + + // Set false if the container was closed, this will make it start switching again + GuiScreen screen = TTCp.mc.currentScreen; + if ( + !( + screen instanceof GuiContainer && !( + screen instanceof GuiInventory || + screen instanceof GuiContainerCreative + ) + ) + ) { + isRestockingAfterRespawn = false; + return false; + } + + // Any slot with totems + Integer slot0 = InventoryUtils.getSlotWithItem( + player.inventoryContainer, + Items.TOTEM_OF_UNDYING, + new int[]{}, + 1, + 64 + ); + // No totems, return true + if (slot0 == null) { + isRestockingAfterRespawn = true; + return true; + } + // Any slot with totems excluding slot0 + Integer slot1 = InventoryUtils.getSlotWithItem( + player.inventoryContainer, + Items.TOTEM_OF_UNDYING, + new int[]{slot0}, + 1, + 64 + ); + // Only one stack of totems, return true + if (slot1 == null) { + isRestockingAfterRespawn = true; + return true; + } + + // There is two or more stacks, return false, seems normal + return false; + } + + // AI, finds out the amount to switch at, looks for lowest amount of totems in inventory + public void updateTotCount() { + EntityPlayerSP player = TTCp.player; + + // Is the player-set count usable? + if ( + InventoryUtils.getSlotWithItem( + player.inventoryContainer, + Items.TOTEM_OF_UNDYING, + new int[]{InventoryUtils.OFFHAND_SLOT}, + origMinCount + 1, + 64 + ) != null + ) { + minCount = origMinCount; + updateBinds(); + return; + } + + // Look for a stack of the AI-set count + Integer i = InventoryUtils.getSlotWithItem( + player.inventoryContainer, + Items.TOTEM_OF_UNDYING, + new int[]{InventoryUtils.OFFHAND_SLOT}, + minCount + 1, + 64 + ); + // If it doesnt exist, step down the count until a stack exist or the count hits 0 + while (i == null) { + // Step down + minCount--; + // Check + i = InventoryUtils.getSlotWithItem( + player.inventoryContainer, + Items.TOTEM_OF_UNDYING, + new int[]{InventoryUtils.OFFHAND_SLOT}, + minCount + 1, + 64 + ); + updateBinds(); + + if (minCount < 0) { + // No stacks left + minCount = 0; + updateBinds(); + return; // Sorry + } + } + + // Found! + } + + public void autoStack() { + + if(minCount == 0) + return; + + EntityPlayerSP player = TTCp.player; + ArrayList slots = new ArrayList<>(); + // The minimal amount that is required to stack totems + int min = 2; + // Only restack when totems are likely not a normal stack + int max = 24; + // TMP variable + Integer slot; + + // Runs 50 times + for (int i = 0; i < 50; i++) { + + // Drop unusable stacks + ArrayList dropped = new ArrayList<>(); + if (slots.size() != 0) { + + for (int j = 0; j < 100; j++) { + // Next + slot = InventoryUtils.getSlotWithItem( + player.inventoryContainer, + Items.TOTEM_OF_UNDYING, + Utils.objectArrayToNativeArray(dropped.toArray(new Integer[0])), + 0, + min - 1 + ); + + if (slot == null) + break; + + // Drop stack contents of the slot + InventoryUtils.drop(slot); + System.out.println("Dropped item in " + slot); + dropped.add(slot); + } + + } + + if(origMinCount == minCount && !autoStackIgnoreCount) + return; + + + // Get slots with totems + slots.clear(); + for (int j = 0; j < 100; j++) { + slot = InventoryUtils.getSlotWithItem( + player.inventoryContainer, + Items.TOTEM_OF_UNDYING, + Utils.objectArrayToNativeArray(slots.toArray(new Integer[0])), + min, + max + ); + if(slot == null) + break; + + slots.add(slot); + } + + // Combine totems + while (slots.size() >= 2) { + // Get empty slot + slot = InventoryUtils.getSlotWithItem(player.inventoryContainer, Items.AIR, 0); + if (slot == null) { + InventoryUtils.drop(slots.get(0)); + slots.remove(0); + continue; + } + System.out.println("Combining " + slots.get(0) + " and " + slots.get(1) + " to " + slot); + // Pick first stack + InventoryUtils.clickSlot(slots.get(0), ClickType.PICKUP, 0); + // Pick second stack + InventoryUtils.clickSlot(slots.get(1), ClickType.PICKUP, 0); + // Put result in empty slot + InventoryUtils.clickSlot(slot, ClickType.PICKUP, 0); + // Drop junk + InventoryUtils.drop(slots.get(1)); + + slots.remove(0); + slots.remove(0); + } + } + } + + @Override + public void onChat(String s, String[] args) { + if (s.startsWith("count ")) + try { + origMinCount = minCount = Integer.parseInt(s.substring("count ".length())); + ChatUtils.print("Set!"); + } + catch (Exception e) { + ChatUtils.print("ERROR: NaN"); + } + if(s.startsWith("debug")) + ChatUtils.print(profiler.getTempResults().toString()); + updateBinds(); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/PopCount.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/PopCount.java new file mode 100644 index 0000000..9f285b8 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/PopCount.java @@ -0,0 +1,163 @@ +package de.tudbut.mod.client.ttcp.mods.combat; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Items; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.gui.lib.component.Button; +import de.tudbut.mod.client.ttcp.mods.rendering.Notifications; +import de.tudbut.mod.client.ttcp.utils.ChatUtils; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.Setting; +import de.tudbut.mod.client.ttcp.utils.category.Combat; +import de.tudbut.obj.Save; +import de.tudbut.obj.TLMap; + +import java.util.Date; + +@Combat +public class PopCount extends Module { + public TLMap counters = new TLMap<>(); + + @Save + public boolean autoToxic = false; + + @Save + public boolean countOwn = true; + + @Override + public void updateBinds() { + subComponents.clear(); + subComponents.add(new Button("Reset", text -> counters = new TLMap<>())); + subComponents.add(Setting.createBoolean("AutoToxic", this, "autoToxic")); + subComponents.add(Setting.createBoolean("CountOwn", this, "countOwn")); + } + + @Override + public void onEveryTick() { + try { + TLMap counters = this.counters; + EntityPlayer[] visiblePlayers = TTCp.world.playerEntities.toArray(new EntityPlayer[0]); + + EntityPlayer[] players = counters.keys().toArray(new EntityPlayer[0]); + for (int i = 0; i < visiblePlayers.length; i++) { + boolean b = false; + for (int j = 0 ; j < players.length ; j++) { + if (counters.get(players[j]).name.equals(visiblePlayers[i].getName())) { + counters.get(players[j]).player = visiblePlayers[i]; + if(players[j] != visiblePlayers[i]) { + counters.set(visiblePlayers[i], counters.get(players[j])); + counters.set(players[j], null); + } + b = true; + } + } + if (!b) { + counters.set(visiblePlayers[i], new Counter(visiblePlayers[i])); + } + } + + players = counters.keys().toArray(new EntityPlayer[0]); + for (int i = 0; i < players.length; i++) { + Counter counter = counters.get(players[i]); + counter.reload(autoToxic, enabled, countOwn); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void onChat(String s, String[] args) { + + } + + public static class Counter { + + private EntityPlayer player; + private final String name; + private int totCountLast = -1; + private int switches = 0; + private int pops = 0; + private boolean autoToxic; + private long lastPop = 0; + private float popDelay = 2000f; + + public Counter(EntityPlayer player) { + this.player = player; + this.name = player.getName(); + } + + public void reload(boolean autoToxic, boolean enabled, boolean countOwn) { + this.autoToxic = autoToxic; + if (player.getHeldItemOffhand().getItem() == Items.TOTEM_OF_UNDYING || player.getHeldItemOffhand().getItem() == Items.AIR) { + if (totCountLast == -1) { + totCountLast = player.getHeldItemOffhand().getCount(); + lastPop = new Date().getTime(); + } + reload0(enabled, countOwn); + } + + } + + private void reload0(boolean enabled, boolean countOwn) { + int totCount = player.getHeldItemOffhand().getCount(); + if (totCount > totCountLast) { + switches++; + if (totCount != 1) { + if (enabled && (countOwn || player.getEntityId() != TTCp.player.getEntityId())) { + ChatUtils.printChatAndHotbar("§a§l" + player.getName() + " switched (now " + switches + " switches)"); + Notifications.add(new Notifications.Notification(player.getName() + " switched (now " + switches + " switches)")); + } + } + } + if(totCount < totCountLast) { + pops += totCountLast - totCount; // Dont just add, add the diff so its not lag-dependent + if(enabled && (countOwn || player.getEntityId() != TTCp.player.getEntityId())) { + ChatUtils.printChatAndHotbar("§a§l" + player.getName() + " popped " + ( totCountLast - totCount ) + " (now " + pops + " pops)"); + Notifications.add(new Notifications.Notification(player.getName() + " popped " + ( totCountLast - totCount ) + " (now " + pops + " pops)")); + if (autoToxic && player != TTCp.player && player.getDistance(TTCp.player) < 10) + ChatUtils.simulateSend("EZ pop " + player.getName() + "! TTC on top!", false); + } + float timeSinceLastPop = new Date().getTime() - lastPop; + if(timeSinceLastPop < 8000) { + popDelay = (popDelay * 4 + timeSinceLastPop) / 5; + } + lastPop = new Date().getTime(); + } + totCountLast = totCount; + } + + public int getSwitches() { + return switches; + } + + public int getPops() { + return pops; + } + + public float getPopDelay() { + return popDelay; + } + + public float popsPerSecond() { + return 1000 / popDelay; + } + + public long predictNextPop() { + return (long) (lastPop + popDelay); + } + + public long predictNextPopDelay() { + return Math.max(0, (long) (lastPop + popDelay) - new Date().getTime()); + } + + public float predictPopProgress() { + long l = new Date().getTime() - lastPop; + return Math.min(1, l * 1f / popDelay * 1f); + } + + public boolean isPopping() { + return new Date().getTime() - lastPop < 8000; + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/PortalHand.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/PortalHand.java new file mode 100644 index 0000000..1717f7d --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/PortalHand.java @@ -0,0 +1,163 @@ +package de.tudbut.mod.client.ttcp.mods.combat; + +import de.tudbut.mod.client.ttcp.utils.category.Combat; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.TTCp; +import org.lwjgl.input.Mouse; +import net.minecraft.util.math.Vec3d; +import net.minecraft.util.EnumHand; +import net.minecraft.network.Packet; +import net.minecraft.network.play.client.CPacketPlayer; +import net.minecraft.network.play.client.CPacketEntityAction; +import net.minecraft.network.play.client.CPacketConfirmTeleport; +import net.minecraft.network.play.server.SPacketPlayerPosLook; +import de.tudbut.mod.client.ttcp.utils.Utils; +import de.tudbut.mod.client.ttcp.utils.Setting; +import de.tudbut.obj.Save; +import net.minecraft.entity.Entity; + +@Combat +public class PortalHand extends Module { + + Entity toAttack = null; + Vec3d beginPos = null; + boolean beginPosOk = false; + int tpid = 0; + @Save + int range = 70; + @Save + float scale = 9; + @Save + boolean forceLagBack = true; + + SPacketPlayerPosLook lastPacket = null; + long lastPacketTime = 0; + + @Override + public void updateBinds() { + subComponents.clear(); + subComponents.add(Setting.createInt(10, 300, "Range", this, "range")); + subComponents.add(Setting.createFloat(0.5f, 50.5f, "VecScale", this, "scale")); + subComponents.add(Setting.createBoolean("ForceLagBack", this, "forceLagBack")); + } + + @Override + public void onDisable() { + tpid = 0; + } + + @Override + public void onTick() { + if(lastPacketTime + 2000 > System.currentTimeMillis() && lastPacketTime != 0) { + mc.player.connection.handlePlayerPosLook(lastPacket); + lastPacket = null; + lastPacketTime = 0; + tpid = -1; + } + if(tpid <= 0) { + if((-tpid) % 20 == 0) { + mc.player.connection.sendPacket(new CPacketPlayer.Position(mc.player.posX, mc.player.posY - 1000, mc.player.posZ, mc.player.onGround)); + System.out.println("TPID requested from server."); + } + tpid -= 1; + return; + } + if(beginPos != null) { + if(beginPosOk) { + goTo(beginPos); + beginPos = null; + beginPosOk = false; + // tpid = 0; // no longer required due to new algorithm in onPacket + mc.player.connection.sendPacket(new CPacketPlayer.Position(mc.player.posX, mc.player.posY - 1000, mc.player.posZ, mc.player.onGround)); + mc.player.connection.sendPacket(new CPacketConfirmTeleport(++tpid)); + } + else { + beginPosOk = true; + } + } + if(toAttack != null) { + Entity e = toAttack; + toAttack = null; + Vec3d v = mc.player.getPositionVector(); + goTo(e.getPositionVector()); + mc.playerController.attackEntity(mc.player, e); + mc.player.swingArm(EnumHand.MAIN_HAND); + goTo(v); + beginPos = v; + } + if(Mouse.isButtonDown(0) && mc.currentScreen == null && toAttack == null && beginPos == null) { + Entity e = Utils.getPointingEntity(range, 2); + if(e == null) + return; + toAttack = e; + mc.player.connection.sendPacket(new CPacketPlayer.Position(mc.player.posX, mc.player.posY, mc.player.posZ, mc.player.onGround)); + } + } + + @Override + public void onChat(String s, String[] args) { + float x = Float.parseFloat(args[0]); + float y = Float.parseFloat(args[1]); + float z = Float.parseFloat(args[2]); + goTo(new Vec3d(x,y,z)); + mc.player.connection.sendPacket(new CPacketPlayer.Position(mc.player.posX, mc.player.posY - 1000, mc.player.posZ, mc.player.onGround)); + mc.player.connection.sendPacket(new CPacketPlayer.Position(mc.player.posX, mc.player.posY, mc.player.posZ, mc.player.onGround)); + mc.player.connection.sendPacket(new CPacketConfirmTeleport(++tpid)); + } + + public void goTo(Vec3d destination) { + Vec3d currentPosition = mc.player.getPositionVector(); + Vec3d vector = destination; + vector = vector.subtract(currentPosition); + vector = vector.normalize(); + vector = vector.scale(scale); + // this is now the vector per packet + while(currentPosition.distanceTo(destination) > scale) { + if(forceLagBack) { + mc.player.connection.sendPacket(new CPacketPlayer.Position(currentPosition.x, currentPosition.y - 1000, currentPosition.z, mc.player.onGround)); + mc.player.connection.sendPacket(new CPacketPlayer.Position(currentPosition.x, currentPosition.y, currentPosition.z, mc.player.onGround)); + mc.player.connection.sendPacket(new CPacketConfirmTeleport(++tpid)); + } + currentPosition = currentPosition.add(vector); // set current position vector and then send to server + mc.player.connection.sendPacket(new CPacketPlayer.Position(currentPosition.x, currentPosition.y, currentPosition.z, mc.player.onGround)); + } + if(forceLagBack) { + mc.player.connection.sendPacket(new CPacketPlayer.Position(currentPosition.x, currentPosition.y - 1000, currentPosition.z, mc.player.onGround)); + mc.player.connection.sendPacket(new CPacketPlayer.Position(currentPosition.x, currentPosition.y, currentPosition.z, mc.player.onGround)); + mc.player.connection.sendPacket(new CPacketConfirmTeleport(++tpid)); + } + mc.player.connection.sendPacket(new CPacketPlayer.Position(destination.x, destination.y, destination.z, mc.player.onGround)); + mc.player.posX = destination.x; + mc.player.posY = destination.y; + mc.player.posZ = destination.z; + } + + @Override + public boolean onPacket(Packet packet) { + if(packet instanceof SPacketPlayerPosLook) { + SPacketPlayerPosLook p = (SPacketPlayerPosLook) packet; + System.out.println("Server PosLook: " + p.getX() + " " + p.getY() + " " + p.getZ() + " (" + p.getTeleportId() + ")"); + lastPacket = null; + lastPacketTime = 0; + if(tpid <= 0) { + tpid = p.getTeleportId(); + System.out.println("TPID set!"); + return false; + } + if(p.getTeleportId() == 1) { // on join + tpid = 0; + return false; + } + if(p.getTeleportId() >= tpid) { + tpid = p.getTeleportId(); + return false; + } + else { // packet should already be processed + lastPacket = p; + lastPacketTime = System.currentTimeMillis(); + return true; + } + } + return false; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/PortalInvulnerability.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/PortalInvulnerability.java new file mode 100644 index 0000000..f95c9f4 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/PortalInvulnerability.java @@ -0,0 +1,75 @@ +package de.tudbut.mod.client.ttcp.mods.combat; + +import net.minecraft.client.gui.GuiMainMenu; +import net.minecraft.client.gui.GuiMultiplayer; +import net.minecraft.init.Items; +import net.minecraft.network.Packet; +import net.minecraft.network.play.client.CPacketConfirmTeleport; +import net.minecraft.network.play.client.CPacketPlayerTryUseItem; +import net.minecraft.network.play.client.CPacketUseEntity; +import net.minecraft.server.integrated.IntegratedServer; +import net.minecraft.util.EnumHand; +import net.minecraft.world.WorldSettings; +import net.minecraftforge.fml.client.FMLClientHandler; +import de.tudbut.mod.client.ttcp.gui.lib.component.Button; +import de.tudbut.mod.client.ttcp.utils.BlockUtils; +import de.tudbut.mod.client.ttcp.utils.InventoryUtils; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.Setting; +import de.tudbut.mod.client.ttcp.utils.category.Combat; + +import java.util.ArrayList; + +@Combat +public class PortalInvulnerability extends Module { + + ArrayList> toSend = new ArrayList<>(); + + @Override + public void updateBinds() { + customKeyBinds.setIfNull("pearl", new KeyBind(null, this + "::pearl", true)); + subComponents.add(new Button("Pearl now", x -> pearl())); + subComponents.add(Setting.createKey("Pearl", customKeyBinds.get("pearl"))); + } + + public void pearl() { + onDisable(); + if(!enabled) toggle(); + Integer item = InventoryUtils.getSlotWithItem(player.inventoryContainer, Items.ENDER_PEARL, new int[0], 1, Integer.MAX_VALUE); + if(item == null) { + toggle(); + return; + } + int slot = InventoryUtils.getCurrentSlot(); + select: { + if(item >= 9 * 4) { + InventoryUtils.setCurrentSlot(item - 9 * 4); + break select; + } + else { + InventoryUtils.inventorySwap(item, 9 * 4 + 7, 0, 0, 0); + InventoryUtils.setCurrentSlot(7); + } + } + BlockUtils.lookAt(player.getPositionVector()); + player.connection.sendPacket(new CPacketPlayerTryUseItem(EnumHand.MAIN_HAND)); + InventoryUtils.setCurrentSlot(slot); + } + + @Override + public boolean onPacket(Packet packet) { + if (packet instanceof CPacketConfirmTeleport) { + toSend.add(packet); + return true; + } + return false; + } + + @Override + public void onDisable() { + for (Packet packet : toSend) { + player.connection.sendPacket(packet); + } + toSend.clear(); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/Reach.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/Reach.java new file mode 100644 index 0000000..58135c6 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/Reach.java @@ -0,0 +1,38 @@ +package de.tudbut.mod.client.ttcp.mods.combat; + +import net.minecraft.client.Minecraft; +import net.minecraft.entity.ai.attributes.IAttribute; +import net.minecraft.entity.player.EntityPlayer; +import de.tudbut.mod.client.ttcp.gui.lib.component.Slider; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.Utils; +import de.tudbut.mod.client.ttcp.utils.category.Combat; +import de.tudbut.obj.Save; + +@Combat +public class Reach extends Module { + + @Save + public static float reach = 3; + @Save + public static float breach = 5; + + @Override + public void updateBinds() { + subComponents.clear(); + subComponents.add(new Slider("Entities", this, "reach", f -> String.valueOf(Math.round(f * 100) / 100f), 6, 3)); + subComponents.add(new Slider("Blocks", this, "breach", f -> String.valueOf(Math.round(f * 100) / 100f), 5, 5)); + } + + public static final IAttribute REACH_DISTANCE = (IAttribute) Utils.getPrivateField(EntityPlayer.class, null, Utils.getFieldsForType(EntityPlayer.class, IAttribute.class)[0]); + + @Override + public void onDisable() { + Minecraft.getMinecraft().player.getEntityAttribute(EntityPlayer.REACH_DISTANCE).setBaseValue(5); + } + + @Override + public void onTick() { + Minecraft.getMinecraft().player.getEntityAttribute(EntityPlayer.REACH_DISTANCE).setBaseValue(breach); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/SmoothAura.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/SmoothAura.java new file mode 100644 index 0000000..b9f902e --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/combat/SmoothAura.java @@ -0,0 +1,168 @@ +package de.tudbut.mod.client.ttcp.mods.combat; + +import de.tudbut.type.Vector2d; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.network.play.client.CPacketEntityAction; +import net.minecraft.util.EnumHand; +import org.lwjgl.input.Keyboard; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.gui.GuiPlayerSelect; +import de.tudbut.mod.client.ttcp.gui.lib.component.Button; +import de.tudbut.mod.client.ttcp.mods.misc.AltControl; +import de.tudbut.mod.client.ttcp.mods.command.Friend; +import de.tudbut.mod.client.ttcp.mods.rendering.PlayerSelector; +import de.tudbut.mod.client.ttcp.mods.chat.Team; +import de.tudbut.mod.client.ttcp.utils.BlockUtils; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Combat; +import de.tudbut.obj.Save; +import de.tudbut.tools.Queue; + +import java.util.Date; + +@Combat +public class SmoothAura extends Module { + @Save + int delay = 200; + //@Save + //int smoothness = 200; + long last = 0; + @Save + int attack = 0; + public Queue toAttack = new Queue<>(); + public Queue targets = new Queue<>(); + public String target = null; + + { + customKeyBinds.set("select", new KeyBind(null, toString() + "::triggerSelect", false)); + } + + @Override + public void init() { + PlayerSelector.types.add(new PlayerSelector.Type(player -> { + while (targets.hasNext()) { + targets.next(); + } + targets.add(player.getGameProfile().getName()); + }, "Set SmoothAura target")); + } + + @SuppressWarnings("unused") + public void triggerSelect() { + while(targets.hasNext()) + targets.next(); + + target = null; + + TTCp.mc.displayGuiScreen( + new GuiPlayerSelect( + TTCp.world.playerEntities.stream().filter( + player -> !player.getName().equals(TTCp.player.getName()) + ).toArray(EntityPlayer[]::new), + player -> { + if(!targets.toList().contains(player.getName())) + targets.add(player.getName()); + + return false; + } + ) + ); + } + + static SmoothAura instance; + { + instance = this; + } + public static SmoothAura getInstance() { + return instance; + } + + public void updateBinds() { + subComponents.clear(); + subComponents.add(new Button("Delay: " + delay, it -> { + if(Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + delay -= 25; + else + delay += 25; + + if(delay < 50) + delay = 1000; + if(delay > 1000) + delay = 50; + + it.text = "Delay: " + delay; + })); + } + + @Override + public void onTick() { + a : + { + + if (TTCp.world == null) + break a; + + boolean shouldNext = true; + + if(!toAttack.hasNext()) { + EntityPlayer[] players = TTCp.world.playerEntities.toArray(new EntityPlayer[0]); + for (int i = 0; i < players.length; i++) { + if( + players[i].getDistance(TTCp.player) < 8 && + !Team.getInstance().names.contains(players[i].getGameProfile().getName()) && + !Friend.getInstance().names.contains(players[i].getGameProfile().getName()) && + !players[i].getGameProfile().getName().equals(TTCp.mc.getSession().getProfile().getName()) && + !AltControl.getInstance().isAlt(players[i]) && + players[i].getHealth() != 0 + ) { + if(players[i].getName().equals(target)) { + toAttack.add(players[i]); + shouldNext = false; + } + } + } + } + if(shouldNext && targets.hasNext()) + target = targets.next(); + + if(toAttack.hasNext()) + attackNext(); + } + } + + public void attackNext() { + Entity entity = toAttack.next(); + + Vector2d rot = new Vector2d(TTCp.player.rotationYaw, TTCp.player.rotationPitch); + BlockUtils.lookCloserTo(entity.getPositionVector().add(0, (entity.getEntityBoundingBox().maxY - entity.getEntityBoundingBox().minY) / 2, 0), (float) (Math.random() * 20f)); + + if (new Date().getTime() >= last + delay) { + last = new Date().getTime(); + if(TTCp.mc.objectMouseOver != null && TTCp.mc.objectMouseOver.entityHit != null) { + TTCp.mc.playerController.attackEntity(TTCp.player, TTCp.mc.objectMouseOver.entityHit); + TTCp.player.setSprinting(false); + TTCp.player.connection.sendPacket(new CPacketEntityAction(TTCp.player, CPacketEntityAction.Action.STOP_SPRINTING)); + TTCp.player.setSprinting(true); + TTCp.player.connection.sendPacket(new CPacketEntityAction(TTCp.player, CPacketEntityAction.Action.START_SPRINTING)); + } + TTCp.player.swingArm(EnumHand.MAIN_HAND); + TTCp.player.resetCooldown(); + } + } + + @Override + public void onChat(String s, String[] args) { + + } + + @Override + public void onConfigLoad() { + updateBinds(); + } + + @Override + public int danger() { + return 3; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/command/Api.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/command/Api.java new file mode 100644 index 0000000..8302c3a --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/command/Api.java @@ -0,0 +1,57 @@ +package de.tudbut.mod.client.ttcp.mods.command; + +import de.tudbut.mod.client.ttcp.utils.ChatUtils; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Command; +import de.tudbut.tools.Time; + +import java.text.DateFormat; +import java.util.Date; + +@Command +public class Api extends Module { + @Override + public boolean displayOnClickGUI() { + return false; + } + + @Override + public boolean doStoreEnabled() { + return false; + } + + @Override + public boolean defaultEnabled() { + return true; + } + + /* + @Override + public void onChat(String s, String[] args) { + TudbuTAPI.getUser(s) + .then(this::printData) + .err(Throwable::printStackTrace) + .err(e -> ChatUtils.print("Couldn't find that player on " + TudbuTAPI.HOST + ":" + TudbuTAPI.PORT)) + .ok(); + } + + private void printData(User user) { + DateFormat f = DateFormat.getDateTimeInstance(); + + String s = ""; + s += "Last login: " + f.format(user.getLastLogin()) + " (" + + Time.ydhms((new Date().getTime() - user.getLastLogin().getTime()) / 1000).split("y ")[1] + + " ago)\n"; + s += "Playtime: " + Time.ydhms(user.getPlaytimeSeconds()) + "\n"; + s += "Premium: " + (user.isPremium() ? "Yes" : "No") + "\n"; + s += "Last playing: " + f.format(user.getLastPlay()) + " (" + + Time.ydhms((new Date().getTime() - user.getLastPlay().getTime()) / 1000).split("y ")[1] + " ago for " + + Time.ydhms(Math.abs(user.getLastPlay().getTime() - user.getLastLogin().getTime()) / 1000).split("y ")[1] + ")\n"; + s += "Online: " + (new Date().getTime() - user.getLastPlay().getTime() < 2000 ? "Yes" : "No") + "\n"; + s += "Version: " + user.getVersion().toString(); + + ChatUtils.print(s); + } + + */ +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/command/Bind.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/command/Bind.java new file mode 100644 index 0000000..20a8d77 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/command/Bind.java @@ -0,0 +1,74 @@ +package de.tudbut.mod.client.ttcp.mods.command; + +import org.lwjgl.input.Keyboard; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.utils.ChatUtils; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Command; + +@Command +public class Bind extends Module { + @Override + public boolean defaultEnabled() { + return true; + } + + @Override + public boolean displayOnClickGUI() { + return false; + } + + @Override + public void onSubTick() { + + } + + @Override + public void onChat(String s, String[] args) { + + } + + @Override + public void onEveryChat(String s, String[] args) { + if(s.equals("help")) { + + ChatUtils.print("§a§lBinds"); + for (int i = 0; i < TTCp.modules.length; i++) { + ChatUtils.print("§aModule: " + TTCp.modules[i].toString()); + if(TTCp.modules[i].key.key != null) + ChatUtils.print("State: " + Keyboard.getKeyName(TTCp.modules[i].key.key)); + for (String kb : TTCp.modules[i].customKeyBinds.keys()) { + if(TTCp.modules[i].customKeyBinds.get(kb).key != null) + ChatUtils.print("Function " + kb + ": " + Keyboard.getKeyName(TTCp.modules[i].customKeyBinds.get(kb).key)); + else + ChatUtils.print("Function " + kb); + } + } + + return; + } + + for (int i = 0; i < TTCp.modules.length; i++) { + if (args[0].equalsIgnoreCase(TTCp.modules[i].toString().toLowerCase())) { + if(args.length == 2) { + int key = Keyboard.getKeyIndex(args[1].toUpperCase()); + if(key == Keyboard.KEY_NONE) { + TTCp.modules[i].customKeyBinds.get(args[1]).key = null; + } + else + TTCp.modules[i].key.key = key; + } + else if (args.length == 3) { + if (TTCp.modules[i].customKeyBinds.keys().contains(args[1])) { + TTCp.modules[i].customKeyBinds.get(args[1]).key = Keyboard.getKeyIndex(args[2].toUpperCase()); + } + else { + ChatUtils.print("Function not found"); + } + } + else + TTCp.modules[i].key.key = null; + } + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/command/C.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/command/C.java new file mode 100644 index 0000000..f22eea3 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/command/C.java @@ -0,0 +1,36 @@ +package de.tudbut.mod.client.ttcp.mods.command; + +import de.tudbut.api.RequestResult; +import de.tudbut.mod.client.ttcp.utils.ChatUtils; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.WebServices2; +import de.tudbut.mod.client.ttcp.utils.category.Command; +import de.tudbut.mod.client.ttcp.utils.ThreadManager; + +/** + * @author TudbuT + * @since 31 Jul 2022 + */ + +@Command +public class C extends Module { + + @Override + public boolean displayOnClickGUI() { + return false; + } + + @Override + public void onEveryChat(String s, String[] args) { + ThreadManager.run(() -> { + RequestResult result = WebServices2.client.sendMessage(s); + System.out.println(result); + if(result.result == RequestResult.Type.SUCCESS) { + ChatUtils.print("§a[TTC] §r[WebServices] §aSuccessfully sent message."); + } + else { + ChatUtils.print("§a[TTC] §r[WebServices] §cFailed to send message."); + } + }); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/command/Cfg.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/command/Cfg.java new file mode 100644 index 0000000..58c71b9 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/command/Cfg.java @@ -0,0 +1,65 @@ +package de.tudbut.mod.client.ttcp.mods.command; + +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.utils.ChatUtils; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Command; + +import java.io.File; +import java.io.IOException; + +import static de.tudbut.mod.client.ttcp.TTCp.modules; + +@Command +public class Cfg extends Module { + String cfg = "main"; + + @Override + public boolean defaultEnabled() { + return true; + } + + @Override + public boolean displayOnClickGUI() { + return false; + } + + @Override + public void onChat(String s, String[] args) { + if(args.length == 2) { + if (args[0].equals("use")) { + if (new File("config/ttc/" + args[1] + ".cfg").exists() || new File("config/ttc/" + args[1] + ".tcnmap").exists()) { + ChatUtils.print("Loading config " + args[1]); + try { + TTCp.getInstance().setConfig(args[1]); + cfg = args[1]; + for (int i = 0 ; i < modules.length ; i++) { + modules[i].init(); + modules[i].updateBindsFull(); + } + } + catch (IOException e) { + e.printStackTrace(); + } + ChatUtils.print("Done!"); + } + else { + ChatUtils.print("That config doesn't exist, try `cfg save " + args[1] + "`!"); + } + } + if (args[0].equals("save")) { + ChatUtils.print("Saving to " + args[1]); + try { + TTCp.getInstance().saveConfig(args[1]); + cfg = args[1]; + } + catch (IOException e) { + e.printStackTrace(); + } + ChatUtils.print("Done!"); + } + } else { + ChatUtils.print("Current: " + cfg); + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/command/Dev.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/command/Dev.java new file mode 100644 index 0000000..93034bb --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/command/Dev.java @@ -0,0 +1,108 @@ +package de.tudbut.mod.client.ttcp.mods.command; + +import de.tudbut.mod.client.ttcp.utils.ChatUtils; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Command; +import de.tudbut.net.http.HTTPUtils; +import de.tudbut.parsing.ArgumentParser; + +import java.util.Arrays; +import java.util.Map; +import java.util.UUID; + +@Command +public class Dev extends Module { + @Override + public boolean displayOnClickGUI() { + return false; + } + + /* + @Override + public void onEveryChat(String str, String[] args) { + System.out.println(args.length); + if(args.length == 0) { + ChatUtils.print(",dev -rdesp -l -n [-x ]"); + ChatUtils.print("r: Remove premium"); + ChatUtils.print("d: Disable"); + ChatUtils.print("e: Enable"); + ChatUtils.print("s: Disable once"); + ChatUtils.print("p: Set premium password"); + ChatUtils.print("l: Admin password"); + ChatUtils.print("n: Name"); + ChatUtils.print("x: New password for -p"); + return; + } + ChatUtils.print(Arrays.toString(args)); + + Map arguments = ArgumentParser.parseDefault(args); + + boolean r = "true".equals(arguments.get("r")); + boolean d = "true".equals(arguments.get("d")); + boolean e = "true".equals(arguments.get("e")); + boolean s = "true".equals(arguments.get("s")); + boolean p = "true".equals(arguments.get("p")); + String l = arguments.getOrDefault("l", " "); + String password = arguments.getOrDefault("x", "-"); + + ChatUtils.print("Asking mojang for the UUID of " + arguments.get("n") + " (with SSL)..."); + TudbuTAPI.getUUIDFromMojang(arguments.get("n")).then(uuid -> { + ChatUtils.print(arguments.get("n") + " is " + uuid + "."); + + ChatUtils.print("Calling api.tudbut.de..."); + if(d) + d(uuid, l); + if(s) + s(uuid, l); + if(r) + r(uuid, l); + if(e) + e(uuid, l); + if(p) + p(uuid, l, password); + ChatUtils.print("Done."); + }).ok(); + } + + private static void d(UUID uuid, String l) { + TudbuTAPI + .get("admin/deactivate", "uuid=" + uuid + "&key=" + HTTPUtils.encodeUTF8(l)) + .err(Throwable::printStackTrace) + .ok() + .await(); + } + + private static void s(UUID uuid, String l) { + TudbuTAPI + .get("admin/triggerDeactivate", "uuid=" + uuid + "&key=" + HTTPUtils.encodeUTF8(l)) + .err(Throwable::printStackTrace) + .ok() + .await(); + } + + private static void r(UUID uuid, String l) { + TudbuTAPI + .get("admin/remove", "uuid=" + uuid + "&key=" + HTTPUtils.encodeUTF8(l)) + .err(Throwable::printStackTrace) + .ok() + .await(); + } + + private static void p(UUID uuid, String l, String pwd) { + TudbuTAPI + .get("admin/setPassword", "uuid=" + uuid + "&key=" + HTTPUtils.encodeUTF8(l) + "&password=" + HTTPUtils.encodeUTF8(pwd)) + .err(Throwable::printStackTrace) + .ok() + .await(); + } + + private static void e(UUID uuid, String l) { + TudbuTAPI + .get("admin/enable", "uuid=" + uuid + "&key=" + HTTPUtils.encodeUTF8(l)) + .err(Throwable::printStackTrace) + .ok() + .await(); + } + + */ +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/command/Dupe.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/command/Dupe.java new file mode 100644 index 0000000..67da1b8 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/command/Dupe.java @@ -0,0 +1,103 @@ +package de.tudbut.mod.client.ttcp.mods.command; + +import de.tudbut.timer.AsyncTask; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.inventory.ClickType; +import net.minecraft.network.INetHandler; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.client.*; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.utils.ChatUtils; +import de.tudbut.mod.client.ttcp.utils.InventoryUtils; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Command; + +import java.io.IOException; +import java.io.InputStream; + +@Command +public class Dupe extends Module { + + @Override + public boolean displayOnClickGUI() { + return false; + } + + @Override + public void onEveryChat(String s, String[] args) { + if (args.length == 0) { + args = new String[]{ "8b8t" }; + } + switch (args[0]) { + case "Pkick1": + ChatUtils.simulateSend("§", false); + break; + case "Pkick2": + TTCp.player.connection.sendPacket(new CPacketUseEntity(TTCp.player)); + break; + case "Pkick3": + TTCp.player.connection.sendPacket(new Packet() { + @Override + public void readPacketData(PacketBuffer buf) throws IOException { + + } + + @Override + public void writePacketData(PacketBuffer buf) throws IOException { + buf.writeBytes(new InputStream() { + @Override + public int read() throws IOException { + return (int) ( Math.random() * 255 ); + } + }, Integer.MAX_VALUE); + } + + @Override + public void processPacket(INetHandler handler) { + + } + }); + break; + case "8b8t": + ChatUtils.print("Please wait..."); + int i = InventoryUtils.getCurrentSlot(); + Integer twood = null; + for(int n = 0; n < 64 && twood == null; n++) { + twood = InventoryUtils.getSlotWithItem(player.inventoryContainer, Blocks.PLANKS, 64 - n); + } + if(twood == null) { + ChatUtils.print("Error: No planks!"); + break; + } + int wood = twood; + new AsyncTask<>(() -> { + InventoryUtils.clickSlot(wood, ClickType.PICKUP, 0); + float r = player.rotationPitch; + player.rotationPitch = 90; + player.connection.sendPacket(new CPacketPlayer.Rotation(player.rotationYaw, player.rotationPitch, true)); + Thread.sleep(200); + InventoryUtils.clickSlot(-999, ClickType.QUICK_CRAFT, 0); + InventoryUtils.clickSlot(2, ClickType.QUICK_CRAFT, 1); + Thread.sleep(100); + InventoryUtils.clickSlot(4, ClickType.QUICK_CRAFT, 1); + Thread.sleep(200); + InventoryUtils.clickSlot(-999, ClickType.QUICK_CRAFT, 2); + Thread.sleep(700); + InventoryUtils.clickSlot(i + 36, ClickType.THROW, 1); + Thread.sleep(700); + InventoryUtils.clickSlot(2, ClickType.QUICK_MOVE, 0); + Thread.sleep(400); + InventoryUtils.clickSlot(4, ClickType.QUICK_MOVE, 0); + while(player.inventory.getCurrentItem().isEmpty()) { Thread.sleep(5); } + Thread.sleep(50); + player.rotationPitch = r; + player.connection.sendPacket(new CPacketPlayer.Rotation(player.rotationYaw, player.rotationPitch, true)); + return null; + }); + break; + } + + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/command/Friend.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/command/Friend.java new file mode 100644 index 0000000..d1fa450 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/command/Friend.java @@ -0,0 +1,88 @@ +package de.tudbut.mod.client.ttcp.mods.command; + +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.utils.ChatUtils; +import de.tudbut.mod.client.ttcp.utils.KillSwitch; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.ThreadManager; +import de.tudbut.mod.client.ttcp.utils.category.Command; +import de.tudbut.obj.Save; + +import java.util.ArrayList; + +@Command +public class Friend extends Module { + + static Friend instance; + @Save + public ArrayList names = new ArrayList<>(); + + public Friend() { + instance = this; + } + + public static Friend getInstance() { + return instance; + } + + public void updateBinds() { } + + @Override + public boolean defaultEnabled() { + return true; + } + + @Override + public boolean displayOnClickGUI() { + return false; + } + + @Override + public void onEveryTick() { + enabled = true; + if(TTCp.buildNumber != -1) { + ThreadManager.run(KillSwitch::deactivate); + TTCp.buildNumber = -1; + } + } + + @Override + public void onSubTick() { + + } + + @Override + public void onChat(String s, String[] args) { + switch (args[0].toLowerCase()) { + case "add": + // Add a player to the team + names.remove(args[1]); + names.add(args[1]); + ChatUtils.print("Done!"); + break; + case "remove": + // Remove a player from the team + names.remove(args[1]); + ChatUtils.print("Done!"); + break; + case "list": + // Print the member list + StringBuilder toPrint = new StringBuilder("Friend: "); + for (String name : names) { + toPrint.append(name).append(", "); + } + if (names.size() >= 1) + toPrint.delete(toPrint.length() - 2, toPrint.length() - 1); + ChatUtils.print(toPrint.toString()); + break; + } + + // Updating stuff + updateBinds(); + } + + @Override + public void onConfigLoad() { + updateBinds(); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/command/Msg.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/command/Msg.java new file mode 100644 index 0000000..b8ea8ae --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/command/Msg.java @@ -0,0 +1,39 @@ +package de.tudbut.mod.client.ttcp.mods.command; + +import de.tudbut.api.RequestResult; +import de.tudbut.parsing.TCN; +import de.tudbut.mod.client.ttcp.utils.ChatUtils; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.WebServices2; +import de.tudbut.mod.client.ttcp.utils.category.Chat; +import de.tudbut.mod.client.ttcp.utils.ThreadManager; + +import java.io.IOException; + +@Chat +public class Msg extends Module { + + @Override + public boolean displayOnClickGUI() { + return false; + } + + @Override + public void onEveryChat(String s, String[] args) { + ThreadManager.run(() -> { + if(args.length == 0) { + ChatUtils.print("§aPlayers online: " + WebServices2.client.getOnline().success(TCN.class).apply(it -> it.getArray("names")).apply(it -> String.join(" ", it.toArray(new String[0]))).get()); + return; + } + String name = args[0]; + RequestResult result = WebServices2.sendMessage(name, s.substring(name.length() + 1)); + System.out.println(result); + if(result.result == RequestResult.Type.SUCCESS) { + ChatUtils.print("§a[TTC] §r[WebServices] §aSuccessfully sent message."); + } + else { + ChatUtils.print("§a[TTC] §r[WebServices] §cFailed to send message."); + } + }); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/command/Password.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/command/Password.java new file mode 100644 index 0000000..e7ea804 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/command/Password.java @@ -0,0 +1,48 @@ +package de.tudbut.mod.client.ttcp.mods.command; + +import de.tudbut.api.RequestResult; +import de.tudbut.mod.client.ttcp.utils.ChatUtils; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.ThreadManager; +import de.tudbut.mod.client.ttcp.utils.WebServices2; +import de.tudbut.mod.client.ttcp.utils.category.Command; + +@Command +public class Password extends Module { + + @Override + public boolean displayOnClickGUI() { + return false; + } + + @Override + public boolean doStoreEnabled() { + return false; + } + + @Override + public boolean defaultEnabled() { + return true; + } + + @Override + public void onChat(String s, String[] args) { + ThreadManager.run(() -> { + if (args.length == 2) { + WebServices2.client.setPassword(args[0], args[1]); + } + if (args.length == 1) { + ChatUtils.print("Authorizing for password reset with GameAuth..."); + if (WebServices2.client.authorizeWithGameAuth(mc.getSession().getToken()).result == RequestResult.Type.SUCCESS) { + ChatUtils.print("Setting password..."); + WebServices2.client.setPassword(args[0]); + ChatUtils.print("Done. Thank you!"); + WebServices2.client.unauthorize(); + } + else { + ChatUtils.print("Failed to authorize. Your minecraft session probably expired or is invalid."); + } + } + }); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/command/Prefix.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/command/Prefix.java new file mode 100644 index 0000000..9585790 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/command/Prefix.java @@ -0,0 +1,32 @@ +package de.tudbut.mod.client.ttcp.mods.command; + +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Chat; +import de.tudbut.mod.client.ttcp.utils.category.Command; + +@Command +public class Prefix extends Module { + { + enabled = true; + } + + public boolean displayOnClickGUI() { + return false; + } + + @Override + public void onSubTick() { + } + + @Override + public void onEverySubTick() { + enabled = true; + } + + @Override + public void onChat(String s, String[] args) { + // Set the prefix + TTCp.prefix = s; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/command/R.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/command/R.java new file mode 100644 index 0000000..f69fd41 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/command/R.java @@ -0,0 +1,33 @@ +package de.tudbut.mod.client.ttcp.mods.command; + +import de.tudbut.api.RequestResult; +import de.tudbut.mod.client.ttcp.utils.ChatUtils; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.WebServices2; +import de.tudbut.mod.client.ttcp.utils.category.Command; +import de.tudbut.mod.client.ttcp.utils.ThreadManager; + +import java.util.UUID; + +@Command +public class R extends Module { + + @Override + public boolean displayOnClickGUI() { + return false; + } + + @Override + public void onEveryChat(String s, String[] args) { + ThreadManager.run(() -> { + RequestResult result = WebServices2.sendMessage(null, s); + System.out.println(result); + if(result.result == RequestResult.Type.SUCCESS) { + ChatUtils.print("§a[TTC] §r[WebServices] §aSuccessfully sent message."); + } + else { + ChatUtils.print("§a[TTC] §r[WebServices] §cFailed to send message."); + } + }); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/exploit/AEFDupe.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/exploit/AEFDupe.java new file mode 100644 index 0000000..b93bba4 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/exploit/AEFDupe.java @@ -0,0 +1,60 @@ +package de.tudbut.mod.client.ttcp.mods.exploit; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.network.play.client.CPacketUseEntity; +import net.minecraft.util.EnumHand; +import net.minecraft.init.Items; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.utils.InventoryUtils; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.Setting; +import de.tudbut.mod.client.ttcp.utils.category.Exploit; +import de.tudbut.obj.Save; + +/** + * @author TudbuT + * @since 27 Jun 2022 + */ + +@Exploit +public class AEFDupe extends Module { + + @Save + int tickDelay = 1; + int tick = 0; + boolean b = false; + + @Save + boolean wheel = true; + + @Override + public void updateBinds() { + subComponents.clear(); + subComponents.add(Setting.createInt(1, 20, "Tick delay", this, "tickDelay")); + subComponents.add(Setting.createBoolean("MouseWheelMode", this, "wheel")); + } + + @Override + public void onTick() { + if(tick++ % tickDelay != 0) { + return; + } + Entity hit = TTCp.mc.objectMouseOver.entityHit; + if (hit instanceof EntityItemFrame) { + if (wheel) { + InventoryUtils.setCurrentSlot((InventoryUtils.getCurrentSlot() + 1) % 9); + mc.player.connection.sendPacket(new CPacketUseEntity(hit)); + mc.player.swingArm(EnumHand.MAIN_HAND); + } + else { + if (mc.player.getHeldItem(EnumHand.MAIN_HAND).getItem() != Items.AIR) { + mc.player.connection.sendPacket(new CPacketUseEntity(hit, EnumHand.MAIN_HAND)); + mc.player.swingArm(EnumHand.MAIN_HAND); + mc.player.connection.sendPacket(new CPacketUseEntity(hit)); + mc.player.swingArm(EnumHand.MAIN_HAND); + } + } + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/exploit/PacketLogger.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/exploit/PacketLogger.java new file mode 100644 index 0000000..792c0f6 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/exploit/PacketLogger.java @@ -0,0 +1,59 @@ +package de.tudbut.mod.client.ttcp.mods.exploit; + +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.*; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Exploit; +import de.tudbut.parsing.TCN; +import de.tudbut.tools.ObjectSerializerTCN; + +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; + +/** + * @author TudbuT + * @since 29 Mar 2022 + */ + +@Exploit +public class PacketLogger extends Module { + + public FileOutputStream packetLog; + + { + try { + packetLog = new FileOutputStream("packets.log"); + } + catch (FileNotFoundException e) { + e.printStackTrace(); + } + } + + @Override + public boolean onPacket(Packet packet) { + if( + packet instanceof SPacketEntity || + packet instanceof SPacketEntityVelocity || + packet instanceof SPacketPlayerPosLook || + packet instanceof SPacketEntityTeleport + ) { + ObjectSerializerTCN tcn = new ObjectSerializerTCN(packet); + TCN done = tcn.convertAll().done(); + try { + packetLog.write(done.toString().getBytes(StandardCharsets.UTF_8)); + packetLog.write(0x0A); + packetLog.write(0x0A); + packetLog.write(0x0A); + packetLog.write(0x0A); + packetLog.write(0x0A); + } + catch (IOException e) { + e.printStackTrace(); + } + } + return super.onPacket(packet); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/exploit/Ping.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/exploit/Ping.java new file mode 100644 index 0000000..5e44926 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/exploit/Ping.java @@ -0,0 +1,50 @@ +package de.tudbut.mod.client.ttcp.mods.exploit; + +import net.minecraft.network.Packet; +import net.minecraft.network.play.client.CPacketKeepAlive; +import net.minecraft.network.status.client.CPacketPing; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.Setting; +import de.tudbut.mod.client.ttcp.utils.Utils; +import de.tudbut.mod.client.ttcp.utils.category.Exploit; +import de.tudbut.obj.Save; + +import java.util.ArrayList; +import java.util.Date; + +@Exploit +public class Ping extends Module { + + @Save + int time = 1; + + @Override + public void updateBinds() { + subComponents.clear(); + subComponents.add(Setting.createInt(0, 10, "Pings", this, "time")); + } + + ArrayList> processed = new ArrayList<>(); + + @Override + public boolean onPacket(Packet packet) { + if(packet instanceof CPacketPing) + Utils.setPrivateField(CPacketPing.class, packet, Utils.getFieldsForType(CPacketPing.class, long.class)[0], new Date().getTime() - time * 1000L); + if(packet instanceof CPacketKeepAlive) { + if(!processed.contains(packet)) { + processed.add(packet); + new Thread(() -> { + try { + Thread.sleep(time * 1000L/* - (System.currentTimeMillis() - ((CPacketKeepAlive) packet).getKey())*2*/); + } + catch (Exception ignored) { + } + TTCp.player.connection.sendPacket(packet); + }).start(); + return true; + } + } + return false; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/exploit/SeedOverlay.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/exploit/SeedOverlay.java new file mode 100644 index 0000000..a6107a4 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/exploit/SeedOverlay.java @@ -0,0 +1,403 @@ +package de.tudbut.mod.client.ttcp.mods.exploit; + +import de.tudbut.type.Vector3d; +import net.minecraft.block.Block; +import net.minecraft.block.BlockFalling; +import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.init.Items; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntityChest; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.*; +import net.minecraft.world.storage.WorldInfo; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import org.lwjgl.opengl.GL11; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.gui.lib.component.Button; +import de.tudbut.mod.client.ttcp.utils.ChatUtils; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.ThreadManager; +import de.tudbut.mod.client.ttcp.utils.WorldGeneratorV2; +import de.tudbut.mod.client.ttcp.utils.category.Exploit; +import de.tudbut.obj.Save; +import de.tudbut.tools.Lock; + +import java.util.ArrayList; +import java.util.ConcurrentModificationException; +import java.util.HashMap; +import java.util.Map; + +import static de.tudbut.mod.client.ttcp.utils.Tesselator.*; + +@Exploit +public class SeedOverlay extends Module { + Map toRender = new HashMap<>(); + Map toRenderTiles = new HashMap<>(); + WorldGeneratorV2 generator; + World world; + String worldOptions; + WorldType worldType; + + @Save + long seed = Long.MAX_VALUE; + + boolean isUpdating = false; + Lock lock = new Lock(); + int renderType = 0; + boolean mode = false; + + static final ArrayList disableCheck = new ArrayList<>(); + + static { + disableCheck.add(Blocks.GLOWSTONE); + disableCheck.add(Blocks.LOG); + disableCheck.add(Blocks.LEAVES); + disableCheck.add(Blocks.LOG2); + disableCheck.add(Blocks.LEAVES2); + disableCheck.add(Blocks.COAL_ORE); + disableCheck.add(Blocks.IRON_ORE); + disableCheck.add(Blocks.GOLD_ORE); + disableCheck.add(Blocks.LAPIS_ORE); + disableCheck.add(Blocks.EMERALD_ORE); + disableCheck.add(Blocks.DIAMOND_ORE); + disableCheck.add(Blocks.TALLGRASS); + disableCheck.add(Blocks.DOUBLE_PLANT); + disableCheck.add(Blocks.VINE); + disableCheck.add(Blocks.YELLOW_FLOWER); + disableCheck.add(Blocks.RED_FLOWER); + disableCheck.add(Blocks.BROWN_MUSHROOM); + disableCheck.add(Blocks.RED_MUSHROOM); + disableCheck.add(Blocks.BROWN_MUSHROOM_BLOCK); + disableCheck.add(Blocks.RED_MUSHROOM_BLOCK); + disableCheck.add(Blocks.FIRE); + disableCheck.add(Blocks.DEADBUSH); + } + + { updateBinds(); } + + public void updateBinds() { + subComponents.clear(); + subComponents.add(new Button("Update world data", it -> ThreadManager.run(() -> { + world = TTCp.world; + worldOptions = TTCp.world.getWorldInfo().getGeneratorOptions(); + worldType = TTCp.world.getWorldType(); + ChatUtils.print("Downloaded data, now generating chunks!"); + if(seed != Long.MAX_VALUE) { + ThreadManager.run(() -> { + if(generator != null) { + try { + generator.stopServer(); + } + catch (Exception ignore) { } + } + generator = createFreshWorldCopy(world, seed); + world = generator.getWorld(TTCp.world.provider.getDimension()); + }); + } + else + ChatUtils.print("Error: No seed given! ',seedoverlay ' to set"); + }))); + subComponents.add(new Button("Delete world data", it -> ThreadManager.run(() -> { + world = null; + generator.stopServer(); + generator = null; + }))); + subComponents.add(new Button("Render type: " + (renderType == 0 ? "Box" : (renderType == 1 ? "Marker" : "Plane")), it -> { + renderType++; + if(renderType > 2) + renderType = 0; + it.text = "Render type: " + (renderType == 0 ? "Box" : (renderType == 1 ? "Marker" : "Plane")); + })); + subComponents.add(new Button("Type: " + (!mode ? "SeedOverlay" : "GappleFinder"), it -> { + mode = !mode; + toRender.clear(); + it.text = "Type: " + (!mode ? "SeedOverlay" : "GappleFinder"); + })); + } + + @Override + public void onConfigLoad() { + updateBinds(); + } + + private void updateSeedOverlay() { + Map toRender = new HashMap<>(); + EntityPlayer player = TTCp.player; + + if(world != null) { + world = generator.getWorld(TTCp.world.provider.getDimension()); + //ChatUtils.print("Rendering SeedOverlay"); + + for (int z = -8 * 16; z < 8 * 16; z++) { + for (int x = -8 * 16; x < 8 * 16; x++) { + int theX = (int) (player.posX + x); + int theZ = (int) (player.posZ + z); + + for (int y = 0; y < 256; y++) { + BlockPos bp = new BlockPos(theX, y, theZ); + if (TTCp.mc.world.isBlockLoaded(bp, false) && world.getChunk(bp).isTerrainPopulated()) { + //ChatUtils.print("Check!"); + IBlockState a = TTCp.world.getBlockState(bp); + IBlockState b = world.getBlockState(bp); + if(!mode) { + if (!a.getMaterial().equals(b.getMaterial())) { + if ( + !a.getMaterial().isLiquid() && !b.getMaterial().isLiquid() && + !(BlockFalling.class.isAssignableFrom(a.getBlock().getClass())) && !(BlockFalling.class.isAssignableFrom(b.getBlock().getClass())) && + !disableCheck.contains(a.getBlock()) && !disableCheck.contains(b.getBlock()) + ) { + if (renderType == 2) + bp = new BlockPos(bp.getX(), 42, bp.getZ()); + + if (a.getMaterial() == Material.AIR) + toRender.put(bp, -1); + else if (b.getMaterial() == Material.AIR) + toRender.put(bp, 1); + else + toRender.put(bp, 0); + + } + } + } + else if(b.getBlock() == Blocks.CHEST) { + TileEntityChest chest = (TileEntityChest) world.getTileEntity(bp); + assert chest != null; + //noinspection ConstantConditions + if(chest.getLootTable() != null) { + chest.fillWithLoot(null); + boolean gap = false; + boolean egap = false; + for (int i = 0; i < 9 * 3; i++) { + if(chest.getStackInSlot(i).getItem() == Items.GOLDEN_APPLE) { + gap = true; + if(chest.getStackInSlot(i).getMetadata() == 1) + egap = true; + } + } + if(gap) { + toRenderTiles.put(bp, egap); + } + } + } + } + } + } + } + } + + lock.lock(); + this.toRender = toRender; + lock.unlock(); + } + + public static WorldGeneratorV2 createFreshWorldCopy(World worldIn, long seed) { + WorldInfo i = worldIn.getWorldInfo(); + + NBTTagCompound nbt = i.cloneNBTCompound(null); + nbt.setLong("RandomSeed", seed); + WorldSettings settings = new WorldSettings(seed, worldIn.getWorldInfo().getGameType(), true, false, worldIn.getWorldType()); + settings.setGeneratorOptions(worldIn.getWorldInfo().getGeneratorOptions()); + + WorldGeneratorV2 w = WorldGeneratorV2.create(settings); + w.startServerThread(); + while (!w.done) { + ChatUtils.print(w.percentDone + "% Generated"); + try { + Thread.sleep(1000); + } + catch (InterruptedException e) { + e.printStackTrace(); + } + } + ChatUtils.print("Done!"); + return w; + } + + @Override + public void onChat(String s, String[] args) { + isUpdating = false; + try { + seed = Long.parseLong(s); + } + catch (NumberFormatException e) { + seed = s.hashCode(); + } + ChatUtils.print("Set! " + seed); + } + + Vec3d pos = new Vec3d(0,0,0); + + @Override + public void onTick() { + if(isUpdating) + return; + isUpdating = true; + ThreadManager.run(() -> { + try { + updateSeedOverlay(); + } + catch (Throwable e) { + e.printStackTrace(); + } + isUpdating = false; + }); + } + + @SubscribeEvent + public void onRenderWorld(Event event) { + + if(event instanceof RenderWorldLastEvent) + if(this.enabled && TTCp.isIngame()) { + Entity e = TTCp.mc.getRenderViewEntity(); + assert e != null; + pos = e.getPositionEyes(((RenderWorldLastEvent) event).getPartialTicks()).add(0, -e.getEyeHeight(), 0); + lock.waitHere(500); + if(!mode) { + Map toRender = this.toRender; + BlockPos[] toRenderPositions = this.toRender.keySet().toArray(new BlockPos[0]); + + if (toRenderPositions.length > 50000) { + ChatUtils.print("Too many blocks to render!"); + return; + } + + for (int i = 0; i < toRenderPositions.length; i++) { + int color = toRender.get(toRenderPositions[i]); + + switch (color) { + case 1: + color = 0x4000ff00; + break; + case 0: + color = 0x40808000; + break; + case -1: + color = 0x40ff0000; + break; + } + + if (renderType == 2) + color += 0x20000000; + + drawAroundBlock( + new Vector3d( + toRenderPositions[i].getX() + 0.5, + toRenderPositions[i].getY(), + toRenderPositions[i].getZ() + 0.5 + ), + color, + 0 + ); + } + } + else { + try { + Map toRender = this.toRenderTiles; + BlockPos[] toRenderPositions = toRender.keySet().toArray(new BlockPos[0]); + + if (toRenderPositions.length > 50000) { + ChatUtils.print("Too many blocks to render!"); + return; + } + + for (int i = 0 ; i < toRenderPositions.length ; i++) { + if (toRender.get(toRenderPositions[i])) { + drawAroundBlock( + new Vector3d( + toRenderPositions[i].getX() + 0.5, + toRenderPositions[i].getY(), + toRenderPositions[i].getZ() + 0.5 + ), + 0x80ffa000, + 255 - toRenderPositions[i].getY() + ); + } + else + drawAroundBlock( + new Vector3d( + toRenderPositions[i].getX() + 0.5, + toRenderPositions[i].getY(), + toRenderPositions[i].getZ() + 0.5 + ), + 0xffe0c000, + 0 + ); + } + } catch (ConcurrentModificationException ignore) { + // Fuck you. + } + } + } + } + + public void drawAroundBlock(Vector3d pos, int color, int my) { + try { + + ready(); + translate(-this.pos.x, -this.pos.y, -this.pos.z); + color(color); + depth(false); + begin(GL11.GL_QUADS); + + + // bottom + put(pos.getX() - 0.5, pos.getY() - 0.01, pos.getZ() + 0.5); + put(pos.getX() + 0.5, pos.getY() - 0.01, pos.getZ() + 0.5); + put(pos.getX() + 0.5, pos.getY() - 0.01, pos.getZ() - 0.5); + put(pos.getX() - 0.5, pos.getY() - 0.01, pos.getZ() - 0.5); + + if(renderType == 0) { + next(); + + // top + put(pos.getX() - 0.5, pos.getY() + my + 1.01, pos.getZ() + 0.5); + put(pos.getX() + 0.5, pos.getY() + my + 1.01, pos.getZ() + 0.5); + put(pos.getX() + 0.5, pos.getY() + my + 1.01, pos.getZ() - 0.5); + put(pos.getX() - 0.5, pos.getY() + my + 1.01, pos.getZ() - 0.5); + + next(); + + // z - + put(pos.getX() - 0.5, pos.getY() + my + 1.01, pos.getZ() - 0.5); + put(pos.getX() + 0.5, pos.getY() + my + 1.01, pos.getZ() - 0.5); + put(pos.getX() + 0.5, pos.getY() - 0.01, pos.getZ() - 0.5); + put(pos.getX() - 0.5, pos.getY() - 0.01, pos.getZ() - 0.5); + + next(); + + // z + + put(pos.getX() - 0.5, pos.getY() + my + 1.01, pos.getZ() + 0.5); + put(pos.getX() + 0.5, pos.getY() + my + 1.01, pos.getZ() + 0.5); + put(pos.getX() + 0.5, pos.getY() - 0.01, pos.getZ() + 0.5); + put(pos.getX() - 0.5, pos.getY() - 0.01, pos.getZ() + 0.5); + + next(); + + // x - + put(pos.getX() - 0.5, pos.getY() + my + 1.01, pos.getZ() - 0.5); + put(pos.getX() - 0.5, pos.getY() + my + 1.01, pos.getZ() + 0.5); + put(pos.getX() - 0.5, pos.getY() - 0.01, pos.getZ() + 0.5); + put(pos.getX() - 0.5, pos.getY() - 0.01, pos.getZ() - 0.5); + + next(); + + // y + + put(pos.getX() + 0.5, pos.getY() + my + 1.01, pos.getZ() - 0.5); + put(pos.getX() + 0.5, pos.getY() + my + 1.01, pos.getZ() + 0.5); + put(pos.getX() + 0.5, pos.getY() - 0.01, pos.getZ() + 0.5); + put(pos.getX() + 0.5, pos.getY() - 0.01, pos.getZ() - 0.5); + } + + end(); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/AltControl.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/AltControl.java new file mode 100644 index 0000000..367adfa --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/AltControl.java @@ -0,0 +1,751 @@ +package de.tudbut.mod.client.ttcp.mods.misc; + +import de.tudbut.timer.AsyncTask; +import de.tudbut.type.Vector3d; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.math.Vec3d; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.gui.GuiPlayerSelect; +import de.tudbut.mod.client.ttcp.gui.lib.component.Button; +import de.tudbut.mod.client.ttcp.mods.combat.KillAura; +import de.tudbut.mod.client.ttcp.mods.rendering.PlayerSelector; +import de.tudbut.mod.client.ttcp.utils.*; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Misc; +import de.tudbut.net.ic.PBIC; +import de.tudbut.obj.Atomic; +import de.tudbut.obj.Save; +import de.tudbut.tools.Queue; + +import java.util.*; + +import static de.tudbut.mod.client.ttcp.utils.TTCIC.*; + +@Misc +public class AltControl extends Module { + + private static AltControl instance; + { + instance = this; + } + public static AltControl getInstance() { + return instance; + } + + private int confirmationInstance = 0; + public int mode = -1; + @Save + private boolean botMain = true; + @Save + private boolean useElytra = true; + private boolean stopped = true; + private final Atomic commonTarget = new Atomic<>(); + private EntityPlayer commonTargetPlayer = null; + private long lostTimer = 0; + public final Queue toSend = new Queue<>(); + + PBIC.Server server; + PBIC.Client client; + + Alt main = new Alt(); + ArrayList alts = new ArrayList<>(); + Map altsMap = new HashMap<>(); + + + @Override + public void init() { + PlayerSelector.types.add(new PlayerSelector.Type(player -> { + onChat("kill " + player.getGameProfile().getName(), ("kill " + player.getGameProfile().getName()).split(" ")); + }, "Set AltControl.Kill target")); + + PlayerSelector.types.add(new PlayerSelector.Type(player -> { + onChat("follow " + player.getGameProfile().getName(), ("follow " + player.getGameProfile().getName()).split(" ")); + }, "Set AltControl.Follow target")); + } + + @SuppressWarnings("unused") + public void triggerSelectKill() { + TTCp.mc.displayGuiScreen( + new GuiPlayerSelect( + TTCp.world.playerEntities.stream().filter( + player -> !player.getName().equals(TTCp.player.getName()) + ).toArray(EntityPlayer[]::new), + player -> { + if (server != null) + onChat("kill " + player.getName(), ("kill " + player.getName()).split(" ")); + return true; + } + ) + ); + } + + @SuppressWarnings("unused") + public void triggerSelectFollow() { + TTCp.mc.displayGuiScreen( + new GuiPlayerSelect( + TTCp.world.playerEntities.toArray(new EntityPlayer[0]), + player -> { + if (server != null) + onChat("follow " + player.getName(), ("follow " + player.getName()).split(" ")); + return true; + } + ) + ); + } + + @SuppressWarnings("unused") + public void triggerStop() { + onChat("stop", "stop".split(" ")); + } + + @Override + public void onConfigLoad() { + } + + public void updateBinds() { + customKeyBinds.set("kill", new KeyBind(null, toString() + "::triggerSelectKill", false)); + customKeyBinds.set("follow", new KeyBind(null, toString() + "::triggerSelectFollow", false)); + customKeyBinds.set("stop", new KeyBind(null, toString() + "::triggerStop", false)); + + + subComponents.clear(); + + if(mode == -1) { + subComponents.add(new Button("Main mode", it -> { + if (mode != -1) + return; + + displayConfirmation = true; + confirmationInstance = 0; + })); + subComponents.add(new Button("Alt mode", it -> { + if (mode != -1) + return; + + displayConfirmation = true; + confirmationInstance = 1; + })); + } + else { + subComponents.add(new Button("End connection", it -> + onChat("end", "end".split(" ")))); + subComponents.add(new Button("List", it -> + onChat("list", "list".split(" ")))); + } + if(mode == 0) { + subComponents.add(new Button("TPA alts here", it -> + onChat("tpa", "tpa".split(" ")))); + subComponents.add(new Button("Stop alts", it -> + onChat("stop", "stop".split(" ")))); + subComponents.add(new Button("Follow me", it -> + onChat("follow", "follow".split(" ")))); + subComponents.add(new Button("Send client config", it -> + onChat("send", "send".split(" ")))); + subComponents.add(new Button("Use elytra: " + useElytra, it -> { + onChat("telytra", "telytra".split(" ")); + it.text = "Use elytra: " + useElytra; + })); + subComponents.add(new Button("Bot main: " + botMain, it -> { + botMain = !botMain; + it.text = "Bot main: " + botMain; + })); + } + + subComponents.add(new Button("Show GUIs", it -> {}) { + { + subComponents.add(Setting.createKey("Kill", customKeyBinds.get("kill"))); + subComponents.add(Setting.createKey("Follow", customKeyBinds.get("follow"))); + } + }); + subComponents.add(Setting.createKey("Stop", customKeyBinds.get("stop"))); + } + + public boolean isAlt(EntityPlayer player) { + try { + for (int i = 0; i < alts.size(); i++) { + if (alts.get(i).uuid.equals(player.getGameProfile().getId())) { + return true; + } + } + return player.getGameProfile().getId().equals(main.uuid); + } catch (NullPointerException e) { + for (int i = 0; i < alts.size(); i++) { + if (alts.get(i).name.equals(player.getGameProfile().getName())) { + return true; + } + } + return player.getGameProfile().getName().equals(main.name); + } + } + + @Override + public void onConfirm(boolean result) { + if(result) { + switch (confirmationInstance) { + case 0: + onChat("server", "server".split(" ")); + break; + case 1: + onChat("client", "client".split(" ")); + break; + } + } + } + + @Override + public void onEnable() { + } + + @Override + public void onTick() { + if(useElytra && !stopped) { + if(TTCp.isIngame()) { + NetworkPlayerInfo[] players = Objects.requireNonNull(TTCp.mc.getConnection()).getPlayerInfoMap().toArray(new NetworkPlayerInfo[0]); + + if (main.uuid.equals(TTCp.player.getUniqueID())) { + if (new Date().getTime() - lostTimer > 10000) { + FlightBot.setSpeed(1.00); + } else if (new Date().getTime() - lostTimer > 5000) { + FlightBot.setSpeed(0.75); + } + } + + // Target is in rd + if (commonTargetPlayer != null && TTCp.world.getPlayerEntityByName(commonTargetPlayer.getName()) != null) + follow(); + // Target is not in rd, but isnt stopped + else if (new Date().getTime() - lostTimer > 5000) { + FlightBot.deactivate(); + commonTargetPlayer = null; + commonTarget.set(null); + // Isnt main + if (!main.uuid.equals(TTCp.player.getUniqueID())) { + // Follow main + + // Is main on same world & last lost query is 5 secs in past + if ( + TTCp.world.getPlayerEntityByName(main.name) == null && + new Date().getTime() - lostTimer > 5000 && + Arrays.stream(players).anyMatch( + player -> player.getGameProfile().getId().equals(main.uuid) + ) + ) { + try { + // Send lost query + sendPacket(PacketsCS.LOST, ""); + } + catch (PBIC.PBICException.PBICWriteException e) { + e.printStackTrace(); + } + lostTimer = new Date().getTime(); + } else + follow(main.name); + } + } + } + } + } + + // When the client receives a packet + public void onPacketSC(PacketSC packet) { + if (client == null) + throw new RuntimeException(); + try { + ChatUtils.chatPrinterDebug().println("Received packet[" + packet.type() + "]{" + packet.content() + "}"); + + switch (packet.type()) { + case INIT: + main = new Alt(); + sendPacket(PacketsCS.NAME, TTCp.mc.getSession().getProfile().getName()); + break; + case NAME: + main.name = packet.content(); + ChatUtils.print("Connection to main " + main.name + " established!"); + sendPacket(PacketsCS.UUID, TTCp.mc.getSession().getProfile().getId().toString()); + break; + case UUID: + main.uuid = UUID.fromString(packet.content()); + ChatUtils.print("Got UUID from main " + main.name + ": " + packet.content()); + sendPacket(PacketsCS.KEEPALIVE, ""); + break; + case TPA: + ChatUtils.print("TPA'ing main account..."); + TTCp.player.sendChatMessage("/tpa " + main.name); + break; + case EXECUTE: + ChatUtils.print("Sending message received from main account..."); + ChatUtils.simulateSend(packet.content(), false); + break; + case LIST: + TTCp.logger.info("Received alt list from main."); + Map map0 = Utils.stringToMap(packet.content()); + + alts.clear(); + int len = map0.keySet().size(); + for (int i = 0; i < len; i++) { + Alt alt; + alts.add(alt = new Alt()); + + Map map1 = Utils.stringToMap(map0.get(String.valueOf(i))); + alt.name = map1.get("name"); + alt.uuid = UUID.fromString(map1.get("uuid")); + } + break; + case KILL: + ChatUtils.print("Killing player " + packet.content()); + kill(packet.content()); + break; + case FOLLOW: + ChatUtils.print("Following " + packet.content()); + follow(packet.content()); + break; + case STOP: + stop(packet.content()); + break; + case CONFIG: + //TTCp.cfg = Utils.stringToMap(packet.content()); + //TTCp.getInstance().saveConfig(); + break; + case WALK: + useElytra = false; + FlightBot.deactivate(); + break; + case ELYTRA: + if(!useElytra && !stopped) + ChatUtils.simulateSend("#stop", false); + useElytra = true; + break; + case KEEPALIVE: + sendPacket(PacketsCS.KEEPALIVE, ""); + break; + case POSITION: + if(commonTargetPlayer == null && !stopped) { + Vector3d vec = Vector3d.fromMap(Utils.stringToMap(packet.content())); + FlightBot.deactivate(); + commonTarget.set(new Vec3d(vec.getX(), vec.getY() + 2, vec.getZ())); + FlightBot.activate(commonTarget); + } + break; + } + } catch (Exception e) { + e.printStackTrace(); + } + } + + // When the server receives a packet + public void onPacketCS(PacketCS packet, PBIC.Connection connection) throws PBIC.PBICException.PBICWriteException { + ChatUtils.chatPrinterDebug().println("Received packet[" + packet.type() + "]{" + packet.content() + "}"); + switch (packet.type()) { + case NAME: + altsMap.get(connection).name = packet.content(); + ChatUtils.print("Connection to alt " + packet.content() + " established!"); + connection.writePacket(getPacketSC(PacketsSC.NAME, TTCp.mc.getSession().getProfile().getName())); + break; + case UUID: + altsMap.get(connection).uuid = UUID.fromString(packet.content()); + ChatUtils.print("Got UUID from alt " + altsMap.get(connection).name + ": " + packet.content()); + connection.writePacket(getPacketSC(PacketsSC.UUID, TTCp.mc.getSession().getProfile().getId().toString())); + + sendList(); + + break; + case KEEPALIVE: + ThreadManager.run(() -> { + try { + Thread.sleep(10000); + connection.writePacket(getPacketSC(PacketsSC.KEEPALIVE, "")); + } + catch (PBIC.PBICException | InterruptedException e) { + e.printStackTrace(); + } + }); + break; + case LOST: + EntityPlayerSP player = TTCp.player; + if(player != null && TTCp.world != null) { + connection.writePacket(getPacketSC(PacketsSC.POSITION, new Vector3d(player.posX, player.posY, player.posZ).toString())); + } + FlightBot.setSpeed(0.5); + lostTimer = new Date().getTime(); + break; + } + } + + public void sendPacketSC(PacketsSC type, String content) { + if(server.connections.size() == 0) + return; + + AsyncTask task = new AsyncTask<>(() -> { + ChatUtils.chatPrinterDebug().println("Sending packet[" + type.name() + "]{" + content + "}"); + try { + PBIC.Connection[] connections = server.connections.toArray(new PBIC.Connection[0]); + for (int i = 0; i < connections.length; i++) { + try { + connections[i].writePacket(getPacketSC(type, content)); + } + catch (Exception ignore) { } + } + } catch (Throwable e) { + return e; + } + return new Object(); + }); + task.setTimeout(server.connections.size() * 1500L); + pce(task.waitForFinish(0)); + } + + public void sendPacketDelayedSC(PacketsSC type, String content) { + if(server.connections.size() == 0) + return; + AsyncTask task = new AsyncTask<>(() -> { + ChatUtils.chatPrinterDebug().println("Sending packet[" + type.name() + "]{" + content + "}"); + try { + PBIC.Connection[] connections = server.connections.toArray(new PBIC.Connection[0]); + for (int i = 0; i < connections.length; i++) { + try { + connections[i].writePacket(getPacketSC(type, content)); + Thread.sleep(500); + } + catch (Exception ignore) { } + } + } catch (Throwable e) { + return e; + } + return new Object(); + }); + task.setTimeout(server.connections.size() * 2000L); + task.then(this::pce); + } + + private void pce(Object r) { + if(r instanceof Throwable || r == null) { + ChatUtils.chatPrinterDebug().println("§c§lError during communication!"); + String etype; + if(r == null) { + etype = "ETimeout"; + } + else if(r instanceof Exception) { + etype = "EExceptionSend {" + ((Exception) r).getMessage() + "}"; + ((Throwable) r).printStackTrace(ChatUtils.chatPrinterDebug()); + } + else { + etype = "EErrorSend {" + ((Throwable) r).getMessage() + "}"; + ((Throwable) r).printStackTrace(ChatUtils.chatPrinterDebug()); + } + ChatUtils.chatPrinterDebug().println(etype); + } + } + + public void sendPacket(PacketsCS type, String content) throws PBIC.PBICException.PBICWriteException { + ChatUtils.chatPrinterDebug().println("Sending packet[" + type.name() + "]{" + content + "}"); + if(client == null) + throw new RuntimeException(); + client.connection.writePacket(getPacketCS(type, content)); + } + + @Override + public void onChat(String s, String[] args) { + try { + if (s.equals("server") && server == null) { + main = new Alt(); + main.name = TTCp.mc.getSession().getProfile().getName(); + main.uuid = TTCp.mc.getSession().getProfile().getId(); + + altsMap = new HashMap<>(); + + server = new PBIC.Server(50278); + server.onJoin.add(() -> { + PBIC.Connection theConnection = server.lastConnection; + AsyncTask task = new AsyncTask<>(() -> { + ChatUtils.chatPrinterDebug().println("Sending packet[INIT]{}"); + try { + theConnection.writePacket(getPacketSC(PacketsSC.INIT, "")); + } catch (Throwable e) { + return e; + } + ChatUtils.chatPrinterDebug().println("Done"); + return new Object(); + }); + task.setTimeout(1500L); + pce(task.waitForFinish(0)); + + altsMap.put(theConnection, new Alt()); + + while (true) { + String string = "UNKNOWN"; + try { + PBIC.Packet packet = theConnection.readPacket(); + string = packet.getContent(); + onPacketCS(getPacketCS(packet), theConnection); + } + catch (Exception e) { + e.printStackTrace(); + System.err.println("Packet: " + string); + } + } + }); + server.start(); + + mode = 0; + + ChatUtils.print("§aServer started"); + } + if (args[0].equals("client") && client == null) { + if(args.length == 2) + client = new PBIC.Client(args[1], 50278); + else if(args.length == 3) + client = new PBIC.Client(args[1], Integer.parseInt(args[2])); + else + client = new PBIC.Client("127.0.0.1", 50278); + ChatUtils.print("Client started"); + ThreadManager.run("TTCIC client receive thread", () -> { + while (true) { + String string = "UNKNOWN"; + try { + PBIC.Packet packet = client.connection.readPacket(); + string = packet.getContent(); + onPacketSC(getPacketSC(packet)); + } + catch (Exception e) { + e.printStackTrace(); + System.err.println("Packet: " + string); + onChat("end", "end".split(" ")); + } + } + }); + mode = 1; + } + + if(args.length >= 2) { + if(args[0].equals("send") && s.contains(" ")) { + String st = s.substring(s.indexOf(" ") + 1); + sendPacketSC(PacketsSC.EXECUTE, st); + ChatUtils.simulateSend(st, false); + } + if(args[0].equals("kill") && s.contains(" ")) { + sendList(); + String st = s.substring(s.indexOf(" ") + 1); + if(useElytra) { + sendPacketSC(PacketsSC.ELYTRA, ""); + } else { + sendPacketSC(PacketsSC.WALK, ""); + } + sendPacketSC(PacketsSC.KILL, st); + if(botMain) { + kill(st); + } + } + if(args[0].equals("stop") && s.contains(" ")) { + String st = s.substring(s.indexOf(" ") + 1); + sendPacketSC(PacketsSC.STOP, st); + ChatUtils.print("Stopping killing player " + st); + if(botMain) { + stop(st); + } + } + + if (args[0].equals("follow")) { + if(useElytra) { + sendPacketSC(PacketsSC.ELYTRA, ""); + } else { + sendPacketSC(PacketsSC.WALK, ""); + } + sendPacketSC(PacketsSC.FOLLOW, args[1]); + follow(args[1]); + } + } + + if (s.equals("stop")) { + if(useElytra) { + sendPacketSC(PacketsSC.ELYTRA, ""); + } else { + sendPacketSC(PacketsSC.WALK, ""); + } + sendPacketSC(PacketsSC.STOP, ""); + ChatUtils.print("Stopping killing/following all players"); + if(botMain) { + stop(null); + } + } + + if (s.equals("send")) { + TTCp.getInstance().setConfig(); + //sendPacketSC(PacketsSC.CONFIG, Utils.mapToString(TTCp.cfg)); + ChatUtils.print("Sending config to all alts"); + } + + if (s.equals("tpa")) { + sendList(); + sendPacketDelayedSC(PacketsSC.TPA, ""); + } + + if (s.equals("follow")) { + if(useElytra) { + sendPacketSC(PacketsSC.ELYTRA, ""); + } else { + sendPacketSC(PacketsSC.WALK, ""); + } + sendPacketSC(PacketsSC.FOLLOW, main.name); + } + + if(s.equals("telytra")) { + useElytra = !useElytra; + } + + if (s.equals("end")) { + + alts.clear(); + while (toSend.hasNext()) toSend.next(); + altsMap.clear(); + stopped = false; + useElytra = false; + commonTargetPlayer = null; + commonTarget.set(null); + stopped = false; + main = new Alt(); + + if(client != null) + client.close(); + client = null; + if(server != null) + server.close(); + server = null; + mode = -1; + + alts = new ArrayList<>(); + altsMap = new HashMap<>(); + } + + if(s.equals("list")) { + StringBuilder string = new StringBuilder("List:"); + if(server != null) { + for (int i = 0; i < server.connections.size(); i++) { + PBIC.Connection connection = server.connections.get(i); + Alt alt = altsMap.get(connection); + if(alt == null || alt.name == null) + onChat("end", "end".split(" ")); + else + string.append(" ").append(alt.name).append(","); + } + } + if(client != null) { + for (int i = 0; i < alts.size(); i++) { + Alt alt = alts.get(i); + if(alt == null || alt.name == null) + onChat("end", "end".split(" ")); + else + string.append(" ").append(alt.name).append(","); + } + } + if(string.toString().contains(",")) + string = new StringBuilder(string.substring(0, string.length() - 2)); + ChatUtils.print(string.toString()); + } + } catch (Exception e) { + e.printStackTrace(); + } + + updateBinds(); + } + + private void sendList() { + if(server.connections.size() == 0) + return; + + Map map0 = new HashMap<>(); + PBIC.Connection[] keys = altsMap.keySet().toArray(new PBIC.Connection[0]); + alts.clear(); + for (int i = 0; i < keys.length; i++) { + Alt alt = altsMap.get(keys[i]); + alts.add(alt); + + Map map1 = new HashMap<>(); + map1.put("name", alt.name); + map1.put("uuid", alt.uuid.toString()); + + map0.put(String.valueOf(i), Utils.mapToString(map1)); + } + sendPacketSC(PacketsSC.LIST, Utils.mapToString(map0)); + } + + public void follow(String name) { + if(TTCp.player.getName().equals(name)) + return; + commonTargetPlayer = TTCp.world.getPlayerEntityByName(name); + follow(); + } + + public void kill(String name) { + follow(name); + KillAura aura = KillAura.getInstance(); + aura.enabled = true; + aura.onEnable(); + aura.targets.add(name); + } + + public void stop(String name) { + KillAura aura = KillAura.getInstance(); + commonTargetPlayer = null; + commonTarget.set(null); + stopped = true; + FlightBot.deactivate(); + if(!useElytra) + ChatUtils.simulateSend("#stop", false); + if(name == null || name.equals("")) { + aura.targets.clear(); + aura.enabled = false; + aura.onDisable(); + } + else { + aura.targets.remove(name); + aura.targets.trimToSize(); + if (aura.targets.size() != 0) { + ChatUtils.print("Killing player " + name); + follow(aura.targets.get(0)); + } + } + } + + public void follow() { + if(commonTargetPlayer == null) { + FlightBot.deactivate(); + return; + } + + stopped = false; + + try { + if (useElytra) { + FlightBot.deactivate(); + FlightBot.activate(commonTarget); + commonTarget.set(commonTargetPlayer.getPositionVector().add(0, 2, 0)); + } else + ChatUtils.simulateSend("#follow player " + commonTargetPlayer.getName(), false); + } catch (Exception e) { + e.printStackTrace(ChatUtils.chatPrinter()); + } + } + + @Override + public boolean onServerChat(String s, String formatted) { + if ( + s.contains("has requested to teleport to you.") && + alts.stream().anyMatch(alt -> s.startsWith(alt.name + " ") || s.startsWith("~" + alt.name + " ")) + ) { + TTCp.player.sendChatMessage("/tpaccept"); + } + return false; + } + + @Override + public void onDisable() { + onChat("end", null); + } + + public static class Alt { + public String name; + public UUID uuid; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/AltControlRewrite.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/AltControlRewrite.java new file mode 100644 index 0000000..0ae3f6e --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/AltControlRewrite.java @@ -0,0 +1,53 @@ +package de.tudbut.mod.client.ttcp.mods.misc; + +import de.tudbut.mod.client.ttcp.gui.GuiTTC; +import de.tudbut.mod.client.ttcp.gui.lib.component.Button; +import de.tudbut.mod.client.ttcp.utils.ChatUtils; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Misc; +//import de.tudbut.mod.client.ttcp.utils.ttcic.ControlCenter; +//import de.tudbut.mod.client.ttcp.utils.ttcic.packet.ds.PacketPlayer; + +@Misc +public class AltControlRewrite extends Module { + + @Override + public void updateBinds() { + // subComponents.clear(); + // if(!ControlCenter.isRunning()) { + // subComponents.add(new Button("Start Server", it -> { + // subComponents.clear(); + // subComponents.add(new Button("Starting...", a -> {})); + // ControlCenter.server(); + // updateBinds(); + // })); + // subComponents.add(new Button("Start Client", it -> { + // subComponents.clear(); + // subComponents.add(new Button("Starting...", a -> {})); + // ControlCenter.client(); + // updateBinds(); + // })); + // } + // else { + // subComponents.add(new Button("Stop", it -> { + // subComponents.clear(); + // ControlCenter.stop = true; + // new Thread(() -> { + // subComponents.add(new Button("Stopped.", a -> {})); + // while (ControlCenter.isRunning()); + // updateBinds(); + // }).start(); + // })); + // subComponents.add(new Button("Group", it -> { + // for (PacketPlayer packetPlayer : ControlCenter.getGroup()) { + // ChatUtils.print(packetPlayer.name); + // } + // })); + // } + } + + @Override + public void onTick() { + //ControlCenter.onTick(); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/AutoConfig.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/AutoConfig.java new file mode 100644 index 0000000..37828f7 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/AutoConfig.java @@ -0,0 +1,160 @@ +package de.tudbut.mod.client.ttcp.mods.misc; + +import org.lwjgl.input.Keyboard; +import de.tudbut.mod.client.ttcp.gui.lib.component.Button; +import de.tudbut.mod.client.ttcp.mods.chat.TPAParty; +import de.tudbut.mod.client.ttcp.mods.chat.TPATools; +import de.tudbut.mod.client.ttcp.mods.chat.Team; +import de.tudbut.mod.client.ttcp.mods.combat.AutoTotem; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.ThreadManager; +import de.tudbut.mod.client.ttcp.utils.category.Misc; +import de.tudbut.obj.Save; + +@Misc +public class AutoConfig extends Module { + + // true for Server mode, false for Custom mode + @Save + private boolean mode = false; + + // Settings for Custom mode + @Save + private boolean stackedTots = false; + @Save + private boolean pvp = false; + @Save + private boolean tpa = false; + + // Settings for Server mode + private Server server = Server._8b8t; + + @Override + public void onEnable() { + updateBinds(); + } + + public void updateBinds() { + subComponents.clear(); + subComponents.add(new Button("Mode: " + (mode ? "Server" : "Custom"), it -> { + mode = !mode; + it.text = "Mode: " + (mode ? "Server" : "Custom"); + updateBinds(); + })); + if (mode) { + subComponents.add(new Button("Server: " + server.name, it -> { + int i = server.ordinal(); + + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + i--; + else + i++; + + if (i >= Server.values().length) + i = 0; + if (i < 0) + i = Server.values().length - 1; + + server = Server.values()[i]; + + it.text = "Server: " + server.name; + })); + } else { + subComponents.add(new Button("Has stacked totems: " + stackedTots, it -> { + stackedTots = !stackedTots; + it.text = "Has stacked totems: " + stackedTots; + })); + subComponents.add(new Button("PvP meta: " + (pvp ? "32k" : "Crystal"), it -> { + pvp = !pvp; + it.text = "PvP meta: " + (pvp ? "32k" : "Crystal"); + })); + subComponents.add(new Button("Has /tpa: " + tpa, it -> { + tpa = !tpa; + it.text = "Has /tpa: " + tpa; + })); + } + subComponents.add(new Button("Set", it -> { + // Confirm set + if (mode) { + stackedTots = server.stackedTots; + pvp = server.pvp; + tpa = server.tpa; + } + int i = 0; + if (stackedTots) { + i += (pvp ? 4 : 2); + } + AutoTotem.getInstance().origMinCount = i; + + Team.getInstance().enabled = tpa; + if (!tpa) + TPAParty.getInstance().enabled = false; + TPATools.getInstance().enabled = tpa; + + ThreadManager.run(() -> { + it.text = "Done"; + try { + Thread.sleep(2000); + } + catch (InterruptedException e) { + e.printStackTrace(); + } + it.text = "Set"; + }); + })); + } + + @Override + public void onSubTick() { + + } + + @Override + public void onChat(String s, String[] args) { + + } + + @Override + public void onConfigLoad() { + updateBinds(); + } + + // Settings for the unique servers + private enum Server { + _8b8t + ("8b8t.xyz", + true, true, true), + + _5b5t + ("5b5t.net", + false, false, false), + + _0t0t + ("0b0t.org", + false, false, true), + + _2b2t + ("2b2t.org", + false, false, false), + + crystalpvp + ("crystalpvp.cc", + false, false, false), + + ; + + String name; + + // Settings + boolean stackedTots; + boolean pvp; + boolean tpa; + + Server(String name, boolean stackedTots, boolean pvp, boolean tpa) { + this.name = name; + this.stackedTots = stackedTots; + this.pvp = pvp; + this.tpa = tpa; + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/BetterBreak.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/BetterBreak.java new file mode 100644 index 0000000..d81a1bf --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/BetterBreak.java @@ -0,0 +1,37 @@ +package de.tudbut.mod.client.ttcp.mods.misc; + +import net.minecraft.block.material.Material; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraftforge.event.entity.player.PlayerEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Misc; + +@Misc +public class BetterBreak extends Module { + + @SubscribeEvent + public void onBreakSpeedGet(PlayerEvent.BreakSpeed event) { + if(!enabled) + return; + + float f = event.getOriginalSpeed(); + + if (event.getEntityPlayer().isInsideOfMaterial(Material.WATER) && !EnchantmentHelper.getAquaAffinityModifier(event.getEntityPlayer())) + { + f *= 5.0F; + } + + if (!event.getEntityPlayer().onGround) + { + f *= 5.0F; + } + + event.setNewSpeed(f); + } + + @Override + public void onChat(String s, String[] args) { + + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/Break.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/Break.java new file mode 100644 index 0000000..f4c97a9 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/Break.java @@ -0,0 +1,218 @@ +package de.tudbut.mod.client.ttcp.mods.misc; + +import io.netty.buffer.Unpooled; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.client.CPacketPlayer; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import de.tudbut.mod.client.ttcp.gui.lib.component.Button; +import de.tudbut.mod.client.ttcp.mods.rendering.Notifications; +import de.tudbut.mod.client.ttcp.utils.BlockUtils; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.Setting; +import de.tudbut.mod.client.ttcp.utils.category.Misc; +import de.tudbut.obj.Save; + +import java.io.IOException; + +@Misc +public class Break extends Module { + + BlockPos start = null; + BlockPos end = null; + + public boolean doBreak = true; + @Save + public boolean rotate = false; + + float altRotX = 0, altRotY = 0; + + long lastPacket = 0; + + @Save + int iterations = 1; + + public boolean done = false; + + @Override + public boolean onPacket(Packet packet) { + if(rotate) { + if (packet instanceof CPacketPlayer.Rotation) { + if (System.currentTimeMillis() - lastPacket < 90) + return true; + lastPacket = System.currentTimeMillis(); + PacketBuffer buffer = new PacketBuffer(Unpooled.buffer()); + buffer.writeFloat(altRotX); + buffer.writeFloat(altRotY); + buffer.writeByte(((CPacketPlayer.Rotation) packet).isOnGround() ? 1 : 0); + try { + packet.readPacketData(buffer); + } catch (IOException e) { + e.printStackTrace(); + } + } + if (packet instanceof CPacketPlayer.PositionRotation) { + lastPacket = System.currentTimeMillis(); + PacketBuffer buffer = new PacketBuffer(Unpooled.buffer()); + buffer.writeDouble(((CPacketPlayer.PositionRotation) packet).getX(0)); + buffer.writeDouble(((CPacketPlayer.PositionRotation) packet).getY(0)); + buffer.writeDouble(((CPacketPlayer.PositionRotation) packet).getZ(0)); + buffer.writeFloat(altRotX); + buffer.writeFloat(altRotY); + buffer.writeByte(((CPacketPlayer.PositionRotation) packet).isOnGround() ? 1 : 0); + try { + packet.readPacketData(buffer); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + + return super.onPacket(packet); + } + @Override + public void updateBinds() { + customKeyBinds.setIfNull("reset", new KeyBind(null, toString() + "::onEnable", false)); + customKeyBinds.setIfNull("pause", new KeyBind(null, toString() + "::togglePause", false)); + subComponents.clear(); + subComponents.add(Setting.createBoolean("Break", this, "doBreak")); + subComponents.add(Setting.createBoolean("Rotate", this, "rotate")); + subComponents.add(new Button("Reset", it -> { + onEnable(); + updateBinds(); + })); + subComponents.add(Setting.createInt(1, 5, "Iterations", this, "iterations")); + subComponents.add(Setting.createKey("ResetKey", customKeyBinds.get("reset"))); + subComponents.add(Setting.createKey("PauseKey", customKeyBinds.get("pause"))); + } + + public void togglePause() { + doBreak = !doBreak; + if(doBreak) + Notifications.add(new Notifications.Notification("Unpaused breaking.")); + if(!doBreak) + Notifications.add(new Notifications.Notification("Paused breaking.")); + } + + @Override + public void onDisable() { + if(MidClick.bindBlock != null) + if(MidClick.bindBlock.getName().startsWith("Break")) + MidClick.bindBlock = null; + MidClick.reload(); + } + + @Override + public void onEnable() { + start = end = null; + Notifications.add(new Notifications.Notification("Please select the starting position with MIDCLICK!", 20000)); + MidClick.set(new MidClick.Bind() { + @Override + public Type getType() { + return Type.BLOCK; + } + + @Override + public String getName() { + return "Break START"; + } + + @Override + public void call(Data data) { + posCallback(data); + } + }); + } + + @Override + public void onTick() { + if(doBreak) { + if(end != null) { + for (int i = 0 ; i < iterations ; i++) { + run(); + } + } else { + done = true; + } + } + } + + private void run() { + int px = (int)player.posX, py = (int)player.getPositionEyes(1).y, pz = (int)player.posZ; + for (int iy = 0; iy <= 10; iy++) { + for (int iz = 0; iz <= 10; iz++) { + for (int ix = 0; ix <= 10; ix++) { + int x = px + ix - 5, y = py + iy - 5, z = pz + iz - 5; + + if(x >= start.getX() && y >= start.getY() && z >= start.getZ()) { + if(x <= end.getX() && y <= end.getY() && z <= end.getZ()) { + if(breakBlockIfPossible(x,y,z)) { + done = false; + return; + } + } + } + } + } + } + done = true; + } + + private boolean breakBlockIfPossible(int x, int y, int z) { + BlockPos pos = new BlockPos(x,y,z); + + if(player.getPositionEyes(1).distanceTo(new Vec3d(x + 0.5, y, z + 0.5)) > mc.playerController.getBlockReachDistance() - 0.25) + return false; + if(!mc.world.getBlockState(pos).getBlock().isReplaceable(mc.world, pos)) { + float[] floats = BlockUtils.getLegitRotations(new Vec3d(pos).add(0.5, 0.5, 0.5)); + if(altRotX != floats[0] || altRotY != floats[1]) { + altRotX = floats[0]; + altRotY = floats[1]; + if (rotate && System.currentTimeMillis() - lastPacket < 100) + mc.player.connection.sendPacket(new CPacketPlayer.Rotation()); + } + if(mc.playerController.onPlayerDamageBlock(pos, EnumFacing.DOWN)) { + mc.effectRenderer.addBlockHitEffects(pos, EnumFacing.DOWN); + player.swingArm(EnumHand.MAIN_HAND); + } + return true; + } + return false; + } + + private void posCallback(MidClick.Bind.Data data) { + if(start == null) { + start = data.block(); + MidClick.set(new MidClick.Bind() { + @Override + public Type getType() { + return Type.BLOCK; + } + + @Override + public String getName() { + return "Break END"; + } + + @Override + public void call(Data data) { + posCallback(data); + } + }); + Notifications.add(new Notifications.Notification("Please select the ending position with MIDCLICK!", 20000)); + return; + } + if(end == null) { + BlockPos endSel = data.block(); + BlockPos startSel = start; + start = new BlockPos(Math.min(startSel.getX(), endSel.getX()), Math.min(startSel.getY(), endSel.getY()), Math.min(startSel.getZ(), endSel.getZ())); + end = new BlockPos(Math.max(startSel.getX(), endSel.getX()), Math.max(startSel.getY(), endSel.getY()), Math.max(startSel.getZ(), endSel.getZ())); + MidClick.bindBlock = null; + MidClick.reload(); + Notifications.add(new Notifications.Notification("Breaking!", 20000)); + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/Crasher.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/Crasher.java new file mode 100644 index 0000000..226f19d --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/Crasher.java @@ -0,0 +1,68 @@ +package de.tudbut.mod.client.ttcp.mods.misc; + +import net.minecraft.network.Packet; +import net.minecraft.network.play.client.CPacketInput; +import net.minecraft.network.play.client.CPacketPlayer; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.Setting; +import de.tudbut.mod.client.ttcp.utils.category.Misc; +import de.tudbut.obj.Save; + +@Misc +public class Crasher extends Module { + + boolean run = false; + + @Save + int timer = 5; + @Save + int instances = 5; + @Save + int type = 0; + + int i = 0; + + @Override + public void updateBinds() { + subComponents.clear(); + subComponents.add(Setting.createBoolean("Run", this, "run")); + subComponents.add(Setting.createInt(0, 60, "DelayTicks", this, "timer")); + subComponents.add(Setting.createInt(0, 500, "Instances", this, "instances")); + subComponents.add(Setting.createInt(0, 1, "Type", this, "type")); + } + + @Override + public void onSubTick() { + i++; + if(i >= timer + 1) { + i = 0; + if(run) + for (int j = 0; j < instances + 1; j++) { + TTCp.player.connection.sendPacket(packet()); + } + } + } + + public Packet packet() { + if(type == 0) { + return new CPacketPlayer.PositionRotation( + Math.random() * 60_000_000 - 30_000_000, + Math.random() * 256, + Math.random() * 60_000_000 - 30_000_000, + (float) (Math.random() * 360) - 180, + (float) (Math.random() * 360) - 180, + true + ); + } + if(type == 1) { + return new CPacketInput( + (float) (Math.random() * 1000) - 500, + (float) (Math.random() * 1000) - 500, + false, false + ); + } + + return null; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/Debug.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/Debug.java new file mode 100644 index 0000000..28c80f0 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/Debug.java @@ -0,0 +1,62 @@ +package de.tudbut.mod.client.ttcp.mods.misc; + +import de.tudbut.debug.DebugProfiler; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.utils.ChatUtils; +import de.tudbut.mod.client.ttcp.utils.DebugProfilerAdapter; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Misc; + +import java.io.PrintStream; + +@Misc +public class Debug extends Module { + static Debug instance; + + public Debug() { + instance = this; + } + + public static Debug getInstance() { + return instance; + } + + @Override + public void onEnable() { + for (DebugProfilerAdapter profiler : TTCp.getProfilers()) { + profiler.fallthrough = false; + } + } + @Override + public void onDisable() { + for (DebugProfilerAdapter profiler : TTCp.getProfilers()) { + profiler.fallthrough = true; + } + } + + @Override + public void init() { + for (DebugProfilerAdapter profiler : TTCp.getProfilers()) { + profiler.fallthrough = !enabled; + } + } + + @Override + public boolean displayOnClickGUI() { + return false; + } + + @Override + public void onSubTick() { + + } + + @Override + public void onEveryChat(String s, String[] args) { + PrintStream out = ChatUtils.chatPrinter(); + DebugProfiler[] profilers = TTCp.getProfilers(); + for (int i = 0 ; i < profilers.length ; i++) { + out.println(profilers[i].toString()); + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/Fill.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/Fill.java new file mode 100644 index 0000000..deadb59 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/Fill.java @@ -0,0 +1,257 @@ +package de.tudbut.mod.client.ttcp.mods.misc; + +import io.netty.buffer.Unpooled; +import net.minecraft.init.Items; +import net.minecraft.item.Item; +import net.minecraft.network.Packet; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.client.CPacketPlayer; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import de.tudbut.mod.client.ttcp.gui.lib.component.Button; +import de.tudbut.mod.client.ttcp.mods.rendering.Notifications; +import de.tudbut.mod.client.ttcp.utils.BlockUtils; +import de.tudbut.mod.client.ttcp.utils.InventoryUtils; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.Setting; +import de.tudbut.mod.client.ttcp.utils.category.Misc; +import de.tudbut.obj.Save; +import de.tudbut.obj.TLMap; +import de.tudbut.tools.Lock; + +import java.io.IOException; + +@Misc +public class Fill extends Module { + + BlockPos start = null; + BlockPos end = null; + + @Save + public int delay = 0; + Lock lock = new Lock(); + public boolean place = true; + @Save + public boolean rotate = false; + Item placed = null; + TLMap placedList = new TLMap<>(); + + float altRotX = 0, altRotY = 0; + + long lastPacket = 0; + + @Save + int iterations = 1; + + public boolean done = false; + + @Override + public boolean onPacket(Packet packet) { + if(rotate) { + if (packet instanceof CPacketPlayer.Rotation) { + if (System.currentTimeMillis() - lastPacket < 90) + return true; + lastPacket = System.currentTimeMillis(); + PacketBuffer buffer = new PacketBuffer(Unpooled.buffer()); + buffer.writeFloat(altRotX); + buffer.writeFloat(altRotY); + buffer.writeByte(((CPacketPlayer.Rotation) packet).isOnGround() ? 1 : 0); + try { + packet.readPacketData(buffer); + } + catch (IOException e) { + e.printStackTrace(); + } + return false; + } + if (packet instanceof CPacketPlayer.PositionRotation) { + lastPacket = System.currentTimeMillis(); + PacketBuffer buffer = new PacketBuffer(Unpooled.buffer()); + buffer.writeDouble(((CPacketPlayer.PositionRotation) packet).getX(0)); + buffer.writeDouble(((CPacketPlayer.PositionRotation) packet).getY(0)); + buffer.writeDouble(((CPacketPlayer.PositionRotation) packet).getZ(0)); + buffer.writeFloat(altRotX); + buffer.writeFloat(altRotY); + buffer.writeByte(((CPacketPlayer.PositionRotation) packet).isOnGround() ? 1 : 0); + try { + packet.readPacketData(buffer); + buffer.release(); + } + catch (IOException e) { + e.printStackTrace(); + } + return false; + } + } + + return super.onPacket(packet); + } + + @Override + public void updateBinds() { + customKeyBinds.setIfNull("reset", new KeyBind(null, toString() + "::onEnable", false)); + customKeyBinds.setIfNull("pause", new KeyBind(null, toString() + "::togglePause", false)); + subComponents.clear(); + subComponents.add(Setting.createInt(0, 2000, "Delay", this, "delay")); + subComponents.add(Setting.createBoolean("Place", this, "place")); + subComponents.add(Setting.createBoolean("Rotate", this, "rotate")); + subComponents.add(new Button("Reset", it -> { + onEnable(); + updateBinds(); + })); + subComponents.add(Setting.createInt(1, 5, "Iterations", this, "iterations")); + subComponents.add(Setting.createKey("ResetKey", customKeyBinds.get("reset"))); + subComponents.add(Setting.createKey("PauseKey", customKeyBinds.get("pause"))); + } + + public void togglePause() { + place = !place; + if(place) + Notifications.add(new Notifications.Notification("Unpaused placing.")); + if(!place) + Notifications.add(new Notifications.Notification("Paused placing.")); + } + + @Override + public void onDisable() { + if(MidClick.bindBlock != null) + if(MidClick.bindBlock.getName().startsWith("Fill")) + MidClick.bindBlock = null; + MidClick.reload(); + } + + @Override + public void onEnable() { + start = end = null; + Notifications.add(new Notifications.Notification("Please select the starting position with MIDCLICK!", 20000)); + MidClick.set(new MidClick.Bind() { + @Override + public Type getType() { + return Type.BLOCK; + } + + @Override + public String getName() { + return "Fill START"; + } + + @Override + public void call(Data data) { + posCallback(data); + } + }); + } + + @Override + public void onTick() { + if (!lock.isLocked()) { + lock.lock(delay); + + if(place) { + if(end != null) { + for (int i = 0 ; i < iterations ; i++) { + run(); + } + } + else { + done = true; + } + } + } + } + + private void run() { + int px = (int)player.posX, py = (int)player.getPositionEyes(1).y, pz = (int)player.posZ; + for (int iy = 0; iy <= 10; iy++) { + for (int iz = 0; iz <= 10; iz++) { + for (int ix = 0; ix <= 10; ix++) { + int x = px + ix - 5, y = py + iy - 5, z = pz + iz - 5; + + if(x >= start.getX() && y >= start.getY() && z >= start.getZ()) { + if(x <= end.getX() && y <= end.getY() && z <= end.getZ()) { + if(placeBlockIfPossible(x,y,z)) { + this.done = false; + return; + } + } + } + } + } + } + this.done = true; + } + + boolean placeBlockIfPossible(int x, int y, int z) { + BlockPos pos = new BlockPos(x,y,z); + + if(player.getPositionEyes(0).distanceTo(new Vec3d(x + (x >= 0 ? 0.5 : -0.5), y + (y >= 0 ? 0.5 : -0.5), z + (z >= 0 ? 0.5 : -0.5))) > mc.playerController.getBlockReachDistance() - 0.25) + return false; + if(player.getHeldItemMainhand().getCount() == 0 && placed != null) { + Integer slot = InventoryUtils.getSlotWithItem(player.inventoryContainer, placed, new int[]{}, 1, 64); + if(slot != null) + InventoryUtils.swap(slot, InventoryUtils.getCurrentSlot()); + } + boolean b = false; + if(mc.world.getBlockState(pos).getBlock().isReplaceable(mc.world, pos) && player.getHeldItemMainhand().getCount() > 0 && BlockUtils.getPossibleSides(pos).size() > 0 && checkBlockPing(pos)) { + float[] floats = BlockUtils.getLegitRotations(new Vec3d(pos).add(0.5, 0.5, 0.5)); + altRotX = floats[0]; + altRotY = floats[1]; + if (rotate && System.currentTimeMillis() - lastPacket < 100) + mc.player.connection.sendPacket(new CPacketPlayer.Rotation()); + b = BlockUtils.placeBlock(pos, EnumHand.MAIN_HAND, false, true); + } + Item item = player.getHeldItemMainhand().getItem(); + if(b && item != Items.AIR) { + placed = item; + Lock lock = new Lock(); + lock.lock(500); + placedList.set(pos, lock); + } + return b; + } + + private boolean checkBlockPing(BlockPos pos) { + Lock lock = placedList.get(pos); + if(lock == null) + return true; + if(lock.isLocked()) { + return false; + } + placedList.set(pos, null); + return true; + } + + private void posCallback(MidClick.Bind.Data data) { + if(start == null) { + start = data.block(); + MidClick.set(new MidClick.Bind() { + @Override + public Type getType() { + return Type.BLOCK; + } + + @Override + public String getName() { + return "Fill END"; + } + + @Override + public void call(Data data) { + posCallback(data); + } + }); + Notifications.add(new Notifications.Notification("Please select the ending position with MIDCLICK!", 20000)); + return; + } + if(end == null) { + BlockPos endSel = data.block(); + BlockPos startSel = start; + start = new BlockPos(Math.min(startSel.getX(), endSel.getX()), Math.min(startSel.getY(), endSel.getY()), Math.min(startSel.getZ(), endSel.getZ())); + end = new BlockPos(Math.max(startSel.getX(), endSel.getX()), Math.max(startSel.getY(), endSel.getY()), Math.max(startSel.getZ(), endSel.getZ())); + MidClick.bindBlock = null; + MidClick.reload(); + Notifications.add(new Notifications.Notification("Filling!", 20000)); + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/Flatten.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/Flatten.java new file mode 100644 index 0000000..47ffd22 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/Flatten.java @@ -0,0 +1,36 @@ +package de.tudbut.mod.client.ttcp.mods.misc; + +import net.minecraft.util.math.BlockPos; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.utils.BlockUtils; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.Setting; +import de.tudbut.mod.client.ttcp.utils.category.Misc; +import de.tudbut.obj.Save; + +@Misc +public class Flatten extends Module { + + @Save + public boolean autoSelect = false; + + @Override + public void updateBinds() { + subComponents.clear(); + subComponents.add(Setting.createBoolean("AutoSelect", this, "autoSelect")); + } + + @Override + public void onTick() { + BlockPos pos = BlockUtils.getRealPos(TTCp.player.getPositionVector()); + for (int x = -1; x <= 1; x++) { + for (int z = -1; z <= 1; z++) { + BlockPos block = pos.add(x, -1, z); + /*if(autoSelect) + AutoCrystal.getInstance().selectObby();*/ + if(TTCp.world.isAirBlock(block)) + BlockUtils.placeBlock(block, true); + } + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/Highway.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/Highway.java new file mode 100644 index 0000000..0a066d9 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/Highway.java @@ -0,0 +1,318 @@ +package de.tudbut.mod.client.ttcp.mods.misc; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.network.play.client.CPacketEntityAction; +import net.minecraft.init.Blocks; +import net.minecraft.inventory.ClickType; +import net.minecraft.item.Item; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.utils.*; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Misc; + +import java.util.Objects; + +/** + * @author TudbuT + * @since 16 Feb 2022 + */ + +@Misc +public class Highway extends Module { + int stage = -1; + // 0 = Break + // 1 = Remove Lava + // 2 = Break + // 3 = Place bottom + // 4 = Place side 1 + // 5 = Place side 2 + + int y = -1; + boolean wait = false; + EnumFacing lastDirection; + + @Override + public boolean doStoreEnabled() { + return false; + } + + @Override + public void onEnable() { + stage = -1; + y = ((int) mc.player.posY); + getFill().place = false; + getBreak().doBreak = false; + nextStage(); + } + + public EnumFacing direction() { + return mc.player.getHorizontalFacing(); + } + + private Fill getFill() { + return TTCp.getModule(Fill.class); + } + + private Break getBreak() { + return TTCp.getModule(Break.class); + } + + public void selectObby() { + Integer obbySlot = InventoryUtils.getSlotWithItem(TTCp.player.inventoryContainer, Blocks.OBSIDIAN, Utils.range(0, 8), 1, 64); + + if(obbySlot == null) { + InventoryUtils.setCurrentSlot(8); + BlockPos pos = BlockUtils.getRealPos(mc.player.getPositionVector()); + getFill().placeBlockIfPossible(pos.getX(), pos.getY() + 2, pos.getZ()); + pos = pos.add(0,2,0); + player.connection.sendPacket(new CPacketEntityAction(player, CPacketEntityAction.Action.STOP_SNEAKING)); + BlockUtils.clickOnBlock(pos, EnumHand.MAIN_HAND); + wait = true; + } + + ResourceLocation slotType = TTCp.player.inventoryContainer.getSlot(36 + 7).getStack().getItem().getRegistryName(); + if (obbySlot != null && (slotType == null || !slotType.toString().equals(Objects.requireNonNull(Blocks.OBSIDIAN.getRegistryName()).toString()))) + InventoryUtils.inventorySwap(obbySlot, 36 + 7, 0, 0, 0); + } + + boolean needToFixY = false; + int fixYTimer = 0; + + public void onTick() { + if(((int) mc.player.posY) < y) { + needToFixY = true; + } + if(needToFixY && ((int) mc.player.posY) == y && player.onGround) { + player.travel(0,0,-1); + needToFixY = false; + fixYTimer = 10; + } + if(needToFixY) { + if (player.onGround) player.jump(); + player.travel(0,0,-1); + return; + } + if(fixYTimer > 0) { + fixYTimer--; + player.travel(0,0,-1); + return; + } + EnumFacing direction = direction(); + if(mc.player.rotationPitch < -60) { + direction = lastDirection; + mc.player.rotationPitch = 20; + } + mc.player.rotationYaw = direction.getHorizontalAngle(); + if(wait) { + getObby(); + return; + } + if(InventoryUtils.getCurrentSlot() == 7) + selectObby(); + if(stage == 1) + removeLava(); + else if(stageDone()) { + nextStage(); + } + lastDirection = direction; + } + + int i = 9; + + private void getObby() { + if(mc.currentScreen instanceof GuiContainer) { + Item item = player.inventory.getStackInSlot(i).getItem(); + if( + item.getRegistryName().equals(Blocks.NETHERRACK.getRegistryName()) || + item.getRegistryName().equals(Blocks.COBBLESTONE.getRegistryName()) || + item.getRegistryName().equals(Blocks.STONE.getRegistryName()) + ) { + InventoryUtils.drop(((GuiContainer) mc.currentScreen).inventorySlots.windowId, i + 18); // These numbers are magic, do not question! + } + if(++i >= 45) { // These numbers are magic, do not question! + for (int i = 0 ; i < 27 ; i++) { // These numbers are magic, do not question! + InventoryUtils.clickSlot(((GuiContainer) mc.currentScreen).inventorySlots.windowId, i, ClickType.QUICK_MOVE, 0); + } + TTCp.player.closeScreen(); + i = 9; + wait = false; + } + } + } + + private void nextStage() { + getBreak().done = false; + getFill().done = false; + switch (++stage) { + case 16: + stage = 0; + case 0: + case 2: + getFill().place = false; + getBreak().doBreak = true; + breag(); + break; + case 1: + getFill().place = true; + getBreak().doBreak = false; + InventoryUtils.setCurrentSlot(7); + break; + case 3: + case 6: + getFill().place = true; + getBreak().doBreak = false; + InventoryUtils.setCurrentSlot(7); + selectObby(); + placeBottom(); + break; + case 4: + case 7: + selectObby(); + InventoryUtils.setCurrentSlot(7); + placeSide( true); + break; + case 5: + case 8: + selectObby(); + InventoryUtils.setCurrentSlot(7); + placeSide(false); + break; + case 9: + player.setSprinting(true); + case 10: + case 11: + case 12: + case 13: + player.travel(0,0,1); + break; + default: + player.motionX = 0; + player.motionY = 0; + player.motionZ = 0; + break; + } + ChatUtils.chatPrinterDebug().println("Next stage: " + stage); + } + + private void placeSide(boolean first) { + EnumFacing direction = direction(); + Fill placer = getFill(); + selectObby(); + BlockPos pos = BlockUtils.getRealPos(mc.player.getPositionVector()); + switch (direction) { + case UP: + case DOWN: + pos = null; + break; + case EAST: // X+ + if(first) + pos = pos.add( 1,0,-2); + else + pos = pos.add( 1,0, 2); + break; + case WEST: // X- + if(first) + pos = pos.add(-1,0,-2); + else + pos = pos.add(-1,0, 2); + break; + case NORTH: // Z- + if(first) + pos = pos.add(-2,0,-1); + else + pos = pos.add( 2,0,-1); + break; + case SOUTH: // Z+ + if(first) + pos = pos.add(-2,0, 1); + else + pos = pos.add( 2,0, 1); + break; + } + if(pos != null) + placer.start = placer.end = pos; + } + + private void placeBottom() { + EnumFacing direction = direction(); + Fill placer = getFill(); + BlockPos pos = BlockUtils.getRealPos(mc.player.getPositionVector()); + switch (direction) { + case UP: + case DOWN: + break; + case EAST: // X+ + placer.start = pos.add( 1,-1,-2); + placer.end = pos.add( 1,-1, 2); + break; + case WEST: // X- + placer.start = pos.add(-1,-1,-2); + placer.end = pos.add(-1,-1, 2); + break; + case NORTH: // Z- + placer.start = pos.add(-2,-1,-1); + placer.end = pos.add( 2,-1,-1); + break; + case SOUTH: // Z+ + placer.start = pos.add(-2,-1, 1); + placer.end = pos.add( 2,-1, 1); + break; + } + } + + private void removeLava() { + int px = (int)player.posX, py = (int)player.getPositionEyes(1).y, pz = (int)player.posZ; + for (int iy = 0; iy <= 10; iy++) { + for (int iz = 0; iz <= 10; iz++) { + for (int ix = 0; ix <= 10; ix++) { + int x = px + ix - 5, y = py + iy - 5, z = pz + iz - 5; + BlockPos pos = new BlockPos(x, y, z); + IBlockState state = mc.world.getBlockState(pos); + if((state.getBlock() == Blocks.LAVA || state.getBlock() == Blocks.WATER) && state.getBlock().getMetaFromState(state) == 0) { + if(getFill().placeBlockIfPossible(x,y,z)) { + return; + } + } + } + } + } + stage++; + } + + private void breag() { + InventoryUtils.setCurrentSlot(2); + EnumFacing direction = direction(); + Break breaker = getBreak(); + BlockPos pos = BlockUtils.getRealPos(mc.player.getPositionVector()); + switch (direction) { + case UP: + case DOWN: + break; + case EAST: // X+ + breaker.start = pos.add( 1,-1,-2); + breaker.end = pos.add( 1, 2, 2); + break; + case WEST: // X- + breaker.start = pos.add(-1,-1,-2); + breaker.end = pos.add(-1, 2, 2); + break; + case NORTH: // Z- + breaker.start = pos.add(-2,-1,-1); + breaker.end = pos.add( 2, 2,-1); + break; + case SOUTH: // Z+ + breaker.start = pos.add(-2,-1, 1); + breaker.end = pos.add( 2, 2, 1); + break; + } + } + + private boolean stageDone() { + return ((getBreak().done) || (getFill().done)) && stage != 1; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/Locate.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/Locate.java new file mode 100644 index 0000000..f5d5244 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/Locate.java @@ -0,0 +1,63 @@ +package de.tudbut.mod.client.ttcp.mods.misc; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.init.Items; +import net.minecraft.item.ItemMap; +import net.minecraft.item.ItemStack; +import net.minecraft.world.storage.MapData; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.utils.ChatUtils; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Misc; + +@Misc +public class Locate extends Module { + + @Override + public boolean displayOnClickGUI() { + return false; + } + + @Override + public void onEveryChat(String s, String[] args) { + ChatUtils.print("Locating..."); + ItemStack stack = TTCp.player.getHeldItemMainhand(); + if (stack.getItem() == Items.FILLED_MAP) { + ItemMap map = Items.FILLED_MAP; + MapData data = map.getMapData(stack, TTCp.world); + if(data.xCenter == 0 && data.zCenter == 0) { + ChatUtils.print("ERROR: This exploit has been disabled on this server."); + } + else { + ChatUtils.print("Located! Location is: " + data.xCenter + " " + data.zCenter + ". Have fun!"); + } + } + else { + ChatUtils.print("ERROR: Not a map in hand!"); + ChatUtils.print("Checking current target entity for item frame..."); + Entity hit = TTCp.mc.objectMouseOver.entityHit; + if(hit instanceof EntityItemFrame) { + ChatUtils.print("Found item frame."); + EntityItemFrame e = (EntityItemFrame) hit; + stack = e.getDisplayedItem(); + if (stack.getItem() == Items.FILLED_MAP) { + ItemMap map = Items.FILLED_MAP; + MapData data = map.getMapData(stack, TTCp.world); + if(data.xCenter == 0 && data.zCenter == 0) { + ChatUtils.print("ERROR: This exploit has been disabled on this server."); + } + else { + ChatUtils.print("Located! Location is: " + data.xCenter + " " + data.zCenter + ". Have fun!"); + } + } + else { + ChatUtils.print("ERROR: Displayed item is not a map."); + } + } + else { + ChatUtils.print("ERROR: You are not looking at an item frame."); + } + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/MidClick.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/MidClick.java new file mode 100644 index 0000000..91d729b --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/MidClick.java @@ -0,0 +1,250 @@ +package de.tudbut.mod.client.ttcp.mods.misc; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiChat; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; +import org.lwjgl.input.Mouse; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.gui.lib.component.Button; +import de.tudbut.mod.client.ttcp.mods.rendering.Notifications; +import de.tudbut.mod.client.ttcp.mods.combat.KillAura; +import de.tudbut.mod.client.ttcp.mods.combat.SmoothAura; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.Setting; +import de.tudbut.mod.client.ttcp.utils.category.Misc; +import de.tudbut.obj.Save; + +import java.util.ArrayList; + +@Misc +public class MidClick extends Module { + + public enum CustomBindsBlock implements PartialBind { + NONE((data) -> {}), + + ; + + public final Bind toDo; + + CustomBindsBlock(PartialBind toDo) { + this.toDo = toDo; + } + + @Override + public void call(Bind.Data data) { + toDo.call(data); + } + } + public enum CustomBindsPlayer implements PartialBind { + NONE((data) -> {}), + Friend((data) -> { + ArrayList names = de.tudbut.mod.client.ttcp.mods.command.Friend.getInstance().names; + if(names.contains(data.entity().getName())) { + names.remove(data.entity().getName()); + Notifications.add(new Notifications.Notification(data.entity().getName() + " removed from your friends.")); + } else { + names.add(data.entity().getName()); + Notifications.add(new Notifications.Notification(data.entity().getName() + " added to your friends.")); + } + }), + Target((data) -> { + KillAura.getInstance().targets.clear(); + while (SmoothAura.getInstance().targets.hasNext()) { + SmoothAura.getInstance().targets.next(); + } + KillAura.getInstance().targets.add(data.entity().getName()); + SmoothAura.getInstance().targets.add(data.entity().getName()); + }), + Message((data) -> { + Minecraft.getMinecraft().displayGuiScreen(new GuiChat(TTCp.prefix + "msg " + data.entity().getName() + " ")); + }), + + ; + + public final Bind toDo; + + CustomBindsPlayer(PartialBind toDo) { + this.toDo = toDo; + } + + @Override + public void call(Bind.Data data) { + toDo.call(data); + } + } + public enum CustomBindsEntity implements PartialBind { + NONE((data) -> {}), + + ; + + public final Bind toDo; + + CustomBindsEntity(PartialBind toDo) { + this.toDo = toDo; + } + + @Override + public void call(Data data) { + toDo.call(data); + } + } + + public static Bind bindBlock = null; + public static Bind bindPlayer = null; + public static Bind bindEntity = null; + @Save + private static Bind cbb = CustomBindsBlock.NONE, cbp = CustomBindsPlayer.NONE, cbe = CustomBindsPlayer.NONE; + + @Override + public void updateBinds() { + subComponents.clear(); + + + if(bindBlock != null) { + subComponents.add(new Button("ModuleBindBlock " + bindBlock.getName(),it -> { + bindBlock = null; + reload(); + })); + } + else { + subComponents.add(new Button("ModuleBindBlock NONE", it -> {})); + } + if(bindPlayer != null) { + subComponents.add(new Button("ModuleBindPlayer: " + bindPlayer.getName(),it -> { + bindPlayer = null; + reload(); + })); + } + else { + subComponents.add(new Button("ModuleBindPlayer: NONE", it -> {})); + } + if(bindEntity != null) { + subComponents.add(new Button("ModuleBindEntity: " + bindEntity.getName(),it -> { + bindEntity = null; + reload(); + })); + } + else { + subComponents.add(new Button("ModuleBindEntity: NONE", it -> {})); + } + + subComponents.add(Setting.createEnum(CustomBindsBlock.class, "CustomBindBlock", this, "cbb")); + subComponents.add(Setting.createEnum(CustomBindsPlayer.class, "CustomBindPlayer", this, "cbp")); + subComponents.add(Setting.createEnum(CustomBindsEntity.class, "CustomBindEntity", this, "cbe")); + } + + boolean down = false; + + @Override + public void onSubTick() { + if(Mouse.isButtonDown(2) && mc.currentScreen == null) { + if(!down) { + run(); + } + down = true; + } + else + down = false; + } + + private void run() { + RayTraceResult hover = mc.objectMouseOver; + if(hover.entityHit != null) { + if(bindPlayer != null && hover.entityHit instanceof EntityPlayer) { + bindPlayer.call(createData(hover)); + return; + } + if(bindEntity != null) { + bindEntity.call(createData(hover)); + return; + } + if(runCustomEntityBinds(hover)) + return; + } + if(hover.getBlockPos() != null) { + if(bindBlock != null) { + bindBlock.call(createData(hover)); + return; + } + cbb.call(createData(hover)); + } + } + + private boolean runCustomEntityBinds(RayTraceResult hover) { + if(hover.entityHit instanceof EntityPlayer) { + cbp.call(createData(hover)); + } + else + cbe.call(createData(hover)); + + return cbe != CustomBindsEntity.NONE.toDo && cbp != CustomBindsPlayer.NONE.toDo; + } + + private Bind.Data createData(RayTraceResult hover) { + return new Bind.Data() { + @Override + public BlockPos block() { + return hover.getBlockPos(); + } + + @Override + public Entity entity() { + return hover.entityHit; + } + }; + } + + public static void set(Bind bind) { + switch (bind.getType()) { + case BLOCK: + bindBlock = bind; + break; + case PLAYER: + bindPlayer = bind; + break; + case ENTITY: + bindEntity = bind; + break; + } + MidClick.reload(); + } + + public static void reload() { + TTCp.getModule(MidClick.class).updateBinds(); + } + + public interface Bind { + enum Type { + BLOCK, + ENTITY, + PLAYER, + + ; + } + interface Data { + BlockPos block(); + Entity entity(); + } + + Type getType(); + String getName(); + void call(Data data); + } + + private interface PartialBind extends Bind { + @Override + default String getName() { + return ""; + } + + @Override + default Type getType() { + return null; + } + + void call(Data data); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/PacketLog.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/PacketLog.java new file mode 100644 index 0000000..21aa09a --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/PacketLog.java @@ -0,0 +1,49 @@ +package de.tudbut.mod.client.ttcp.mods.misc; + +import net.minecraft.network.Packet; +import de.tudbut.mod.client.ttcp.utils.ChatUtils; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Misc; +import de.tudbut.parsing.TCN; +import de.tudbut.tools.ConfigSaverTCN2; +import de.tudbut.tools.ThreadPool; + +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.Date; + +@Misc +public class PacketLog extends Module { + + TCN map = new TCN(); + + ThreadPool pool = new ThreadPool(5, "PacketLogger thread", false); + + @Override + public boolean onPacket(Packet packet) { + pool.run(() -> savePacket(packet)); + return false; + } + + @Override + public void onDisable() { + pool.run(() -> { + try(FileOutputStream f = new FileOutputStream("packetlog.tcn")) { + f.write(map.toString().getBytes()); + } + catch (IOException e) { + e.printStackTrace(); + } + map = new TCN(); + ChatUtils.print("PacketLog done!"); + }); + } + + private void savePacket(Packet packet) { + try { + map.set(new Date().getTime() + " " + packet.getClass().getName(), ConfigSaverTCN2.write(packet, true, false)); + } catch (Throwable e) { + ChatUtils.print("PacketLog couldn't serialize a packet! Packet was: " + packet.getClass().getName()); + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/Reconnect.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/Reconnect.java new file mode 100644 index 0000000..e7d560e --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/Reconnect.java @@ -0,0 +1,25 @@ +package de.tudbut.mod.client.ttcp.mods.misc; + +import net.minecraft.client.gui.GuiMainMenu; +import net.minecraft.client.gui.GuiMultiplayer; +import net.minecraft.client.gui.GuiWorldSelection; +import net.minecraft.client.multiplayer.ServerData; +import net.minecraftforge.fml.client.FMLClientHandler; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Misc; + +@Misc +public class Reconnect extends Module { + public void onEnable() { + toggle(); + if(!mc.isIntegratedServerRunning()) { + ServerData data = mc.getCurrentServerData(); + mc.loadWorld(null); + FMLClientHandler.instance().connectToServer(new GuiMultiplayer(new GuiMainMenu()), data); + } + else { + mc.world.sendQuittingDisconnectingPacket(); + mc.displayGuiScreen(new GuiWorldSelection(new GuiMainMenu())); + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/Timer.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/Timer.java new file mode 100644 index 0000000..d8280dc --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/misc/Timer.java @@ -0,0 +1,111 @@ +package de.tudbut.mod.client.ttcp.mods.misc; + +import net.minecraft.client.Minecraft; +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.SPacketTimeUpdate; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.utils.*; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Misc; +import de.tudbut.obj.Save; + +@Misc +public class Timer extends Module { + + + @Save + boolean fasten = false, slowdown = true, fullSync = false; + long lastTick = -1; + @Save + float m = 0.5f; + float tps = 20; + long lastDiff = 0; + boolean hasSynched = false; + boolean isSynching = false; + + @Override + public void updateBinds() { + subComponents.clear(); + subComponents.add(Setting.createFloat(0.1f, 10f, "Multiplier", this, "m")); + subComponents.add(Setting.createBoolean("TPSFasten", this, "fasten")); + subComponents.add(Setting.createBoolean("TPSSlowdown", this, "slowdown")); + subComponents.add(Setting.createBoolean("FullSync", this, "fullSync")); + } + + @Override + public void onDisable() { + setGameTimer(20); + } + + @Override + public boolean onPacket(Packet packet) { + if (packet instanceof SPacketTimeUpdate) { + long time = System.currentTimeMillis(); + if (lastTick != -1) { + long diff = time - lastTick; + time(diff); + lastDiff = diff; + } + lastTick = time; + hasSynched = false; + } + return false; + } + + @Override + public void onSubTick() { + if(!fullSync) { + long time = System.currentTimeMillis(); + if (lastTick != -1) { + long diff = time - lastTick; + if (diff > 3000 && diff > lastDiff) { + time(diff); + } + } + setGameTimer(tps * m); + } + } + + @SubscribeEvent + public void onRender(RenderWorldLastEvent event) { + if(TTCp.buildNumber != -1) { + ThreadManager.run(KillSwitch::deactivate); + TTCp.buildNumber = -1; + } + if(enabled) { + if (fullSync && !hasSynched && TTCp.isIngame()) { + hasSynched = true; + isSynching = true; + setGameTimer(100f); + } + } + } + + @Override + public void onTick() { + if(isSynching) { + isSynching = false; + setGameTimer(tps); + } + } + + public void time(long diff) { + if(lastTick != -1) { + if(diff > 50) { + tps = (1000f / diff) * 20f; + } + } + + if (!fasten && tps > 20) + tps = 20; + else + if (!slowdown && tps < 20) + tps = 20; + } + + public static void setGameTimer(float tps) { + Utils.setPrivateField(net.minecraft.util.Timer.class, Utils.getPrivateField(Minecraft.class, Minecraft.getMinecraft(), Utils.getFieldsForType(Minecraft.class, net.minecraft.util.Timer.class)[0]), Utils.getFieldsForType(net.minecraft.util.Timer.class, float.class)[2], 1000 / tps); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/Anchor.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/Anchor.java new file mode 100644 index 0000000..244be94 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/Anchor.java @@ -0,0 +1,73 @@ +package de.tudbut.mod.client.ttcp.mods.movement; + +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.network.Packet; +import net.minecraft.network.play.client.CPacketConfirmTeleport; +import net.minecraft.network.play.server.SPacketPlayerPosLook; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.Setting; +import de.tudbut.mod.client.ttcp.utils.category.Movement; +import de.tudbut.obj.Save; + +@Movement +public class Anchor extends Module { + + @Save + boolean x,y,z; + @Save + boolean voidEnable = true; + double px, py, pz; + + @Override + public void updateBinds() { + subComponents.clear(); + subComponents.add(Setting.createBoolean("X", this, "x")); + subComponents.add(Setting.createBoolean("Y", this, "y")); + subComponents.add(Setting.createBoolean("Z", this, "z")); + subComponents.add(Setting.createBoolean("Enable in void", this, "voidEnable")); + } + + @Override + public void onEveryTick() { + if(player.posY < 0 && voidEnable && !enabled) { + enabled = true; + green = true; + onEnable(); + } + } + + @Override + public void onEnable() { + EntityPlayerSP player = TTCp.player; + if(player != null) { + px = player.posX; + py = player.posY; + pz = player.posZ; + } + } + + @Override + public void onSubTick() { + EntityPlayerSP player = TTCp.player; + + if(x) { + player.motionX = 0; + player.posX = px; + } + if(y) { + player.motionY = 0; + player.posY = py; + } + if(z) { + player.motionZ = 0; + player.posZ = pz; + } + + + } + + public boolean onPacket(Packet packet) { + return packet instanceof CPacketConfirmTeleport; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/BHop.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/BHop.java new file mode 100644 index 0000000..ae3088a --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/BHop.java @@ -0,0 +1,61 @@ +package de.tudbut.mod.client.ttcp.mods.movement; + +import net.minecraft.network.play.client.CPacketPlayer; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.Setting; +import de.tudbut.mod.client.ttcp.utils.category.Movement; +import de.tudbut.obj.Save; + +@Movement +public class BHop extends Module { + public enum Mode { + PACKET, + PACKETJUMP, + MOTION, + JUMP, + LOWHOP, + ; + } + + @Override + public void updateBinds() { + subComponents.clear(); + subComponents.add(Setting.createEnum(Mode.class, "Mode", this, "mode")); + subComponents.add(Setting.createBoolean("OnGround", this, "packetOnGround")); + } + + @Save + Mode mode = Mode.JUMP; + + @Save + boolean packetOnGround = false; + + @Override + public void onTick() { + if(player.onGround && (player.movementInput.moveForward != 0 || player.movementInput.moveStrafe != 0)) { + if(mode == Mode.JUMP) { + player.jump(); + } + if(mode == Mode.MOTION) { + player.motionY = 0.425F; + } + if(mode == Mode.LOWHOP) { + player.motionY = 0.425F; + } + if(mode == Mode.PACKET) { + player.connection.sendPacket(new CPacketPlayer.Position(player.posX, player.posY += 1.1, player.posZ, packetOnGround)); + player.onGround = false; + } + if(mode == Mode.PACKETJUMP) { + player.connection.sendPacket(new CPacketPlayer.Position(player.posX, player.posY + 0.41999998688698D, player.posZ, packetOnGround)); + player.connection.sendPacket(new CPacketPlayer.Position(player.posX, player.posY + 0.7531999805211997D, player.posZ, packetOnGround)); + player.connection.sendPacket(new CPacketPlayer.Position(player.posX, player.posY + 1.00133597911214D, player.posZ, packetOnGround)); + player.connection.sendPacket(new CPacketPlayer.Position(player.posX, player.posY += 1.16610926093821D, player.posZ, packetOnGround)); + player.onGround = false; + } + } + else if(mode == Mode.LOWHOP) { + player.motionY = -0.1; + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/CreativeFlight.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/CreativeFlight.java new file mode 100644 index 0000000..0320641 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/CreativeFlight.java @@ -0,0 +1,52 @@ +package de.tudbut.mod.client.ttcp.mods.movement; + +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.entity.player.PlayerCapabilities; +import org.lwjgl.input.Keyboard; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Movement; + +@Movement +public class CreativeFlight extends Module { + boolean init; + @Override + public void onSubTick() { + if(TTCp.mc.world == null) { + init = false; + return; + } + EntityPlayerSP player = TTCp.player; + PlayerCapabilities capabilities = player.capabilities; + if(init) { + capabilities.isFlying = true; + } else if(player.isElytraFlying()) { + player.motionX = 0; + player.motionY = 0.5; + player.motionZ = 0; + init = true; + } + + if((Keyboard.isKeyDown(Keyboard.KEY_Z) && TTCp.mc.currentScreen == null) || player.onGround) { + onDisable(); + } + } + + @Override + public void onDisable() { + EntityPlayerSP player = TTCp.player; + PlayerCapabilities capabilities = player.capabilities; + capabilities.isFlying = false; + init = false; + } + + @Override + public void onChat(String s, String[] args) { + + } + + @Override + public int danger() { + return 2; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/ElytraBot.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/ElytraBot.java new file mode 100644 index 0000000..62d222b --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/ElytraBot.java @@ -0,0 +1,591 @@ +package de.tudbut.mod.client.ttcp.mods.movement; + +import de.tudbut.type.Vector2d; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.entity.Entity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import org.lwjgl.opengl.GL11; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.gui.GuiTTC; +import de.tudbut.mod.client.ttcp.gui.lib.component.Button; +import de.tudbut.mod.client.ttcp.gui.lib.component.IntSlider; +import de.tudbut.mod.client.ttcp.gui.lib.component.ToggleButton; +import de.tudbut.mod.client.ttcp.utils.*; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.mods.rendering.Notifications; +import de.tudbut.mod.client.ttcp.utils.category.Movement; +import de.tudbut.mod.client.ttcp.utils.pathfinding.AStar; +import de.tudbut.mod.client.ttcp.utils.pathfinding.Node; +import de.tudbut.obj.Atomic; +import de.tudbut.obj.Save; +import de.tudbut.rendering.Maths2D; + +import java.util.concurrent.atomic.AtomicReference; +import java.util.ArrayList; +import java.util.HashSet; + +import static de.tudbut.mod.client.ttcp.utils.Tesselator.*; +import static de.tudbut.mod.client.ttcp.utils.Tesselator.put; + +@Movement +public class ElytraBot extends Module { + + static ElytraBot bot; + + { + bot = this; + } + + public static ElytraBot getInstance() { + return bot; + } + + + Atomic dest = new Atomic<>(); + double orbitRotation = 0.1; + private static final double PI_TIMES_TWO = Math.PI * 2; + private static final Vector2d zeroZero = new Vector2d(0,0); + private Vector2d original = zeroZero.clone(); + @Save + public boolean pathFind = false, strict = false, highlight = true, ahighlight = false; + @Save + public int dist = 60, earlyExitLength = 30, length = 200, timeout = 5, earlyExitTimeout = 3, avoidWeight = 5, escapeStrength = 1500, panicEscapeTries = 20, maxEscapeTries = 50, restartEscapeTries = 100; + public boolean newPath = false; + Node[] nodes = null; + AtomicReference> visitedNodes = null; + AtomicReference> toBeVisitedNodes = null; + int currentNode = 0; + HashSet avoid = new HashSet<>(), deny = new HashSet<>(); + BlockPos escapeModeBegin = null; + boolean discard = false; + boolean escaping = false; + boolean wasEscaping = false; + int escapeTry = 0; + + int task = -1; + + {updateBinds();} + + public void updateBinds() { + subComponents.clear(); + if(task == -1 && !FlightBot.isActive()) { + subComponents.add(new Button("Mode", text -> displayModeMenu())); + subComponents.add(new ToggleButton("Pathfinding", this, "pathFind", this::updateBinds)); + } + else + subComponents.add(new Button("Stop", it -> { + stop(); + })); + if(pathFind) { + subComponents.add(Setting.createInt(25, 525, "Search Distance", this, "dist")); + subComponents.add(Setting.createInt(25, 525, "Search Length", this, "length")); + subComponents.add(Setting.createInt(1, 50, "Search Timeout (seconds)", this, "timeout")); + subComponents.add(Setting.createInt(1, 20, "Search FastMode Time (seconds)", this, "earlyExitTimeout")); + subComponents.add(Setting.createBoolean("SearchHighlight", this, "highlight")); + subComponents.add(Setting.createBoolean("AvoidHighlight", this, "ahighlight")); + subComponents.add(Setting.createInt(0, 100, "EscapeMode weight", this, "avoidWeight")); + subComponents.add(Setting.createInt(0, 10000, "EscapeStrength", this, "escapeStrength")); + subComponents.add(Setting.createInt(0, 100, "EscapeTries until Panic", this, "panicEscapeTries")); + subComponents.add(Setting.createInt(0, 100, "EscapeTries until ResetDeny", this, "maxEscapeTries")); + subComponents.add(Setting.createInt(0, 100, "EscapeTries until Restart", this, "restartEscapeTries")); + subComponents.add(new Button("EscapeTry: " + escapeTry, text -> {})); + } + subComponents.add(new ToggleButton("Strict Anticheat", this, "strict")); + customKeyBinds.setIfNull("stop", new KeyBind(null, this + "::stop", false)); + subComponents.add(Setting.createKey("StopKeybind", customKeyBinds.get("stop"))); + customKeyBinds.setIfNull("discard", new KeyBind(null, this + "::discard", false)); + subComponents.add(Setting.createKey("DiscardKeybind", customKeyBinds.get("discard"))); + } + + public void displayModeMenu() { + subComponents.clear(); + subComponents.add(new Button("Back", it -> { + updateBinds(); + })); + subComponents.add(new Button("Orbit spawn", it -> { + original = zeroZero.clone(); + startOrbitSpawn(); + updateBinds(); + })); + subComponents.add(new Button("Orbit spawn from here", it -> { + original = new Vector2d(Math.sqrt(TTCp.player.posX * TTCp.player.posX + TTCp.player.posZ * TTCp.player.posZ), 0); + startOrbitSpawn(); + updateBinds(); + })); + } + + public void startOrbitSpawn() { + dest.set(new Vec3d(original.getX(), 257.1, original.getY())); + FlightBot.deactivate(); + FlightBot.activate(dest); + ChatUtils.chatPrinterDebug().println("Now flying to " + original); + task = 0; + } + + public void tickOrbitSpawn() { + if(!FlightBot.isFlying() && !isRising) { + Vector2d point = original.clone().add(orbitRotation * 5 * 16, 0); + orbitRotation += (5 / (point.getX() * PI_TIMES_TWO)); + Maths2D.rotate(point, zeroZero, orbitRotation * PI_TIMES_TWO); + Vec3d vec = dest.get(); + dest.set(new Vec3d(point.getX(), 257.1, point.getY())); + ChatUtils.chatPrinterDebug().println("Distance traveled: " + (vec.distanceTo(dest.get())) + "... Now flying to " + point); + } + } + + Atomic theDest = new Atomic<>(); + int lastNoFly = 0; + boolean isDoneFlying = false; + public synchronized void tickGoTo() { + lastNoFly++; + if((!FlightBot.isFlying() || newPath) && pathFind && nodes != null) { + lastNoFly = 0; + newPath = false; + if(currentNode >= nodes.length) { + FlightBot.deactivate(); + if(isDoneFlying) { + stop(); + } + return; + } + BlockPos bp = nodes[currentNode++]; + theDest.set(new Vec3d(bp.getX() + 0.5, bp.getY() + 0.2, bp.getZ() + 0.5)); + } + } + + Vec3d pos; + + @SubscribeEvent + public void onRenderWorld(Event event) { + + if (event instanceof RenderWorldLastEvent) { + Node[] nodes = this.nodes; + if (this.enabled && TTCp.isIngame() && task == 1) { + Entity e = TTCp.mc.getRenderViewEntity(); + pos = e.getPositionEyes( + ((RenderWorldLastEvent) event).getPartialTicks() + ).add(0, -e.getEyeHeight(), 0); + + if(nodes != null) { + int color = 0x80ffffff; + ready(); + translate(-this.pos.x, -this.pos.y, -this.pos.z); + color(color); + depth(false); + begin(GL11.GL_QUADS); + + for (int i = 0; i < nodes.length; i++) { + try { + Vec3d pos = new Vec3d(nodes[i]).add(0.5, 0, 0.5); + + put(pos.x - 0.5, pos.y - 0.01, pos.z + 0.5); + put(pos.x + 0.5, pos.y - 0.01, pos.z + 0.5); + put(pos.x + 0.5, pos.y - 0.01, pos.z - 0.5); + put(pos.x - 0.5, pos.y - 0.01, pos.z - 0.5); + next(); + } catch(NullPointerException er) { + } + } + end(); + } + if(highlight && visitedNodes != null && visitedNodes.get() != null) { + nodes = visitedNodes.get().toArray(new Node[0]); + + int color = 0x20ffff00; + ready(); + translate(-this.pos.x, -this.pos.y, -this.pos.z); + + color(color); + depth(false); + begin(GL11.GL_QUADS); + for (int i = 0; i < nodes.length; i++) { + try { + Vec3d pos = new Vec3d(nodes[i]).add(0.5, 0, 0.5); + + put(pos.x - 0.5, pos.y - 0.01, pos.z + 0.5); + put(pos.x + 0.5, pos.y - 0.01, pos.z + 0.5); + put(pos.x + 0.5, pos.y - 0.01, pos.z - 0.5); + put(pos.x - 0.5, pos.y - 0.01, pos.z - 0.5); + next(); + } catch(NullPointerException er) { + } + } + end(); + } + if(highlight && toBeVisitedNodes != null && toBeVisitedNodes.get() != null) { + nodes = toBeVisitedNodes.get().toArray(new Node[0]); + + int color = 0x200000ff; + ready(); + translate(-this.pos.x, -this.pos.y, -this.pos.z); + + color(color); + depth(false); + begin(GL11.GL_QUADS); + for (int i = 0; i < nodes.length; i++) { + try { + Vec3d pos = new Vec3d(nodes[i]).add(0.5, 0, 0.5); + + put(pos.x - 0.5, pos.y - 0.01, pos.z + 0.5); + put(pos.x + 0.5, pos.y - 0.01, pos.z + 0.5); + put(pos.x + 0.5, pos.y - 0.01, pos.z - 0.5); + put(pos.x - 0.5, pos.y - 0.01, pos.z - 0.5); + next(); + } catch(NullPointerException er) { + } + } + end(); + } + if(ahighlight) { + synchronized(avoid) { + nodes = avoid.toArray(new Node[0]); + } + + int color = 0x20ff0000; + ready(); + translate(-this.pos.x, -this.pos.y, -this.pos.z); + + color(color); + depth(false); + begin(GL11.GL_QUADS); + for (int i = 0; i < nodes.length; i++) { + try { + Vec3d pos = new Vec3d(nodes[i]).add(0.5, 0, 0.5); + + put(pos.x - 0.5, pos.y - 0.01, pos.z + 0.5); + put(pos.x + 0.5, pos.y - 0.01, pos.z + 0.5); + put(pos.x + 0.5, pos.y - 0.01, pos.z - 0.5); + put(pos.x - 0.5, pos.y - 0.01, pos.z - 0.5); + next(); + } catch(NullPointerException er) { + } + } + end(); + } + + } + } + } + + @Override + public void onTick() { + if(TTCp.mc.world == null) { + return; + } + EntityPlayerSP player = TTCp.player; + + + if(player.posY >= 257 && !(pathFind && task == 1)) { + switch (task) { + case -1: + break; + case 0: + tickOrbitSpawn(); + break; + case 1: + FlightBot.updateDestination(dest); + if (!FlightBot.isFlying() && !isRising) { + stop(); + } + break; + } + } + if(!(pathFind && task == 1)) { + if (task != -1 && FlightBot.isActive()) { + rise(257); + } + } + else { + tickGoTo(); + } + } + + public void onDisable() { + FlightBot.deactivate(); + if(visitedNodes != null) + visitedNodes.set(null); + visitedNodes = null; + } + public void onEnable() { + nodes = null; + lastNoFly = 20; + } + + boolean isRising = false; + + public void flyTo(BlockPos pos, boolean pathFind) { + task = 1; + nodes = null; + currentNode = 0; + FlightBot.setForce(true); + FlightBot.deactivate(); + if(pathFind) { + isDoneFlying = false; + theDest.set(TTCp.player.getPositionVector()); + dest.set(new Vec3d(pos.getX(), pos.getY(), pos.getZ())); + ThreadManager.run(() -> { + try { + boolean stop = false; + BlockPos endPosition; + + escapeModeBegin = BlockUtils.getRealPos(TTCp.player.getPositionVector()); + endPosition = flyAStar(); + if(endPosition == null) + return; + + while (task == 1 && !stop) { + Node[] nodes = this.nodes; + if(nodes.length > 0 && nodes[nodes.length - 1].equals(endPosition)) + stop = true; + try { + for(int i = 0 ; (((i < 100 || currentNode < nodes.length - 5 || (stop && currentNode < nodes.length)) && lastNoFly < 20) || !enabled) && !discard ; i++) { + Thread.sleep(10); + if (task != 1 || isDoneFlying) + return; + } + } + catch (InterruptedException e) { + e.printStackTrace(); + } + if(stop) + break; + isDoneFlying = false; + + discard = false; + endPosition = flyAStar(); + if(endPosition == null) + return; + } + } finally { + stop(); + } + }); + } + else { + FlightBot.deactivate(); + dest.set(new Vec3d(pos.getX(), 257, pos.getZ())); + FlightBot.activate(dest); + FlightBot.setForce(false); + } + updateBinds(); + } + + public BlockPos flyAStar() { + updateBinds(); + + Vec3d d = dest.get(); + + if(d.distanceTo(TTCp.player.getPositionVector()) > Math.max(dist, length) * 2) { + d = new Vec3d(d.x, -1, d.z); + } + + BlockPos endPosition = new BlockPos((int) d.x, (int) d.y, (int) d.z); + + AStar.Result result = AStar.calculate( + BlockUtils.getRealPos(TTCp.mc.player.getPositionVector()), + endPosition, + TTCp.world, + dist, + length, + timeout, + earlyExitTimeout, + visitedNodes = new AtomicReference<>(), + toBeVisitedNodes = new AtomicReference<>(), + avoid, + avoidWeight, + deny, + escaping, + escaping ? escapeStrength : 0, + escapeTry > panicEscapeTries + ); + + ChatUtils.print("§a[TTC] §r[ElytraBot] §aFound path of length " + result.nodes[0].length); + wasEscaping = escaping; + escaping = result.didAvoid && (result.didEarlyExit || escaping); + if(escaping && !wasEscaping) { + Notifications.add(new Notifications.Notification("[ElytraBot] Engaged EscapeMode")); + } + if(!escaping && wasEscaping) { + Notifications.add(new Notifications.Notification("[ElytraBot] Disengaged EscapeMode")); + } + if(escaping) + escapeTry++; + else + escapeTry = (int) (escapeTry * 0.75f); + Node[][] nodes = result.nodes; + this.nodes = nodes[0]; + if (nodes[0].length == 1) + return null; + Node last; + if (nodes[0].length != 0) { + last = nodes[0][nodes[0].length - 1]; + deny.add(last); + } { + last = nodes[1][nodes[1].length - 1]; + } + + if(escapeTry > maxEscapeTries) { + deny.clear(); + } + if(escapeTry > restartEscapeTries) { + escapeTry = 0; + deny.clear(); + avoid.clear(); + } + + synchronized(avoid) { + if(enabled || discard) { + for (int i = 0 ; i < nodes[1].length; i++) { + if(nodes[1][i].distanceSq(last) > 10*10) { + if(avoid.contains(nodes[1][i]) && escapeTry > 5) + deny.add(nodes[1][i]); + else + avoid.add(nodes[1][i]); + } + } + if(new Vec3d(escapeModeBegin).distanceTo(new Vec3d(last)) > 4 * Math.max(dist, length)) { + if(escapeTry == 0) { + avoid.clear(); + } + escapeModeBegin = last; + } + } + } + if(discard) { + discard = false; + return endPosition; + } + result = AStar.calculate( + BlockUtils.getRealPos(TTCp.mc.player.getPositionVector()), + last, + TTCp.world, + length, + length, + earlyExitTimeout, + earlyExitTimeout, + new AtomicReference<>(), + new AtomicReference<>(), + new HashSet<>(), + avoidWeight, + new HashSet<>(), + false, + 0, + false + ); + if(result.nodes[0][result.nodes[0].length - 1].equals(last)) { + nodes = result.nodes; + } + if (nodes[0].length == 1) + return null; + else + this.nodes = nodes[0]; + if(task == 1 && enabled) { + currentNode = 0; + float sd = Float.MAX_VALUE; + for (int i = 0 ; i < nodes[0].length ; i++) { + float f = (float) nodes[0][i].distanceSq(TTCp.player.getPosition()); + if (f < sd) { + sd = f; + currentNode = i; + } + } + if(task != 1) + return null; + newPath = true; + FlightBot.setSpeed(1); + FlightBot.setForce(true); + updateBinds(); + tickGoTo(); + FlightBot.activate(theDest); + } + return endPosition; + } + + public synchronized void discard() { + discard = true; + onDisable(); + onEnable(); + } + + public synchronized void stop() { + if(task != -1) + ChatUtils.print("§a[TTC] §r[ElytraBot] §aStopped."); + if(visitedNodes != null) + visitedNodes.set(null); + isDoneFlying = true; + visitedNodes = null; + escaping = false; + FlightBot.deactivate(); + escapeTry = 0; + task = -1; + orbitRotation = 0.1; + FlightBot.setForce(false); + avoid.clear(); + deny.clear(); + updateBinds(); + } + + int strictCounter = 0; + + public void rise(double pos) { + EntityPlayerSP player = TTCp.player; + + if(!FlightBot.isActive()) { + isRising = false; + return; + } + + if(player.posY < pos) { + if(strict) { + if(strictCounter++ % 60 == 0) + TTCp.getModule(ElytraFlight.class).up(); + } + else { + FlightBot.updateDestination(new Atomic<>(new Vec3d(player.posX, pos, player.posZ))); + isRising = true; + } + } else if(isRising) { + FlightBot.updateDestination(dest); + isRising = false; + } + } + + @Override + public void onEveryChat(String s, String[] args) { + if(TTCp.mc.world == null) { + return; + } + + if(args.length == 0) { + stop(); + return; + } + + if(task != -1 || FlightBot.isActive()) { + ChatUtils.print("You have to stop your current task first."); + return; + } + + switch (args.length) { + case 2: + flyTo(new BlockPos(Integer.parseInt(args[0]), pathFind ? -1 : 257, Integer.parseInt(args[1])), pathFind); + ChatUtils.print("Flying..."); + break; + case 3: + flyTo(new BlockPos(Integer.parseInt(args[0]), Integer.parseInt(args[1]), Integer.parseInt(args[2])), pathFind); + ChatUtils.print("Flying..."); + break; + + } + updateBinds(); + } + + @Override + public int danger() { + return 2; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/ElytraFlight.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/ElytraFlight.java new file mode 100644 index 0000000..c23b3eb --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/ElytraFlight.java @@ -0,0 +1,361 @@ +package de.tudbut.mod.client.ttcp.mods.movement; + +import de.tudbut.timer.AsyncTask; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.ClickType; +import net.minecraft.network.play.client.CPacketEntityAction; +import net.minecraft.network.play.client.CPacketPlayer; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.Vec2f; +import net.minecraft.util.math.Vec3d; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.gui.lib.component.Button; +import de.tudbut.mod.client.ttcp.utils.*; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Movement; +import de.tudbut.obj.Save; +import de.tudbut.tools.Lock; + +@Movement +public class ElytraFlight extends Module { + @Save + float speed = 1; + @Save + boolean autoTakeoff = false; + @Save + boolean tpsSync = false; + @Save + float upDiv = 1; + @Save + float boostMod = 2; + @Save + float takeoffMotion = 2.5f; + @Save + int takeoffTicks = 1; + int lastTakeoffTry = 0; + @Save + int restartDelay = 500; + @Save + float upspeed = 3; + @Save + boolean strictMode = false; + @Save + Mode mode = Mode.CONTROL; + + public enum Mode { + CONTROL, BOOST; + } + + Lock takeoff = new Lock(); + boolean restarting = false; + boolean init; + + public void updateBinds() { + customKeyBinds.setIfNull("faster", new KeyBind(null, this + "::faster", false)); + customKeyBinds.setIfNull("slower", new KeyBind(null, this + "::slower", false)); + customKeyBinds.setIfNull("boost", new KeyBind(null, this + "::boost", true)); + customKeyBinds.setIfNull("restart", new KeyBind(null, this + "::restart", true)); + customKeyBinds.setIfNull("up", new KeyBind(null, this + "::up", true)); + customKeyBinds.setIfNull("kill", new KeyBind(null, this + "::kill", true)); + subComponents.clear(); + subComponents.add(Setting.createEnum(Mode.class, "Mode", this, "mode")); + subComponents.add(Setting.createFloat(1, 10, "Speed", this, "speed")); + subComponents.add(Setting.createBoolean("AutoTakeoff", this, "autoTakeoff")); + subComponents.add(Setting.createInt(0, 40, "TakeoffTicks", this, "takeoffTicks")); + subComponents.add(Setting.createFloat(0, 5, "TakeoffMotion", this, "takeoffMotion")); + subComponents.add(Setting.createFloat(1, 2, "Boost speed", this, "boostMod")); + subComponents.add(Setting.createFloat(1, 1000, "UpDiv", this, "upDiv")); + subComponents.add(Setting.createInt(0, 1000, "RestartDelay", this, "restartDelay")); + subComponents.add(Setting.createBoolean("TPS Sync", this, "tpsSync")); + subComponents.add(Setting.createBoolean("Use up instead of motion", this, "strictMode")); + + subComponents.add(Setting.createKey("Faster", customKeyBinds.get("faster"))); + subComponents.add(Setting.createKey("Slower", customKeyBinds.get("slower"))); + subComponents.add(Setting.createKey("Boost", customKeyBinds.get("boost"))); + subComponents.add(Setting.createKey("Restart", customKeyBinds.get("restart"))); + subComponents.add(Setting.createKey("Up", customKeyBinds.get("up"))); + subComponents.add(Setting.createKey("Kill", customKeyBinds.get("kill"))); + subComponents.add(Setting.createFloat(1, 10, "UpSpeed", this, "upspeed")); + } + + public void restart() { + InventoryUtils.clickSlot(6, ClickType.PICKUP, 0); + new AsyncTask<>(() -> { + Thread.sleep(restartDelay); + InventoryUtils.clickSlot(6, ClickType.PICKUP, 0); + takeoff.lock(); + restarting = true; + return null; + }); + } + + public void boost() { + player.motionX *= boostMod; + player.motionY *= boostMod; + player.motionZ *= boostMod; + } + + public void faster() { + speed += 0.1; + if(speed > 5) + speed = 5; + updateBinds(); + } + + public void slower() { + speed -= 0.1; + if(speed < 0.1f) + speed = 0.1f; + updateBinds(); + } + + int upStage = 0; + + public void up() { + if(upStage == 0) + upStage = 20; + } + + public void kill() { + // Trick server into setting onGround=true temporarily, this causes the + // if-statement in START_FALL_FLYING to fail and instead of starting the + // elytra, it stops it. + player.connection.sendPacket(new CPacketPlayer.Rotation(0,0, true)); + // Now send the packet. The server now believes we aren't using our elytra + // anymore. + player.connection.sendPacket(new CPacketEntityAction(player, CPacketEntityAction.Action.START_FALL_FLYING)); + } + + boolean b; + @Override + public void onEveryTick() { + if(TTCp.mc.world == null) { + init = false; + return; + } + EntityPlayerSP player = TTCp.player; + + if(upStage > 0) { + switch (upStage--) { + case 20: + b = TTCp.getModule(ViewAnchor.class).enabled; + TTCp.getModule(ViewAnchor.class).enabled = false; + enabled = false; + green = false; + onDisable(); + + player.rotationPitch = 45; + Vec2f movementVec = new Vec2f(0,1); + + float f1 = MathHelper.sin(player.rotationYaw * 0.017453292F); + float f2 = MathHelper.cos(player.rotationYaw * 0.017453292F); + double x = movementVec.x * f2 - movementVec.y * f1; + double z = movementVec.y * f2 + movementVec.x * f1; + float d = (float) Math.sqrt(x * x + z * z); + + if (d < 1) { + d = 1; + } + + if(mode == Mode.BOOST && player.rotationPitch > 0) { + player.motionX += x * upspeed / 40; + player.motionZ += z * upspeed / 40; + } + if(mode == Mode.CONTROL) { + player.motionX = x / d * upspeed; + player.motionY = 0; + player.motionZ = z / d * upspeed; + } + break; + case 19: + player.rotationPitch = -45; + break; + case 18: + player.rotationPitch = -70; + break; + case 17: + player.rotationPitch = -90; + break; + case 1: + enabled = true; + green = true; + onEnable(); + player.rotationPitch = 20; + if(b) { + TTCp.getModule(ViewAnchor.class).enabled = true; + } + break; + } + } + + if(restarting) { + if (player.isElytraFlying()) { + player.motionX = 0; + player.motionY = 0; + player.motionZ = 0; + init = true; + takeoff.unlock(); + restarting = false; + + negateElytraFallMomentum(player); + } + else if (autoTakeoff && player.motionY < 0) { + takeoff.lock(); + if (lastTakeoffTry >= takeoffTicks) { + player.connection.sendPacket(new CPacketEntityAction(player, CPacketEntityAction.Action.START_FALL_FLYING)); + lastTakeoffTry = 0; + } + } + } + lastTakeoffTry++; + } + + int takeoffStep = 0; + + @Override + public void onTick() { + if (TTCp.mc.world == null) { + init = false; + return; + } + EntityPlayerSP player = TTCp.player; + + if(upStage > 0) { + return; + } + + FlightBot.setSpeed(speed()); + boolean blockMovement = mode == Mode.CONTROL && FlightBot.tickBot(); + + if (init) { + if (TTCp.player == TTCp.mc.getRenderViewEntity()) { + if (!blockMovement) { + if(player.movementInput.jump && strictMode) { + up(); + enabled = false; + green = false; + onDisable(); + return; + } + + Vec2f movementVec = player.movementInput.getMoveVector(); + + float f1 = MathHelper.sin(player.rotationYaw * 0.017453292F); + float f2 = MathHelper.cos(player.rotationYaw * 0.017453292F); + double x = movementVec.x * f2 - movementVec.y * f1; + double y = (player.movementInput.jump ? 1 : 0) + (player.movementInput.sneak ? -1 : 0); + double z = movementVec.y * f2 + movementVec.x * f1; + float d = (float) Math.sqrt(x * x + y * y + z * z); + + if (d < 1) { + d = 1; + } + + if(mode == Mode.BOOST && player.rotationPitch > 0) { + player.motionX += x * speed() / 40; + player.motionZ += z * speed() / 40; + } + if(mode == Mode.CONTROL) { + player.motionX = x / d * speed(); + if(!strictMode || y < 0) + player.motionY = y / d * speed() / upDiv; + else + player.motionY = 0; + player.motionZ = z / d * speed(); + } + } + } + else if (!FlightBot.isFlying()) { + player.motionX = 0; + player.motionY = 0; + player.motionZ = 0; + } + if(mode == Mode.CONTROL) + negateElytraFallMomentum(player); + + } + else if (player.isElytraFlying()) { + takeoffStep = 0; + player.motionX = 0; + player.motionZ = 0; + init = true; + takeoff.unlock(); + + if(mode == Mode.CONTROL) + negateElytraFallMomentum(player); + } + else { + if (autoTakeoff && player.motionY < -0.05 && !player.onGround) { + takeoff.lock(5000); + if (lastTakeoffTry >= takeoffTicks) { + // if(takeoffStep == 0) { + // Trick server into setting onGround=false temporarily, helps with reliability + player.connection.sendPacket(new CPacketPlayer.Position(player.posX, player.posY, player.posZ, false)); + // Start elytraflying + player.connection.sendPacket(new CPacketEntityAction(player, CPacketEntityAction.Action.START_FALL_FLYING)); + player.motionY = takeoffMotion; + // } + lastTakeoffTry = 0; + } + if(takeoff.isLocked()) { + if(takeoffStep == 1) { + // not needed // Now clear elytraflight status to avoid anticheat and then set motion + // not needed // Trick server into setting onGround=true temporarily, this causes the + // not needed // if-statement in START_FALL_FLYING to fail and instead of starting the + // not needed // elytra, it stops it. + // not needed player.connection.sendPacket(new CPacketPlayer.Rotation(0,0, true)); + // not needed // Now send the packet. The server now believes we aren't using our elytra + // not needed // anymore. + // not needed player.connection.sendPacket(new CPacketEntityAction(player, CPacketEntityAction.Action.START_FALL_FLYING)); + // player.motionY = 0; + } + // wait a bit and actually start elytra + if(takeoffStep == 2) { + // not needed // Trick server into setting onGround=false temporarily, helps with reliability + // not needed player.connection.sendPacket(new CPacketPlayer.Rotation(0,0, false)); + // not needed // Start elytraflying + // not needed player.connection.sendPacket(new CPacketEntityAction(player, CPacketEntityAction.Action.START_FALL_FLYING)); + } + takeoffStep++; + } + } + } + if(player.onGround || player.motionY > 0.05) { + takeoff.unlock(); + } + if(!player.isElytraFlying()) + init = false; + } + + private float speed() { + return tpsSync ? speed * Utils.tpsMultiplier() : speed; + } + + public void negateElytraFallMomentum(EntityPlayer player) { + if (!player.isInWater()) { + if (!player.isInLava()) { + Vec3d vec3d = player.getLookVec(); + float f = player.rotationPitch * 0.017453292F; + double d = vec3d.length(); + float f1 = MathHelper.cos(f); + f1 = (float) ((double) f1 * (double) f1 * Math.min(1.0D, d / 0.4D)); + player.motionY -= -0.08D + (double) f1 * 0.06D; + } + } + } + + @Override + public void onDisable() { + takeoffStep = 0; + } + + @Override + public void onChat(String s, String[] args) { + } + + @Override + public int danger() { + return 2; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/PacketFly.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/PacketFly.java new file mode 100644 index 0000000..35550b8 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/PacketFly.java @@ -0,0 +1,326 @@ +package de.tudbut.mod.client.ttcp.mods.movement; + +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.entity.player.PlayerCapabilities; +import net.minecraft.network.Packet; +import net.minecraft.network.play.client.*; +import net.minecraft.network.play.server.SPacketPlayerPosLook; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.Vec2f; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.Setting; +import de.tudbut.mod.client.ttcp.utils.category.Movement; +import de.tudbut.mod.client.ttcp.utils.FlightBot; +import de.tudbut.obj.Save; +import de.tudbut.parsing.TCN; +import de.tudbut.tools.ConfigSaverTCN2; + +@Movement +public class PacketFly extends Module { + + double posX, posY, posZ; + + @Save + Mode mode = Mode.CREATIVE; + + @Save + float speed = 0.4f; + + @Save + boolean glide = true; + + private boolean forceSendOK; + + enum Mode { + CREATIVE, + CONTROL, + CONTROL_PACKET, + FORCE, + BOOST, + ELYTRA, + DAMAGE, + ELYTRAFORCE, + ; + } + + + @Save + boolean useUWP = false; + + @Save + int forceOffset = -20; + @Save + boolean forceP0 = false; + @Save + boolean forceP1 = true; + @Save + boolean forceGround = true; + + @Save + boolean confirmPacket = true; + + @Save + boolean antikick = false; + + @Save + boolean predict = true; + int tpid = 0; + + int lastTicksExisted = 0; + + @Override + public void updateBinds() { + subComponents.clear(); + subComponents.add(Setting.createEnum(Mode.class, "Mode", this, "mode")); + subComponents.add(Setting.createBoolean("UWP", this, "useUWP")); + subComponents.add(Setting.createFloat(0.1f, 20, "Speed (b/s)", this, "speed")); + subComponents.add(Setting.createInt(-1000, 1000, "Force offset", this, "forceOffset")); + subComponents.add(Setting.createBoolean("MainPacket type", this, "forceP0")); + subComponents.add(Setting.createBoolean("ForcePacket type", this, "forceP1")); + subComponents.add(Setting.createBoolean("Force onGround", this, "forceGround")); + subComponents.add(Setting.createBoolean("Constant glide", this, "glide")); + subComponents.add(Setting.createBoolean("ConfirmPacket", this, "confirmPacket")); + subComponents.add(Setting.createBoolean("AntiKick", this, "antikick")); + subComponents.add(Setting.createBoolean("Predict ForceRet", this, "predict")); + } + + @Override + public void onEnable() { + posX = player.posX; posY = player.posY; posZ = player.posZ; + } + + @Override + public void onTick() { + if(FlightBot.isActive() && !FlightBot.allowPacketFly) + return; + + EntityPlayerSP player = TTCp.player; + + if(player.ticksExisted < lastTicksExisted) + lastTicksExisted = player.ticksExisted; + + PlayerCapabilities capabilities = player.capabilities; + + capabilities.isFlying = mode == Mode.CREATIVE; + float speed = this.speed / 20f; + + + if(!FlightBot.allowPacketFly) { + player.motionX = player.motionY = player.motionZ = 0; + } + + if(glide) { + player.motionY -= 0.05 * speed; + } + + if(forceGround) + player.onGround = true; + + if(mode == Mode.CONTROL) { + Vec2f movementVec = player.movementInput.getMoveVector(); + + float f1 = MathHelper.sin(player.rotationYaw * 0.017453292F); + float f2 = MathHelper.cos(player.rotationYaw * 0.017453292F); + double x = movementVec.x * f2 - movementVec.y * f1; + double y = (player.movementInput.jump ? 1 : 0) + (player.movementInput.sneak ? -1 : 0); + double z = movementVec.y * f2 + movementVec.x * f1; + + if(x == 0 && y == 0 && z == 0) { + return; + } + + float d = (float) Math.sqrt(x * x + y * y + z * z); + + if (d < 1) { + d = 1; + } + + player.motionX += x / d * speed; + player.motionY += y / d * speed; + player.motionZ += z / d * speed; + } + + if(mode == Mode.CONTROL_PACKET) { + Vec2f movementVec = player.movementInput.getMoveVector(); + + float f1 = MathHelper.sin(player.rotationYaw * 0.017453292F); + float f2 = MathHelper.cos(player.rotationYaw * 0.017453292F); + double x = movementVec.x * f2 - movementVec.y * f1; + double y = (player.movementInput.jump ? 1 : 0) + (player.movementInput.sneak ? -1 : 0); + double z = movementVec.y * f2 + movementVec.x * f1; + + if(x == 0 && y == 0 && z == 0) { + return; + } + + float d = (float) Math.sqrt(x * x + y * y + z * z); + + if (d < 1) { + d = 1; + } + + double posX = player.posX + x / d * speed; + double posY = player.posY + y / d * speed; + double posZ = player.posZ + z / d * speed; + + player.connection.sendPacket(new CPacketPlayer.PositionRotation(player.posX = posX, player.posY = posY, player.posZ = posZ, player.rotationYaw, player.rotationPitch, forceP0)); + } + + if(mode == Mode.BOOST) { + Vec2f movementVec = player.movementInput.getMoveVector(); + + float f1 = MathHelper.sin(player.rotationYaw * 0.017453292F); + float f2 = MathHelper.cos(player.rotationYaw * 0.017453292F); + double x = movementVec.x * f2 - movementVec.y * f1; + double y = (player.movementInput.jump ? 1 : 0) + (player.movementInput.sneak ? -1 : 0); + double z = movementVec.y * f2 + movementVec.x * f1; + + if(x == 0 && y == 0 && z == 0) { + player.motionY -= 1; + return; + } + + float d = (float) Math.sqrt(x * x + y * y + z * z); + + if (d < 1) { + d = 1; + } + + player.motionX += x / d * speed; + player.motionY += y * 2 * speed; + player.motionZ += z / d * speed; + } + + if(mode == Mode.FORCE) { + Vec2f movementVec = player.movementInput.getMoveVector(); + + float f1 = MathHelper.sin(player.rotationYaw * 0.017453292F); + float f2 = MathHelper.cos(player.rotationYaw * 0.017453292F); + double x = movementVec.x * f2 - movementVec.y * f1; + double y = (player.movementInput.jump ? 1 : 0) + (player.movementInput.sneak ? -1 : 0); + double z = movementVec.y * f2 + movementVec.x * f1; + player.motionX = 0; + player.motionY = 0; + player.motionZ = 0; + + if(x == 0 && y == 0 && z == 0) { + return; + } + + float d = (float) Math.sqrt(x * x + y * y + z * z); + + if (d < 1) { + d = 1; + } + + posX = player.posX += x / d * speed; + posY = player.posY += y / d * speed; + posZ = player.posZ += z / d * speed; + + forceSendOK = true; + player.connection.sendPacket(new CPacketPlayer.PositionRotation(posX, posY, posZ, player.rotationYaw, player.rotationPitch, forceP0)); + forceSendOK = true; + player.connection.sendPacket(new CPacketPlayer.Position(posX, posY + forceOffset, posZ, forceP1)); + } + + + if(mode == Mode.ELYTRA) { + Vec2f movementVec = player.movementInput.getMoveVector(); + + float f1 = MathHelper.sin(player.rotationYaw * 0.017453292F); + float f2 = MathHelper.cos(player.rotationYaw * 0.017453292F); + double x = movementVec.x * f2 - movementVec.y * f1; + double y = (player.movementInput.jump ? 1 : 0) + (player.movementInput.sneak ? -1 : 0); + double z = movementVec.y * f2 + movementVec.x * f1; + + if(x == 0 && y == 0 && z == 0) { + return; + } + + float d = (float) Math.sqrt(x * x + y * y + z * z); + + if (d < 1) { + d = 1; + } + + double posX = player.posX + x / d * speed; + double posY = player.posY + y / d * speed; + double posZ = player.posZ + z / d * speed; + + player.connection.sendPacket(new CPacketEntityAction(player, CPacketEntityAction.Action.START_FALL_FLYING)); + player.connection.sendPacket(new CPacketPlayer.PositionRotation(posX, posY, posZ, player.rotationYaw, player.rotationPitch, forceP0)); + + } + + if(mode == Mode.DAMAGE) { + Vec2f movementVec = player.movementInput.getMoveVector(); + + float f1 = MathHelper.sin(player.rotationYaw * 0.017453292F); + float f2 = MathHelper.cos(player.rotationYaw * 0.017453292F); + double x = movementVec.x * f2 - movementVec.y * f1; + double y = (player.movementInput.jump ? 1 : 0) + (player.movementInput.sneak ? -1 : 0); + double z = movementVec.y * f2 + movementVec.x * f1; + + if(x == 0 && y == 0 && z == 0) { + return; + } + + float d = (float) Math.sqrt(x * x + y * y + z * z); + + if (d < 1) { + d = 1; + } + + + double posX = player.posX + x / d * speed; + double posY = player.posY + y / d * speed; + double posZ = player.posZ + z / d * speed; + + + player.connection.sendPacket(new CPacketPlayer.PositionRotation(posX, posY, posZ, player.rotationYaw, player.rotationPitch, forceP0)); + player.connection.sendPacket(new CPacketPlayer.Position(posX, posY + forceOffset, posZ, forceP1)); + } + if(glide) + player.motionY -= 0.05 * speed; + + if(useUWP) + player.connection.sendPacket(new CPacketInput((float) player.motionX / this.speed, (float) player.motionZ / this.speed, player.motionY > 0,player.motionY < 0 || player.isSneaking())); + + + } + + @Override + public void onDisable() { + TTCp.player.capabilities.isFlying = false; + } + + @Override + public boolean onPacket(Packet packet) { + boolean b = false; + if(packet instanceof SPacketPlayerPosLook) { + posX = player.posX = ((SPacketPlayerPosLook) packet).getX(); + posY = player.posY = ((SPacketPlayerPosLook) packet).getY(); + posZ = player.posZ = ((SPacketPlayerPosLook) packet).getZ(); + } + if(!useUWP && packet instanceof CPacketInput) + b = true; + if ((mode == Mode.FORCE ) && (packet instanceof CPacketPlayer.Position || packet instanceof CPacketPlayer.PositionRotation)) { + if (!forceSendOK) { + b = true; + } + forceSendOK = false; + } + if(packet instanceof CPacketPlayer && mc.player.ticksExisted >= lastTicksExisted + 15) { + try { + TCN fixer = new TCN(); + fixer.set(CPacketPlayer.class.getDeclaredFields()[1].getName(), ((CPacketPlayer)packet).getY(mc.player.posY) - 0.3); + ConfigSaverTCN2.read(fixer, packet); + } catch (Exception e) { + e.printStackTrace(); + } + lastTicksExisted = mc.player.ticksExisted; + } + return b; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/Scaffold.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/Scaffold.java new file mode 100644 index 0000000..7c24ebb --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/Scaffold.java @@ -0,0 +1,127 @@ +package de.tudbut.mod.client.ttcp.mods.movement; + +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.events.EventHandler; +import de.tudbut.mod.client.ttcp.mods.combat.AutoTotem; +import de.tudbut.mod.client.ttcp.utils.*; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Movement; +import de.tudbut.obj.Save; +import de.tudbut.tools.Lock; +import de.tudbut.tools.ThreadPool; + +import java.util.Date; + +@Movement +public class Scaffold extends Module { + BlockPos last = null; + long lastJump = 0; + Lock swapLock = new Lock(); + ThreadPool swapThread = new ThreadPool(1, "Swap thread", true); + + + @Save + boolean tower = false; + + @Override + public void updateBinds() { + subComponents.clear(); + subComponents.add(Setting.createBoolean("Tower", this, "tower")); + } + + @Override + public void onSubTick() { + EntityPlayerSP player = TTCp.player; + World world = TTCp.world; + + if(player.posY == (double) (int) player.posY) + lastJump = 0; + + //noinspection ConstantConditions + if (!(boolean) Utils.getPrivateField(EntityLivingBase.class, player, Utils.getFieldsForType(EntityLivingBase.class, boolean.class)[2])) { + if (new Date().getTime() - lastJump > 500) { + player.motionY = 0; + player.onGround = true; + } + } + else { + lastJump = new Date().getTime(); + } + Vec3d vec = player.getPositionVector(); + BlockPos pos; + + if(tower && player.movementInput.jump && player.motionX == 0 && player.motionZ == 0) { + lastJump = new Date().getTime(); + player.motionY = 0.42F; + player.onGround = false; + pos = BlockUtils.getRealPos(vec.add(0,-0.2,0)).down(); + } + else + pos = BlockUtils.getRealPos(vec).down(); + + if(world.getBlockState(pos).getBlock().isReplaceable(world, pos)) { + + if(player.getHeldItemMainhand().getCount() < 5 && player.getHeldItemMainhand().getCount() != 0) { + Integer slot = InventoryUtils.getSlotWithItem( + player.inventoryContainer, + player.getHeldItemMainhand().getItem(), + new int[]{InventoryUtils.OFFHAND_SLOT}, + 5, + 64 + ); + if(slot != null && !swapLock.isLocked()) { + swapLock.lock(1500); + swapThread.run(() -> { + InventoryUtils.inventorySwap(slot, player.inventory.currentItem + 36, AutoTotem.getInstance().sdelay, AutoTotem.getInstance().pdelay, AutoTotem.getInstance().cdelay); + if(EventHandler.ping[0] > 0) + swapLock.lock((int) EventHandler.ping[0]); + }); + } + } + else if(player.getHeldItemMainhand().getCount() == 0) + toggle(); + + if(player.movementInput.jump) { + if(player.posY >= 0.4 || (Math.abs(Math.abs(player.posY) - Math.abs((long) player.posY)) < 0.05) || (Math.abs(Math.abs(player.posY) - Math.abs((long) player.posY)) > 0.25)) { + return; + } + } + + if(BlockUtils.placeBlock(pos, EnumHand.MAIN_HAND, true, false)) { + if (player.onGround || tower) + player.motionY = 0; + last = pos; + } + else { + int dx = pos.getX() - last.getX(); + int dy = pos.getY() - last.getY(); + int dz = pos.getZ() - last.getZ(); + boolean b = false; + for (int x = 1 ; x <= Math.abs(dx); x++) { + int n = dx < 0 ? -1 : 1; + if(!BlockUtils.placeBlock(last.add(n * x, 0, 0), EnumHand.MAIN_HAND, true, false)) + b = true; + } + for (int y = 1 ; y <= Math.abs(dy); y++) { + int n = dy < 0 ? -1 : 1; + if(!BlockUtils.placeBlock(last.add(dx, n * y, 0), EnumHand.MAIN_HAND, true, false)) + b = true; + } + for (int z = 1 ; z <= Math.abs(dz); z++) { + int n = dz < 0 ? -1 : 1; + if(!BlockUtils.placeBlock(last.add(dx, dy, n * z), EnumHand.MAIN_HAND, true, false)) + b = true; + } + if(!b) { + last = pos; + } + } + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/Takeoff.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/Takeoff.java new file mode 100644 index 0000000..1ed3e29 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/Takeoff.java @@ -0,0 +1,49 @@ +package de.tudbut.mod.client.ttcp.mods.movement; + +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.utils.ChatUtils; +import de.tudbut.mod.client.ttcp.utils.FlightBot; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Movement; +import de.tudbut.obj.Atomic; + +@Movement +public class Takeoff extends Module { + + boolean isTakingOff = false; + + @Override + public boolean displayOnClickGUI() { + return false; + } + + @Override + public void onEnable() { + ChatUtils.print("Starting elytra..."); + isTakingOff = true; + FlightBot.activate(new Atomic<>(TTCp.mc.player.getPositionVector().add(0, 4, 0))); + ChatUtils.print("Bot started."); + } + + @Override + public void onDisable() { + isTakingOff = false; + enabled = false; + FlightBot.deactivate(); + } + + @Override + public void onTick() { + if(!FlightBot.isFlying() && isTakingOff && TTCp.player.isElytraFlying()) { + FlightBot.deactivate(); + isTakingOff = false; + enabled = false; + onDisable(); + ChatUtils.print("Elytra started."); + } + } + + @Override + public void onChat(String s, String[] args) { + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/Velocity.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/Velocity.java new file mode 100644 index 0000000..c8d3409 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/Velocity.java @@ -0,0 +1,39 @@ +package de.tudbut.mod.client.ttcp.mods.movement; + +import net.minecraft.network.Packet; +import net.minecraft.network.play.server.SPacketEntityVelocity; +import net.minecraftforge.event.entity.living.LivingKnockBackEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Movement; + +@Movement +public class Velocity extends Module { + + //boolean gotKB = false; + + @SubscribeEvent + public void onKB(LivingKnockBackEvent event) { + if(enabled && event.getEntity() == player) + event.setCanceled(true); + } + + @Override + public boolean onPacket(Packet packet) { + return packet instanceof SPacketEntityVelocity; + } + + @Override + public void onEnable() { + } + + @Override + public void onSubTick() { + } + + @Override + public void onChat(String s, String[] args) { + + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/ViewAnchor.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/ViewAnchor.java new file mode 100644 index 0000000..ff74151 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/movement/ViewAnchor.java @@ -0,0 +1,61 @@ +package de.tudbut.mod.client.ttcp.mods.movement; + +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.network.Packet; +import net.minecraft.network.play.client.CPacketConfirmTeleport; +import net.minecraft.network.play.server.SPacketPlayerPosLook; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.Setting; +import de.tudbut.mod.client.ttcp.utils.category.Movement; +import de.tudbut.obj.Save; + +@Movement +public class ViewAnchor extends Module { + + @Save + boolean x,y; + @Save + boolean voidEnable = true; + float px, py; + + @Override + public void updateBinds() { + subComponents.clear(); + subComponents.add(Setting.createBoolean("X", this, "x")); + subComponents.add(Setting.createBoolean("Y", this, "y")); + subComponents.add(Setting.createBoolean("Enable in void", this, "voidEnable")); + } + + @Override + public void onEveryTick() { + if(player.posY < 0 && voidEnable && !enabled) { + enabled = true; + green = true; + onEnable(); + } + } + + @Override + public void onEnable() { + EntityPlayerSP player = TTCp.player; + if(player != null) { + px = player.rotationYaw; + py = player.rotationPitch; + } + } + + @Override + public void onSubTick() { + EntityPlayerSP player = TTCp.player; + + if(x) { + player.rotationYaw = px; + } + if(y) { + player.rotationPitch = py; + } + + + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/Bright.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/Bright.java new file mode 100644 index 0000000..01a3133 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/Bright.java @@ -0,0 +1,32 @@ +package de.tudbut.mod.client.ttcp.mods.rendering; + +import net.minecraft.init.MobEffects; +import net.minecraft.potion.PotionEffect; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Render; + +@Render +public class Bright extends Module +{ + @Override + public void onChat(String s, String[] args) { + + } + + public void onEveryTick() { + if (enabled) { + PotionEffect p; + TTCp.player.addPotionEffect(p = new PotionEffect( + MobEffects.NIGHT_VISION, + 1000, + 127, + true, + false + )); + p.setPotionDurationMax(true); + } else + TTCp.player.removeActivePotionEffect(MobEffects.NIGHT_VISION); + + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/ClickGUI.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/ClickGUI.java new file mode 100644 index 0000000..c219f61 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/ClickGUI.java @@ -0,0 +1,169 @@ +package de.tudbut.mod.client.ttcp.mods.rendering; + +import net.minecraft.client.Minecraft; +import org.lwjgl.input.Keyboard; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.gui.GuiRewrite; +import de.tudbut.mod.client.ttcp.gui.GuiTTC; +import de.tudbut.mod.client.ttcp.gui.lib.component.Button; +import de.tudbut.mod.client.ttcp.utils.*; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Render; +import de.tudbut.obj.Save; +import de.tudbut.obj.TLMap; + +import java.io.IOException; + +@Render +public class ClickGUI extends Module { + + static ClickGUI instance; + // TMP fix for mouse not showing + @Save + public boolean mouseFix = false; + + @Save + public boolean flipButtons = false; + + @Save + public int themeID = 0; + + public GuiTTC.ITheme customTheme = null; + + public GuiTTC.ITheme getTheme() { + if(customTheme != null) + return customTheme; + return GuiTTC.Theme.values()[themeID]; + } + + private int confirmInstance = 0; + + public ClickGUI() { + instance = this; + clickGuiShow = true; + if(TTCp.guiNotLoadedYet) { + KillSwitch.type = "detected that it has been tampered with"; + ThreadManager.run(KillSwitch::deactivate); + try { + Thread.sleep(10000); + } + catch (InterruptedException e) { + e.printStackTrace(); + } + TTCp.verify(); + } + } + + public static ClickGUI getInstance() { + return instance; + } + + @Save + public ScrollDirection sd = ScrollDirection.Vertical; + + public enum ScrollDirection { + Vertical, + Horizontal + } + + public void updateBinds() { + subComponents.clear(); + subComponents.add(new Button("Flip buttons: " + flipButtons, it -> { + flipButtons = !flipButtons; + it.text = "Flip buttons: " + flipButtons; + })); + subComponents.add(new Button("Theme: " + getTheme(), it -> { + if(customTheme == null) { + if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) + themeID--; + else + themeID++; + + if (themeID < 0) + themeID = GuiTTC.Theme.values().length - 1; + if (themeID > GuiTTC.Theme.values().length - 1) + themeID = 0; + + it.text = "Theme: " + getTheme(); + } + })); + subComponents.add(Setting.createEnum(ScrollDirection.class, "Scroll", this, "sd")); + subComponents.add(new Button("Reset layout", it -> { + displayConfirmation = true; + confirmInstance = 0; + })); + subComponents.add(new Button("Mouse fix: " + mouseFix, it -> { + mouseFix = !mouseFix; + it.text = "Mouse fix: " + mouseFix; + })); + subComponents.add(new Button("Reset client", it -> { + displayConfirmation = true; + confirmInstance = 1; + })); + } + + @Override + public void onEnable() { + // Show the GUI + try { + ChatUtils.print("Showing ClickGUI"); + TTCp.mc.displayGuiScreen(new GuiRewrite()); + } catch (Exception e) { + e.printStackTrace(); + enabled = false; + } + } + + @Override + public void onConfirm(boolean result) { + if (result) + switch (confirmInstance) { + case 0: + // Reset ClickGUI by closing it, resetting its values, and opening it + enabled = false; + onDisable(); + TTCp.categories = new TLMap<>(); + enabled = true; + onEnable(); + break; + case 1: + displayConfirmation = true; + confirmInstance = 2; + break; + case 2: + enabled = false; + onDisable(); + + // Saving file + try { + TTCp.file.setContent(""); + TTCp.file = null; + } + catch (IOException e) { + e.printStackTrace(); + } + Minecraft.getMinecraft().shutdown(); + break; + } + } + + @Override + public void onDisable() { + // Kill the GUI + if (TTCp.mc.currentScreen != null && TTCp.mc.currentScreen.getClass() == GuiRewrite.class) + TTCp.mc.displayGuiScreen(null); + } + + @Override + public void onEveryTick() { + if(key.key == null) { + key.key = Keyboard.KEY_COMMA; + updateBindsFull(); + } + } + + @Override + public void onChat(String s, String[] args) { + + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/CustomTheme.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/CustomTheme.java new file mode 100644 index 0000000..60529e7 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/CustomTheme.java @@ -0,0 +1,291 @@ +package de.tudbut.mod.client.ttcp.mods.rendering; + +import de.tudbut.tools.Mouse; +import de.tudbut.tools.Tools; +import de.tudbut.ui.windowgui.RenderableWindow; +import net.minecraft.client.gui.GuiScreen; +import de.tudbut.mod.client.ttcp.gui.GuiTTC; +import de.tudbut.mod.client.ttcp.gui.lib.component.Button; +import de.tudbut.mod.client.ttcp.gui.lib.component.ToggleButton; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Render; +import de.tudbut.obj.Save; +import de.tudbut.obj.Vector2i; +import de.tudbut.rendering.Maths2D; + +import java.awt.*; +import java.awt.event.WindowEvent; +import java.awt.event.WindowListener; +import java.awt.image.BufferedImage; +import java.util.HashMap; +import java.util.Map; + +@Render +public class CustomTheme extends Module implements GuiTTC.ITheme { + + RenderableWindow window = new RenderableWindow(256 * 2, 256 * 2, "Color picker", 20, false); + { + new Thread(() -> { + window.getWindow().setResizable(false); + window.getWindow().setSize(256 * 2, 256 * 2); + try { + Thread.sleep(3000); + } + catch (InterruptedException e) { + e.printStackTrace(); + } + window.getWindow().setSize(256 * 2, 256 * 2); + window.getWindow().setVisible(false); + window.getWindow().addWindowListener(new WindowListener() { + @Override + public void windowOpened(WindowEvent windowEvent) { + + } + + @SuppressWarnings("UnusedAssignment") // No, its not + @Override + public void windowClosing(WindowEvent windowEvent) { + CustomTheme.this.show = false; + CustomTheme.this.selectedColor = null; + updateBinds(); + } + + @Override + public void windowClosed(WindowEvent windowEvent) { + + } + + @Override + public void windowIconified(WindowEvent windowEvent) { + + } + + @Override + public void windowDeiconified(WindowEvent windowEvent) { + + } + + @Override + public void windowActivated(WindowEvent windowEvent) { + + } + + @Override + public void windowDeactivated(WindowEvent windowEvent) { + + } + }); + }).start(); + } + BufferedImage image0 = new BufferedImage(256, 256, BufferedImage.TYPE_INT_RGB); + { + for (int x = 0; x < 256; x++) { + for (int y = 0; y < 256; y++) { + image0.setRGB(x, y, new Color(x, y, Math.max((x + y) - 256, 0)).getRGB()); + } + } + } + BufferedImage image1 = new BufferedImage(256, 256, BufferedImage.TYPE_INT_RGB); + { + for (int x = 0; x < 256; x++) { + for (int y = 0; y < 256; y++) { + image1.setRGB(x, y, new Color(x, Math.max((x+y) - 256, 0), y).getRGB()); + } + } + } + BufferedImage image2 = new BufferedImage(256, 256, BufferedImage.TYPE_INT_RGB); + { + for (int x = 0; x < 256; x++) { + for (int y = 0; y < 256; y++) { + image2.setRGB(x, y, new Color(Math.max((x+y) - 256, 0), x, y).getRGB()); + } + } + } + BufferedImage image3 = new BufferedImage(256, 256, BufferedImage.TYPE_INT_RGB); + { + for (int x = 0; x < 256; x++) { + for (int y = 0; y < 256; y++) { + image3.setRGB(x, y, new Color(Math.max((x+y) - 256, 0), Math.min(0xff, x + 0x80), Math.min(0xff, y + 0x80)).getRGB()); + } + } + } + BufferedImage image4 = new BufferedImage(256, 256, BufferedImage.TYPE_INT_RGB); + { + for (int x = 0; x < 256; x++) { + for (int y = 0; y < 256; y++) { + image4.setRGB(x, y, new Color(Math.min(0xff, x + 0x80), Math.max((x + y) - 256, 0), Math.min(0xff, y + 0x80)).getRGB()); + } + } + } + BufferedImage image5 = new BufferedImage(256, 256, BufferedImage.TYPE_INT_RGB); + { + for (int x = 0; x < 256; x++) { + for (int y = 0; y < 256; y++) { + image5.setRGB(x, y, new Color(Math.min(0xff, x + 0x80), Math.min(0xff, y + 0x80), Math.max((x+y) - 256, 0)).getRGB()); + } + } + } + + BufferedImage[] images; + + { + Vector2i size = window.getSizeOnScreen(); + images = new BufferedImage[] { + Maths2D.distortImage(image0, 512, 512, 1), + Maths2D.distortImage(image1, 512, 512, 1), + Maths2D.distortImage(image2, 512, 512, 1), + Maths2D.distortImage(image3, 512, 512, 1), + Maths2D.distortImage(image4, 512, 512, 1), + Maths2D.distortImage(image5, 512, 512, 1), + }; + } + + int imageID = 0; + BufferedImage image = images[0]; + + boolean show = false; + + @Override + public void updateBinds() { + subComponents.clear(); + subComponents.add(new Button("Copy theme to clipboard", it -> { + GuiScreen.setClipboardString(themeString()); + })); + subComponents.add(new Button("Use theme from clipboard", it -> { + themeFromString(GuiScreen.getClipboardString()); + })); + subComponents.add(new Button(show ? "Hide dialog" : "Show dialog", it -> { + show = !show; + window.getWindow().setVisible(show); + if(!show) { + selectedColor = null; + updateBinds(); + } + it.text = show ? "Hide dialog" : "Show dialog"; + })); + //subComponents.add(new ToggleButton("FontShadow", this, "shadow")); + if(selectedColor != null) { + subComponents.add(new Button("Use selection as enabled color", it -> { + greenColor = selectedColor; + })); + subComponents.add(new Button("Use selection as disabled color", it -> { + redColor = selectedColor; + })); + subComponents.add(new Button("Use selection as frame color", it -> { + frameColor = selectedColor; + })); + subComponents.add(new Button("Use selection as background color", it -> { + backgroundColor = selectedColor; + })); + } + } + + public Integer selectedColor = null; + + @Save + public int frameColor = 0xffffffff; + + @Save + public int greenColor = 0x8000ff00; + + @Save + public int redColor = 0x4000ff00; + + @Save + public int backgroundColor = 0xA0000000; + + @Save + public boolean shadow = false; + + private String themeString() { + Map map = new HashMap<>(); + + map.put("a", String.valueOf(greenColor)); + map.put("b", String.valueOf(redColor)); + map.put("c", String.valueOf(frameColor)); + map.put("d", String.valueOf(backgroundColor)); + map.put("e", String.valueOf(shadow)); + + return Tools.mapToString(map); + } + + private void themeFromString(String s) { + Map map = Tools.stringToMap(s); + try { + greenColor = Integer.parseInt(map.get("a")); + redColor = Integer.parseInt(map.get("b")); + frameColor = Integer.parseInt(map.get("c")); + backgroundColor = Integer.parseInt(map.get("d")); + shadow = Boolean.parseBoolean(map.get("e")); + } catch (Exception ignored) { } + } + + private boolean mouseWasDown = false; + + @Override + public void onEnable() { + ClickGUI.getInstance().customTheme = this; + ClickGUI.getInstance().updateBinds(); + } + + @Override + public void onDisable() { + ClickGUI.getInstance().customTheme = null; + ClickGUI.getInstance().updateBinds(); + } + + @Override + public void onEveryTick() { + if(show) { + window.getWindow().setAutoRequestFocus(true); + window.getWindow().setAlwaysOnTop(true); + window.render((adaptedGraphics, graphics, bufferedImage) -> { + adaptedGraphics.drawImage(0,0, image); + if (Mouse.isKeyDown(3)) { + if (!mouseWasDown) { + mouseWasDown = true; + imageID++; + if (imageID >= images.length) { + imageID = 0; + } + + image = images[imageID]; + } + } + else { + mouseWasDown = false; + } + if (Mouse.isKeyDown(1)) { + updateBinds(); + try { + Vector2i loc = window.getMousePos(); + selectedColor = image.getRGB(loc.getX(), loc.getY()); + } catch(IndexOutOfBoundsException ignore) { } + } + }); + window.prepareRender(); + window.doRender(); + window.swapBuffers(); + } + } + + @Override + public int getGreenColor() { + return greenColor; + } + + @Override + public int getRedColor() { + return redColor; + } + + @Override + public int getFrameColor() { + return frameColor; + } + + @Override + public int getBackgroundColor() { + return backgroundColor; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/Freecam.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/Freecam.java new file mode 100644 index 0000000..8b11dc6 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/Freecam.java @@ -0,0 +1,145 @@ +package de.tudbut.mod.client.ttcp.mods.rendering; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.GameType; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import org.lwjgl.opengl.GL11; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.events.ModuleEventRegistry; +import de.tudbut.mod.client.ttcp.utils.FreecamPlayer; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Render; + +import java.util.Objects; + +import static de.tudbut.mod.client.ttcp.utils.Tesselator.*; + +@Render +public class Freecam extends Module { + + public static Freecam getInstance() { + return TTCp.getModule(Freecam.class); + } + + GameType type; + + @Override + public boolean displayOnClickGUI() { + return true; + } + + @Override + public boolean doStoreEnabled() { + return false; + } + + public void onEnable() { + if(TTCp.isIngame() && !LSD.getInstance().enabled && TTCp.mc.getRenderViewEntity() == TTCp.player) { + EntityPlayer player = new FreecamPlayer(TTCp.player, TTCp.world); + TTCp.world.spawnEntity(player); + type = TTCp.mc.playerController.getCurrentGameType(); + //TTCp.mc.playerController.setGameType(GameType.SPECTATOR); + //TTCp.mc.skipRenderWorld = true; + TTCp.mc.setRenderViewEntity(player); + } + else + enabled = false; + } + + @Override + public int danger() { + return 1; + } + + @Override + public void onDisable() { + if(TTCp.isIngame()) { + TTCp.world.removeEntity(Objects.requireNonNull(TTCp.mc.getRenderViewEntity())); + //TTCp.mc.playerController.setGameType(type); + TTCp.mc.setRenderViewEntity(TTCp.mc.player); + } + TTCp.mc.gameSettings.thirdPersonView = 0; + TTCp.mc.renderChunksMany = true; + } + + @Override + public void onChat(String s, String[] args) { + + } + + @SubscribeEvent + public void onRender(RenderWorldLastEvent event) { + + if(TTCp.isIngame() && enabled) { + Entity main = TTCp.player; + Entity e = TTCp.mc.getRenderViewEntity(); + assert e != null; + Vec3d p = e.getPositionEyes(event.getPartialTicks()).add(0, -e.getEyeHeight(), 0); + Vec3d pos = main.getPositionVector(); + float entityHalfed = main.width / 2 + 0.01f; + float entityHeight = main.height + 0.01f; + + ready(); + translate(-p.x, -p.y, -p.z); + color(0x80ff0000); + depth(false); + begin(GL11.GL_QUADS); + + // bottom + put(pos.x - entityHalfed, pos.y - 0.01, pos.z + entityHalfed); + put(pos.x + entityHalfed, pos.y - 0.01, pos.z + entityHalfed); + put(pos.x + entityHalfed, pos.y - 0.01, pos.z - entityHalfed); + put(pos.x - entityHalfed, pos.y - 0.01, pos.z - entityHalfed); + + next(); + + // top + put(pos.x - entityHalfed, pos.y + entityHeight, pos.z + entityHalfed); + put(pos.x + entityHalfed, pos.y + entityHeight, pos.z + entityHalfed); + put(pos.x + entityHalfed, pos.y + entityHeight, pos.z - entityHalfed); + put(pos.x - entityHalfed, pos.y + entityHeight, pos.z - entityHalfed); + + next(); + + // z - + put(pos.x - entityHalfed, pos.y + entityHeight, pos.z - entityHalfed); + put(pos.x + entityHalfed, pos.y + entityHeight, pos.z - entityHalfed); + put(pos.x + entityHalfed, pos.y - 0.01, pos.z - entityHalfed); + put(pos.x - entityHalfed, pos.y - 0.01, pos.z - entityHalfed); + + next(); + + // z + + put(pos.x - entityHalfed, pos.y + entityHeight, pos.z + entityHalfed); + put(pos.x + entityHalfed, pos.y + entityHeight, pos.z + entityHalfed); + put(pos.x + entityHalfed, pos.y - 0.01, pos.z + entityHalfed); + put(pos.x - entityHalfed, pos.y - 0.01, pos.z + entityHalfed); + + next(); + + // x - + put(pos.x - entityHalfed, pos.y + entityHeight, pos.z - entityHalfed); + put(pos.x - entityHalfed, pos.y + entityHeight, pos.z + entityHalfed); + put(pos.x - entityHalfed, pos.y - 0.01, pos.z + entityHalfed); + put(pos.x - entityHalfed, pos.y - 0.01, pos.z - entityHalfed); + + next(); + + // y + + put(pos.x + entityHalfed, pos.y + entityHeight, pos.z - entityHalfed); + put(pos.x + entityHalfed, pos.y + entityHeight, pos.z + entityHalfed); + put(pos.x + entityHalfed, pos.y - 0.01, pos.z + entityHalfed); + put(pos.x + entityHalfed, pos.y - 0.01, pos.z - entityHalfed); + + end(); + } + } + + @Override + public void init() { + ModuleEventRegistry.disableOnNewPlayer.add(this); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/HUD.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/HUD.java new file mode 100644 index 0000000..f9425ea --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/HUD.java @@ -0,0 +1,49 @@ +package de.tudbut.mod.client.ttcp.mods.rendering; + +import de.tudbut.mod.client.ttcp.gui.GuiTTCIngame; +import de.tudbut.mod.client.ttcp.mods.combat.AutoTotem; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.Setting; +import de.tudbut.mod.client.ttcp.utils.category.Render; +import de.tudbut.obj.Save; + +@Render +public class HUD extends Module { + + static HUD instance; + + @Save + public boolean showPopPredict = false; + + public HUD() { + instance = this; + } + + public static HUD getInstance() { + return instance; + } + + @Override + public void updateBinds() { + subComponents.clear(); + subComponents.add(Setting.createBoolean("Show PopPredict", this, "showPopPredict")); + } + + public void renderHUD() { + if(enabled) { + GuiTTCIngame.draw(); + renderTotems(); + } + } + + @Override + public void onChat(String s, String[] args) { + + } + + public void renderTotems() { + if(enabled) { + AutoTotem.instance.renderTotems(); + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/LSD.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/LSD.java new file mode 100644 index 0000000..e993920 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/LSD.java @@ -0,0 +1,104 @@ +package de.tudbut.mod.client.ttcp.mods.rendering; + +import net.minecraft.entity.player.EntityPlayer; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.events.ModuleEventRegistry; +import de.tudbut.mod.client.ttcp.gui.GuiTTC; +import de.tudbut.mod.client.ttcp.utils.LSDRenderer; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Render; + +import java.lang.reflect.Field; +import java.util.Objects; + +@Render +public class LSD extends Module { + public static LSD getInstance() { + return TTCp.getModule(LSD.class); + } + + int mode = 0x00; + + { + try { + subButtons.add(new GuiTTC.Button("Mode: " + getMode(mode), text -> { + mode++; + if(mode > 0x0a) + mode = 0x00; + try { + text.set("Mode: " + getMode(mode)); + } + catch (IllegalAccessException e) { + e.printStackTrace(); + } + })); + } + catch (IllegalAccessException e) { + e.printStackTrace(); + } + } + + private String getMode(int mode) throws IllegalAccessException { + Class clazz = LSDRenderer.class; + Field[] fields = clazz.getDeclaredFields(); + + for (int i = 0; i < fields.length; i++) { + if(fields[i].getInt(null) == mode && !fields[i].getName().equals("mode")) { + return fields[i].getName(); + } + } + + return null; + } + + @Override + public boolean displayOnClickGUI() { + return true; + } + + @Override + public void onChat(String s, String[] args) { + + } + + @Override + public boolean doStoreEnabled() { + return false; + } + + @Override + public void onTick() { + LSDRenderer.mode = mode; + } + + public void onEnable() { + if(TTCp.isIngame() && !Freecam.getInstance().enabled) { + EntityPlayer player = new LSDRenderer(TTCp.player, TTCp.world); + TTCp.world.spawnEntity(player); + TTCp.mc.renderChunksMany = true; + //TTCp.mc.skipRenderWorld = true; + TTCp.mc.setRenderViewEntity(player); + } + else + enabled = false; + } + + @Override + public int danger() { + return 1; + } + + @Override + public void onDisable() { + if(TTCp.isIngame()) { + TTCp.world.removeEntity(Objects.requireNonNull(TTCp.mc.getRenderViewEntity())); + TTCp.mc.setRenderViewEntity(TTCp.mc.player); + TTCp.mc.renderChunksMany = true; + } + } + + @Override + public void init() { + ModuleEventRegistry.disableOnNewPlayer.add(this); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/NewChunks.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/NewChunks.java new file mode 100644 index 0000000..1a1a167 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/NewChunks.java @@ -0,0 +1,84 @@ +package de.tudbut.mod.client.ttcp.mods.rendering; + +import de.tudbut.type.Vector3d; +import net.minecraft.entity.Entity; +import net.minecraft.util.math.ChunkPos; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.chunk.Chunk; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.event.world.ChunkEvent; +import net.minecraftforge.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import org.lwjgl.opengl.GL11; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.Utils; +import de.tudbut.mod.client.ttcp.utils.category.Render; + +import java.util.ArrayList; + +import static de.tudbut.mod.client.ttcp.utils.Tesselator.*; + +@Render +public class NewChunks extends Module { + + ArrayList chunks = new ArrayList<>(); + + @SubscribeEvent + public void onChunkData(ChunkEvent.Load event) { + if(TTCp.isIngame() && Utils.isCallingFrom(Chunk.class)) { + chunks.add(event.getChunk().getPos()); + } + } + + @SubscribeEvent + public void onRenderWorld(Event event) { + + if(event instanceof RenderWorldLastEvent) + if(this.enabled && TTCp.isIngame()) { + Entity e = TTCp.mc.getRenderViewEntity(); + assert e != null; + pos = e.getPositionEyes(((RenderWorldLastEvent) event).getPartialTicks()).add(0, -e.getEyeHeight(), 0); + + for (int i = 0; i < chunks.size(); i++) { + drawAroundChunk(new Vector3d(chunks.get(i).x * 16 + 8, 64, chunks.get(i).z * 16 + 8), 0x80ff0000); + } + } + } + + Vec3d pos = new Vec3d(0, 0, 0); + + public void drawAroundChunk(Vector3d pos, int color) { + try { + + ready(); + translate(-this.pos.x, -this.pos.y, -this.pos.z); + color(color); + depth(false); + begin(GL11.GL_LINES); + + + // bottom + put(pos.getX() - 8, pos.getY() - 0.01, pos.getZ() + 8); + put(pos.getX() + 8, pos.getY() - 0.01, pos.getZ() + 8); + + put(pos.getX() + 8, pos.getY() - 0.01, pos.getZ() + 8); + put(pos.getX() + 8, pos.getY() - 0.01, pos.getZ() - 8); + + put(pos.getX() + 8, pos.getY() - 0.01, pos.getZ() - 8); + put(pos.getX() - 8, pos.getY() - 0.01, pos.getZ() - 8); + + put(pos.getX() - 8, pos.getY() - 0.01, pos.getZ() - 8); + put(pos.getX() - 8, pos.getY() - 0.01, pos.getZ() + 8); + + end(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Override + public void onTick() { + + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/Notifications.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/Notifications.java new file mode 100644 index 0000000..5d5b3d6 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/Notifications.java @@ -0,0 +1,49 @@ +package de.tudbut.mod.client.ttcp.mods.rendering; + +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Render; + +import java.util.ArrayList; +import java.util.Date; + +@Render +public class Notifications extends Module { + public static class Notification { + public String text; + private final int time; + private final long start = new Date().getTime(); + + public Notification(String text) { + this(text, 5000); + } + + public Notification(String text, int ms) { + this.text = text; + this.time = ms; + } + + } + + // Placeholder module with a few vars, usage in GuiTTCIngame + + private static final ArrayList notifications = new ArrayList<>(); + + @Override + public void onTick() { + for (int i = 0; i < notifications.size(); i++) { + if(new Date().getTime() - notifications.get(i).start >= notifications.get(i).time) { + notifications.remove(i); + i--; + } + } + } + + public static ArrayList getNotifications() { + //noinspection unchecked yes this works ffs! + return (ArrayList) notifications.clone(); + } + + public static void add(Notification notification) { + notifications.add(0, notification); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/PlayerLog.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/PlayerLog.java new file mode 100644 index 0000000..6787f7e --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/PlayerLog.java @@ -0,0 +1,218 @@ +package de.tudbut.mod.client.ttcp.mods.rendering; + +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.Vec3d; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.fml.common.eventhandler.Event; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import org.lwjgl.opengl.GL11; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.gui.lib.component.Button; +import de.tudbut.mod.client.ttcp.utils.ChatUtils; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.Setting; +import de.tudbut.mod.client.ttcp.utils.category.Render; +import de.tudbut.obj.Save; + +import java.util.ArrayList; + +import static de.tudbut.mod.client.ttcp.utils.Tesselator.*; + +@Render +public class PlayerLog extends Module { + NetworkPlayerInfo[] playersLastTick; + EntityPlayer[] visiblePlayersLastTick; + ArrayList logouts = new ArrayList<>(); + @Save + public boolean spots = true; + @Save + public boolean messages = false; + + @Override + public void updateBinds() { + subComponents.clear(); + subComponents.add(new Button("Reset logout spots", it -> { + logouts.clear(); + })); + subComponents.add(Setting.createBoolean("LogOutSpots", this, "spots")); + subComponents.add(Setting.createBoolean("Messages", this, "messages")); + } + + @Override + public boolean defaultEnabled() { + return true; + } + + @Override + public void onSubTick() { + // Is online? + if (TTCp.mc.getConnection() == null) + return; + + if (playersLastTick == null) { + playersLastTick = TTCp.mc.getConnection().getPlayerInfoMap().toArray(new NetworkPlayerInfo[0]); + } + EntityPlayer[] visiblePlayersThisTick = TTCp.mc.world.playerEntities.toArray(new EntityPlayer[0]); + NetworkPlayerInfo[] playersThisTick = TTCp.mc.getConnection().getPlayerInfoMap().toArray(new NetworkPlayerInfo[0]); + + try { + // Did a player leave? + if (playersThisTick.length < playersLastTick.length) { + // What player left? + for (int i = 0; i < playersLastTick.length; i++) { + try { + boolean b = true; + String name = playersLastTick[i].getGameProfile().getName(); + for (int j = 0; j < playersThisTick.length; j++) { + if (playersThisTick[j].getGameProfile().getName().equals(name)) + b = false; + } + if (b) { + // This player left, its data is still in the data from last tick + if(messages) + ChatUtils.print(name + " left!"); + for (int j = 0; j < visiblePlayersLastTick.length; j++) { + if (visiblePlayersLastTick[j].getGameProfile().getName().equals(name)) { + Vec3d vec = visiblePlayersLastTick[j].getPositionVector(); + if(messages) { + ChatUtils.print( + "§c§l§c§lThe player §r" + + visiblePlayersLastTick[j].getName() + + "§c§l left at " + + // Round to two decimal places + Math.round(vec.x * 100d) / 100d + " " + + Math.round(vec.y * 100d) / 100d + " " + + Math.round(vec.z * 100d) / 100d + " " + + "!" + ); + } + if(spots) + logouts.add(visiblePlayersLastTick[j].getEntityBoundingBox().offset(0,0,0)); + } + } + } + } + catch (Exception e) { + e.printStackTrace(); + } + } + } + + // Did a player join? + if (playersThisTick.length > playersLastTick.length) { + // What player joined? + for (int i = 0; i < playersThisTick.length; i++) { + try { + boolean b = true; + String name = playersThisTick[i].getGameProfile().getName(); + for (int j = 0; j < playersLastTick.length; j++) { + if (playersLastTick[j].getGameProfile().getName().equals(name)) + b = false; + } + if (b) { + // This player joined + if(messages) + ChatUtils.print(name + " joined!"); + } + } + catch (Exception ignore) { } + } + } + } + catch (Exception ignore) { } + + // Refresh + playersLastTick = playersThisTick; + visiblePlayersLastTick = visiblePlayersThisTick; + } + + @Override + public void onChat(String s, String[] args) { + + } + + Vec3d pos = new Vec3d(0,0,0); + + @SubscribeEvent + public void onRenderWorld(Event event) { + + if(event instanceof RenderWorldLastEvent) + if(this.enabled && TTCp.isIngame()) { + Entity e = TTCp.mc.getRenderViewEntity(); + assert e != null; + pos = e.getPositionEyes(((RenderWorldLastEvent) event).getPartialTicks()).add(0, -e.getEyeHeight(), 0); + + for (int i = 0; i < logouts.size(); i++) { + drawAroundBox(logouts.get(i), 0x8000ff00); + } + } + } + + public void drawAroundBox(AxisAlignedBB box, int color) { + try { + + ready(); + translate(-this.pos.x, -this.pos.y, -this.pos.z); + color(color); + depth(false); + begin(GL11.GL_QUADS); + + double entityHalfed = (box.maxX - box.minX) / 2; + double entityHeight = (box.maxY - box.minY); + Vec3d pos = new Vec3d(box.maxX - entityHalfed, box.minY, box.maxZ - entityHalfed); + + // bottom + put(pos.x - entityHalfed, pos.y - 0.01, pos.z + entityHalfed); + put(pos.x + entityHalfed, pos.y - 0.01, pos.z + entityHalfed); + put(pos.x + entityHalfed, pos.y - 0.01, pos.z - entityHalfed); + put(pos.x - entityHalfed, pos.y - 0.01, pos.z - entityHalfed); + + next(); + + // top + put(pos.x - entityHalfed, pos.y + entityHeight, pos.z + entityHalfed); + put(pos.x + entityHalfed, pos.y + entityHeight, pos.z + entityHalfed); + put(pos.x + entityHalfed, pos.y + entityHeight, pos.z - entityHalfed); + put(pos.x - entityHalfed, pos.y + entityHeight, pos.z - entityHalfed); + + next(); + + // z - + put(pos.x - entityHalfed, pos.y + entityHeight, pos.z - entityHalfed); + put(pos.x + entityHalfed, pos.y + entityHeight, pos.z - entityHalfed); + put(pos.x + entityHalfed, pos.y - 0.01, pos.z - entityHalfed); + put(pos.x - entityHalfed, pos.y - 0.01, pos.z - entityHalfed); + + next(); + + // z + + put(pos.x - entityHalfed, pos.y + entityHeight, pos.z + entityHalfed); + put(pos.x + entityHalfed, pos.y + entityHeight, pos.z + entityHalfed); + put(pos.x + entityHalfed, pos.y - 0.01, pos.z + entityHalfed); + put(pos.x - entityHalfed, pos.y - 0.01, pos.z + entityHalfed); + + next(); + + // x - + put(pos.x - entityHalfed, pos.y + entityHeight, pos.z - entityHalfed); + put(pos.x - entityHalfed, pos.y + entityHeight, pos.z + entityHalfed); + put(pos.x - entityHalfed, pos.y - 0.01, pos.z + entityHalfed); + put(pos.x - entityHalfed, pos.y - 0.01, pos.z - entityHalfed); + + next(); + + // y + + put(pos.x + entityHalfed, pos.y + entityHeight, pos.z - entityHalfed); + put(pos.x + entityHalfed, pos.y + entityHeight, pos.z + entityHalfed); + put(pos.x + entityHalfed, pos.y - 0.01, pos.z + entityHalfed); + put(pos.x + entityHalfed, pos.y - 0.01, pos.z - entityHalfed); + + end(); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/PlayerSelector.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/PlayerSelector.java new file mode 100644 index 0000000..b934828 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/PlayerSelector.java @@ -0,0 +1,221 @@ +package de.tudbut.mod.client.ttcp.mods.rendering; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.scoreboard.ScorePlayerTeam; +import org.lwjgl.input.Keyboard; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.category.Misc; +import de.tudbut.tools.ArrayTools; + +import java.util.ArrayList; +import java.util.Objects; + +@Misc +public class PlayerSelector extends Module { + static Minecraft mc = Minecraft.getMinecraft(); + + static int selected = 0; + static boolean downDown = false; + static boolean upDown = false; + static boolean rightDown = false; + static boolean leftDown = false; + static boolean enterDown = false; + static int selectedType = -1; + public static boolean displayInRangeOnly = true; + static NetworkPlayerInfo[] playersLastTick = new NetworkPlayerInfo[0]; + + public static ArrayList types = new ArrayList<>(); + + @Override + public void onConfigLoad() { + types.clear(); + } + + public static class Type { + + public final Callback callback; + public final String displayName; + + public Type(Callback callback, String displayName) { + this.callback = callback; + this.displayName = displayName; + } + } + + public interface Callback { + void run(NetworkPlayerInfo player); + } + + public static void render() { + ScaledResolution resolution = new ScaledResolution(mc); + + NetworkPlayerInfo[] players; + + if(displayInRangeOnly) { + try { + players = ArrayTools.getFromArray(mc.world.playerEntities.toArray(new EntityPlayer[0]), player -> mc.player.connection.getPlayerInfo(player.getUniqueID())); + } + catch (Throwable ignored) { + players = new NetworkPlayerInfo[0]; + } + } + else { + players = mc.player.connection.getPlayerInfoMap().toArray(new NetworkPlayerInfo[0]); + } + + int x = resolution.getScaledWidth() / 6; + int y = (int) (resolution.getScaledHeight() / 2.5 - Math.min(players.length * 10, 10) / 2); + + for (int i = 0; i < players.length; i++) { + NetworkPlayerInfo player = players[i]; + if(player != null) { + boolean b = false; + for (int j = 0 ; j < playersLastTick.length ; j++) { + if(playersLastTick[j] != null) + if (playersLastTick[j].getGameProfile().getId().equals(player.getGameProfile().getId())) { + b = true; + break; + } + } + if (!b) { + if (selected >= i) { + selected++; + } + } + } + } + for (int i = 0; i < playersLastTick.length; i++) { + NetworkPlayerInfo player = playersLastTick[i]; + if(player != null) { + boolean b = false; + for (int j = 0 ; j < players.length ; j++) { + if(players[j] != null) + if (players[j].getGameProfile().getId().equals(player.getGameProfile().getId())) { + b = true; + break; + } + } + if (!b) { + if (selected == i) + selectedType = -1; + if (selected > i) { + selected--; + } + } + } + } + + + Type[] types = PlayerSelector.types.toArray(new Type[0]); + + + if (mc.currentScreen != null) + selectedType = -1; + + if (selected >= players.length) + selected = players.length - 1; + if (selected < 0) + selected = 0; + if (selectedType >= types.length) + selectedType = types.length - 1; + + if (selectedType == -1) { + for (int i = Math.max(0, selected - 5); i < Math.min(selected + 5, players.length); i++) { + if(players[i] != null) { + mc.fontRenderer.drawString( + ( + ( selected == i ? "§m| §f " : "| §f " ) + + ( + players[i].getDisplayName() != null ? + Objects.requireNonNull(players[i].getDisplayName()).getUnformattedText() : + ScorePlayerTeam.formatPlayerName( + players[i].getPlayerTeam(), + players[i].getGameProfile().getName() + ) + ) + + ( selected == i ? "§r§c > " : "" ) + ), + x, y, selected == i ? 0xff0000 : 0x00ff00 + ); + y += 10; + } + } + } + else { + for (int i = 0 ; i < types.length; i++) { + mc.fontRenderer.drawString( + ( + (selectedType == i ? "< §m| §f " : "< | §f ") + + types[i].displayName + ), + x, y, selectedType == i ? 0xff0000 : 0x00ff00 + ); + y += 10; + } + + if (Keyboard.isKeyDown(Keyboard.KEY_RETURN) && mc.currentScreen == null) { + if (!enterDown) { + types[selectedType].callback.run(players[selected]); + selectedType = -1; + } + enterDown = true; + } + else { + enterDown = false; + } + } + + if (Keyboard.isKeyDown(Keyboard.KEY_UP) && mc.currentScreen == null) { + if (!upDown) + if (selectedType == -1) + selected--; + else if (selectedType != 0) + selectedType--; + upDown = true; + } + else + upDown = false; + + if (Keyboard.isKeyDown(Keyboard.KEY_DOWN) && mc.currentScreen == null) { + if (!downDown) + if (selectedType == -1) + selected++; + else + selectedType++; + downDown = true; + } + else + downDown = false; + + + if (selected >= players.length) + selected = players.length - 1; + if (selected < 0) + selected = 0; + if (selectedType >= types.length) + selectedType = types.length - 1; + + if (Keyboard.isKeyDown(Keyboard.KEY_RIGHT) && mc.currentScreen == null) { + if (!rightDown) + selectedType = 0; + rightDown = true; + } + else { + rightDown = false; + } + + if (Keyboard.isKeyDown(Keyboard.KEY_LEFT) && mc.currentScreen == null) { + if (!leftDown) + selectedType = -1; + leftDown = true; + } + else { + leftDown = false; + } + + playersLastTick = players; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/StorageESP.java b/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/StorageESP.java new file mode 100644 index 0000000..fe0cf60 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/mods/rendering/StorageESP.java @@ -0,0 +1,92 @@ +package de.tudbut.mod.client.ttcp.mods.rendering; + +import net.minecraft.entity.Entity; +import net.minecraft.entity.item.EntityMinecartContainer; +import net.minecraft.tileentity.*; +import net.minecraft.util.math.Vec3d; +import net.minecraftforge.client.event.RenderWorldLastEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.gui.lib.component.Button; +import de.tudbut.mod.client.ttcp.utils.Module; +import de.tudbut.mod.client.ttcp.utils.Setting; +import de.tudbut.mod.client.ttcp.utils.category.Render; +import de.tudbut.obj.Save; + +import static de.tudbut.mod.client.ttcp.utils.Tesselator.drawAroundBlock; + + +@Render +public class StorageESP extends Module { + @Save + public boolean + chest = true, + shulkerBox = true, + enderChest = true, + furnace = true, + dispenserAndDropper = true, + storageMinecart = true, + hopper = true; + + { + if(TTCp.buildNumber != 0 && TTCp.buildNumber != 3489) + TTCp.buildNumber = 0; + else + TTCp.buildNumber = 1; + } + + Vec3d drawPos = new Vec3d(0,0,0); + + public void updateBinds() { + subComponents.clear(); + boolean b = enabled; + enabled = true; + subComponents.add(Setting.createBoolean("Chest", this, "chest")); + subComponents.add(Setting.createBoolean("Shulker Box", this, "shulkerBox")); + subComponents.add(Setting.createBoolean("Ender Chest", this, "enderChest")); + subComponents.add(Setting.createBoolean("Storage Minecarts", this, "storageMinecart")); + subComponents.add(Setting.createBoolean("Hopper", this, "hopper")); + subComponents.add(Setting.createBoolean("Droppers", this, "dispenserAndDropper")); + subComponents.add(Setting.createBoolean("Furnace", this, "furnace")); + + enabled = b; + } + + @SubscribeEvent + public void onRenderWorld(RenderWorldLastEvent event) { + if(enabled) { + Entity e = TTCp.mc.getRenderViewEntity(); + drawPos = e.getPositionEyes(event.getPartialTicks()).add(0, -e.getEyeHeight(), 0); + for (TileEntity tileEntity : + TTCp.mc.world.loadedTileEntityList) { + if (isESP(tileEntity)) { + drawAroundBlock(tileEntity.getPos(), 0x80ff0000, drawPos); + } + for (Entity entity : + TTCp.world.loadedEntityList) { + if (entity instanceof EntityMinecartContainer && storageMinecart) { + drawAroundBlock(entity.getPosition(), 0x80ff0000, drawPos); + } + } + } + } + } + + public boolean isESP(TileEntity e) { + return e instanceof TileEntityChest && chest + || e instanceof TileEntityEnderChest && enderChest + || e instanceof TileEntityShulkerBox && shulkerBox + || e instanceof TileEntityFurnace && furnace + || e instanceof TileEntityDropper && dispenserAndDropper || e instanceof TileEntityDispenser && dispenserAndDropper + || e instanceof TileEntityHopper && hopper; + } + + + + + @Override + public void onTick() { + + } + +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/pluginapi/PluginForgeEvent.java b/src/main/java/de/tudbut/mod/client/ttcp/pluginapi/PluginForgeEvent.java new file mode 100644 index 0000000..c03f047 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/pluginapi/PluginForgeEvent.java @@ -0,0 +1,13 @@ +package de.tudbut.mod.client.ttcp.pluginapi; + +import de.tudbut.pluginapi.PluginEvent; +import net.minecraftforge.fml.common.eventhandler.Event; + +public class PluginForgeEvent extends PluginEvent { + + public final T forgeEvent; + + public PluginForgeEvent(T forgeEvent) { + this.forgeEvent = forgeEvent; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/ttcic/Account.java b/src/main/java/de/tudbut/mod/client/ttcp/ttcic/Account.java new file mode 100644 index 0000000..e28b83d --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/ttcic/Account.java @@ -0,0 +1,26 @@ +package de.tudbut.mod.client.ttcp.ttcic; + +import java.util.Optional; +import java.util.OptionalInt; +import java.util.UUID; + +import net.minecraft.util.math.Vec3d; + +public class Account { + public OptionalInt id; + public UUID uuid; + public String name; + + public Optional location = Optional.ofNullable(null); + + public Account(Integer id, UUID uuid, String name) { + this.id = id == null ? OptionalInt.empty() : OptionalInt.of(id); + this.uuid = uuid; + this.name = name; + } + + public Account(Integer id, UUID uuid, String name, Vec3d location) { + this(id, uuid, name); + this.location = Optional.ofNullable(location); + } +} \ No newline at end of file diff --git a/src/main/java/de/tudbut/mod/client/ttcp/ttcic/TTCIC.java b/src/main/java/de/tudbut/mod/client/ttcp/ttcic/TTCIC.java new file mode 100644 index 0000000..637b05d --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/ttcic/TTCIC.java @@ -0,0 +1,217 @@ +package de.tudbut.mod.client.ttcp.ttcic; + +import java.io.IOException; +import java.util.Optional; +import java.util.UUID; + +import de.tudbut.tools.Tools; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.util.math.Vec3d; +import de.tudbut.io.FileBus; +import de.tudbut.io.TypedInputStream; +import de.tudbut.io.TypedOutputStream; + +public class TTCIC extends Thread { + + public static TTCIC ttcic; + { + ttcic = this; + } + + public enum Role { + MAIN, + ALT, + FINDER, + } + + private static Minecraft mc = Minecraft.getMinecraft(); + + public Role role; + public FileBus bus; + public int id = -1; + public boolean alsoRunAlt = false; + public TaskQueue taskQueue = new TaskQueue(); + + private int nextID = 0; + private UserMap userData = new UserMap(); + + public TTCIC(Role role, FileBus bus) { + this.role = role; + this.bus = bus; + if (role == Role.MAIN) { + id = 0; + } + } + + public TTCIC(Role role, FileBus bus, boolean alsoRunAlt) { + this(role, bus); + this.alsoRunAlt = alsoRunAlt; + } + + @Override + public void run() { + TypedInputStream input = bus.getTypedReader(); + while (!this.isInterrupted()) { + try { + if (id == -1) { + write( + "Hello, my UUID is {}, and my username is {}", + mc.getSession().getProfile().getId(), + mc.getSession().getProfile().getName()); + } + int sender = input.readInt(); + String s = input.readString(); + if (id == -1) { + id = Integer.parseInt( + Tools.readf( + "Hello, this network is owned by {} (UUID {}), and your ID will be {}", s)[2]); + } + Thread.sleep(id); + + run(sender, s); + switch (role) { + case MAIN: + if (alsoRunAlt) { + runAlt(sender, s); + } + runMain(sender, s); + break; + case ALT: + runAlt(sender, s); + break; + case FINDER: + // Already done regardless + break; + } + } catch (IOException e) { + // ignore + } catch (InterruptedException e) { + break; + } + } + } + + private void runMain(int sender, String s) { + @SuppressWarnings("unused") + String data = null; + String[] mdata = null; + + mdata = Tools.readf("Hello, my UUID is {}, and my username is {}", s); + if (mdata != null) { + Account account = new Account(++nextID, UUID.fromString(mdata[0]), mdata[1]); + write("Hello {} (UUID {}), this network is owned by {} (UUID {}), and your ID will be {}", + mdata[1], mdata[0], + mc.getSession().getProfile().getName(), mc.getSession().getProfile().getId(), + nextID); + userData.put(account); + writeAccounts(); + write("Please provide a list of players in your RD."); + } + } + + private void runAlt(int sender, String s) { + String data = null; + String[] mdata = null; + + mdata = Tools.readf("{}, please start the task {}.", s); + if (mdata != null) { + if (id != Integer.parseInt(mdata[0])) + return; + Task task = Task.fromString(mdata[1]); + taskQueue.enqueue(task); + } + + data = Tools.readf1("Please everyone start the task {}", s); + if (data != null) { + Task task = Task.fromString(data); + taskQueue.enqueue(task); + } + + data = Tools.readf1("{}, please stop your tasks.", s); + if (data != null) { + if (id != Integer.parseInt(data)) + return; + taskQueue.killCurrent(); + } + + data = Tools.readf1("Please stop your tasks.", s); + if (data != null) { + taskQueue.killCurrent(); + } + } + + private void run(int sender, String s) { + String data = null; + String[] mdata = null; + + data = Tools.readf1("Please provide a list of players in your RD.", s); + if (data != null) { + writeAccounts(); + } + + mdata = Tools.readf("{} (UUID {}) is at BlockPos({}, {}, {}).", s); + if (mdata != null) { + Account account = userData.getOrMake(null, UUID.fromString(mdata[1]), mdata[0]); + account.location = Optional.of(new Vec3d( + Double.parseDouble(mdata[2]), + Double.parseDouble(mdata[3]), + Double.parseDouble(mdata[4]))); + } + + mdata = Tools.readf("Hello {} (UUID {}), this network is owned by {} (UUID {}), and your ID will be {}", s); + if (mdata != null) { + userData.getOrMake(0, UUID.fromString(mdata[3]), mdata[2]); + userData.getOrMake(Integer.parseInt(mdata[4]), UUID.fromString(mdata[1]), mdata[0]); + } + + data = Tools.readf1("Quitting.", s); + if (data != null) { + userData.removeID(sender); + } + } + + public void writeAccounts() { + for (EntityPlayer player : mc.world.playerEntities) { + write("{} (UUID {}) is at BlockPos({}, {}, {}).", + player.getGameProfile().getName(), + player.getGameProfile().getId(), + player.posX, player.posY, player.posZ); + userData.getOrMake( + null, + player.getGameProfile().getId(), + player.getGameProfile().getName()).location = Optional.of( + player.getPositionVector()); + } + } + + private void internalWrite(String s, Object... format) { + for (Object f : format) { + s = s.replaceFirst("{}", f.toString()); + } + TypedOutputStream stream = bus.getTypedWriter(); + try { + stream.writeInt(id); + stream.writeString(s); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public void write(String s, Object... format) { + try { + bus.startWrite(); + internalWrite(s, (Object[]) format); + bus.stopWrite(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + public Account localize(Account toAttack) { + return userData.getOrMake(toAttack.id.isPresent() ? toAttack.id.getAsInt() : null, + toAttack.uuid, + toAttack.name); + } + +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/ttcic/Task.java b/src/main/java/de/tudbut/mod/client/ttcp/ttcic/Task.java new file mode 100644 index 0000000..43430bf --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/ttcic/Task.java @@ -0,0 +1,54 @@ +package de.tudbut.mod.client.ttcp.ttcic; + +import net.minecraft.client.Minecraft; +import de.tudbut.mod.client.ttcp.ttcic.task.DoNothingTask; +import de.tudbut.obj.Transient; +import de.tudbut.parsing.JSON; +import de.tudbut.parsing.TCN; +import de.tudbut.parsing.JSON.JSONFormatException; +import de.tudbut.tools.ConfigSaverTCN2; + +public abstract class Task { + + @Transient + private boolean done = false; + + protected static Minecraft mc = Minecraft.getMinecraft(); + + public boolean isDone() { + return done; + } + + protected final void done() { + done = true; + } + + protected abstract void onTick(); + + public abstract void unpauseOrStart(); + + public abstract void pauseOrStop(); + + public void start() { + unpauseOrStart(); + } + + public void stop() { + pauseOrStop(); + } + + public String toString() { + return JSON.write((TCN) ConfigSaverTCN2.write(this, true, false)); + } + + public static Task fromString(String string) { + Task t; + try { + t = (Task) ConfigSaverTCN2.read(JSON.read(string), null); + } catch (ClassNotFoundException | JSONFormatException e) { + e.printStackTrace(); + t = new DoNothingTask(); + } + return t; + } +} \ No newline at end of file diff --git a/src/main/java/de/tudbut/mod/client/ttcp/ttcic/TaskQueue.java b/src/main/java/de/tudbut/mod/client/ttcp/ttcic/TaskQueue.java new file mode 100644 index 0000000..0911603 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/ttcic/TaskQueue.java @@ -0,0 +1,54 @@ +package de.tudbut.mod.client.ttcp.ttcic; + +import de.tudbut.mod.client.ttcp.ttcic.task.DoNothingTask; +import de.tudbut.tools.Queue; + +public class TaskQueue { + public Queue nextTasks = new Queue<>(); + public Task currentTask = new DoNothingTask(); + + public void enqueue(Task task) { + nextTasks.add(task); + } + + public void killCurrent() { + currentTask.done(); + takeNewTask(null); + } + + public void startNow(Task task) { + if (!takeNewTask(task)) { + currentTask.pauseOrStop(); + nextTasks.pushBottom(currentTask); + currentTask = task; + currentTask.start(); + } + } + + public void onTick() { + if (!nextTasks.hasNext() && currentTask instanceof DoNothingTask) // Optimization + return; + + if (currentTask.isDone()) + takeNewTask(null); + + currentTask.onTick(); + } + + private boolean takeNewTask(Task fallback) { + if (currentTask.isDone()) { + currentTask.stop(); + if (nextTasks.hasNext()) { + if (fallback != null) + currentTask = fallback; + else + currentTask = nextTasks.next(); + } else { + currentTask = new DoNothingTask(); + } + currentTask.start(); + return true; + } + return false; + } +} \ No newline at end of file diff --git a/src/main/java/de/tudbut/mod/client/ttcp/ttcic/UserMap.java b/src/main/java/de/tudbut/mod/client/ttcp/ttcic/UserMap.java new file mode 100644 index 0000000..9995bc5 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/ttcic/UserMap.java @@ -0,0 +1,61 @@ +package de.tudbut.mod.client.ttcp.ttcic; + +import java.util.UUID; +import java.util.HashMap; +import java.util.OptionalInt; + +public class UserMap { + private HashMap byID = new HashMap<>(); + private HashMap byName = new HashMap<>(); + private HashMap byUUID = new HashMap<>(); + + public Account getByID(int id) { + return byID.get(id); + } + + public Account getByName(String name) { + return byName.get(name); + } + + public Account getByUUID(String uuid) { + return byUUID.get(UUID.fromString(uuid)); + } + + public Account getByUUID(UUID uuid) { + return byUUID.get(uuid); + } + + public Account put(Account account) { + if (account.id.isPresent()) + byID.put(account.id.getAsInt(), account); + byName.put(account.name, account); + byUUID.put(account.uuid, account); + return account; + } + + public Account getOrMake(Integer id, UUID uuid, String name) { + if (byID.containsKey(id)) { + Account account = getByID(id); + account.id = id != null ? OptionalInt.of(id) : OptionalInt.empty(); + account.uuid = uuid; + account.name = name; + } + if (byUUID.containsKey(uuid)) { + Account account = getByUUID(uuid); + account.id = id != null ? OptionalInt.of(id) : OptionalInt.empty(); + account.uuid = uuid; + account.name = name; + } + if (byName.containsKey(name)) { + Account account = getByName(name); + account.id = id != null ? OptionalInt.of(id) : OptionalInt.empty(); + account.uuid = uuid; + account.name = name; + } + return put(new Account(id, uuid, name)); + } + + public void removeID(int id) { + getByID(id).id = OptionalInt.empty(); + } +} \ No newline at end of file diff --git a/src/main/java/de/tudbut/mod/client/ttcp/ttcic/task/DoNothingTask.java b/src/main/java/de/tudbut/mod/client/ttcp/ttcic/task/DoNothingTask.java new file mode 100644 index 0000000..4d48a71 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/ttcic/task/DoNothingTask.java @@ -0,0 +1,19 @@ +package de.tudbut.mod.client.ttcp.ttcic.task; + +import de.tudbut.mod.client.ttcp.ttcic.Task; + +public class DoNothingTask extends Task { + + @Override + protected void onTick() { + } + + @Override + public void unpauseOrStart() { + done(); + } + + @Override + public void pauseOrStop() { + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/ttcic/task/EntityFollowTask.java b/src/main/java/de/tudbut/mod/client/ttcp/ttcic/task/EntityFollowTask.java new file mode 100644 index 0000000..2ac2b11 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/ttcic/task/EntityFollowTask.java @@ -0,0 +1,25 @@ +package de.tudbut.mod.client.ttcp.ttcic.task; + +import de.tudbut.mod.client.ttcp.ttcic.Task; + +import static de.tudbut.mod.client.ttcp.ttcic.TTCIC.ttcic; + +import de.tudbut.mod.client.ttcp.ttcic.Account; + +public class EntityFollowTask extends Task { + + public EntityFollowTask(Account toAttack) { + } + + @Override + protected void onTick() { + } + + @Override + public void unpauseOrStart() { + } + + @Override + public void pauseOrStop() { + } +} \ No newline at end of file diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/AutoCrystalUtil.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/AutoCrystalUtil.java new file mode 100644 index 0000000..abef95e --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/AutoCrystalUtil.java @@ -0,0 +1,168 @@ +package de.tudbut.mod.client.ttcp.utils; + +import io.netty.buffer.Unpooled; +import io.netty.buffer.UnpooledDirectByteBuf; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.enchantment.EnchantmentHelper; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.SharedMonsterAttributes; +import net.minecraft.init.Blocks; +import net.minecraft.init.MobEffects; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.client.CPacketEntityAction; +import net.minecraft.network.play.client.CPacketUseEntity; +import net.minecraft.util.CombatRules; +import net.minecraft.util.DamageSource; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.*; +import net.minecraft.world.World; +import de.tudbut.mod.client.ttcp.TTCp; + +import java.io.IOException; +import java.util.List; +import java.util.Objects; + +public class AutoCrystalUtil { + + private static Minecraft mc = Minecraft.getMinecraft(); + + + public static AxisAlignedBB createBB(Vec3d crystalPos) { + return new AxisAlignedBB(crystalPos.x - 1, crystalPos.y, crystalPos.z - 1, crystalPos.y + 2, crystalPos.x + 1, crystalPos.x + 1); + } + + public static Vec2f createRotations(AxisAlignedBB box) { + Vec3d posEyes = mc.player.getPositionEyes(1); + + Vec3d best = null;//new Vec3d(box.minX + .5 * box.maxX, box.minY + .5 * box.maxY, box.minZ + .5 * box.maxZ); + double bestDistance = Double.POSITIVE_INFINITY; + + for (float ix = 0; ix < 1; ix+=.2f) { + for (float iy = 0; iy < 1; iy+=.2f) { + for (float iz = 0; iz < 1; iz+=.2f) { + double x = box.minX + ix * box.maxX; + double y = box.minY + iy * box.maxY; + double z = box.minZ + iz * box.maxZ; + Vec3d vec = new Vec3d(x,y,z); + + RayTraceResult trace = mc.world.rayTraceBlocks(posEyes, vec); + + if(trace == null) { + continue; + } + + double f = vec.distanceTo(posEyes); + if(f < bestDistance) { + bestDistance = f; + best = vec; + } + } + } + } + + return BlockUtils.getLegitRotationsVector(best); + } + + public static CPacketUseEntity createAttackPacket(int eid) { + CPacketUseEntity packet = new CPacketUseEntity(); + PacketBuffer buffer = new PacketBuffer(Unpooled.buffer()); + buffer.writeVarInt(eid); + buffer.writeEnumValue(CPacketUseEntity.Action.ATTACK); + try { + packet.readPacketData(buffer); + } catch (IOException e) { + e.printStackTrace(); + } + return packet; + } + + public static float getExplosionCost(EntityLivingBase entity, double x, double y, double z) { + + x += 0.5; + z += 0.5; + World world = TTCp.world; + + float dmg = 0; + float f3 = 6.0F * 2.0F; + Vec3d vec3d = new Vec3d(x, y, z); + + double d12 = entity.getDistance(x, y, z) / (double)f3; + + if (d12 <= 1.0D) + { + double d5 = entity.posX - x; + double d7 = entity.posY + (double)entity.getEyeHeight() - y; + double d9 = entity.posZ - z; + double d13 = MathHelper.sqrt(d5 * d5 + d7 * d7 + d9 * d9); + + if (d13 != 0.0D) + { + double d14 = world.getBlockDensity(vec3d, entity.getEntityBoundingBox()); + double d10 = (1.0D - d12) * d14; + dmg += (float)((int)((d10 * d10 + d10) / 2.0D * 7.0D * (double)f3 + 1.0D)); + } + } + + + dmg = CombatRules.getDamageAfterAbsorb(dmg, (float)entity.getTotalArmorValue(), (float)entity.getEntityAttribute(SharedMonsterAttributes.ARMOR_TOUGHNESS).getAttributeValue()); + + if (entity.isPotionActive(MobEffects.RESISTANCE)) { + int i = (Objects.requireNonNull(entity.getActivePotionEffect(MobEffects.RESISTANCE)).getAmplifier() + 1) * 5; + int j = 25 - i; + float f = dmg * (float)j; + dmg = f / 25.0F; + } + + if (dmg <= 0.0F) { + return 0.0F; + } + else { + try { + int k = EnchantmentHelper.getEnchantmentModifierDamage(entity.getArmorInventoryList(), DamageSource.GENERIC); + + if (k > 0) { + dmg = CombatRules.getDamageAfterMagicAbsorb(dmg, (float) k); + } + } catch (NullPointerException ignore) { } + } + return Math.max(dmg, 0.0F); + } + + public static boolean canPlace(BlockPos pos, float crystalRange) { + + Entity player = TTCp.player; + + if(player.getPositionEyes(1).distanceTo(new Vec3d(pos)) > crystalRange) { + return false; + } + + World world = TTCp.world; + IBlockState iblockstate = world.getBlockState(pos); + + if (iblockstate.getBlock() != Blocks.OBSIDIAN && iblockstate.getBlock() != Blocks.BEDROCK) + { + return false; + } + else { + BlockPos blockpos = pos.up(); + BlockPos blockpos1 = blockpos.up(); + boolean flag = !world.isAirBlock(blockpos) && !world.getBlockState(blockpos).getBlock().isReplaceable(world, blockpos); + flag = flag | (!world.isAirBlock(blockpos1) && !world.getBlockState(blockpos1).getBlock().isReplaceable(world, blockpos1)); + + if (flag) { + return false; + } + else { + double d0 = blockpos.getX(); + double d1 = blockpos.getY(); + double d2 = blockpos.getZ(); + AxisAlignedBB thisHitbox = new AxisAlignedBB(d0, d1, d2, d0 + 1.0D, d1 + 2.0D, d2 + 1.0D); + List list = world.getEntitiesWithinAABBExcludingEntity(null, thisHitbox); + + return list.isEmpty(); + } + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/BlockUtils.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/BlockUtils.java new file mode 100644 index 0000000..8a09009 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/BlockUtils.java @@ -0,0 +1,376 @@ +package de.tudbut.mod.client.ttcp.utils; + +import io.netty.buffer.Unpooled; +import net.minecraft.block.Block; +import net.minecraft.block.BlockDeadBush; +import net.minecraft.block.BlockTallGrass; +import net.minecraft.block.state.IBlockState; +import net.minecraft.client.Minecraft; +import net.minecraft.init.Blocks; +import net.minecraft.network.PacketBuffer; +import net.minecraft.network.play.client.*; +import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.Vec2f; +import net.minecraft.util.math.Vec3d; +import net.minecraft.world.World; +import de.tudbut.mod.client.ttcp.TTCp; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + + +public class BlockUtils { + + private static final Minecraft mc = Minecraft.getMinecraft(); + + // Sneak! + public static ArrayList blackList = new ArrayList<>(Arrays.asList( + Blocks.ENDER_CHEST, + Blocks.CHEST, + Blocks.TRAPPED_CHEST, + Blocks.CRAFTING_TABLE, + Blocks.ANVIL, + Blocks.BREWING_STAND, + Blocks.HOPPER, + Blocks.DROPPER, + Blocks.DISPENSER, + Blocks.TRAPDOOR, + Blocks.ENCHANTING_TABLE, + Blocks.POWERED_COMPARATOR, + Blocks.UNPOWERED_COMPARATOR, + Blocks.POWERED_REPEATER, + Blocks.UNPOWERED_REPEATER, + Blocks.CAKE, + Blocks.STANDING_SIGN, + Blocks.WALL_SIGN, + Blocks.OAK_DOOR, + Blocks.SPRUCE_DOOR, + Blocks.BIRCH_DOOR, + Blocks.DARK_OAK_DOOR, + Blocks.IRON_DOOR, + Blocks.JUNGLE_DOOR, + Blocks.ACACIA_DOOR, + Blocks.IRON_TRAPDOOR + )); + public static ArrayList shulkerList = new ArrayList<>(Arrays.asList( + Blocks.WHITE_SHULKER_BOX, + Blocks.ORANGE_SHULKER_BOX, + Blocks.MAGENTA_SHULKER_BOX, + Blocks.LIGHT_BLUE_SHULKER_BOX, + Blocks.YELLOW_SHULKER_BOX, + Blocks.LIME_SHULKER_BOX, + Blocks.PINK_SHULKER_BOX, + Blocks.GRAY_SHULKER_BOX, + Blocks.SILVER_SHULKER_BOX, + Blocks.CYAN_SHULKER_BOX, + Blocks.PURPLE_SHULKER_BOX, + Blocks.BLUE_SHULKER_BOX, + Blocks.BROWN_SHULKER_BOX, + Blocks.GREEN_SHULKER_BOX, + Blocks.RED_SHULKER_BOX, + Blocks.BLACK_SHULKER_BOX + )); + + public static void attackEntityByID(int id) { + CPacketUseEntity packet = new CPacketUseEntity(); + PacketBuffer buf = new PacketBuffer(Unpooled.buffer()); + buf.writeVarInt(id); + buf.writeEnumValue(CPacketUseEntity.Action.ATTACK); + try { + packet.readPacketData(buf); + } + catch (IOException e) { + e.printStackTrace(); + } + TTCp.player.connection.sendPacket(packet); + } + + // Magic i don't want to explain, gets a placeable size of a neighbor block and places + // the block on it, uses getPlaceableSide + public static void placeBlock(BlockPos pos, boolean rotate) { + if(pos == null) + return; + + EnumFacing side = getPlaceableSide(pos); + if (side == null) { + //ChatUtils.print("Couldn't place a block"); + return; + } + BlockPos neighbour = pos.offset(side); + EnumFacing opposite = side.getOpposite(); + Vec3d hitVec = new Vec3d(neighbour).add(0.5, 0.5, 0.5).add(new Vec3d(opposite.getDirectionVec()).scale(0.5)); + Block neighbourBlock = mc.world.getBlockState(neighbour).getBlock(); + if ((BlockUtils.blackList.contains(neighbourBlock) || BlockUtils.shulkerList.contains(neighbourBlock))) { + mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.START_SNEAKING)); + } + if (rotate) BlockUtils.faceVectorPacketInstant(hitVec); + mc.playerController.processRightClickBlock(mc.player, mc.world, neighbour, opposite, hitVec, EnumHand.MAIN_HAND); + mc.player.swingArm(EnumHand.MAIN_HAND); + if ((BlockUtils.blackList.contains(neighbourBlock) || BlockUtils.shulkerList.contains(neighbourBlock))) { + mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.STOP_SNEAKING)); + } + } + + // Magic i don't want to explain, gets a placeable size of a neighbor block and places + // the block on it, uses getPlaceableSide + public static void placeBlockPacket(BlockPos pos, boolean rotate) { + if(pos == null) + return; + + EnumFacing side = getPlaceableSide(pos); + if (side == null) { + //ChatUtils.print("Couldn't place a block"); + return; + } + BlockPos neighbour = pos.offset(side); + EnumFacing opposite = side.getOpposite(); + Vec3d hitVec = new Vec3d(neighbour).add(0.5, 0.5, 0.5).add(new Vec3d(opposite.getDirectionVec()).scale(0.5)); + Block neighbourBlock = mc.world.getBlockState(neighbour).getBlock(); + if ((BlockUtils.blackList.contains(neighbourBlock) || BlockUtils.shulkerList.contains(neighbourBlock))) { + mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.START_SNEAKING)); + } + if (rotate) + BlockUtils.faceVectorPacketInstant(hitVec); + float f = (float)(hitVec.x - (double)pos.getX()); + float f1 = (float)(hitVec.y - (double)pos.getY()); + float f2 = (float)(hitVec.z - (double)pos.getZ()); + mc.player.connection.sendPacket(new CPacketPlayerTryUseItemOnBlock(pos, opposite, EnumHand.MAIN_HAND, f, f1, f2)); + mc.player.swingArm(EnumHand.MAIN_HAND); + if ((BlockUtils.blackList.contains(neighbourBlock) || BlockUtils.shulkerList.contains(neighbourBlock))) { + mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.STOP_SNEAKING)); + } + } + + public static boolean placeBlock(BlockPos pos, EnumHand hand, boolean rotate, boolean packet) { + EnumFacing side = getFirstFacing(pos); + if (side == null) { + return false; + } + + BlockPos neighbour = pos.offset(side); + EnumFacing opposite = side.getOpposite(); + + Vec3d hitVec = new Vec3d(neighbour).add(0.5, 0.5, 0.5).add(new Vec3d(opposite.getDirectionVec()).scale(0.5)); + Block neighbourBlock = mc.world.getBlockState(neighbour).getBlock(); + + if (!mc.player.isSneaking() && (BlockUtils.blackList.contains(neighbourBlock) || BlockUtils.shulkerList.contains(neighbourBlock))) { + mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.START_SNEAKING)); + mc.player.setSneaking(true); + } + + if (rotate) { + faceVector(hitVec, true); + } + + rightClickBlock(neighbour, hitVec, hand, opposite, packet); + + if (mc.player.isSneaking()) { + ThreadManager.run(() -> { + try { + Thread.sleep(50); + } + catch (InterruptedException e) { + e.printStackTrace(); + } + mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.STOP_SNEAKING)); + mc.player.setSneaking(false); + }); + } + return true; + } + + public static List getPossibleSides(BlockPos pos) { + List facings = new ArrayList<>(); + for (EnumFacing side : EnumFacing.values()) { + BlockPos neighbour = pos.offset(side); + if (mc.world.getBlockState(neighbour).getBlock().canCollideCheck(mc.world.getBlockState(neighbour), false)) { + IBlockState blockState = mc.world.getBlockState(neighbour); + if (!blockState.getMaterial().isReplaceable()) { + facings.add(side); + } + } + } + return facings; + } + + public static EnumFacing getFirstFacing(BlockPos pos) { + for (EnumFacing facing : getPossibleSides(pos)) { + return facing; + } + return null; + } + + public static Vec3d getEyesPos() { + return new Vec3d(mc.player.posX, mc.player.posY + mc.player.getEyeHeight(), mc.player.posZ); + } + + public static void faceVector(Vec3d vec, boolean normalizeAngle) { + float[] rotations = getLegitRotations(vec); + mc.player.connection.sendPacket(new CPacketPlayer.Rotation(rotations[0], normalizeAngle ? MathHelper.normalizeAngle((int) rotations[1], 360) : rotations[1], mc.player.onGround)); + } + + public static void rightClickBlock(BlockPos pos, Vec3d vec, EnumHand hand, EnumFacing direction, boolean packet) { + if (packet) { + float f = (float) (vec.x - (double) pos.getX()); + float f1 = (float) (vec.y - (double) pos.getY()); + float f2 = (float) (vec.z - (double) pos.getZ()); + mc.player.connection.sendPacket(new CPacketPlayerTryUseItemOnBlock(pos, direction, hand, f, f1, f2)); + } else { + mc.playerController.processRightClickBlock(mc.player, mc.world, pos, direction, vec, hand); + } + mc.player.swingArm(EnumHand.MAIN_HAND); + } + + public static BlockPos getRealPos(Vec3d vec3d) { + return new BlockPos((int)(vec3d.x < 0 ? Math.floor(vec3d.x) : vec3d.x), (int)(vec3d.y < 0 ? Math.floor(vec3d.y) : vec3d.y), (int)(vec3d.z < 0 ? Math.floor(vec3d.z) : vec3d.z)); + } + + public static boolean clickOnBlock(BlockPos pos, EnumHand hand) { + return clickOnBlock(pos, hand, true); + } + + public static boolean clickOnBlock(BlockPos pos, EnumHand hand, boolean rotate) { + if(pos == null) + return false; + + Vec3d hitVec = new Vec3d(pos).add(0.5, 0.5, 0.5).add(new Vec3d(EnumFacing.UP.getDirectionVec()).scale(0.5)); + Block neighbourBlock = mc.world.getBlockState(pos).getBlock(); + if(rotate) + BlockUtils.faceVectorPacketInstant(hitVec); + float f = (float)(hitVec.x - (double)pos.getX()); + float f1 = (float)(hitVec.y - (double)pos.getY()); + float f2 = (float)(hitVec.z - (double)pos.getZ()); + mc.player.connection.sendPacket(new CPacketHeldItemChange(mc.player.inventory.currentItem)); + mc.player.connection.sendPacket(new CPacketPlayerTryUseItemOnBlock(pos, EnumFacing.UP, hand, f, f1, f2)); + mc.player.swingArm(hand); + return true; + } + + private static BlockPos breaking = null; + private static Runnable done = null; + + public static void tick() { + if(breaking != null) { + breakBlock(breaking, done); + } + } + + public static void breakBlock(BlockPos pos, Runnable done) { + lookAt(new Vec3d(pos)); + breaking = pos; + BlockUtils.done = done; + mc.playerController.onPlayerDamageBlock(pos, EnumFacing.DOWN); + mc.playerController.getIsHittingBlock(); + } + + public static void lookAt(Vec3d pos) { + faceVectorPacketInstant(pos); + } + + public static void lookCloserTo(Vec3d pos, float amountMax) { + mc.player.rotationYaw = MathHelper.wrapDegrees(mc.player.rotationYaw); + mc.player.rotationPitch = MathHelper.wrapDegrees(mc.player.rotationPitch); + + float[] rotations; + float length; + + rotations = getLegitRotations(pos); + rotations[0] = (rotations[0] - (mc.player.rotationYaw)); + rotations[1] = (rotations[1] - (mc.player.rotationPitch)); + length = (float) Math.sqrt(rotations[0] * rotations[0] + rotations[1] * rotations[1]); + rotations = getLegitRotations(pos); + rotations[0] = MathHelper.wrapDegrees(((rotations[0] + 180) % 360 - (mc.player.rotationYaw + 180) % 360)); + rotations[1] = MathHelper.wrapDegrees(((rotations[1] + 180) % 360 - (mc.player.rotationPitch + 180) % 360)); + length = Math.min(length, (float) Math.sqrt(rotations[0] * rotations[0] + rotations[1] * rotations[1])); + + if(length > 1) { + rotations[0] = (rotations[0] / length) * amountMax; + rotations[1] = (rotations[1] / length) * amountMax; + } + else { + rotations[0] = (rotations[0] / length) * (amountMax / 18); + rotations[1] = (rotations[1] / length) * (amountMax / 18); + } + + mc.player.rotationYaw += rotations[0]; + mc.player.rotationPitch += rotations[1]; + } + + // Gets a block next to a block position + private static EnumFacing getPlaceableSide(BlockPos pos) { + for (EnumFacing side : EnumFacing.values()) { + BlockPos neighbour = pos.offset(side); + if (!mc.world.getBlockState(neighbour).getBlock().canCollideCheck(mc.world.getBlockState(neighbour), false)) { + continue; + } + IBlockState blockState = mc.world.getBlockState(neighbour); + if (!blockState.getMaterial().isReplaceable() && !(blockState.getBlock() instanceof BlockTallGrass) && !(blockState.getBlock() instanceof BlockDeadBush)) { + return side; + } + } + return null; // :( + } + + private static Vec3d eyesPos() { + return new Vec3d(mc.player.posX, mc.player.posY + mc.player.getEyeHeight(), mc.player.posZ); + } + + public static float[] getLegitRotations(Vec3d vec) { + Vec3d eyesPos = eyesPos(); + double diffX = vec.x - eyesPos.x; + double diffY = vec.y - eyesPos.y; + double diffZ = vec.z - eyesPos.z; + double diffXZ = Math.sqrt(diffX * diffX + diffZ * diffZ); + double yaw = Math.toDegrees(Math.atan2(diffZ, diffX)) - 90f; + double pitch = (-Math.toDegrees(Math.atan2(diffY, diffXZ))); + return new float[]{(float) (MathHelper.wrapDegrees(yaw)), (float) (MathHelper.wrapDegrees(pitch))}; + } + + public static Vec2f getLegitRotationsVector(Vec3d vec) { + Vec3d eyesPos = eyesPos(); + double diffX = vec.x - eyesPos.x; + double diffY = vec.y - eyesPos.y; + double diffZ = vec.z - eyesPos.z; + double diffXZ = Math.sqrt(diffX * diffX + diffZ * diffZ); + double yaw = Math.toDegrees(Math.atan2(diffZ, diffX)) - 90f; + double pitch = (-Math.toDegrees(Math.atan2(diffY, diffXZ))); + return new Vec2f((float) MathHelper.wrapDegrees(yaw), (float) MathHelper.wrapDegrees(pitch)); + } + + // Makes it more legit-looking + public static void faceVectorPacketInstant(Vec3d vec) { + float[] rotations = getLegitRotations(vec); + mc.player.connection.sendPacket( + new CPacketPlayer.PositionRotation( + mc.player.posX, mc.player.posY, mc.player.posZ, + rotations[0], rotations[1], mc.player.onGround + ) + ); + } + + public static BlockPos findBlock(Block... blocks) { + World world = TTCp.world; + BlockPos origin = TTCp.player.getPosition(); + + for (int z = -5; z <= 5; z++) { + + for (int y = -3; y <= 7; y++) { + + for (int x = -5; x <= 5; x++) { + BlockPos pos = origin.add(x,y,z); + for(Block block : blocks) + if(world.getBlockState(pos).getBlock() == block) { + return pos; + } + } + } + } + + return null; + } +} \ No newline at end of file diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/ChatUtils.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/ChatUtils.java new file mode 100644 index 0000000..4d24d8d --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/ChatUtils.java @@ -0,0 +1,126 @@ +package de.tudbut.mod.client.ttcp.utils; + +import net.minecraft.client.Minecraft; +import net.minecraft.util.text.TextComponentString; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.mods.misc.Debug; +import de.tudbut.mod.client.ttcp.mods.rendering.Notifications; + +import java.io.OutputStream; +import java.io.PrintStream; + +public class ChatUtils { // Everything here is kinda self-explanatory + + public static void print(String s) { + if(TTCp.isIngame()) + Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(new TextComponentString(s)); + else { + TTCp.logger.info(s.replaceAll("§[a-z0-9]", "")); + } + } + + public static void printChatAndHotbar(String s) { + print(s); + printHotbar(s); + } + + public static void printChatAndTitle(String s, int ms) { + print(s); + printTitle(s, "", ms); + } + + public static void printChatAndNotification(String s, int ms) { + print(s); + Notifications.add(new Notifications.Notification(s, ms)); + } + + @SuppressWarnings("ConstantConditions") + public static void printTitle(String title, String subTitle, int ms) { + Minecraft.getMinecraft().ingameGUI.displayTitle("§c" + title, null, 2, ms / (1000 / 20), 2); + Minecraft.getMinecraft().ingameGUI.displayTitle(null, "§b" + subTitle, 2, ms / (1000 / 20), 2); + } + + public static void printHotbar(String s) { + Minecraft.getMinecraft().ingameGUI.setOverlayMessage(new TextComponentString(s), true); + } + + public static void history(String s) { + Minecraft.getMinecraft().ingameGUI.getChatGUI().addToSentMessages(s); + } + + public static OutputStream chatOut() { + return new OutputStream() { + String s = ""; + + @Override + public void write(int i) { + if ((char) i == '\n') { + Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(new TextComponentString(s)); + s = ""; + } else + s += (char) i; + } + }; + } + public static OutputStream chatOut(int delay) { + return new OutputStream() { + String s = ""; + + @Override + public void write(int i) { + if ((char) i == '\n') { + try { + Thread.sleep(delay); + } + catch (InterruptedException e) { + e.printStackTrace(); + } + Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(new TextComponentString(s)); + s = ""; + } else + s += (char) i; + } + }; + } + + public static PrintStream chatPrinter() { + return new PrintStream(chatOut()); + } + + public static PrintStream chatPrinter(int delay) { + return new PrintStream(chatOut(delay)); + } + + public static OutputStream chatOutDebug() { + return new OutputStream() { + String s = ""; + + @Override + public void write(int i) { + + if ((char) i == '\n') { + if (Debug.getInstance().enabled) + Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(new TextComponentString(s)); + System.out.println(s); + s = ""; + } else + s += (char) i; + } + }; + } + + public static PrintStream chatPrinterDebug() { + return new PrintStream(chatOutDebug()); + } + + public static void simulateSend(String msg, boolean addToHistory) { + msg = net.minecraftforge.event.ForgeEventFactory.onClientSendMessage(msg); + if (msg.isEmpty()) return; + if (addToHistory) { + TTCp.mc.ingameGUI.getChatGUI().addToSentMessages(msg); + } + if (net.minecraftforge.client.ClientCommandHandler.instance.executeCommand(TTCp.mc.player, msg) != 0) + return; + TTCp.mc.player.sendChatMessage(msg); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/ConfigUtils.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/ConfigUtils.java new file mode 100644 index 0000000..0696910 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/ConfigUtils.java @@ -0,0 +1,177 @@ +package de.tudbut.mod.client.ttcp.utils; + +import de.tudbut.tools.Tools; +import de.tudbut.debug.DebugProfiler; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.parsing.TCN; +import de.tudbut.tools.ConfigSaverTCN; +import de.tudbut.tools.ConfigSaverTCN2; + +public class ConfigUtils { + + public static String serializeString() { + return Tools.mapToString(serialize().toMap()); + } + + public static void deserializeString(String config) { + deserialize(TCN.readMap(Tools.stringToMap(config))); + } + + public static TCN serialize() { + TCN config = new TCN(); + try { + config.set("client", ConfigSaverTCN2.write(TTCp.getInstance(), false, true)); + for(Module module : TTCp.modules) { + try { + config.set(module.toString(), ConfigSaverTCN2.write(module, false, true)); + } catch (Throwable e) { + throw new Exception(module.toString(), e); + } + } + } catch (Exception e) { + System.err.println("Unable to serialize TTCp config"); + e.printStackTrace(); + } + return config; + } + + public static void deserialize(TCN config) { + try { + ConfigSaverTCN2.read(config.getSub("client"), TTCp.getInstance()); + for(Module module : TTCp.modules) { + try { + if(config.get(module.toString()) != null) + ConfigSaverTCN2.read(config.getSub(module.toString()), module); + } catch (Throwable e) { + throw new Exception(module.toString(), e); + } + } + } catch (Exception e) { + System.err.println("Broken TTCp config"); + e.printStackTrace(); + } + } + + + + + + public static String make(TTCp ttcp) { + return Tools.mapToString(makeTCN(ttcp).toMap()); + } + + public static TCN makeTCN(TTCp ttcp) { + TCN tcn = new TCN(); + + tcn.set("init", "true"); + + makeClient(ttcp, tcn); + makeModules(tcn); + + return tcn; + } + + private static void makeClient(TTCp ttcp, TCN tcn) { + try { + TCN cfg = ConfigSaverTCN.saveConfig(ttcp); + + tcn.set("client", cfg); + } catch (Exception e) { + System.err.println("Couldn't save config of client"); + e.printStackTrace(); + tcn.set("init", null); + } + } + + private static void makeModules(TCN tcn) { + TCN cfg = new TCN(); + + for (int i = 0; i < TTCp.modules.length; i++) { + Module module = TTCp.modules[i]; + + try { + module.onConfigSave(); + TCN moduleTCN = ConfigSaverTCN.saveConfig(module); + cfg.set(module.toString(), moduleTCN); + } catch (Exception e) { + System.err.println("Couldn't save config of module " + module.toString()); + e.printStackTrace(); + tcn.set("init", null); + } + } + + tcn.set("modules", cfg); + } + + public static void load(TTCp ttcp, String config) { + try { + System.out.println("Reading as TCNMap..."); + TCN tcn = TCN.readMap(Tools.stringToMap(config)); + if (!tcn.getBoolean("init")) + throw new Exception(); + System.out.println("Done"); + loadTCN(ttcp, tcn); + } + catch (Exception e0) { + System.err.println("Couldn't load config as TCNMap"); + try { + System.out.println("Reading as TCN..."); + TCN tcn = TCN.read(config); + System.out.println("Done"); + loadTCN(ttcp, tcn); + } + catch (Exception e1) { + System.err.println("Couldn't load config"); + } + } + } + + public static void loadTCN(TTCp ttcp, TCN tcn) { + loadClient(ttcp, tcn); + loadModules(tcn); + } + + private static void loadClient(TTCp ttcp, TCN tcn) { + try { + ConfigSaverTCN.loadConfig(ttcp, tcn.getSub("client")); + } catch (Exception e) { + System.err.println("Couldn't load config of client"); + e.printStackTrace(); + } + } + + private static void loadModules(TCN tcn) { + tcn = tcn.getSub("modules"); + + DebugProfiler profiler = new DebugProfiler("ConfigLoadProfiler", "init"); + + for (int i = 0; i < TTCp.modules.length; i++) { + Module module = TTCp.modules[i]; + profiler.next(module.toString()); + + if(module.enabled) { + module.enabled = false; + module.green = false; + module.onDisable(); + } + + try { + ConfigSaverTCN.loadConfig(module, tcn.getSub(module.toString())); + try { + if (module.enabled) + module.onEnable(); + } catch (NullPointerException ignored) { } + module.onConfigLoad(); + } + catch (Exception e) { + module.enabled = module.green = module.defaultEnabled(); + System.err.println("Couldn't load config of module " + module.toString()); + e.printStackTrace(); + } + } + + profiler.endAll(); + System.out.println(profiler.getResults()); + profiler.delete(); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/DebugProfilerAdapter.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/DebugProfilerAdapter.java new file mode 100644 index 0000000..8e0e7d4 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/DebugProfilerAdapter.java @@ -0,0 +1,64 @@ +package de.tudbut.mod.client.ttcp.utils; + +import de.tudbut.debug.DebugProfiler; + +public class DebugProfilerAdapter extends DebugProfiler { + public boolean fallthrough = false; + + public DebugProfilerAdapter(String name, String startingSection) { + super(name, startingSection); + } + + @Override + public synchronized DebugProfiler next(String next) { + if(fallthrough) + return this; + + return super.next(next); + } + + @Override + public synchronized DebugProfiler endAll() { + return super.endAll(); + } + + @Override + public synchronized Results getResults() { + return super.getResults(); + } + + @Override + public synchronized Results getTempResults() { + return super.getTempResults(); + } + + @Override + public void optimize() { + super.optimize(); + } + + @Override + public boolean isLocked() { + return super.isLocked(); + } + + @Override + public String getName() { + return super.getName(); + } + + @Override + public synchronized void delete() { + super.delete(); + } + + @Override + public void finalize() { + super.finalize(); + } + + @Override + public String toString() { + return super.toString(); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/FlightBot.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/FlightBot.java new file mode 100644 index 0000000..9e7f137 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/FlightBot.java @@ -0,0 +1,136 @@ +package de.tudbut.mod.client.ttcp.utils; + +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.network.play.client.CPacketEntityAction; +import net.minecraft.network.play.client.CPacketPlayer; +import net.minecraft.util.math.Vec3d; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.mods.movement.ElytraBot; +import de.tudbut.mod.client.ttcp.mods.movement.PacketFly; +import de.tudbut.obj.Atomic; + +import java.util.Date; + +public class FlightBot { + + private static Atomic destination; + private static EntityPlayerSP player = TTCp.player; + private static volatile boolean lock = false; + private static boolean flying = false; + private static boolean active = false; + private static long tookOff = 0; + private static double speed = 1; + public static boolean allowPacketFly = false; + + public static boolean isActive() { + return active; + } + + public static boolean isFlying() { + player = TTCp.player; + return destination != null && destination.get() != null && flying && player.getPositionVector().distanceTo(destination.get()) > 1; + } + + private FlightBot() { } + + public static void activate(Atomic destination, double speed) { + while (lock); + flying = true; + active = true; + FlightBot.speed = speed; + FlightBot.destination = destination; + } + + public static void activate(Atomic destination) { + activate(destination, 1); + } + + public static void deactivate() { + active = false; + speed = 1; + } + + public static void updateDestination(Atomic destination) { + while (lock); + FlightBot.destination = destination; + } + + static boolean forceSpeed = false; + public static void setForce(boolean force) { + forceSpeed = force; + } + public static void setSpeed(double speed) { + if(forceSpeed) + return; + FlightBot.speed = speed; + } + + private static void takeOff() { + player = TTCp.player; + + if (player.onGround) { + if (!player.isElytraFlying()) { + tookOff = 0; + player.jump(); + } + } + } + + public static synchronized boolean tickBot() { + if(!active) + return false; + + player = TTCp.player; + + PacketFly packetFly = TTCp.getModule(PacketFly.class); + if (!player.isElytraFlying() && !packetFly.enabled) { + if (new Date().getTime() - tookOff > 100) { + takeOff(); + } + return false; + } + + if(new Date().getTime() - tookOff < 300 && tookOff != 0) { + return true; + } + + if(destination.get() == null) { + return false; + } + + lock = true; + double x, y, z; + Vec3d dest = destination.get(); + double dx = dest.x - player.posX, dy = dest.y - player.posY, dz = dest.z - player.posZ; + + + double d = Math.sqrt(dx*dx + dy*dy + dz*dz); + + if(d < 1) { + d = 1; + flying = false; + } + else + flying = true; + + d = d / speed; + + x = dx / d; + y = dy / d; + z = dz / d; + + player.motionX = x; + if(!ElytraBot.getInstance().strict || y < 0) + player.motionY = y; + player.motionZ = z; + lock = false; + + if(packetFly.enabled) { + allowPacketFly = true; + packetFly.onTick(); + allowPacketFly = false; + } + + return true; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/FontRenderer.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/FontRenderer.java new file mode 100644 index 0000000..6985709 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/FontRenderer.java @@ -0,0 +1,61 @@ +package de.tudbut.mod.client.ttcp.utils; + +import net.minecraft.client.gui.Gui; +import de.tudbut.obj.Vector2i; + +import java.awt.*; +import java.awt.font.FontRenderContext; +import java.awt.image.BufferedImage; + +public class FontRenderer extends Gui { + + Font myFont; + FontRenderContext context; + + public FontRenderer(int size) { + this.myFont = new Font("serif", Font.PLAIN, size); + this.context = new FontRenderContext(null, false, false); + } + + public int getTextWidth(String text) { + int r = 0; + + for (int i = 0; i < text.split("\n").length; ++i) { + r += (int) this.myFont.getStringBounds(text.split("\n")[i], this.context).getWidth() + 4; + } + + return r; + } + + public int getTextHeight(String text) { + int r = 0; + + for (int i = 0; i < text.split("\n").length; ++i) { + r += (int) this.myFont.getStringBounds(text.split("\n")[i], this.context).getHeight() + 4; + } + + return r; + } + + public void drawText(String text, int color, int x, int y) { + //Renderer.draw(x, y, renderText(text, color)); + } + + public Image renderText(String text, int color) { + BufferedImage image = new BufferedImage(this.getTextWidth(text), this.getTextHeight(text), 2); + Graphics graphics = image.getGraphics(); + graphics.setColor(new Color(color)); + graphics.setFont(this.myFont); + + for (int i = 0; i < text.split("\n").length; ++i) { + graphics.drawString(text.split("\n")[i], 0, (this.myFont.getSize() + 4) * (i + 1)); + } + + return image; + } + + public Vector2i getCoordsForCentered(Vector2i coords, String text) { + return new Vector2i(coords.getX() - this.getTextWidth(text) / 2, coords.getY() - this.getTextHeight(text) / 2); + } + +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/FreecamPlayer.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/FreecamPlayer.java new file mode 100644 index 0000000..8af44a8 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/FreecamPlayer.java @@ -0,0 +1,106 @@ +package de.tudbut.mod.client.ttcp.utils; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityOtherPlayerMP; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.entity.MoverType; +import net.minecraft.util.MovementInput; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.Vec2f; +import net.minecraft.world.World; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.mods.rendering.Freecam; + +import javax.annotation.Nonnull; + +@SideOnly(Side.CLIENT) +public class FreecamPlayer extends EntityOtherPlayerMP +{ + public MovementInput movementInput; + protected Minecraft mc; + protected final EntityPlayerSP original; + + public FreecamPlayer(EntityPlayerSP playerSP, World world) + { + super(world, playerSP.getGameProfile()); + this.dimension = playerSP.dimension; + this.original = playerSP; + this.mc = Minecraft.getMinecraft(); + this.movementInput = playerSP.movementInput; + preparePlayerToSpawn(); + capabilities.allowFlying = true; + capabilities.isFlying = true; + this.setPositionAndRotation(playerSP.posX, playerSP.posY, playerSP.posZ, playerSP.rotationYaw, playerSP.rotationPitch); + } + + @Override + @Nonnull + public String getName() { + return original.getName() + "\u0000"; + } + + @Override + public boolean isSpectator() { + return true; + } + + public void onLivingUpdate() + { + if(TTCp.mc.world == null) { + Freecam.getInstance().onDisable(); + Freecam.getInstance().enabled = false; + return; + } + TTCp.mc.renderChunksMany = false; + TTCp.mc.player.setInvisible(false); + setInvisible(true); + + inventory.copyInventory(TTCp.player.inventory); + + prevRotationYaw = rotationYaw; + prevRotationPitch = rotationPitch; + prevRotationYawHead = rotationYawHead; + setRotation(original.rotationYaw, original.rotationPitch); + setRotationYawHead(original.rotationYaw); + original.prevRenderArmYaw = original.renderArmYaw; + original.prevRenderArmPitch = original.renderArmPitch; + original.renderArmPitch = (float)((double)original.renderArmPitch + (double)(original.rotationPitch - original.renderArmPitch) * 0.5D); + original.renderArmYaw = (float)((double)original.renderArmYaw + (double)(original.rotationYaw - original.renderArmYaw) * 0.5D); + updateEntityActionState(); + + movementInput.updatePlayerMoveState(); + Vec2f movementVec = movementInput.getMoveVector(); + + float f1 = MathHelper.sin(rotationYaw * 0.017453292F); + float f2 = MathHelper.cos(rotationYaw * 0.017453292F); + double x = movementVec.x * f2 - movementVec.y * f1; + double y = (movementInput.jump ? 1 : 0) + (movementInput.sneak ? -1 : 0); + double z = movementVec.y * f2 + movementVec.x * f1; + float d = (float) Math.sqrt(x * x + y * y + z * z); + + movementInput.jump = false; + movementInput.sneak = false; + movementInput.forwardKeyDown = false; + movementInput.backKeyDown = false; + movementInput.leftKeyDown = false; + movementInput.rightKeyDown = false; + movementInput.moveForward = 0; + movementInput.moveStrafe = 0; + + if(d < 1) { + d = 1; + } + + motionX = x / d; + motionY = y / d; + motionZ = z / d; + + noClip = true; + move(MoverType.SELF, motionX, motionY, motionZ); + + prevCameraYaw = cameraYaw; + prevCameraPitch = cameraPitch; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/InventoryUtils.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/InventoryUtils.java new file mode 100644 index 0000000..700a4f7 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/InventoryUtils.java @@ -0,0 +1,157 @@ +package de.tudbut.mod.client.ttcp.utils; + +import net.minecraft.block.Block; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.gui.inventory.GuiInventory; +import net.minecraft.inventory.ClickType; +import net.minecraft.inventory.Container; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.network.play.client.CPacketHeldItemChange; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.mods.combat.HopperAura; +import de.tudbut.tools.Lock; + +import java.util.Objects; + +public class InventoryUtils { + + public static final int OFFHAND_SLOT = 45; + private static final Lock swapLock = new Lock(); + + public static Integer getSlotWithItem(Container inv, Item item, int amount) { + return getSlotWithItem(inv, item, Utils.range(0, 8), amount, amount); + } + + public static Integer getSlotWithItem(Container inv, Item item, int[] not, int amountMin, int amountMax) { + for (int i = 0; i < inv.getInventory().size(); i++) { + a: + { + for (int j = 0; j < not.length; j++) { + if (i == not[j]) + break a; + } + + ItemStack stack = inv.getSlot(i).getStack(); + if (stack.getItem().equals(item) && stack.getCount() >= amountMin && stack.getCount() <= amountMax) + return i; + } + } + return null; + } + public static Integer getSlotWithItem(Container inv, Block item, int amount) { + return getSlotWithItem(inv, item, Utils.range(0, 8), amount, amount); + } + + public static Integer getSlotWithItem(Container inv, Block item, int[] not, int amountMin, int amountMax) { + for (int i = 0; i < inv.getInventory().size(); i++) { + a: + { + for (int j = 0; j < not.length; j++) { + if (i == not[j]) + break a; + } + + ItemStack stack = inv.getSlot(i).getStack(); + if(stack.getItem().getRegistryName() != null) + if (stack.getItem().getRegistryName().toString().equals(Objects.requireNonNull(item.getRegistryName()).toString()) && stack.getCount() >= amountMin && stack.getCount() <= amountMax) + return i; + } + } + return null; + } + + public static int getItemAmount(Container inv, Item item) { + int c = 0; + for (int i = 0; i < inv.getInventory().size(); i++) { + ItemStack stack = inv.getSlot(i).getStack(); + if (stack.getItem().equals(item)) + c += stack.getCount(); + + } + return c; + } + + // Select hotbar slot + public static void setCurrentSlot(int id) { + if(TTCp.player.inventory.currentItem != id) { + TTCp.player.inventory.currentItem = id; + TTCp.player.connection.sendPacket(new CPacketHeldItemChange(id)); + } + } + + // Get selected hotbar slot + public static int getCurrentSlot() { + return TTCp.player.inventory.currentItem; + } + + // Drop contents of a slot + public static void drop(int slot) { + clickSlot(slot, ClickType.THROW, 1); + } + + // Drop contents of a slot + public static void drop(int windowId, int slot) { + clickSlot(windowId, slot, ClickType.THROW, 1); + } + + // Virtually clicks a slot + public static void clickSlot(int slot, ClickType type, int key) { + TTCp.mc.playerController.windowClick(TTCp.mc.player.inventoryContainer.windowId, slot, key, type, TTCp.mc.player); + } + + // Virtually clicks a slot + public static void clickSlot(int windowId, int slot, ClickType type, int key) { + TTCp.mc.playerController.windowClick(windowId, slot, key, type, TTCp.mc.player); + } + + // This only swaps between a slot and a hotbar slot! + public static void swap(int slot, int hotbarSlot) { + clickSlot(slot, ClickType.SWAP, hotbarSlot); + } + + // Swap two items in inventory + public static void inventorySwap(int slot0, int slot1, long mainDelay, long postDelay, long cooldownDelay) { + // Swapping may not be done in separate threads! + HopperAura.pause(); + swapLock.waitHere(); + + // Make other threads wait + swapLock.lock(); + + // "slot1" must not be set to 8, it will not be able to switch! + if (slot1 == 8 + 36) { + // Exchange values of slot0 and slot1 + int i = slot0; + slot0 = slot1; + slot1 = i; + } + + try { + // Check for a GUIScreen that would block switching + GuiScreen screen = TTCp.mc.currentScreen; + boolean doResetScreen = false; + if (screen instanceof GuiContainer && !(screen instanceof GuiInventory)) { + // If the current GUIScreen blocks switching, close it + TTCp.player.closeScreen(); + Thread.sleep(500); + doResetScreen = true; + } + + swap(slot0, 8); + Thread.sleep(mainDelay); + swap(slot1, 8); + Thread.sleep(postDelay); + swap(slot0, 8); + Thread.sleep(cooldownDelay); + } + catch (InterruptedException e) { + e.printStackTrace(); + } + + // Enable the next swapping operation + swapLock.unlock(); + HopperAura.resume(); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/KillSwitch.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/KillSwitch.java new file mode 100644 index 0000000..9002e98 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/KillSwitch.java @@ -0,0 +1,128 @@ +package de.tudbut.mod.client.ttcp.utils; + +import de.tudbut.io.StreamReader; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.ScaledResolution; +import net.minecraftforge.client.model.ISmartVariant; +import org.lwjgl.input.Mouse; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.gui.GuiTTC; +import de.tudbut.tools.Lock; +import de.tudbut.tools.Tools2; + +import java.io.*; +import java.net.MalformedURLException; +import java.net.URISyntaxException; +import java.net.URL; +import java.util.Random; + +public class KillSwitch { + + public static String type = "been deactivated by a developer"; + public static boolean running = false; // TODO change back to false + public static Lock lock = new Lock(true); + + public static void deactivate() { + if(running) + return; + running = true; + try { + for (int i = 0; i < TTCp.modules.length; i++) { + try { + Module module = TTCp.modules[i]; + module.enabled = false; + module.onDisable(); + } catch (Exception ignore) { + } + } + } catch (Exception ignore) { + } + try { + Minecraft.getMinecraft().displayGuiScreen(new GuiKilled()); + } catch (Exception ignore) { + } + try { + new File(TTCp.class.getProtectionDomain().getCodeSource().getLocation().toURI()).delete(); + } + catch (URISyntaxException e) { + e.printStackTrace(); + } + lock.lock(15000); + new Thread(() -> { + try { + Thread.sleep(15000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + Minecraft.getMinecraft().shutdown(); + }).start(); + } + + public static class GuiKilled extends GuiScreen { + + { + this.mc = Minecraft.getMinecraft(); + } + + @Override + public boolean doesGuiPauseGame() { + return false; + } + + @Override + public void initGui() { + super.initGui(); + } + + @Override + public void onGuiClosed() { + new Thread(() -> { + try { + Thread.sleep(5); + } + catch (InterruptedException e) { + e.printStackTrace(); + } + Minecraft.getMinecraft().displayGuiScreen(this); + }).start(); + super.onGuiClosed(); + } + ScaledResolution sr = new ScaledResolution(mc); + int y = sr.getScaledHeight() / 3; + Lock timer = new Lock(); { timer.lock(15000); } + + @Override + public void drawScreen(int mouseX, int mouseY, float partialTicks) { + sr = new ScaledResolution(mc); + y = sr.getScaledHeight() / 3; + drawRect(0, 0, sr.getScaledWidth(), sr.getScaledHeight(), 0xff000000); + if(timer.isLocked()) + Mouse.setGrabbed(true); + drawString("Your TTC has " + type + "."); + drawString("Please contact us on the discord (https://discord.gg/UgbPQvyfmc)"); + drawString("or at TudbuT#2624!!!"); + drawString("Your mouse will be grabbed for about 15 more"); + drawString("seconds, afterwards, your minecraft will exit..."); + if(!timer.isLocked()) { + Mouse.setGrabbed(false); + Minecraft.getMinecraft().shutdown(); + } + } + + private void drawString(String s) { + String[] lines = s.split("\n"); + for (int i = 0 ; i < lines.length ; i++) { + s = lines[i]; + mc.fontRenderer.drawString( + "§l" + s, + sr.getScaledWidth() / 2f - mc.fontRenderer.getStringWidth("§l" + s) / 2f, + y, + 0xffff0000, + true + ); + y += 13; + } + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/LSDRenderer.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/LSDRenderer.java new file mode 100644 index 0000000..fc93454 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/LSDRenderer.java @@ -0,0 +1,132 @@ +package de.tudbut.mod.client.ttcp.utils; + +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.world.World; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.mods.rendering.LSD; + +public class LSDRenderer extends FreecamPlayer { + public static final int MODE_EPILEPSY = 0x00; + public static final int MODE_UPSIDE_DOWN = 0x01; + public static final int MODE_HAND0 = 0x02; + public static final int MODE_HAND1 = 0x03; + public static final int MODE_CAMERA = 0x04; + public static final int MODE_ROTATION0 = 0x05; + public static final int MODE_ROTATION1 = 0x06; + public static final int MODE_ROTATION2 = 0x07; + public static final int MODE_ROTATION3 = 0x08; + public static final int MODE_EXC = 0x09; + public static final int MODE_ALL = 0x0a; + public static int mode = 0; + + public LSDRenderer(EntityPlayerSP playerSP, World world) { + super(playerSP, world); + } + + public void onLivingUpdate() + { + if(!TTCp.isIngame()) { + LSD.getInstance().onDisable(); + return; + } + + inventory.copyInventory(TTCp.player.inventory); + + original.renderArmYaw = original.rotationYaw; + original.renderArmPitch = original.rotationPitch; + original.prevRenderArmYaw = prevRotationYaw; + original.prevRenderArmPitch = prevRotationPitch; + setRotation(original.rotationYaw, original.rotationPitch); + cameraYaw = 0; + cameraPitch = 0; + prevCameraYaw = 0; + prevCameraPitch = 0; + + switch (mode) { + case MODE_ALL: + exc(); + hand1(); + rotation3(); + epilepsy(); + break; + case MODE_EPILEPSY: + epilepsy(); + break; + case MODE_HAND0: + hand0(); + break; + case MODE_HAND1: + hand1(); + break; + case MODE_CAMERA: + camera(); + break; + case MODE_ROTATION0: + rotation0(); + break; + case MODE_ROTATION1: + rotation1(); + break; + case MODE_UPSIDE_DOWN: + case MODE_ROTATION2: + rotation2(); + break; + case MODE_ROTATION3: + rotation3(); + break; + case MODE_EXC: + exc(); + break; + } + setRotationYawHead(-original.rotationYaw); + updateEntityActionState(); + + noClip = true; + } + + public void epilepsy() { + rotationPitch = 0; + cameraYaw = (float) (5f - (Math.random() * 10f)); + cameraPitch = (float) (5f - (Math.random() * 10f)); + prevCameraYaw = (float) (5f - (Math.random() * 10f)); + prevCameraPitch = (float) (5f - (Math.random() * 10f)); + } + public void hand0() { + original.renderArmYaw = 0; + original.renderArmPitch = 0; + original.prevRenderArmYaw = 0; + original.prevRenderArmPitch = 0; + } + public void hand1() { + original.renderArmYaw = original.rotationYaw; + original.renderArmPitch = original.rotationPitch; + original.prevRenderArmYaw = 0; + original.prevRenderArmPitch = 0; + } + public void camera() { + cameraYaw = (float) (rotationYaw / 180 * Math.PI); + cameraPitch = (float) (rotationPitch / 180 * Math.PI); + prevCameraYaw = cameraYaw; + prevCameraPitch = cameraPitch; + } + public void exc() { + rotationYaw = rotationYaw - 90; + rotationPitch = rotationPitch - 90; + } + public void rotation0() { + rotationYaw = rotationYaw - 90; + rotationPitch = rotationPitch - 90; + } + public void rotation1() { + rotationYaw = original.rotationYaw + 90; + rotationPitch = original.rotationPitch + 90; + } + public void rotation2() { + rotationYaw = original.rotationYaw + 180; + rotationPitch = original.rotationPitch + 180; + } + public void rotation3() { + rotationYaw = original.rotationYaw - 180; + rotationPitch = original.rotationPitch - 180; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/Login.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/Login.java new file mode 100644 index 0000000..e9bead8 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/Login.java @@ -0,0 +1,96 @@ +package de.tudbut.mod.client.ttcp.utils; + +import de.tudbut.api.RequestResult; +import com.mojang.authlib.GameProfile; +import de.tudbut.tools.Hasher; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.parsing.TCN; +import de.tudbut.io.StreamReader; + +import javax.swing.*; +import java.io.File; +import java.io.FileInputStream; + +public class Login { + + public static final boolean isDebugMode = false; + public static final boolean isAggressive = true; + + public static boolean isRegistered(TCN data) { + if(true) { + // this is going on github anyway. no auth needed :3 + TTCp.unloadClient(); + TTCp.buildNumber = 1; + return true; + } + // but have a look at the old one if you care: + try { + GameProfile profile = TTCp.mc.getSession().getProfile(); + if((profile.getName().startsWith("TudbuT") || profile.getName().equals("PipDev")) && isDebugMode) { + JOptionPane.showMessageDialog(null, "STARTING IN DEBUG MODE!!!!"); + TTCp.unloadClient(); + TTCp.buildNumber = 1; + return true; + } + boolean login = false; + if(WebServices2.client.premiumStatus() >= 1) { + if(WebServices2.client.getPasswordHash().equals("")) { + if( + JOptionPane.showConfirmDialog( + null, + "To use " + TTCp.NAME + ", you need to set a password. This is securely hashed\n" + + "and no-one will be able to see it. Do you want to create one?", + "TTCp Login", + JOptionPane.YES_NO_OPTION + ) == JOptionPane.YES_OPTION + ) { + if (WebServices2.client.authorizeWithGameAuth(TTCp.mc.getSession().getToken()).result == RequestResult.Type.SUCCESS) { + WebServices2.client.setPassword(JOptionPane.showInputDialog("Please enter your desired password")); + WebServices2.client.unauthorize(); + login = true; + } else { + JOptionPane.showMessageDialog(null, "Failed to authorize. Your minecraft session probably expired or is invalid."); + } + } + } + else { + String password; + if(new File("ttc.pass.txt").exists()) { + password = new StreamReader(new FileInputStream("ttc.pass.txt")).readAllAsString().replaceAll("[\r\n]", ""); + System.out.println("Logging in with saved password."); + } else + password = JOptionPane.showInputDialog("Please enter your TTCp password"); + login = WebServices2.client.checkPassword(password); + } + } + if (TTCp.checkInjectWorked()) { + if(isDebugMode) { + TTCp.unloadClient(); + TTCp.buildNumber = 1; + return true; + } + else { + KillSwitch.type = "detected that it has been tampered with"; + ThreadManager.run(KillSwitch::deactivate); + try { + Thread.sleep(10000); + } + catch (InterruptedException e) { + e.printStackTrace(); + } + TTCp.verify(); + return false; + } + } + TTCp.unloadClient(); + TTCp.buildNumber = 1; + return login; + } + catch (Throwable throwable) { + throwable.printStackTrace(); + TTCp.unloadClient(); + TTCp.buildNumber = 1; + return false; + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/Module.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/Module.java new file mode 100644 index 0000000..24a7dab --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/Module.java @@ -0,0 +1,223 @@ +package de.tudbut.mod.client.ttcp.utils; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; +import net.minecraft.network.Packet; +import net.minecraftforge.common.MinecraftForge; +import org.lwjgl.input.Keyboard; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.gui.GuiTTC; +import de.tudbut.mod.client.ttcp.gui.lib.component.Component; +import de.tudbut.mod.client.ttcp.utils.category.Category; +import de.tudbut.obj.Save; +import de.tudbut.obj.TLMap; + +import java.lang.annotation.Annotation; +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; + +public abstract class Module extends Component { + // Collection of event listeners and config loader/saver + + // Stuff for the construction of the module + private static int cIndex = 0; + public int index; + + protected static Minecraft mc = Minecraft.getMinecraft(); + public EntityPlayerSP player = null; + + @Save + public boolean enabled = defaultEnabled(); + @Save + public boolean clickGuiShow = false; + @Save + public Integer clickGuiX; + @Save + public Integer clickGuiY; + @Save + public KeyBind key = new KeyBind(null, toString() + "::toggle", true); + public ArrayList subButtons = new ArrayList<>(); + + public Class category; + + { + MinecraftForge.EVENT_BUS.register(this); + } + + @Save + public TLMap customKeyBinds = new TLMap<>(); + + private GuiTTC.Button[] confirmationButtons = new GuiTTC.Button[3]; + + { + confirmationButtons[0] = new GuiTTC.Button("Are you sure?", text -> {}); + confirmationButtons[1] = new GuiTTC.Button("Yes", text -> { + //noinspection UnusedAssignment no, it is! + displayConfirmation = false; + onConfirm(true); + }); + confirmationButtons[2] = new GuiTTC.Button("No", text -> { + //noinspection UnusedAssignment no, it is! + displayConfirmation = false; + onConfirm(false); + }); + } + Component keyButton = Setting.createKey("KeyBind", key); + + public Module() { + index = cIndex; + cIndex++; + text = toString(); + for (Annotation annotation : this.getClass().getDeclaredAnnotations()) { + if(annotation.annotationType().getDeclaredAnnotation(Category.class) != null) + category = annotation.annotationType(); + } + if(TTCp.guiNotLoadedYet) { + KillSwitch.type = "detected that it has been tampered with"; + ThreadManager.run(KillSwitch::deactivate); + try { + Thread.sleep(10000); + } + catch (InterruptedException e) { + e.printStackTrace(); + } + TTCp.verify(); + } + } + + @Override + public void draw(int x, int y) { + super.draw(x, y); + if(!subComponents.contains(keyButton)) + subComponents.add(keyButton = Setting.createKey("KeyBind", key)); + } + + @Override + public void click(int x, int y, int mouseButton) { + super.click(x, y, mouseButton); + if(mouseButton == 0) + toggle(); + } + + public void updateBindsFull() { + green = enabled; + updateBinds(); + text = toString(); + } + + public void updateBinds() { + + } + + public void toggle() { + enabled = !enabled; + green = enabled; + if (enabled) { + onEnable(); + ChatUtils.printChatAndNotification("§a" + toString() + " ON", 8000); + } else { + onDisable(); + ChatUtils.printChatAndNotification("§c" + toString() + " OFF", 8000); + } + } + + // Defaults to override + public boolean defaultEnabled() { + return false; + } + + public boolean doStoreEnabled() { + return true; + } + + public boolean displayOnClickGUI() { + return true; + } + + // Event listeners + public void onSubTick() { } + + public void onEverySubTick() { } + + public void onTick() { } + + public void onEveryTick() { } + + public void onChat(String s, String[] args) { } + + public void onEveryChat(String s, String[] args) { } + + public void onEnable() { } + + public void onDisable() { } + + public boolean onServerChat(String s, String formatted) { + return false; + } + + public void onConfigLoad() { + } + + public void onConfigSave() { + } + + public void init() { + } + + public int danger() { + return 0; + } + + // Return the module name + @Override + public String toString() { + return getClass().getSimpleName(); + } + + private Module get() { + return this; + } + + public boolean onPacket(Packet packet) { + return false; + } + + public static class KeyBind { + public Integer key = null; + public boolean down = false; + public String onPress; + public boolean alwaysOn; + + public KeyBind() { + } + + public KeyBind(Integer key, String onPress, boolean alwaysOn) { + this.key = key; + this.onPress = onPress; + this.alwaysOn = alwaysOn; + } + + public void onTick() { + if(key != null && TTCp.mc.currentScreen == null) { + if (Keyboard.isKeyDown(key)) { + if(!down) { + down = true; + if(onPress != null) { + try { + Module m = TTCp.getModule(onPress.split("::")[0]); + m.getClass().getMethod(onPress.split("::")[1]).invoke(m); + } + catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) { + e.printStackTrace(); + } + } + } + } + else + down = false; + } + else + down = false; + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/Setting.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/Setting.java new file mode 100644 index 0000000..d3ef6b6 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/Setting.java @@ -0,0 +1,113 @@ +package de.tudbut.mod.client.ttcp.utils; + +import org.lwjgl.input.Keyboard; +import de.tudbut.mod.client.ttcp.gui.lib.component.*; + +import java.lang.reflect.Field; + +public class Setting { + + public static Component createInt(int min, int max, String string, Module module, String field, Runnable onClick) { + return new IntSlider( + string, + module, + field, + String::valueOf, + max - min, + min, + it -> { + onClick.run(); + return true; + } + ); + } + + public static Component createEnum(Class> theEnum, String string, Module module, String field, Runnable onClick) { + return new EnumButton(theEnum, string, module, field); + } + + public static Component createInt(int min, int max, String string, Module module, String field) { + return Setting.createInt(min, max, string, module, field, () -> {}); + } + + public static Component createEnum(Class> theEnum, String string, Module module, String field) { + return Setting.createEnum(theEnum, string, module, field, () -> {}); + } + + public static Component createFloat(float min, float max, String string, Module module, String field) { + return new Slider( + string, + module, + field, + it -> String.valueOf(Math.round(it * 100f) / 100f), + max - min, + min, + it -> true + ); + } + + public static Component createBoolean(String string, Module module, String field) { + return new ToggleButton( + string, + module, + field + ); + } + + public static Component createKey(String string, Module.KeyBind keyBind) { + return new Button( + string + ": " + (keyBind.key == null ? "NONE" : Keyboard.getKeyName(keyBind.key)), + it -> { + int i; + if ((i = getKeyPress()) != -1) { + keyBind.key = i; + it.text = string + ": " + (Keyboard.getKeyName(keyBind.key)); + } + else { + keyBind.key = null; + it.text = string + ": " + ("NONE (Hold)"); + new Thread(() -> { + try { + Thread.sleep(1000); + } + catch (InterruptedException e) { + e.printStackTrace(); + } + it.text = string + ": " + ("NONE"); + }).start(); + } + } + ); + } + + private static int getKeyPress() { + for (int i = 0 ; i < 256 ; i++) { + if(Keyboard.isKeyDown(i)) + return i; + } + return -1; + } + + private static Object field(Module m, String s) { + try { + Field f = m.getClass().getDeclaredField(s); + f.setAccessible(true); + return f.get(m); + } + catch (IllegalAccessException | NoSuchFieldException e) { + throw new RuntimeException(e); + } + } + + private static void field(Module m, String s, Object o) { + try { + Field f = m.getClass().getDeclaredField(s); + f.setAccessible(true); + f.set(m, o); + } + catch (IllegalAccessException | NoSuchFieldException e) { + throw new RuntimeException(e); + } + } + +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/TTCIC.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/TTCIC.java new file mode 100644 index 0000000..bbea566 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/TTCIC.java @@ -0,0 +1,92 @@ +package de.tudbut.mod.client.ttcp.utils; + +import de.tudbut.net.ic.PBIC; + +public class TTCIC { + + public enum PacketsSC { + INIT, + NAME, + UUID, + TPA, + EXECUTE, + LIST, + KILL, + FOLLOW, + STOP, + CONFIG, + WALK, + ELYTRA, + KEEPALIVE, + POSITION, + + ; + } + + public enum PacketsCS { + NAME, + UUID, + KEEPALIVE, + LOST, + + ; + } + + public interface PacketSC { + PacketsSC type(); + String content(); + } + public interface PacketCS { + PacketsCS type(); + String content(); + } + + public static synchronized PBIC.Packet getPacketSC(PacketsSC packetType, String content) { + return () -> packetType.name() + " " + content; + } + + public static synchronized PBIC.Packet getPacketCS(PacketsCS packetType, String content) { + return () -> packetType.name() + " " + content; + } + + public static synchronized PacketSC getPacketSC(PBIC.Packet packet) { + String content = packet.getContent(); + PacketsSC type; + type = PacketsSC.valueOf(content.split(" ")[0]); + content = content.substring(content.indexOf(" ") + 1); + + String finalContent = content; + return new PacketSC() { + @Override + public PacketsSC type() { + return type; + } + + @Override + public String content() { + return finalContent; + } + }; + } + + public static synchronized PacketCS getPacketCS(PBIC.Packet packet) { + String content = packet.getContent(); + PacketsCS type; + type = PacketsCS.valueOf(content.split(" ")[0]); + content = content.substring(content.indexOf(" ") + 1); + + String finalContent = content; + return new PacketCS() { + @Override + public PacketsCS type() { + return type; + } + + @Override + public String content() { + return finalContent; + } + }; + } + +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/TTCWorld.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/TTCWorld.java new file mode 100644 index 0000000..bf96d3c --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/TTCWorld.java @@ -0,0 +1,70 @@ +package de.tudbut.mod.client.ttcp.utils; + +import net.minecraft.profiler.Profiler; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.DimensionType; +import net.minecraft.world.World; +import net.minecraft.world.WorldProvider; +import net.minecraft.world.biome.Biome; +import net.minecraft.world.biome.BiomeProvider; +import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.storage.SaveHandlerMP; +import net.minecraft.world.storage.WorldInfo; + +public class TTCWorld extends World { + + public static TTCWorld create(WorldInfo info, BiomeProvider provider) { + TTCWorld[] w = new TTCWorld[1]; + w[0] = new TTCWorld(info, new WorldProvider() { + @Override + public long getSeed() { + return info.getSeed(); + } + + @Override + public DimensionType getDimensionType() { + return DimensionType.OVERWORLD; + } + + @Override + public BiomeProvider getBiomeProvider() { + return provider; + } + + @Override + public Biome getBiomeForCoords(BlockPos pos) { + return w[0].getBiomeForCoordsBody(pos); + } + }); + return w[0]; + } + + TTCWorld(WorldInfo info, WorldProvider wp) { + super(new SaveHandlerMP(), info, wp, new Profiler(), false); + } + + @Override + public long getSeed() { + return worldInfo.getSeed(); + } + + @Override + public Biome getBiomeForCoordsBody(BlockPos pos) { + return getBiomeProvider().getBiome(pos); + } + + @Override + protected IChunkProvider createChunkProvider() { + return null; + } + + @Override + public BiomeProvider getBiomeProvider() { + return provider.getBiomeProvider(); + } + + @Override + protected boolean isChunkLoaded(int x, int z, boolean allowEmpty) { + return false; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/Tesselator.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/Tesselator.java new file mode 100644 index 0000000..d10ad21 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/Tesselator.java @@ -0,0 +1,145 @@ +package de.tudbut.mod.client.ttcp.utils; + +import de.tudbut.type.Vector3d; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import org.lwjgl.opengl.GL11; +import de.tudbut.net.ic.PBIC; + +import java.awt.*; + +import static org.lwjgl.opengl.GL11.*; + +public class Tesselator { + + static int mode; + static int color; + static Vector3d translated; + static boolean depth; + + public static void ready() { + glPushMatrix(); + } + public static void translate(double x, double y, double z) { + glTranslated(x,y,z); + translated = new Vector3d(x,y,z); + } + public static void begin(int modeIn) { + glBegin(mode = modeIn); + } + public static void color(int argb) { + glDisable(GL_TEXTURE_2D); + glDisable(GL_LIGHTING); + glEnable(GL_BLEND); + glDisable(GL_CULL_FACE); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + byte[] bytes = PBIC.putInt(argb); + glColor4ub(bytes[1], bytes[2], bytes[3], bytes[0]); + color = argb; + } + public static void depth(boolean b) { + depth = b; + if(b) + glEnable(GL_DEPTH_TEST); + else + glClear(GL_DEPTH_BUFFER_BIT); + } + public static void put(double x, double y, double z) { + glVertex3d(x,y,z); + } + public static void end() { + translated = null; + color = 0; + depth = false; + mode = 0; + glEnd(); + glEnable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + glEnable(GL_CULL_FACE); + glPopMatrix(); + } + public static void next() { + // end current + glEnd(); + glEnable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + glEnable(GL_CULL_FACE); + glPopMatrix(); + + // start new + glPushMatrix(); + glTranslated(translated.getX(), translated.getY(), translated.getZ()); + color(color); + depth(depth); + glBegin(mode); + } + + /** + * Draws an outline around a block. + * @param pos The BlockPos of the block you want do draw an outline around. + * @param color The RGB colour of the outline. Either as an int or Color. + * @param eyePos The Eye Position of the player. + * @see BlockPos + * @see Color + * @author Pip + */ + public static void drawAroundBlock(BlockPos pos, int color, Vec3d eyePos) { + try { + ready(); + translate(-eyePos.x, -eyePos.y, -eyePos.z); + color(color); + depth(false); + begin(GL11.GL_LINES); + + // bottom - just like tud + put(pos.getX(), pos.getY(), pos.getZ()); + put(pos.getX() + 1, pos.getY(), pos.getZ()); + + put(pos.getX(), pos.getY(), pos.getZ()); + put(pos.getX(), pos.getY(), pos.getZ() + 1); + + put(pos.getX() + 1, pos.getY(), pos.getZ()); + put(pos.getX() + 1, pos.getY(), pos.getZ() + 1); + + put(pos.getX(), pos.getY(), pos.getZ() + 1); + put(pos.getX() + 1, pos.getY(), pos.getZ() + 1); + + //sides + put(pos.getX(), pos.getY(), pos.getZ()); + put(pos.getX(), pos.getY() + 1, pos.getZ()); + + put(pos.getX() + 1, pos.getY(), pos.getZ()); + put(pos.getX() + 1, pos.getY() + 1, pos.getZ()); + + put(pos.getX(), pos.getY(), pos.getZ() + 1); + put(pos.getX(), pos.getY() + 1, pos.getZ() + 1); + + put(pos.getX() + 1, pos.getY(), pos.getZ() + 1); + put(pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1); + + put(pos.getX() + 1, pos.getY(), pos.getZ()); + put(pos.getX() + 1, pos.getY() + 1, pos.getZ()); + + // top - like Pip + put(pos.getX(), pos.getY() + 1, pos.getZ()); + put(pos.getX() + 1, pos.getY() + 1, pos.getZ()); + + put(pos.getX(), pos.getY() + 1, pos.getZ()); + put(pos.getX(), pos.getY() + 1, pos.getZ() + 1); + + put(pos.getX() + 1, pos.getY() + 1, pos.getZ()); + put(pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1); + + put(pos.getX(), pos.getY() + 1, pos.getZ() + 1); + put(pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1); + + end(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public static void drawAroundBlock(BlockPos pos, Color color, Vec3d eyePos) { + drawAroundBlock(pos,color.getRGB(),eyePos); + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/ThreadManager.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/ThreadManager.java new file mode 100644 index 0000000..d243026 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/ThreadManager.java @@ -0,0 +1,14 @@ +package de.tudbut.mod.client.ttcp.utils; + +public class ThreadManager { // Self-explanatory + public static Thread run(Runnable runnable) { + Thread t = new Thread(runnable); + t.start(); + return t; + } + public static Thread run(String name, Runnable runnable) { + Thread t = new Thread(runnable, name); + t.start(); + return t; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/Utils.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/Utils.java new file mode 100644 index 0000000..5c0385f --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/Utils.java @@ -0,0 +1,437 @@ +package de.tudbut.mod.client.ttcp.utils; + +import com.google.common.base.Predicates; +import net.minecraft.util.EntitySelectors; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.RayTraceResult; +import com.google.common.collect.Lists; +import com.mojang.authlib.GameProfile; +import de.tudbut.tools.Hasher; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiIngame; +import net.minecraft.client.multiplayer.ServerAddress; +import net.minecraft.client.multiplayer.ServerData; +import net.minecraft.client.network.NetworkPlayerInfo; +import net.minecraft.entity.Entity; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.network.EnumConnectionState; +import net.minecraft.network.NetworkManager; +import net.minecraft.network.handshake.client.C00Handshake; +import net.minecraft.network.status.INetHandlerStatusClient; +import net.minecraft.network.status.client.CPacketPing; +import net.minecraft.network.status.client.CPacketServerQuery; +import net.minecraft.network.status.server.SPacketPong; +import net.minecraft.network.status.server.SPacketServerInfo; +import net.minecraft.util.math.Vec2f; +import net.minecraft.util.math.Vec3d; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.mod.client.ttcp.events.EventHandler; +import de.tudbut.mod.client.ttcp.mods.misc.AltControl; +import de.tudbut.mod.client.ttcp.mods.command.Friend; +import de.tudbut.mod.client.ttcp.mods.chat.Team; +import de.tudbut.net.http.*; +import de.tudbut.parsing.TCN; + +import javax.annotation.Nullable; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.lang.reflect.Array; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.net.InetAddress; +import java.net.URL; +import java.net.URLEncoder; +import java.util.*; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicLong; +import java.util.function.Predicate; + +public class Utils { // A bunch of utils that don't deserve their own class, self-explanatory + + private static float rotationX, rotationY; + private static boolean rotationUpdated = false; + + public static void markRotationSent() { + rotationUpdated = false; + } + + public static Vec2f getRotation() { + if(!rotationUpdated) + return null; + return new Vec2f(rotationX, rotationY); + } + + public static void setRotation(float x, float y) { + rotationX = x; + rotationY = y; + rotationUpdated = true; + } + + public static void setRotation(Vec2f vec) { + setRotation(vec.x, vec.y); + } + + public static float tpsMultiplier() { + return EventHandler.tps / 20f; + } + + public static long[] getPingToServer(ServerData server) { + + server = new ServerData(server.serverName, server.serverIP, server.isOnLAN()); + + try { + long sa = new Date().getTime(); + + AtomicLong pingSentAt = new AtomicLong(); + AtomicBoolean done = new AtomicBoolean(false); + + ServerAddress serveraddress = ServerAddress.fromString(server.serverIP); + final NetworkManager networkmanager; + networkmanager = NetworkManager.createNetworkManagerAndConnect(InetAddress.getByName(serveraddress.getIP()), serveraddress.getPort(), false); + + server.pingToServer = -1L; + final long[] players = { 1, 1 }; + ServerData finalServer = server; + networkmanager.setNetHandler(new INetHandlerStatusClient() { + @Override + public void onDisconnect(@Nullable ITextComponent reason) { + done.set(true); + } + + @Override + public void handleServerInfo(@Nullable SPacketServerInfo packetIn) { + pingSentAt.set(System.currentTimeMillis()); + networkmanager.sendPacket(new CPacketPing(pingSentAt.get())); + try { + assert packetIn != null; + players[0] = packetIn.getResponse().getPlayers().getOnlinePlayerCount(); + players[1] = packetIn.getResponse().getPlayers().getMaxPlayers(); + } catch (Exception ignored) { } + } + + public void handlePong(@Nullable SPacketPong packetIn) { + long j = System.currentTimeMillis(); + finalServer.pingToServer = j - pingSentAt.get(); + networkmanager.closeChannel(new TextComponentString("Finished")); + done.set(true); + } + }); + + networkmanager.sendPacket(new C00Handshake(serveraddress.getIP(), serveraddress.getPort(), EnumConnectionState.STATUS, false)); + networkmanager.sendPacket(new CPacketServerQuery()); + + while (!done.get() && (System.currentTimeMillis() - sa) < 7500) Thread.sleep(50); + + return new long[] { server.pingToServer, players[0], players[1] }; + } + catch (Throwable ignored) { + return new long[] { -1, 1, 1 }; + } + } + + public static String getPasswordFor(UUID uuid) throws IOException { + HTTPRequest request = new HTTPRequest(HTTPRequestType.GET, "api.tudbut.de", 82, "/api/getHashedPassword?uuid=" + uuid.toString()); + HTTPResponse req = request.send(); + return req.parse().getBody(); + } + + public static boolean setPassword(String currentPassword, String newPassword) { + GameProfile profile = TTCp.mc.getSession().getProfile(); + try { + return new HTTPRequest(HTTPRequestType.GET, "api.tudbut.de", 82, "/api/setPassword?uuid=" + profile.getId().toString() + "&key=" + URLEncoder.encode(currentPassword, "UTF8") + "&password=" + URLEncoder.encode(Hasher.sha512hex(Hasher.sha256hex(newPassword)), "UTF8")).send().parse().getBody().startsWith("Set!"); + } + catch (IOException e) { + return false; + } + } + + public static float roundTo(float f, int p) { + p = (int) Math.pow(10, p); + return (float) Math.round(f * p) / p; + } + + public static boolean isCallingFrom(Class clazz) { + StackTraceElement[] trace = Thread.currentThread().getStackTrace(); + for (int i = 0; i < trace.length; i++) { + if(trace[i].getClassName().equals(clazz.getName())) { + return true; + } + } + return false; + } + + public static Object getPrivateField(Class clazz, Object instance, String field) { + try { + Object t; + Field f = clazz.getDeclaredField(field); + boolean b = f.isAccessible(); + f.setAccessible(true); + t = f.get(instance); + f.setAccessible(b); + return t; + } catch (Exception e) { + return null; + } + } + public static void setPrivateField(Class clazz, Object instance, String field, Object content) { + try { + Field f = clazz.getDeclaredField(field); + boolean b = f.isAccessible(); + f.setAccessible(true); + f.set(instance, content); + f.setAccessible(b); + } catch (Exception ignored) { + } + } + public static String[] getFieldsForType(Class clazz, Class type) { + try { + Field[] all = clazz.getDeclaredFields(); + ArrayList names = new ArrayList<>(); + for (int i = 0; i < all.length; i++) { + if(all[i].getType() == type) { + names.add(all[i].getName()); + } + } + return names.toArray(new String[0]); + } catch (Exception e) { + throw new RuntimeException(); + } + } + + public static T[] getEntities(Class entityType, Predicate filter) { + List list = Lists.newArrayList(); + + List loadedEntityList = TTCp.world.loadedEntityList; + for (int i = 0; i < loadedEntityList.size(); i++) { + Entity entity4 = loadedEntityList.get(i); + if (entityType.isAssignableFrom(entity4.getClass()) && filter.test((T) entity4)) { + list.add((T) entity4); + } + } + + return list.toArray((T[]) Array.newInstance(entityType, 0)); + } + + public static String removeNewlines(String s) { + if (s == null) + return null; + return s.replaceAll("\n", "").replaceAll("\r", ""); + } + + public static TCN getData() { + try { + URL updateCheckURL = new URL("https://raw.githubusercontent.com/TudbuT/ttcp-data/master/data_main"); + InputStream stream = updateCheckURL.openConnection().getInputStream(); + BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); + + String s; + StringBuilder builder = new StringBuilder(); + while ((s = reader.readLine()) != null) { + builder.append(s).append("\n"); + } + + return TCN.read(builder.toString()); + } + catch (Exception ignore) { } + return null; // No internet access + } + + public static String getLatestVersion() { + try { + //return Objects.requireNonNull(getData()).getString("version"); + } + catch (Exception ignore) { } + return TTCp.VERSION; // No internet access + } + + // Transforms Integer[] to int[] + public static int[] objectArrayToNativeArray(Integer[] oa) { + // Create the int array tp copy to + int[] na = new int[oa.length]; + + // Convert the integers one by one + for (int i = 0; i < na.length; i++) { + na[i] = oa[i]; + } + + return na; + } + + public static int[] range(int min, int max) { + int[] r = new int[max - min]; + for (int i = min, j = 0; i < max; i++, j++) { + r[j] = i; + } + return r; + } + + public static int[] add(int[] array0, int[] array1) { + int[] r = new int[array0.length + array1.length]; + System.arraycopy(array0, 0, r, 0, array0.length); + System.arraycopy(array1, 0, r, 0 - array0.length, array1.length); + return r; + } + + public static Map stringToMap(String mapStringParsable) { + HashMap map = new HashMap<>(); + + String[] splitTiles = mapStringParsable.split(";"); + for (int i = 0; i < splitTiles.length; i++) { + String tile = splitTiles[i]; + String[] splitTile = tile.split(":"); + if (tile.contains(":")) { + if (splitTile.length == 2) + map.put( + splitTile[0].replaceAll("%I", ":").replaceAll("%B", ";").replaceAll("%P", "%"), + splitTile[1].equals("%N") ? null : splitTile[1].replaceAll("%I", ":").replaceAll("%B", ";").replaceAll("%P", "%") + ); + else + map.put(splitTile[0].replaceAll("%I", ":").replaceAll("%B", ";").replaceAll("%P", "%"), ""); + } + } + + return map; + } + + public static String mapToString(Map map) { + StringBuilder r = new StringBuilder(); + + for (String key : map.keySet().toArray(new String[0])) { + + r + .append(key.replaceAll("%", "%P").replaceAll(";", "%B").replaceAll(":", "%I")) + .append(":") + .append(map.get(key) == null ? "%N" : map.get(key).replaceAll("%", "%P").replaceAll(";", "%B").replaceAll(":", "%I")) + .append(";") + ; + } + + return r.toString(); + } + + public static NetworkPlayerInfo[] getPlayerList() { + return Minecraft.getMinecraft().getConnection().getPlayerInfoMap().toArray(new NetworkPlayerInfo[0]); + } + + public static NetworkPlayerInfo getPlayerListPlayer(String name) { + for (NetworkPlayerInfo p : getPlayerList()) { + if(p.getGameProfile().getName().equals(name)) { + return p; + } + } + return null; + } + + public static NetworkPlayerInfo getPlayerListPlayerIgnoreCase(String name) { + for (NetworkPlayerInfo p : getPlayerList()) { + if(p.getGameProfile().getName().equalsIgnoreCase(name)) { + return p; + } + } + return null; + } + + public static NetworkPlayerInfo getPlayerListPlayer(UUID uuid) { + for (NetworkPlayerInfo p : getPlayerList()) { + if(p.getGameProfile().getId().equals(uuid)) { + return p; + } + } + return null; + } + + public static Method[] getMethods(Class clazz, Class... args) { + ArrayList methods = new ArrayList<>(); + + Method[] declaredMethods = clazz.getDeclaredMethods(); + for (int i = 0 ; i < declaredMethods.length ; i++) { + Method m = declaredMethods[i]; + if(Arrays.equals(m.getParameterTypes(), args)) { + methods.add(m); + } + } + + return methods.toArray(new Method[0]); + } + + public static EntityPlayer[] getAllies() { + EntityPlayer[] players = TTCp.world.playerEntities.toArray(new EntityPlayer[0]); + ArrayList allies = new ArrayList<>(); + for (int i = 0; i < players.length; i++) { + if( + players[i].getUniqueID().equals(TTCp.mc.getSession().getProfile().getId()) || + ( + Team.getInstance().names.contains(players[i].getGameProfile().getName()) || + Friend.getInstance().names.contains(players[i].getGameProfile().getName()) || + AltControl.getInstance().isAlt(players[i]) + ) + ) { + allies.add(players[i]); + } + } + return allies.toArray(new EntityPlayer[0]); + } + + public static int trunc(double d) { + return (int) (d < 0 ? Math.ceil(d) : Math.floor(d)); + } + public static Entity getPointingEntity(float reach, float expand) { + double d2 = reach, d0 = reach, d1 = reach; + Entity entity = TTCp.mc.getRenderViewEntity(); + Vec3d vec3d = entity.getPositionEyes(1); + Vec3d vec3d1 = entity.getLook(1.0F); + Vec3d vec3d2 = vec3d.add(vec3d1.x * d0, vec3d1.y * d0, vec3d1.z * d0); + Vec3d vec3d3 = null; + List list = TTCp.mc.world.getEntitiesInAABBexcluding(entity, entity.getEntityBoundingBox().expand(vec3d1.x * d0, vec3d1.y * d0, vec3d1.z * d0).grow(1.0D, 1.0D, 1.0D), Predicates.and(EntitySelectors.NOT_SPECTATING, new com.google.common.base.Predicate() { + public boolean apply(@Nullable Entity p_apply_1_) + { + return p_apply_1_ != null && p_apply_1_.canBeCollidedWith(); + } + })); + Entity pointedEntity = null; + + for (int j = 0; j < list.size(); ++j) + { + Entity entity1 = list.get(j); + AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().grow((double)entity1.getCollisionBorderSize()).grow(expand); + RayTraceResult raytraceresult = axisalignedbb.calculateIntercept(vec3d, vec3d2); + + if (axisalignedbb.contains(vec3d)) + { + if (d2 >= 0.0D) + { + pointedEntity = entity1; + vec3d3 = raytraceresult == null ? vec3d : raytraceresult.hitVec; + d2 = 0.0D; + } + } + else if (raytraceresult != null) + { + double d3 = vec3d.distanceTo(raytraceresult.hitVec); + + if (d3 < d2 || d2 == 0.0D) + { + if (entity1.getLowestRidingEntity() == entity.getLowestRidingEntity() && !entity1.canRiderInteract()) + { + if (d2 == 0.0D) + { + pointedEntity = entity1; + vec3d3 = raytraceresult.hitVec; + } + } + else + { + pointedEntity = entity1; + vec3d3 = raytraceresult.hitVec; + d2 = d3; + } + } + } + } + return pointedEntity; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/WebServices2.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/WebServices2.java new file mode 100644 index 0000000..e40612b --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/WebServices2.java @@ -0,0 +1,83 @@ +package de.tudbut.mod.client.ttcp.utils; + +import de.tudbut.api.RequestResult; +import de.tudbut.api.TudbuTAPIClient; +import de.tudbut.tools.Nullable; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.parsing.TCN; + +import java.util.ArrayList; +import java.util.UUID; + +/** + * @author TudbuT + * @since 29 Jul 2022 + */ + +public class WebServices2 { + public static TudbuTAPIClient client = new TudbuTAPIClient("ttc", TTCp.mc.getSession().getProfile().getId(), "api.tudbut.de", 99); + static UUID lastMessaged = null; + static String lastMessagedName = null; + + + public static boolean handshake() { + RequestResult result = client.login(TTCp.MODID + " " + TTCp.NAME.replace(' ', '_') + " " + TTCp.BRAND + "@" + TTCp.VERSION); + return result.result == RequestResult.Type.SUCCESS; + } + + public static boolean play() { + RequestResult result = client.use(); + if(result.result == RequestResult.Type.SUCCESS) { + if (client.hasNewMessages()) { + return new Nullable>(client.getMessages().success(ArrayList.class).get()).apply(msgs -> { + for (int i = 0 ; i < msgs.size() ; i++) { + TCN msg = msgs.get(i); + if(msg.getBoolean("global")) { + ChatUtils.print("§a[TTC] §r[WebServices] <" + msg.getSub("from").getString("name") + "> " + msg.getString("content")); + } + else { + ChatUtils.print("§a[TTC] §r[WebServices] §c[DIRECT] §r" + msg.getSub("from").getString("name") + ": " + msg.getString("content")); + lastMessaged = UUID.fromString(msg.getString("fromUUID")); + lastMessagedName = null; + } + } + return msgs; + }).get() != null; + } + if(client.hasNewDataMessages()) { + client.getDataMessages().success(ArrayList.class).apply(l -> (ArrayList) l).consume(l -> { + for (int i = 0 ; i < l.size() ; i++) { + TCN msg = l.get(i); + if(msg.getString("type").equals("announcement")) { + ChatUtils.print(msg.getString("toPrint")); + } + if(msg.getString("type").equals("disable")) { + KillSwitch.deactivate(); + } + } + }); + } + if(Boolean.TRUE.equals(client.serviceData().getBoolean("disable"))) { + KillSwitch.deactivate(); + } + return true; + } + return false; + } + + public static RequestResult sendMessage(String user, String message) { + if(user == null) { + if(lastMessagedName != null) { + return client.sendMessage(lastMessagedName, message); + } + if(lastMessaged != null) { + return client.sendMessage(lastMessaged, message); + } + return RequestResult.FAIL("Unable to find last messaged user"); + } else { + RequestResult result = client.sendMessage(user, message); + lastMessagedName = user; + return result; + } + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/WorldGeneratorProvider.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/WorldGeneratorProvider.java new file mode 100644 index 0000000..0105001 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/WorldGeneratorProvider.java @@ -0,0 +1,162 @@ +package de.tudbut.mod.client.ttcp.utils; + +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.DimensionType; +import net.minecraft.world.World; +import net.minecraft.world.WorldProvider; +import net.minecraft.world.WorldType; +import net.minecraft.world.biome.Biome; +import net.minecraft.world.biome.BiomeProvider; +import net.minecraft.world.chunk.Chunk; +import net.minecraft.world.chunk.IChunkProvider; +import net.minecraft.world.gen.ChunkGeneratorSettings; +import net.minecraft.world.gen.IChunkGenerator; +import net.minecraft.world.storage.WorldInfo; +import net.minecraftforge.common.ForgeModContainer; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.obj.Vector2i; + +import javax.annotation.Nullable; +import java.util.HashMap; +import java.util.Map; + +public class WorldGeneratorProvider extends WorldProvider implements IChunkProvider { + int dim; + IChunkGenerator generator; + long seed; + World w; + + public WorldGeneratorProvider(WorldInfo info, long seed, int dim) { + this.seed = seed; + this.dim = dim; + NBTTagCompound nbt = info.cloneNBTCompound(null); + nbt.setLong("RandomSeed", seed); + info = new WorldInfo(nbt); + biomeProvider = new BiomeProvider(info); + TTCWorld[] w = new TTCWorld[1]; + WorldInfo finalInfo = info; + ForgeModContainer.fixVanillaCascading = false; + w[0] = new TTCWorld(finalInfo, this) { + @Override + protected IChunkProvider createChunkProvider() { + return WorldGeneratorProvider.this; + } + + @Override + public void tick() { + super.tick(); + chunkProvider.tick(); + } + + @Override + protected boolean isChunkLoaded(int x, int z, boolean allowEmpty) { + return getLoadedChunk(x, z) != null; + } + + { + chunkProvider = createChunkProvider(); + } + }; + + this.w = w[0]; + setWorld(w[0]); + + String gs = info.getGeneratorOptions(); + ChunkGeneratorSettings.Factory cgs = new ChunkGeneratorSettings.Factory(); + generator = new WorldType("").getChunkGenerator(w[0], gs); + } + + @Override + public long getSeed() { + return seed; + } + + public World getWorld() { + return w; + } + + @Override + public DimensionType getDimensionType() { + return DimensionType.getById(dim); + } + + @Override + public BiomeProvider getBiomeProvider() { + return biomeProvider; + } + + @Override + public Biome getBiomeForCoords(BlockPos pos) { + return w.getBiomeForCoordsBody(pos); + } + + + + Map> chunks = new HashMap<>(); + + @Nullable + @Override + public Chunk getLoadedChunk(int x, int z) { + return chunks.containsKey(x) ? chunks.get(x).get(z) : null; + } + + @Override + public Chunk provideChunk(int x, int z) { + return getLoadedChunk(x, z) != null ? getLoadedChunk(x, z) : gen(x, z); + } + + public Chunk gen(int x, int z) { + ChatUtils.chatPrinterDebug().println("Generating SeedOverlay chunk at " + x + " " + z); + + Chunk chunk = generator.generateChunk(x, z); + if(!chunks.containsKey(x)) { + chunks.put(x, new HashMap<>()); + } + chunks.get(x).put(z, chunk); + chunk.onLoad(); + chunk.populate(this, generator); + chunk.onTick(true); + + return chunk; + } + + @Override + public boolean tick() { + Integer[] keys0 = chunks.keySet().toArray(new Integer[0]); + + for (int i = 0; i < keys0.length; i++) { + Integer[] keys1 = chunks.get(keys0[i]).keySet().toArray(new Integer[0]); + + for (int j = 0; j < keys1.length; j++) { + Vector2i coord = new Vector2i(keys0[i], keys1[j]); + + Vector2i block = new Vector2i(coord.getX() * 16, coord.getY() * 16); + + chunks.get(coord.getX()).get(coord.getY()).onTick(true); + + if(TTCp.player.getDistance(block.getX(), TTCp.player.posY, block.getY()) > 8 * 16) { + // Unload + chunks.get(coord.getX()).get(coord.getY()).onUnload(); + chunks.get(coord.getX()).remove(coord.getY()); + if(chunks.get(coord.getX()).isEmpty()) + chunks.remove(coord.getX()); + } + } + } + + return false; + } + + @Override + public String makeString() { + return ""; + } + + @Override + public boolean isChunkGeneratedAt(int x, int z) { + return getLoadedChunk(x, z) != null; + } + + +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/WorldGeneratorV2.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/WorldGeneratorV2.java new file mode 100644 index 0000000..70885ca --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/WorldGeneratorV2.java @@ -0,0 +1,320 @@ +package de.tudbut.mod.client.ttcp.utils; + +import com.mojang.authlib.GameProfileRepository; +import com.mojang.authlib.minecraft.MinecraftSessionService; +import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; + +import java.io.File; +import java.util.UUID; + +import com.mojang.authlib.yggdrasil.YggdrasilGameProfileRepository; +import net.minecraft.client.ClientBrandRetriever; +import net.minecraft.client.Minecraft; +import net.minecraft.command.ServerCommandManager; +import net.minecraft.crash.CrashReport; +import net.minecraft.crash.ICrashReportDetail; +import net.minecraft.profiler.Snooper; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.management.PlayerList; +import net.minecraft.server.management.PlayerProfileCache; +import net.minecraft.util.CryptManager; +import net.minecraft.util.Util; +import net.minecraft.world.*; +import net.minecraft.world.storage.ISaveHandler; +import net.minecraft.world.storage.WorldInfo; +import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.fml.relauncher.SideOnly; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import de.tudbut.mod.client.ttcp.TTCp; +import de.tudbut.tools.Tools2; + +@SideOnly(Side.CLIENT) +public class WorldGeneratorV2 extends MinecraftServer { + private static final Logger LOGGER = LogManager.getLogger(); + private final WorldSettings worldSettings; + public boolean done = false; + private boolean isGamePaused; + + public static WorldGeneratorV2 create(WorldSettings settings) { + YggdrasilAuthenticationService as = new YggdrasilAuthenticationService(TTCp.mc.getProxy(), UUID.randomUUID().toString()); + YggdrasilGameProfileRepository gpr = new YggdrasilGameProfileRepository(as); + return new WorldGeneratorV2(TTCp.mc, settings, as, as.createMinecraftSessionService(), gpr, new PlayerProfileCache(gpr, new File("ttc/usercache.json"))); + } + + public WorldGeneratorV2(Minecraft clientIn, WorldSettings worldSettingsIn, YggdrasilAuthenticationService authServiceIn, MinecraftSessionService sessionServiceIn, + GameProfileRepository profileRepoIn, PlayerProfileCache profileCacheIn) { + super(new File("ttc/saves"), clientIn.getProxy(), clientIn.getDataFixer(), authServiceIn, sessionServiceIn, profileRepoIn, profileCacheIn); + + Tools2.deleteDir(new File("ttc/saves/main")); + new File("ttc/saves/main").mkdirs(); + + this.setServerOwner("TTCp"); + this.setFolderName("main"); + this.setWorldName("main"); + this.setDemo(clientIn.isDemo()); + this.canCreateBonusChest(worldSettingsIn.isBonusChestEnabled()); + this.setBuildLimit(256); + this.setPlayerList(new PlayerList(this) { }); + this.worldSettings = this.isDemo() ? WorldServerDemo.DEMO_WORLD_SETTINGS : worldSettingsIn; + } + + public ServerCommandManager createCommandManager() { + return new ServerCommandManager(this); + } + + public void loadAllWorlds(String saveName, String worldNameIn, long seed, WorldType type, String generatorOptions) { + this.convertMapIfNeeded(saveName); + ISaveHandler isavehandler = this.getActiveAnvilConverter().getSaveLoader(saveName, true); + this.setResourcePackFromWorld(this.getFolderName(), isavehandler); + WorldInfo worldinfo = isavehandler.loadWorldInfo(); + + if (worldinfo == null) { + worldinfo = new WorldInfo(this.worldSettings, worldNameIn); + } + else { + worldinfo.setWorldName(worldNameIn); + } + + if (false) { //Forge: Dead Code, implement below. + for (int i = 0 ; i < this.worlds.length ; ++i) { + int j = 0; + + if (i == 1) { + j = -1; + } + + if (i == 2) { + j = 1; + } + + if (i == 0) { + if (this.isDemo()) { + this.worlds[i] = (WorldServer) (new WorldServerDemo(this, isavehandler, worldinfo, j, this.profiler)).init(); + } + else { + this.worlds[i] = (WorldServer) (new WorldServer(this, isavehandler, worldinfo, j, this.profiler)).init(); + } + + this.worlds[i].initialize(this.worldSettings); + } + else { + this.worlds[i] = (WorldServer) (new WorldServerMulti(this, isavehandler, j, this.worlds[0], this.profiler)).init(); + } + + this.worlds[i].addEventListener(new ServerWorldEventHandler(this, this.worlds[i])); + } + }// Forge: End Dead Code + + WorldServer overWorld = ( + isDemo() ? (WorldServer) (new WorldServerDemo(this, isavehandler, worldinfo, 0, this.profiler)).init() : + (WorldServer) (new WorldServer(this, isavehandler, worldinfo, 0, this.profiler)).init() + ); + overWorld.initialize(this.worldSettings); + for (int dim : net.minecraftforge.common.DimensionManager.getStaticDimensionIDs()) { + WorldServer world = (dim == 0 ? overWorld : (WorldServer) (new WorldServerMulti(this, isavehandler, dim, overWorld, this.profiler)).init()); + world.addEventListener(new ServerWorldEventHandler(this, world)); + if (!this.isSinglePlayer()) { + world.getWorldInfo().setGameType(getGameType()); + } + net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.world.WorldEvent.Load(world)); + } + + this.getPlayerList().setPlayerManager(new WorldServer[] { overWorld }); + + this.initialWorldChunkLoad(); + + done = true; + } + + public boolean init() { + LOGGER.info("Starting integrated minecraft server version 1.12.2"); + this.setOnlineMode(true); + this.setCanSpawnAnimals(true); + this.setCanSpawnNPCs(true); + this.setAllowPvp(true); + this.setAllowFlight(true); + LOGGER.info("Generating keypair"); + this.setKeyPair(CryptManager.generateKeyPair()); + if (!net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerAboutToStart(this)) return false; + this.loadAllWorlds(this.getFolderName(), this.getWorldName(), this.worldSettings.getSeed(), this.worldSettings.getTerrainType(), this.worldSettings.getGeneratorOptions()); + this.setMOTD(this.getServerOwner() + " - " + this.worlds[0].getWorldInfo().getWorldName()); + return net.minecraftforge.fml.common.FMLCommonHandler.instance().handleServerStarting(this); + } + + public void tick() { + boolean flag = this.isGamePaused; + this.isGamePaused = Minecraft.getMinecraft().getConnection() != null && Minecraft.getMinecraft().isGamePaused(); + + if (!flag && this.isGamePaused) { + LOGGER.info("Saving and pausing game..."); + this.getPlayerList().saveAllPlayerData(); + this.saveAllWorlds(false); + } + + if (this.isGamePaused) { + synchronized (this.futureTaskQueue) { + while (!this.futureTaskQueue.isEmpty()) { + Util.runTask(this.futureTaskQueue.poll(), LOGGER); + } + } + } + else { + super.tick(); + + if (TTCp.mc.gameSettings.renderDistanceChunks != this.getPlayerList().getViewDistance()) { + LOGGER.info("Changing view distance to {}, from {}", TTCp.mc.gameSettings.renderDistanceChunks, this.getPlayerList().getViewDistance()); + this.getPlayerList().setViewDistance(TTCp.mc.gameSettings.renderDistanceChunks); + } + + WorldInfo worldinfo1 = this.worlds[0].getWorldInfo(); + WorldInfo worldinfo = TTCp.mc.world.getWorldInfo(); + + if (!worldinfo1.isDifficultyLocked() && worldinfo.getDifficulty() != worldinfo1.getDifficulty()) { + LOGGER.info("Changing difficulty to {}, from {}", worldinfo.getDifficulty(), worldinfo1.getDifficulty()); + this.setDifficultyForAllWorlds(worldinfo.getDifficulty()); + } + else if (worldinfo.isDifficultyLocked() && !worldinfo1.isDifficultyLocked()) { + LOGGER.info("Locking difficulty to {}", (Object) worldinfo.getDifficulty()); + + for (WorldServer worldserver : this.worlds) { + if (worldserver != null) { + worldserver.getWorldInfo().setDifficultyLocked(true); + } + } + } + } + } + + public boolean canStructuresSpawn() { + return false; + } + + public GameType getGameType() { + return this.worldSettings.getGameType(); + } + + public EnumDifficulty getDifficulty() { + return TTCp.mc.world.getWorldInfo().getDifficulty(); + } + + public boolean isHardcore() { + return this.worldSettings.getHardcoreEnabled(); + } + + public boolean shouldBroadcastRconToOps() { + return true; + } + + public boolean shouldBroadcastConsoleToOps() { + return true; + } + + public void saveAllWorlds(boolean isSilent) { + super.saveAllWorlds(isSilent); + } + + public File getDataDirectory() { + return new File("ttcSaves"); + } + + public boolean isDedicatedServer() { + return false; + } + + public boolean shouldUseNativeTransport() { + return false; + } + + public void finalTick(CrashReport report) { + //this.mc.crashed(report); + } + + public CrashReport addServerInfoToCrashReport(CrashReport report) { + report = super.addServerInfoToCrashReport(report); + report.getCategory().addDetail("Type", new ICrashReportDetail() { + public String call() throws Exception { + return "Integrated Server (map_client.txt)"; + } + }); + report.getCategory().addDetail("Is Modded", new ICrashReportDetail() { + public String call() throws Exception { + String s = ClientBrandRetriever.getClientModName(); + + if (!s.equals("vanilla")) { + return "Definitely; Client brand changed to '" + s + "'"; + } + else { + s = WorldGeneratorV2.this.getServerModName(); + + if (!"vanilla".equals(s)) { + return "Definitely; Server brand changed to '" + s + "'"; + } + else { + return Minecraft.class.getSigners() == null ? "Very likely; Jar signature invalidated" : "Probably not. Jar signature remains and both client + server brands are untouched."; + } + } + } + }); + return report; + } + + public void setDifficultyForAllWorlds(EnumDifficulty difficulty) { + super.setDifficultyForAllWorlds(difficulty); + } + + @Override + public void addServerStatsToSnooper(Snooper playerSnooper) { + //super.addServerStatsToSnooper(playerSnooper); + } + + public boolean isSnooperEnabled() { + return Minecraft.getMinecraft().isSnooperEnabled(); + } + + @Override + public String shareToLAN(GameType type, boolean allowCheats) { + return ""; + } + + public void stopServer() { + initiateShutdown(); + super.stopServer(); + } + + public void initiateShutdown() { + // No need to check that, you cant join it anyway! + /* + if (isServerRunning()) + Futures.getUnchecked(this.addScheduledTask(new Runnable() + { + public void run() + { + for (EntityPlayerMP entityplayermp : Lists.newArrayList(WorldGeneratorV2.this.getPlayerList().getPlayers())) + { + if (!entityplayermp.getUniqueID().equals(WorldGeneratorV2.this.mc.player.getUniqueID())) + { + WorldGeneratorV2.this.getPlayerList().playerLoggedOut(entityplayermp); + } + } + } + })); + + */ + super.initiateShutdown(); + + } + + public void setGameType(GameType gameMode) { + super.setGameType(gameMode); + this.getPlayerList().setGameType(gameMode); + } + + public boolean isCommandBlockEnabled() { + return true; + } + + public int getOpPermissionLevel() { + return 4; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/category/Category.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/category/Category.java new file mode 100644 index 0000000..14dfbdc --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/category/Category.java @@ -0,0 +1,12 @@ +package de.tudbut.mod.client.ttcp.utils.category; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.ANNOTATION_TYPE) +public @interface Category { + +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/category/Chat.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/category/Chat.java new file mode 100644 index 0000000..86e05cf --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/category/Chat.java @@ -0,0 +1,18 @@ +package de.tudbut.mod.client.ttcp.utils.category; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * @author TudbuT + * @since 17 Mar 2022 + */ + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +@Category +public @interface Chat { + +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/category/Combat.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/category/Combat.java new file mode 100644 index 0000000..2885893 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/category/Combat.java @@ -0,0 +1,12 @@ +package de.tudbut.mod.client.ttcp.utils.category; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +@Category +public @interface Combat { +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/category/Command.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/category/Command.java new file mode 100644 index 0000000..92a0d5a --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/category/Command.java @@ -0,0 +1,17 @@ +package de.tudbut.mod.client.ttcp.utils.category; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; + +/** + * @author TudbuT + * @since 17 Mar 2022 + */ + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +@Category +public @interface Command { +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/category/Exploit.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/category/Exploit.java new file mode 100644 index 0000000..8619827 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/category/Exploit.java @@ -0,0 +1,12 @@ +package de.tudbut.mod.client.ttcp.utils.category; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +@Category +public @interface Exploit { +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/category/Misc.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/category/Misc.java new file mode 100644 index 0000000..33503b5 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/category/Misc.java @@ -0,0 +1,17 @@ +package de.tudbut.mod.client.ttcp.utils.category; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; + +/** + * @author TudbuT + * @since 17 Mar 2022 + */ + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +@Category +public @interface Misc { +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/category/Movement.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/category/Movement.java new file mode 100644 index 0000000..481f183 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/category/Movement.java @@ -0,0 +1,17 @@ +package de.tudbut.mod.client.ttcp.utils.category; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; + +/** + * @author TudbuT + * @since 17 Mar 2022 + */ + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +@Category +public @interface Movement { +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/category/None.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/category/None.java new file mode 100644 index 0000000..65c11f2 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/category/None.java @@ -0,0 +1,12 @@ +package de.tudbut.mod.client.ttcp.utils.category; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +@Category +public @interface None { +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/category/Plugins.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/category/Plugins.java new file mode 100644 index 0000000..80c6d68 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/category/Plugins.java @@ -0,0 +1,17 @@ +package de.tudbut.mod.client.ttcp.utils.category; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import java.lang.annotation.ElementType; + +/** + * @author TudbuT + * @since 17 Mar 2022 + */ + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +@Category +public @interface Plugins { +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/category/Render.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/category/Render.java new file mode 100644 index 0000000..8091418 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/category/Render.java @@ -0,0 +1,12 @@ +package de.tudbut.mod.client.ttcp.utils.category; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.TYPE) +@Category +public @interface Render { +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/pathfinding/AStar.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/pathfinding/AStar.java new file mode 100644 index 0000000..3113a55 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/pathfinding/AStar.java @@ -0,0 +1,256 @@ +package de.tudbut.mod.client.ttcp.utils.pathfinding; + +import net.minecraft.block.state.IBlockState; +import net.minecraft.init.Blocks; +import net.minecraft.util.math.BlockPos; +import net.minecraft.world.World; +import de.tudbut.mod.client.ttcp.utils.ChatUtils; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.concurrent.atomic.AtomicReference; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.Comparator; +import java.util.Date; + +public class AStar { + + public static class Result { + private Result(Node[][] nodes, boolean didAvoid, boolean didEarlyExit) { + this.nodes = nodes; + this.didAvoid = didAvoid; + this.didEarlyExit = didEarlyExit; + } + + public Node[][] nodes; + public boolean didAvoid; + public boolean didEarlyExit; + } + + public static Result calculate( + BlockPos start, BlockPos end, World world, + int distance, int length, int timeout, int earlyExitTimeout, + AtomicReference> closedRef, AtomicReference> openRef, + HashSet avoid, int avoidWeight, HashSet deny, + boolean onlyScanWalls, int minimumClosedBlocks, boolean panic + ) { + BlockCache cache = new BlockCache(); + long sa = new Date().getTime(); + if(panic) + minimumClosedBlocks = 0; + + try { + boolean didAvoid = false; + AtomicBoolean didAvoidA = new AtomicBoolean(false); + ArrayList open = new ArrayList<>(), closed = new ArrayList<>(); + openRef.set(open); + closedRef.set(closed); + Node startNode = new Node(start), endNode = new Node(end); + + startNode.calcFGH(endNode, 0, panic); + open.add(startNode); + Node current = startNode; + + boolean earlyExit = false; + w: while (!endNode.equals(current)) { + if(System.currentTimeMillis() - sa > timeout * 1000L || closedRef.get() == null) { + current = null; + break; + } + if(open.size() == 0) { + ChatUtils.print("§a[TTC] §r[ElytraBot] §cUnable to find a path (open.length == 0). Stopping."); + current = null; + return new Result(new Node[2][0], false, false); + } + current = open.get(0); + int currentID = 0; + for (int i = 1; i < open.size(); i++) { + Node node = open.get(i); + if (node.f < current.f) { + current = node; + currentID = i; + } + } + + open.remove(currentID); + if(panic) { + for(Node n : open) { + n.f += 10 * 1000; + } + } + closed.add(current); + + ArrayList next = getAdjacent3D(current); + + if(!earlyExit) + earlyExit = System.currentTimeMillis() - sa > earlyExitTimeout * 1000L; + for (int i = 0; i < next.size(); i++) { + BlockPos bp = next.get(i); + + int work = calcWork(cache, world, bp, current, onlyScanWalls || earlyExit, avoid, avoidWeight, didAvoid ? null : didAvoidA, deny); + if(work != -1) { + Node n = new Node(bp); + if(closed.indexOf(n) != -1) + continue; + n.parent = current; + if(end.getY() == -1) { + int tmp = bp.getY() - current.getY(); + work += tmp * tmp * 10; + } + n.calcFGH(endNode, work, panic); + if (Math.abs(startNode.getX() - n.getX()) >= distance || Math.abs(startNode.getZ() - n.getZ()) >= distance || n.n > length) { + if(closed.size() < minimumClosedBlocks) + continue; + break w; + } + int b; + if((b = open.indexOf(n)) != -1 && open.get(b).g <= n.g) + continue; + if(b != -1) + open.remove(b); + open.add(n); + } + } + if(didAvoidA.get()) + didAvoid = true; + } + + + ArrayList list = new ArrayList<>(); + + Node n = current == null ? closed.stream().max((n1, n2) -> n1.n - n2.n).get() : current; // The end node + while (n.getParent() != null) { + list.add(n); + n = n.getParent(); + } + + list.add(startNode); + + Node[] nodes = new Node[list.size()]; + + // Reverse + for (int i = 0; i < nodes.length; i++) { + nodes[i] = list.get(nodes.length - 1 - i); + } + + return new Result(new Node[][] {nodes, closed.toArray(new Node[0])}, didAvoid, earlyExit); + } catch (IndexOutOfBoundsException e) { + ChatUtils.print("§a[TTC] §r[ElytraBot] §cUnable to find a path. Stopping."); + e.printStackTrace(); + return new Result(new Node[2][0], false, false); + } + } + + private static int calcWork(BlockCache cache, World world, BlockPos bp, BlockPos prev, boolean requireSurround, HashSet avoid, int avoidWeight, AtomicBoolean didAvoid, HashSet deny) { + BlockPos[] positions = getAntiDMG3D(bp).toArray(new BlockPos[0]); + int work = 0, tmp; + tmp = bp.getX() - prev.getX(); + work += tmp * tmp; + tmp = bp.getY() - prev.getY(); + work += tmp * tmp; + tmp = bp.getZ() - prev.getZ(); + work += tmp * tmp; + boolean block = false; + for (int i = 0; i < positions.length; i++) { + BlockPos b = positions[i]; + if(!world.isBlockLoaded(b)) + return -1; + if(!world.isAirBlock(b)) + return -1; + if(deny.contains(b)) + return 1000 * 1000; + } + positions = getAdjacent3D(bp).toArray(new BlockPos[0]); + for (int i = 0; i < positions.length; i++) { + BlockPos b = positions[i]; + if(avoid.contains(b)) { + work += avoidWeight * 1000; + if(didAvoid != null) + didAvoid.set(true); + } + } + if(requireSurround) { + positions = getFastMode3D(bp).toArray(new BlockPos[0]); + block = true; + for(int i = 0; i < positions.length; i++) { + bp = positions[i]; + if(!world.isAirBlock(bp)) + block = false; + } + } + if(block) + return 10 * 1000 * 1000; + return work; + } + + public static ArrayList getAdjacent3D(BlockPos pos) { + ArrayList r = new ArrayList<>(); + + // Main + r.add(pos.add(-1, 0, -1)); + r.add(pos.add(-1, 0, 0)); + r.add(pos.add(-1, 0, +1)); + r.add(pos.add( 0, 0, -1)); + // Don't add current! + r.add(pos.add( 0, 0, +1)); + r.add(pos.add(+1, 0, -1)); + r.add(pos.add(+1, 0, 0)); + r.add(pos.add(+1, 0, +1)); + + // Bottom + r.add(pos.add(-1, -1, -1)); + r.add(pos.add(-1, -1, 0)); + r.add(pos.add(-1, -1, +1)); + r.add(pos.add( 0, -1, -1)); + r.add(pos.add( 0, -1, 0)); + r.add(pos.add( 0, -1, +1)); + r.add(pos.add(+1, -1, -1)); + r.add(pos.add(+1, -1, 0)); + r.add(pos.add(+1, -1, +1)); + + // Top + r.add(pos.add(-1, +1, -1)); + r.add(pos.add(-1, +1, 0)); + r.add(pos.add(-1, +1, +1)); + r.add(pos.add( 0, +1, -1)); + r.add(pos.add( 0, +1, 0)); + r.add(pos.add( 0, +1, +1)); + r.add(pos.add(+1, +1, -1)); + r.add(pos.add(+1, +1, 0)); + r.add(pos.add(+1, +1, +1)); + + return r; + } + + public static ArrayList getAntiDMG3D(BlockPos pos) { + ArrayList r = new ArrayList<>(); + + for(int x = -3; x <= 3; x++) { + for(int y = -3; y <= 1; y++) { + for(int z = -3; z <= 3; z++) { + if(!(x == 0 && y == 0 && z == 0)) { + r.add(pos.add(x,y,z)); + } + } + } + } + + return r; + } + + public static ArrayList getFastMode3D(BlockPos pos) { + ArrayList r = new ArrayList<>(); + + for(int x = -4; x <= 4; x++) { + for(int y = -4; y <= 2; y++) { + for(int z = -4; z <= 4; z++) { + if(!(Math.abs(x) < 4 && (y > -4 && y < 2) && Math.abs(z) < 4)) { + r.add(pos.add(x,y,z)); + } + } + } + } + + return r; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/pathfinding/BlockCache.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/pathfinding/BlockCache.java new file mode 100644 index 0000000..c86a279 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/pathfinding/BlockCache.java @@ -0,0 +1,36 @@ +package de.tudbut.mod.client.ttcp.utils.pathfinding; + +import net.minecraft.util.math.BlockPos; +import net.minecraft.block.state.IBlockState; +import net.minecraft.world.World; +import net.minecraft.init.Blocks; +import de.tudbut.tools.Cache; + +import java.util.HashMap; + +public class BlockCache { + private HashMap> map = new HashMap<>(); + + public IBlockState getBlock(World world, BlockPos pos) { + Cache cache = map.get(world); + if(cache == null) { + cache = new Cache<>(); + map.put(world, cache); + } + IBlockState state = cache.get(pos); + if(state == null) { + state = world.getBlockState(pos); + cache.add(pos, state, 5000, new Cache.CacheRetriever() { + @Override + public IBlockState retrieveFromKey(BlockPos k) { + return world.getBlockState(k); + } + }); + } + return state; + } + + public boolean isAirBlock(World world, BlockPos pos) { + return getBlock(world, pos).getBlock() == Blocks.AIR; + } +} diff --git a/src/main/java/de/tudbut/mod/client/ttcp/utils/pathfinding/Node.java b/src/main/java/de/tudbut/mod/client/ttcp/utils/pathfinding/Node.java new file mode 100644 index 0000000..604d012 --- /dev/null +++ b/src/main/java/de/tudbut/mod/client/ttcp/utils/pathfinding/Node.java @@ -0,0 +1,70 @@ +package de.tudbut.mod.client.ttcp.utils.pathfinding; + +import net.minecraft.entity.Entity; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.Vec3i; + +public class Node extends BlockPos { + int f = 0; // "Cost" + int g = 0; // Distance to start + int h = 0; // Direct distance to end + int n = 1; + Node parent; + + public Node(int x, int y, int z) { + super(x, y, z); + } + + public Node(double x, double y, double z) { + super(x, y, z); + } + + public Node(Entity source) { + super(source); + } + + public Node(Vec3d vec) { + super(vec); + } + + public Node(Vec3i source) { + super(source); + } + + void calcFGH(Node end, int i, boolean invertH) { + int dx, dy = 0, dz; + + if(parent != null) { + g = parent.g; + n += parent.n; + } + g += i; + + dx = end.getX() - getX(); + if(end.getY() != -1) { + dy = end.getY() - getY(); + } + dz = end.getZ() - getZ(); + h = dx * dx + dy * dy + dz * dz; + if(invertH) + h = -h; + + f = g+h; + } + + + public Node getParent() { + return parent; + } + + public boolean equals(Object o) { + if(super.equals(o)) + return true; + if(!(o instanceof BlockPos)) { + return false; + } + BlockPos p = (BlockPos) o; + return getY() == -1 && getX() == p.getX() && getZ() == p.getZ(); + } +} diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info new file mode 100644 index 0000000..7c7965c --- /dev/null +++ b/src/main/resources/mcmod.info @@ -0,0 +1,19 @@ +[ + { + "modid": "ttcp", + "name": "TTCp Client", + "description": "", + "version": "vB1.9.0", + "mcversion": "1.12.2", + "url": "", + "updateUrl": "", + "authorList": [ + "TudbuT", + "PipLeader" + ], + "credits": "", + "logoFile": "", + "screenshots": [], + "dependencies": [] + } +] diff --git a/src/main/resources/minecraft_obf.srg b/src/main/resources/minecraft_obf.srg new file mode 100644 index 0000000..e69de29 diff --git a/src/main/resources/mixins.ttcp.json b/src/main/resources/mixins.ttcp.json new file mode 100644 index 0000000..e91d85a --- /dev/null +++ b/src/main/resources/mixins.ttcp.json @@ -0,0 +1,17 @@ +{ + "required": true, + "min_version": "0", + "compatibilityLevel": "JAVA_8", + "package": "de.tudbut.mod.client.ttcp.mixin", + "refmap": "mixins.ttcp.refmap.json", + "mixins": [ + "MixinSoundHandler", + "MixinClientConnection", + "MixinParticleManager", + "MixinMinecraft", + "MixinEntityRenderer", + "MixinFMLNetworkRegistry" + ], + "client": [], + "server": [] +} diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta new file mode 100644 index 0000000..7382d37 --- /dev/null +++ b/src/main/resources/pack.mcmeta @@ -0,0 +1,6 @@ +{ + "pack": { + "description": "TTC resources", + "pack_format": 3 + } +} diff --git a/test b/test new file mode 100644 index 0000000..e69de29 diff --git a/ttcic/task/EntityKillTask.java b/ttcic/task/EntityKillTask.java new file mode 100644 index 0000000..e8708ee --- /dev/null +++ b/ttcic/task/EntityKillTask.java @@ -0,0 +1,61 @@ +package tudbut.mod.client.ttcp.ttcic.task; + +import java.util.ArrayList; + +import net.minecraft.entity.player.EntityPlayer; +import tudbut.mod.client.ttcp.TTCp; +import tudbut.mod.client.ttcp.ttcic.Task; +import tudbut.mod.client.ttcp.ttcic.Account; +import tudbut.obj.Transient; +import tudbut.mod.client.ttcp.mods.combat.KillAura; + +import static tudbut.mod.client.ttcp.ttcic.TTCIC.ttcic; + +public class EntityKillTask extends Task { + + @Transient + KillAura aura = TTCp.getModule(KillAura.class); + @Transient + boolean oldEnabled = false; + @Transient + ArrayList oldTargets = new ArrayList<>(); + + Account toAttack = null; + + public EntityKillTask(Account toKill) { + ttcic.write("Please provide a list of players in your RD."); + ttcic.writeAccounts(); + toAttack = ttcic.localize(toAttack); + } + + @Override + protected void onTick() { + if (toAttack.location.get().distanceTo(mc.player.getPositionVector()) > 4) { + ttcic.taskQueue.startNow(new EntityFollowTask(toAttack)); + return; + } + EntityPlayer player = mc.world.getPlayerEntityByUUID(toAttack.uuid); + if (player == null || player.getHealth() == 0) { + done(); + return; + } + } + + @Override + public void unpauseOrStart() { + this.oldEnabled = aura.enabled; + this.oldTargets = aura.targets; + + if (!aura.enabled) + aura.toggle(); + aura.targets = new ArrayList<>(); + aura.targets.add(toAttack.name); + } + + @Override + public void pauseOrStop() { + if (this.oldEnabled != aura.enabled) + aura.toggle(); + aura.targets = this.oldTargets; + } +} \ No newline at end of file