├── .gitignore ├── README.md ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── settings.gradle └── src └── main ├── java └── io │ └── github │ └── vialdevelopment │ └── tori │ ├── ToriEntryPoint.java │ ├── api │ ├── config │ │ └── TraitConfigurable.java │ ├── event │ │ ├── CancellableEvent.java │ │ ├── EventStage.java │ │ └── StagedEvent.java │ ├── management │ │ └── RunnableManager.java │ ├── runnable │ │ ├── command │ │ │ └── Command.java │ │ └── module │ │ │ ├── Category.java │ │ │ └── Module.java │ ├── setting │ │ └── Setting.java │ └── traits │ │ ├── TraitDescribable.java │ │ ├── TraitNameable.java │ │ ├── TraitRunnable.java │ │ ├── TraitToggleable.java │ │ └── TraitValued.java │ ├── client │ ├── Tori.java │ ├── commands │ │ ├── CommandsCommand.java │ │ └── LoginCommand.java │ ├── config │ │ └── ModuleConfig.java │ ├── events │ │ ├── AddEntityCollisionEvent.java │ │ ├── GetItemCooldownEvent.java │ │ ├── InputEvent.java │ │ ├── MoveEvent.java │ │ ├── PacketEvent.java │ │ ├── Render2DEvent.java │ │ ├── Render3DEvent.java │ │ ├── RenderScreenObstructionEvent.java │ │ ├── SendMovementPacketEvent.java │ │ ├── TickEvent.java │ │ └── UpdateCameraEvent.java │ ├── gui │ │ ├── ClickGUIScreen.java │ │ ├── api │ │ │ ├── Button.java │ │ │ └── ClickGUIScene.java │ │ └── scene │ │ │ └── module │ │ │ ├── ModuleScene.java │ │ │ └── button │ │ │ ├── BooleanButton.java │ │ │ ├── ModuleButton.java │ │ │ ├── SettingButton.java │ │ │ ├── SliderButton.java │ │ │ └── StringButton.java │ ├── management │ │ ├── CommandManager.java │ │ ├── ConfigManager.java │ │ ├── KeyBindingManager.java │ │ └── ModuleManager.java │ ├── modules │ │ ├── exploit │ │ │ ├── ItemTweaksModule.java │ │ │ └── SpeedMineModule.java │ │ ├── misc │ │ │ └── PortalChatModule.java │ │ ├── movement │ │ │ ├── ElytraFlyModule.java │ │ │ ├── JesusModule.java │ │ │ ├── SprintModule.java │ │ │ └── VelocityModule.java │ │ ├── player │ │ │ ├── FreeCamModule.java │ │ │ └── MultiSessionModule.java │ │ ├── render │ │ │ ├── BrightnessModule.java │ │ │ ├── ClickGUIModule.java │ │ │ ├── ESPModule.java │ │ │ ├── HUDModule.java │ │ │ └── NoRenderModule.java │ │ └── violent │ │ │ ├── CrystalAuraModule.java │ │ │ └── KillAuraModule.java │ └── settings │ │ ├── BooleanSetting.java │ │ └── number │ │ ├── DoubleSetting.java │ │ └── FloatSetting.java │ ├── mixin │ ├── duck │ │ ├── ChatHudDuck.java │ │ ├── ClientPlayerInteractionManagerDuck.java │ │ ├── EntityDuck.java │ │ ├── HandshakeC2SPacketDuck.java │ │ └── MinecraftClientDuck.java │ └── mixins │ │ ├── MixinBossBarHud.java │ │ ├── MixinCamera.java │ │ ├── MixinChatHud.java │ │ ├── MixinClientConnection.java │ │ ├── MixinClientPlayerEntity.java │ │ ├── MixinClientPlayerInteractionManager.java │ │ ├── MixinEntity.java │ │ ├── MixinGameRenderer.java │ │ ├── MixinHandshakeC2SPacket.java │ │ ├── MixinInGameHud.java │ │ ├── MixinInGameOverlayRenderer.java │ │ ├── MixinItemCooldownManager.java │ │ ├── MixinLightmapTextureManager.java │ │ ├── MixinLivingEntity.java │ │ └── MixinMinecraftClient.java │ └── util │ ├── FontUtil.java │ ├── GLUtils.java │ ├── Logger.java │ ├── PlayerUtil.java │ ├── RenderUtil.java │ └── SessionUtil.java └── resources ├── fabric.mod.json └── tori.mixins.json /.gitignore: -------------------------------------------------------------------------------- 1 | # eclipse 2 | bin 3 | *.launch 4 | .settings 5 | .metadata 6 | .classpath 7 | .project 8 | 9 | # idea 10 | out 11 | *.ipr 12 | *.iws 13 | *.iml 14 | .idea 15 | 16 | # gradle 17 | build 18 | .gradle 19 | gradle/wrapper/gradle-wrapper.properties 20 | 21 | # other 22 | eclipse 23 | run 24 | remappedSrc 25 | logs 26 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # tori 2 | Tori Utility Mod for Minecraft version 1.16.1, made with fabric. 3 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'fabric-loom' version '0.4-SNAPSHOT' 3 | id 'maven-publish' 4 | } 5 | 6 | sourceCompatibility = JavaVersion.VERSION_1_8 7 | targetCompatibility = JavaVersion.VERSION_1_8 8 | 9 | archivesBaseName = project.archives_base_name 10 | version = project.mod_version 11 | group = project.maven_group 12 | 13 | repositories { 14 | maven { 15 | url 'https://jitpack.io' 16 | } 17 | mavenCentral() 18 | } 19 | 20 | dependencies { 21 | //to change the versions see the gradle.properties file 22 | minecraft "com.mojang:minecraft:${project.minecraft_version}" 23 | mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" 24 | modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" 25 | 26 | // Fabric API. This is technically optional, but you probably want it anyway. 27 | modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" 28 | 29 | modImplementation group: 'net.jodah', name: 'typetools', version: '0.5.0' 30 | 31 | include group: 'net.jodah', name: 'typetools', version: '0.5.0' 32 | 33 | modImplementation "io.github.vialdevelopment:attendance:rewrite-SNAPSHOT" 34 | include "io.github.vialdevelopment:attendance:rewrite-SNAPSHOT" 35 | } 36 | 37 | 38 | processResources { 39 | inputs.property "version", project.version 40 | 41 | from(sourceSets.main.resources.srcDirs) { 42 | include "fabric.mod.json" 43 | expand "version": project.version 44 | } 45 | 46 | from(sourceSets.main.resources.srcDirs) { 47 | exclude "fabric.mod.json" 48 | } 49 | } 50 | 51 | // ensure that the encoding is set to UTF-8, no matter what the system default is 52 | // this fixes some edge cases with special characters not displaying correctly 53 | // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html 54 | tasks.withType(JavaCompile) { 55 | options.encoding = "UTF-8" 56 | } 57 | 58 | // Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task 59 | // if it is present. 60 | // If you remove this task, sources will not be generated. 61 | task sourcesJar(type: Jar, dependsOn: classes) { 62 | classifier = "sources" 63 | from sourceSets.main.allSource 64 | } 65 | 66 | jar { 67 | from "LICENSE" 68 | } 69 | 70 | // configure the maven publication 71 | publishing { 72 | publications { 73 | mavenJava(MavenPublication) { 74 | // add all the jars that should be included when publishing to maven 75 | artifact(remapJar) { 76 | builtBy remapJar 77 | } 78 | artifact(sourcesJar) { 79 | builtBy remapSourcesJar 80 | } 81 | } 82 | } 83 | 84 | // select the repositories you want to publish to 85 | repositories { 86 | // uncomment to publish to the local maven 87 | // mavenLocal() 88 | } 89 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Done to increase the memory available to gradle. 2 | org.gradle.jvmargs=-Xmx1G 3 | # Fabric Properties 4 | # check these on https://fabricmc.net/use 5 | minecraft_version=1.16.2 6 | yarn_mappings=1.16.2+build.19 7 | loader_version=0.9.1+build.205 8 | #Fabric api 9 | fabric_version=0.18.0+build.397-1.16 10 | # Mod Properties 11 | mod_version=1.0-SNAPSHOT 12 | maven_group=io.github.vialdevelopment 13 | archives_base_name=tori 14 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vialdevelopment/tori/5ef187fc6d8f5bda76050f98663271861d9cc3b2/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # Copyright 2015 the original author or authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | 19 | ############################################################################## 20 | ## 21 | ## Gradle start up script for UN*X 22 | ## 23 | ############################################################################## 24 | 25 | # Attempt to set APP_HOME 26 | # Resolve links: $0 may be a link 27 | PRG="$0" 28 | # Need this for relative symlinks. 29 | while [ -h "$PRG" ] ; do 30 | ls=`ls -ld "$PRG"` 31 | link=`expr "$ls" : '.*-> \(.*\)$'` 32 | if expr "$link" : '/.*' > /dev/null; then 33 | PRG="$link" 34 | else 35 | PRG=`dirname "$PRG"`"/$link" 36 | fi 37 | done 38 | SAVED="`pwd`" 39 | cd "`dirname \"$PRG\"`/" >/dev/null 40 | APP_HOME="`pwd -P`" 41 | cd "$SAVED" >/dev/null 42 | 43 | APP_NAME="Gradle" 44 | APP_BASE_NAME=`basename "$0"` 45 | 46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 48 | 49 | # Use the maximum available, or set MAX_FD != -1 to use that value. 50 | MAX_FD="maximum" 51 | 52 | warn () { 53 | echo "$*" 54 | } 55 | 56 | die () { 57 | echo 58 | echo "$*" 59 | echo 60 | exit 1 61 | } 62 | 63 | # OS specific support (must be 'true' or 'false'). 64 | cygwin=false 65 | msys=false 66 | darwin=false 67 | nonstop=false 68 | case "`uname`" in 69 | CYGWIN* ) 70 | cygwin=true 71 | ;; 72 | Darwin* ) 73 | darwin=true 74 | ;; 75 | MINGW* ) 76 | msys=true 77 | ;; 78 | NONSTOP* ) 79 | nonstop=true 80 | ;; 81 | esac 82 | 83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 84 | 85 | 86 | # Determine the Java command to use to start the JVM. 87 | if [ -n "$JAVA_HOME" ] ; then 88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 89 | # IBM's JDK on AIX uses strange locations for the executables 90 | JAVACMD="$JAVA_HOME/jre/sh/java" 91 | else 92 | JAVACMD="$JAVA_HOME/bin/java" 93 | fi 94 | if [ ! -x "$JAVACMD" ] ; then 95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 96 | 97 | Please set the JAVA_HOME variable in your environment to match the 98 | location of your Java installation." 99 | fi 100 | else 101 | JAVACMD="java" 102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 103 | 104 | Please set the JAVA_HOME variable in your environment to match the 105 | location of your Java installation." 106 | fi 107 | 108 | # Increase the maximum file descriptors if we can. 109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 110 | MAX_FD_LIMIT=`ulimit -H -n` 111 | if [ $? -eq 0 ] ; then 112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 113 | MAX_FD="$MAX_FD_LIMIT" 114 | fi 115 | ulimit -n $MAX_FD 116 | if [ $? -ne 0 ] ; then 117 | warn "Could not set maximum file descriptor limit: $MAX_FD" 118 | fi 119 | else 120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 121 | fi 122 | fi 123 | 124 | # For Darwin, add options to specify how the application appears in the dock 125 | if $darwin; then 126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 127 | fi 128 | 129 | # For Cygwin or MSYS, switch paths to Windows format before running java 130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 133 | 134 | JAVACMD=`cygpath --unix "$JAVACMD"` 135 | 136 | # We build the pattern for arguments to be converted via cygpath 137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 138 | SEP="" 139 | for dir in $ROOTDIRSRAW ; do 140 | ROOTDIRS="$ROOTDIRS$SEP$dir" 141 | SEP="|" 142 | done 143 | OURCYGPATTERN="(^($ROOTDIRS))" 144 | # Add a user-defined pattern to the cygpath arguments 145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 147 | fi 148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 149 | i=0 150 | for arg in "$@" ; do 151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 153 | 154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 156 | else 157 | eval `echo args$i`="\"$arg\"" 158 | fi 159 | i=`expr $i + 1` 160 | done 161 | case $i in 162 | 0) set -- ;; 163 | 1) set -- "$args0" ;; 164 | 2) set -- "$args0" "$args1" ;; 165 | 3) set -- "$args0" "$args1" "$args2" ;; 166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 172 | esac 173 | fi 174 | 175 | # Escape application args 176 | save () { 177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 178 | echo " " 179 | } 180 | APP_ARGS=`save "$@"` 181 | 182 | # Collect all arguments for the java command, following the shell quoting and substitution rules 183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 184 | 185 | exec "$JAVACMD" "$@" 186 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | jcenter() 4 | maven { 5 | name = 'Fabric' 6 | url = 'https://maven.fabricmc.net/' 7 | } 8 | gradlePluginPortal() 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/ToriEntryPoint.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori; 2 | 3 | import io.github.vialdevelopment.tori.client.Tori; 4 | import net.fabricmc.api.ModInitializer; 5 | 6 | public class ToriEntryPoint implements ModInitializer { 7 | @Override 8 | public void onInitialize() { 9 | Tori.INSTANCE.init(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/api/config/TraitConfigurable.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.api.config; 2 | 3 | import io.github.vialdevelopment.tori.client.Tori; 4 | import net.minecraft.client.MinecraftClient; 5 | 6 | import java.io.File; 7 | 8 | public interface TraitConfigurable { 9 | 10 | default String getPath() { 11 | return Tori.INSTANCE.configManager.PATH; 12 | } 13 | 14 | default String getDivider() { 15 | return ", "; 16 | } 17 | 18 | void write(); 19 | 20 | void read(); 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/api/event/CancellableEvent.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.api.event; 2 | 3 | /** 4 | * @author cats 5 | * @since April 23, 2020 6 | */ 7 | public class CancellableEvent extends StagedEvent { 8 | 9 | /** 10 | * is the event cancelled? 11 | */ 12 | protected boolean canceled; 13 | 14 | public CancellableEvent() { 15 | } 16 | 17 | public CancellableEvent(boolean canceled) { 18 | this.canceled = canceled; 19 | } 20 | 21 | public boolean isCanceled() { 22 | return this.canceled; 23 | } 24 | 25 | public void setCanceled(boolean canceled) { 26 | this.canceled = canceled; 27 | } 28 | } -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/api/event/EventStage.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.api.event; 2 | 3 | /** 4 | * @author cats 5 | * @since April 23, 2020 6 | * This enum can be put as a parameter of an event if it should have stages 7 | */ 8 | public enum EventStage { 9 | EARLY, 10 | LATE 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/api/event/StagedEvent.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.api.event; 2 | 3 | /** 4 | * @author cats 5 | * @since April 23, 2020 6 | */ 7 | public class StagedEvent { 8 | /** 9 | *The eventstage 10 | */ 11 | protected EventStage eventStage; 12 | 13 | public StagedEvent() { 14 | } 15 | 16 | public StagedEvent(EventStage eventStage) { 17 | this.eventStage = eventStage; 18 | } 19 | 20 | public EventStage getStage() { 21 | return this.eventStage; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/api/management/RunnableManager.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.api.management; 2 | 3 | import io.github.vialdevelopment.tori.api.traits.TraitRunnable; 4 | 5 | public interface RunnableManager { 6 | default void init() { 7 | this.addRunnables(); 8 | } 9 | 10 | void addRunnables(); 11 | 12 | void addRunnable(TraitRunnable runnable); 13 | 14 | boolean dispatchRunnable(String message); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/api/runnable/command/Command.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.api.runnable.command; 2 | 3 | import io.github.vialdevelopment.tori.api.traits.TraitDescribable; 4 | import io.github.vialdevelopment.tori.api.traits.TraitNameable; 5 | import io.github.vialdevelopment.tori.api.traits.TraitRunnable; 6 | 7 | public class Command implements TraitRunnable, TraitNameable, TraitDescribable { 8 | 9 | private final String name; 10 | 11 | private final String description; 12 | 13 | public Command(String name, String description) { 14 | this.name = name; 15 | this.description = description; 16 | } 17 | 18 | @Override 19 | public void run(String[] args) { 20 | 21 | } 22 | 23 | // getters and setters 24 | 25 | 26 | @Override 27 | public String getName() { 28 | return this.name; 29 | } 30 | 31 | @Override 32 | public String getDescription() { 33 | return description; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/api/runnable/module/Category.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.api.runnable.module; 2 | 3 | public enum Category { 4 | MOVEMENT, 5 | PLAYER, 6 | WORLD, 7 | MISC, 8 | RENDER, 9 | EXPLOIT, 10 | VIOLENT 11 | } 12 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/api/runnable/module/Module.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.api.runnable.module; 2 | 3 | import io.github.vialdevelopment.tori.api.runnable.command.Command; 4 | import io.github.vialdevelopment.tori.api.setting.Setting; 5 | import io.github.vialdevelopment.tori.api.traits.TraitToggleable; 6 | import io.github.vialdevelopment.tori.client.Tori; 7 | import io.github.vialdevelopment.tori.client.settings.BooleanSetting; 8 | import io.github.vialdevelopment.tori.client.settings.number.DoubleSetting; 9 | import io.github.vialdevelopment.tori.client.settings.number.FloatSetting; 10 | import net.minecraft.client.MinecraftClient; 11 | import net.minecraft.client.options.KeyBinding; 12 | import net.minecraft.client.util.InputUtil; 13 | import org.lwjgl.glfw.GLFW; 14 | 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | 18 | public class Module extends Command implements TraitToggleable { 19 | 20 | private boolean state; 21 | 22 | private final KeyBinding keyBinding = new KeyBinding( 23 | this.getName(), // The translation key of the keybinding's name 24 | GLFW.GLFW_KEY_UNKNOWN, // The keycode of the key 25 | Tori.MOD_NAME // The translation key of the keybinding's category. 26 | ); 27 | 28 | private Category category; 29 | 30 | private final List settings = new ArrayList<>(); 31 | 32 | protected static final MinecraftClient mc = MinecraftClient.getInstance(); 33 | 34 | public Module(String name, String description, Category category) { 35 | super(name, description); 36 | this.category = category; 37 | } 38 | 39 | @Override 40 | public boolean getState() { 41 | return this.state; 42 | } 43 | 44 | @Override 45 | public void setState(boolean state) { 46 | if (state) { 47 | this.onEnable(); 48 | } else { 49 | this.onDisable(); 50 | } 51 | this.state = state; 52 | } 53 | 54 | @Override 55 | public void onEnable() { 56 | if (!this.getState()) { 57 | if (this.shouldAttend()) Tori.INSTANCE.eventManager.setAttending(this, true); 58 | } 59 | 60 | } 61 | 62 | @Override 63 | public void onDisable() { 64 | if (this.getState()) { 65 | if (this.shouldAttend()) Tori.INSTANCE.eventManager.setAttending(this, false); 66 | } 67 | } 68 | 69 | @Override 70 | public void run(String[] args) { 71 | if (args[0].equalsIgnoreCase("enabled")) { 72 | if (args.length == 2) { 73 | this.setState(Boolean.parseBoolean(args[1])); 74 | } else { 75 | this.toggle(); 76 | } 77 | return; 78 | } 79 | 80 | if (args[0].equalsIgnoreCase("bind")) { 81 | 82 | if (args.length == 2) { 83 | if (args[1].equalsIgnoreCase("none")) { 84 | this.keyBinding.setBoundKey(InputUtil.UNKNOWN_KEY); 85 | } 86 | try { 87 | this.keyBinding.setBoundKey(InputUtil.fromTranslationKey("key.keyboard." + args[1].toLowerCase())); 88 | } catch (IllegalArgumentException e) { 89 | e.printStackTrace(); 90 | } 91 | } 92 | return; 93 | } 94 | 95 | for (Setting setting : settings) { 96 | if (args[0].equalsIgnoreCase(setting.getName())) { 97 | if (setting instanceof BooleanSetting) { 98 | ((BooleanSetting) setting).setBooleanValue(Boolean.parseBoolean(args[1])); 99 | } else 100 | if (setting.getValue() instanceof Number) { 101 | if (setting instanceof DoubleSetting) { 102 | ((DoubleSetting) setting).setDoubleValue(Double.parseDouble(args[1])); 103 | } else 104 | if (setting instanceof FloatSetting) { 105 | ((FloatSetting) setting).setFloatValue(Float.parseFloat(args[1])); 106 | } else 107 | if (setting.getValue() instanceof Integer) { 108 | setting.setValue(Integer.parseInt(args[1])); 109 | } else 110 | if (setting.getValue() instanceof Long) { 111 | setting.setValue(Long.parseLong(args[1])); 112 | } 113 | } 114 | if (setting.getValue() instanceof String) { 115 | setting.setValue(args[1]); 116 | } 117 | } 118 | } 119 | } 120 | 121 | public String getModuleInfo() { 122 | return ""; 123 | } 124 | 125 | public boolean shouldAttend() { 126 | return true; 127 | } 128 | 129 | // getters and setters 130 | 131 | public Setting getSetting(String name) { 132 | for (Setting setting : this.getSettings()) { 133 | if (setting.getName().equalsIgnoreCase(name)) return setting; 134 | } 135 | return null; 136 | } 137 | 138 | public Category getCategory() { 139 | return this.category; 140 | } 141 | 142 | public List getSettings() { 143 | return this.settings; 144 | } 145 | 146 | public KeyBinding getKeyBind() { 147 | return this.keyBinding; 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/api/setting/Setting.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.api.setting; 2 | 3 | import io.github.vialdevelopment.tori.api.traits.TraitNameable; 4 | import io.github.vialdevelopment.tori.api.traits.TraitValued; 5 | 6 | public class Setting implements TraitValued, TraitNameable { 7 | 8 | private final String name; 9 | 10 | private T value; 11 | 12 | public Setting(String name, T value) { 13 | this.name = name; 14 | this.value = value; 15 | } 16 | 17 | @Override 18 | public T getValue() { 19 | return this.value; 20 | } 21 | 22 | @Override 23 | public void setValue(T value) { 24 | this.value = value; 25 | } 26 | 27 | @Override 28 | public String getName() { 29 | return this.name; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/api/traits/TraitDescribable.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.api.traits; 2 | 3 | public interface TraitDescribable { 4 | String getDescription(); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/api/traits/TraitNameable.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.api.traits; 2 | 3 | public interface TraitNameable { 4 | String getName(); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/api/traits/TraitRunnable.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.api.traits; 2 | 3 | public interface TraitRunnable { 4 | void run(String[] args); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/api/traits/TraitToggleable.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.api.traits; 2 | 3 | public interface TraitToggleable { 4 | 5 | boolean getState(); 6 | 7 | void setState(boolean state); 8 | 9 | default void toggle() { 10 | this.setState(!this.getState()); 11 | } 12 | 13 | void onEnable(); 14 | 15 | void onDisable(); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/api/traits/TraitValued.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.api.traits; 2 | 3 | public interface TraitValued { 4 | T getValue(); 5 | 6 | void setValue(T value); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/Tori.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client; 2 | 3 | import io.github.vialdevelopment.attendance.manager.impl.ParentEventManager; 4 | import io.github.vialdevelopment.tori.api.runnable.module.Module; 5 | import io.github.vialdevelopment.tori.client.gui.ClickGUIScreen; 6 | import io.github.vialdevelopment.tori.client.management.CommandManager; 7 | import io.github.vialdevelopment.tori.client.management.ConfigManager; 8 | import io.github.vialdevelopment.tori.client.management.KeyBindingManager; 9 | import io.github.vialdevelopment.tori.client.management.ModuleManager; 10 | import io.github.vialdevelopment.tori.util.Logger; 11 | import net.minecraft.text.TranslatableText; 12 | 13 | public class Tori { 14 | public static final Tori INSTANCE = new Tori(); 15 | 16 | public static final String MOD_NAME = "Tori"; 17 | 18 | public final ParentEventManager eventManager = new ParentEventManager(); 19 | 20 | public final CommandManager commandManager = new CommandManager(); 21 | 22 | public final ModuleManager moduleManager = new ModuleManager(); 23 | 24 | public final KeyBindingManager keyBindingManager = new KeyBindingManager(); 25 | 26 | public final ConfigManager configManager = new ConfigManager(); 27 | 28 | public final ClickGUIScreen clickGUIScreen = new ClickGUIScreen(new TranslatableText("ToriClickGUI")); 29 | 30 | public void init() { 31 | this.commandManager.init(); 32 | Logger.log("Command Manager"); 33 | 34 | this.moduleManager.init(); 35 | Logger.log("Module Manager"); 36 | 37 | this.keyBindingManager.init(); 38 | Logger.log("Bindings!"); 39 | 40 | this.configManager.init(); 41 | this.configManager.readConfig(); 42 | 43 | for (Module module : this.moduleManager.getModules()) { 44 | Logger.log(module.getName()); 45 | } 46 | this.clickGUIScreen.initGUI(); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/commands/CommandsCommand.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.commands; 2 | 3 | import io.github.vialdevelopment.tori.api.runnable.command.Command; 4 | import io.github.vialdevelopment.tori.client.Tori; 5 | import io.github.vialdevelopment.tori.util.Logger; 6 | 7 | public class CommandsCommand extends Command { 8 | public CommandsCommand() { 9 | super("Commands", "Shows all the commands in the client"); 10 | } 11 | 12 | @Override 13 | public void run(String[] args) { 14 | for (Command command : Tori.INSTANCE.commandManager.getCommands()) { 15 | Logger.log(command.getName() + ": " + command.getDescription()); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/commands/LoginCommand.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.commands; 2 | 3 | import io.github.vialdevelopment.tori.api.runnable.command.Command; 4 | import io.github.vialdevelopment.tori.util.Logger; 5 | import io.github.vialdevelopment.tori.util.SessionUtil; 6 | import net.minecraft.client.util.Session; 7 | import net.minecraft.util.Formatting; 8 | 9 | public class LoginCommand extends Command { 10 | public LoginCommand() { 11 | super("Login", "Lets you login to an account"); 12 | } 13 | 14 | 15 | @Override 16 | public void run(String[] args) { 17 | super.run(args); 18 | if (args.length == 2) { 19 | try { 20 | new Thread(() -> { 21 | final Session auth = SessionUtil.createSession(args[0], args[1]); 22 | if (auth == null) { 23 | Logger.log(Formatting.RED + "Login failed!"); 24 | } else { 25 | Logger.log(Formatting.GREEN + "Logged in. (" + auth.getUsername() + ")"); 26 | SessionUtil.setSession(auth); 27 | } 28 | }).start(); 29 | } catch (Exception e) { 30 | Logger.log("Login threw exception"); 31 | e.printStackTrace(); 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/config/ModuleConfig.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.config; 2 | 3 | import io.github.vialdevelopment.tori.api.config.TraitConfigurable; 4 | import io.github.vialdevelopment.tori.api.runnable.module.Module; 5 | import io.github.vialdevelopment.tori.api.setting.Setting; 6 | import io.github.vialdevelopment.tori.client.Tori; 7 | import io.github.vialdevelopment.tori.util.Logger; 8 | 9 | import java.io.BufferedReader; 10 | import java.io.File; 11 | import java.io.FileReader; 12 | import java.io.IOException; 13 | import java.nio.charset.StandardCharsets; 14 | import java.nio.file.Files; 15 | import java.nio.file.Path; 16 | import java.nio.file.Paths; 17 | import java.util.ArrayList; 18 | import java.util.List; 19 | 20 | public class ModuleConfig implements TraitConfigurable { 21 | 22 | @Override 23 | public void write() { 24 | List lines = new ArrayList<>(); 25 | Path file = Paths.get(this.getPath()); 26 | 27 | // For all of the modules, write em 28 | for (Module module : Tori.INSTANCE.moduleManager.getModules()) { 29 | StringBuilder stringBuilder = new StringBuilder(); 30 | 31 | stringBuilder.append(module.getName() + ":" + module.getState() + this.getDivider()); 32 | if (module.getSettings() != null) { 33 | // Settings! 34 | for (Setting setting : module.getSettings()) { 35 | stringBuilder.append(setting.getName() + ":" + setting.getValue() + this.getDivider()); 36 | } 37 | } 38 | lines.add(stringBuilder.toString()); 39 | } 40 | 41 | try { 42 | Files.write(file, lines, StandardCharsets.UTF_8); 43 | } catch (IOException e) { 44 | e.printStackTrace(); 45 | } 46 | } 47 | 48 | @Override 49 | public void read() { 50 | File file = new File(this.getPath()); 51 | 52 | if (!file.exists()) { 53 | // If the file doesn't exist, create it 54 | file.mkdir(); 55 | } 56 | 57 | try { 58 | // for all the lines in a file, add it to the list 59 | BufferedReader br = new BufferedReader(new FileReader(file)); 60 | String string; 61 | while ((string = br.readLine()) != null) { 62 | final String[] args = string.split(this.getDivider()); 63 | final String[] moduleArgs = args[0].split(":"); 64 | final Module module = Tori.INSTANCE.moduleManager.getModule(moduleArgs[0]); 65 | 66 | if (module == null) continue; 67 | 68 | // Set module state 69 | module.setState(Boolean.parseBoolean(moduleArgs[1])); 70 | 71 | if (args.length > 2) { 72 | for (String arg : args) { 73 | final String[] settingArgs = arg.split(":"); 74 | 75 | final Setting setting = module.getSetting(settingArgs[0]); 76 | 77 | if (setting == null) continue; 78 | 79 | if (setting.getValue() instanceof Boolean) { 80 | setting.setValue(Boolean.parseBoolean(settingArgs[1])); 81 | } 82 | if (setting.getValue() instanceof Number) { 83 | if (setting.getValue() instanceof Integer) { 84 | setting.setValue(Integer.parseInt(settingArgs[1])); 85 | } 86 | if (setting.getValue() instanceof Float) { 87 | setting.setValue(Float.parseFloat(settingArgs[1])); 88 | } 89 | if (setting.getValue() instanceof Long) { 90 | setting.setValue(Long.parseLong(settingArgs[1])); 91 | } 92 | if (setting.getValue() instanceof Double) { 93 | setting.setValue(Double.parseDouble(settingArgs[1])); 94 | } 95 | } 96 | if (setting.getValue() instanceof String) { 97 | setting.setValue(settingArgs[1]); 98 | } 99 | } 100 | } 101 | } 102 | } catch (IOException ignored) { 103 | Logger.log("File Not found"); 104 | } 105 | 106 | } 107 | 108 | @Override 109 | public String getPath() { 110 | return Tori.INSTANCE.configManager.PATH + "modules.txt"; 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/events/AddEntityCollisionEvent.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.events; 2 | 3 | import io.github.vialdevelopment.tori.api.event.StagedEvent; 4 | import net.minecraft.entity.Entity; 5 | 6 | public class AddEntityCollisionEvent extends StagedEvent { 7 | public Entity entity; 8 | public double x; 9 | public double y; 10 | public double z; 11 | 12 | public AddEntityCollisionEvent(Object entity, double x, double y, double z) { 13 | this.entity = (Entity) entity; 14 | this.x = x; 15 | this.y = y; 16 | this.z = z; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/events/GetItemCooldownEvent.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.events; 2 | 3 | import io.github.vialdevelopment.tori.api.event.StagedEvent; 4 | 5 | public class GetItemCooldownEvent extends StagedEvent { 6 | public Float coolDown = null; 7 | 8 | public GetItemCooldownEvent() { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/events/InputEvent.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.events; 2 | 3 | import io.github.vialdevelopment.tori.api.event.CancellableEvent; 4 | import io.github.vialdevelopment.tori.api.event.EventStage; 5 | import io.github.vialdevelopment.tori.api.event.StagedEvent; 6 | import net.minecraft.client.input.Input; 7 | 8 | public class InputEvent extends CancellableEvent { 9 | public Input input; 10 | 11 | public InputEvent(EventStage stage) { 12 | this.eventStage = stage; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/events/MoveEvent.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.events; 2 | 3 | import io.github.vialdevelopment.tori.api.event.CancellableEvent; 4 | 5 | public class MoveEvent extends CancellableEvent { 6 | public double x, y, z; 7 | 8 | public MoveEvent(double x, double y, double z) { 9 | this.x = x; 10 | this.y = y; 11 | this.z = z; 12 | } 13 | } -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/events/PacketEvent.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.events; 2 | 3 | import io.github.vialdevelopment.tori.api.event.CancellableEvent; 4 | import net.minecraft.network.Packet; 5 | 6 | public class PacketEvent extends CancellableEvent { 7 | public final Packet packet; 8 | 9 | public PacketEvent(Packet packet) { 10 | super(); 11 | this.packet = packet; 12 | } 13 | 14 | 15 | public static class In extends PacketEvent { 16 | public In(Packet packet) { 17 | super(packet); 18 | } 19 | } 20 | 21 | public static class Out extends PacketEvent { 22 | public Out(Packet packet) { 23 | super(packet); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/events/Render2DEvent.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.events; 2 | 3 | import io.github.vialdevelopment.tori.api.event.StagedEvent; 4 | import net.minecraft.client.util.math.MatrixStack; 5 | 6 | /** 7 | * @author cats 8 | * @since April 23, 2020 9 | */ 10 | public class Render2DEvent extends StagedEvent { 11 | 12 | /** 13 | * the event's matrixStack 14 | * Super epic 15 | */ 16 | public final MatrixStack matrixStack; 17 | 18 | /** 19 | * The event's partialTicks, used for rendering stuff between ticks 20 | */ 21 | public final float partialTicks; 22 | 23 | /** 24 | * Init it and get these things 25 | * @param partialTicks the partial ticks 26 | */ 27 | public Render2DEvent(MatrixStack matrixStack, float partialTicks) { 28 | this.matrixStack = matrixStack; 29 | this.partialTicks = partialTicks; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/events/Render3DEvent.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.events; 2 | 3 | import io.github.vialdevelopment.tori.api.event.StagedEvent; 4 | import net.minecraft.client.util.math.MatrixStack; 5 | 6 | public class Render3DEvent extends StagedEvent { 7 | public float tickDelta; 8 | 9 | public MatrixStack matrixStack; 10 | 11 | public Render3DEvent(MatrixStack matrixStack, float tickDelta) { 12 | this.matrixStack = matrixStack; 13 | this.tickDelta = tickDelta; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/events/RenderScreenObstructionEvent.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.events; 2 | 3 | import io.github.vialdevelopment.tori.api.event.CancellableEvent; 4 | 5 | public class RenderScreenObstructionEvent extends CancellableEvent { 6 | public final Type overlay; 7 | 8 | public RenderScreenObstructionEvent(Type overlay) { 9 | this.overlay = overlay; 10 | } 11 | 12 | public enum Type { 13 | FLUID, 14 | FIRE, 15 | HURT, 16 | BOSS 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/events/SendMovementPacketEvent.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.events; 2 | 3 | 4 | import io.github.vialdevelopment.tori.api.event.EventStage; 5 | import io.github.vialdevelopment.tori.api.event.StagedEvent; 6 | 7 | public class SendMovementPacketEvent extends StagedEvent { 8 | public boolean onGround; 9 | public float yaw; 10 | public float pitch; 11 | public double y; 12 | 13 | public SendMovementPacketEvent(final float yaw, final float pitch, final double y, final boolean onGround, EventStage stage) { 14 | this.yaw = yaw; 15 | this.pitch = pitch; 16 | this.y = y; 17 | this.onGround = onGround; 18 | this.eventStage = stage; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/events/TickEvent.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.events; 2 | 3 | import io.github.vialdevelopment.tori.api.event.StagedEvent; 4 | 5 | public class TickEvent extends StagedEvent { 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/events/UpdateCameraEvent.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.events; 2 | 3 | import io.github.vialdevelopment.tori.api.event.CancellableEvent; 4 | import net.minecraft.entity.Entity; 5 | import net.minecraft.util.math.MathHelper; 6 | 7 | public class UpdateCameraEvent extends CancellableEvent { 8 | public Entity focusedEntity; 9 | 10 | public float tickDelta; 11 | 12 | public double x, y, z; 13 | 14 | public float yaw, pitch; 15 | 16 | public UpdateCameraEvent(Entity focusedEntity, float tickDelta, float lastCameraY, float cameraY) { 17 | this.focusedEntity = focusedEntity; 18 | this.tickDelta = tickDelta; 19 | 20 | this.x = MathHelper.lerp(tickDelta, focusedEntity.prevX, focusedEntity.getX()); 21 | 22 | this.y = MathHelper.lerp(tickDelta, focusedEntity.prevY, focusedEntity.getY()) + MathHelper.lerp(tickDelta, lastCameraY, cameraY); 23 | 24 | this.z = MathHelper.lerp(tickDelta, focusedEntity.prevZ, focusedEntity.getZ()); 25 | 26 | this.yaw = focusedEntity.getYaw(tickDelta); 27 | 28 | this.pitch = focusedEntity.getPitch(tickDelta); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/gui/ClickGUIScreen.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.gui; 2 | 3 | import io.github.vialdevelopment.tori.client.gui.api.ClickGUIScene; 4 | import io.github.vialdevelopment.tori.client.gui.scene.module.ModuleScene; 5 | import net.minecraft.client.gui.ParentElement; 6 | import net.minecraft.client.gui.screen.Screen; 7 | import net.minecraft.client.util.math.MatrixStack; 8 | import net.minecraft.text.Text; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | public class ClickGUIScreen extends Screen implements ParentElement { 14 | 15 | public ClickGUIScreen(Text title) { 16 | super(title); 17 | } 18 | 19 | private List scenes = new ArrayList<>(); 20 | 21 | private ClickGUIScene currentScene; 22 | 23 | public void initGUI() { 24 | this.addScenes(); 25 | this.initScenes(); 26 | this.currentScene = this.scenes.get(0); 27 | } 28 | 29 | private void addScenes() { 30 | this.scenes.add(new ModuleScene()); 31 | } 32 | 33 | private void initScenes() { 34 | for (ClickGUIScene scene : this.scenes) { 35 | scene.init(); 36 | } 37 | } 38 | 39 | @Override 40 | public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { 41 | this.currentScene.render(matrixStack, mouseX, mouseY, partialTicks); 42 | } 43 | 44 | @Override 45 | public boolean mouseClicked(double mouseX, double mouseY, int mouseButton) { 46 | this.currentScene.mouseClicked(mouseX, mouseY, mouseButton); 47 | return super.mouseClicked(mouseX, mouseY, mouseButton); 48 | } 49 | 50 | @Override 51 | public boolean mouseReleased(double mouseX, double mouseY, int mouseButton) { 52 | this.currentScene.mouseReleased(mouseX, mouseY, mouseButton); 53 | return super.mouseReleased(mouseX, mouseY, mouseButton); 54 | } 55 | 56 | @Override 57 | public boolean keyPressed(int keyCode, int scanCode, int modifiers) { 58 | this.currentScene.keyPressed(keyCode, scanCode, modifiers); 59 | return super.keyPressed(keyCode, scanCode, modifiers); 60 | } 61 | 62 | @Override 63 | public boolean mouseScrolled(double mouseX, double mouseY, double amount) { 64 | this.currentScene.mouseScrolled(mouseX, mouseY, amount); 65 | return super.mouseScrolled(mouseX, mouseY, amount); 66 | } 67 | 68 | @Override 69 | public boolean isPauseScreen() { 70 | return false; 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/gui/api/Button.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.gui.api; 2 | 3 | import io.github.vialdevelopment.tori.util.FontUtil; 4 | import net.minecraft.client.MinecraftClient; 5 | import net.minecraft.client.gui.screen.Screen; 6 | import net.minecraft.client.util.math.MatrixStack; 7 | 8 | import java.awt.*; 9 | 10 | /** 11 | * @author cats 12 | * @since April 30, 2020 13 | */ 14 | public class Button { 15 | 16 | /** 17 | * this is text scaling 18 | */ 19 | public static float textScale = 1.4f; 20 | 21 | public int width, height, x, y; 22 | 23 | /** 24 | * the text to render on the button 25 | */ 26 | public String text; 27 | 28 | /** 29 | * the color of the button 30 | */ 31 | public Color color; 32 | 33 | protected MinecraftClient mc = MinecraftClient.getInstance(); 34 | 35 | public Button(String text, Color color) { 36 | this.text = text; 37 | this.color = color; 38 | } 39 | 40 | /** 41 | * Process a click on the button 42 | */ 43 | public void click(double mouseX, double mouseY, int mouseButton) { 44 | 45 | } 46 | 47 | public void release(double mouseX, double mouseY, int button) { 48 | 49 | } 50 | 51 | /** 52 | * process a typed key 53 | */ 54 | public void keyTyped(char typedChar, int keyCode) { 55 | 56 | } 57 | 58 | /** 59 | * draws the button 60 | */ 61 | public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks, int width, int height, int x, int y) { 62 | this.width = width; 63 | this.height = height; 64 | this.x = x; 65 | this.y = y; 66 | 67 | Screen.fill(matrixStack, x, y, x + width, y + height, this.color.getRGB()); 68 | FontUtil.drawShadowedString(matrixStack, this.text, 69 | x + ((width / 2f) 70 | - (FontUtil.getStringWidth(this.text, textScale) / 2)), 71 | y + 2, 72 | -1, 73 | textScale); 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/gui/api/ClickGUIScene.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.gui.api; 2 | 3 | import net.minecraft.client.MinecraftClient; 4 | import net.minecraft.client.util.math.MatrixStack; 5 | 6 | /** 7 | * made to replicate what we might want in a scene 8 | */ 9 | public interface ClickGUIScene { 10 | 11 | default boolean isHovered(final double mouseX, final double mouseY, int width, int height, int x, int y) { 12 | return mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + height; 13 | } 14 | 15 | default MinecraftClient getMinecraft() { 16 | return MinecraftClient.getInstance(); 17 | } 18 | 19 | void init(); 20 | 21 | void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks); 22 | 23 | void mouseClicked(double mouseX, double mouseY, int mouseButton); 24 | 25 | void mouseReleased(double mouseX, double mouseY, int button); 26 | 27 | void keyPressed(int keyCode, int scanCode, int modifiers); 28 | 29 | void mouseScrolled(double mouseX, double mouseY, double amount); 30 | 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/gui/scene/module/ModuleScene.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.gui.scene.module; 2 | 3 | import io.github.vialdevelopment.tori.api.runnable.module.Module; 4 | import io.github.vialdevelopment.tori.api.setting.Setting; 5 | import io.github.vialdevelopment.tori.client.Tori; 6 | import io.github.vialdevelopment.tori.client.gui.api.Button; 7 | import io.github.vialdevelopment.tori.client.gui.api.ClickGUIScene; 8 | import io.github.vialdevelopment.tori.client.gui.scene.module.button.*; 9 | import io.github.vialdevelopment.tori.client.modules.render.ClickGUIModule; 10 | import io.github.vialdevelopment.tori.client.settings.BooleanSetting; 11 | import io.github.vialdevelopment.tori.util.Logger; 12 | import net.minecraft.client.util.InputUtil; 13 | import net.minecraft.client.util.Window; 14 | import net.minecraft.client.util.math.MatrixStack; 15 | 16 | import java.util.ArrayList; 17 | 18 | public class ModuleScene implements ClickGUIScene { 19 | 20 | 21 | private final int buttonHeight = (int) ((9 * Button.textScale) + 4); 22 | 23 | public double moduleRelativeY = 20; 24 | 25 | public double settingRelativeY = 20; 26 | 27 | private final ArrayList moduleButtons = new ArrayList<>(); 28 | 29 | private ModuleButton currentButton = null; 30 | 31 | 32 | @Override 33 | public void init() { 34 | if (this.moduleButtons.isEmpty()) { 35 | for (Module module : Tori.INSTANCE.moduleManager.getModules()) { 36 | ModuleButton button = new ModuleButton(module); 37 | if (ClickGUIModule.INSTANCE.debug.getValue()) Logger.println("Created module button " + button.text); 38 | if (!module.getSettings().isEmpty()) { 39 | for (Setting setting : module.getSettings()) { 40 | if (setting instanceof BooleanSetting) { 41 | button.settingButtons.add(new BooleanButton(setting)); 42 | } 43 | if (setting.getValue() instanceof Number) { 44 | button.settingButtons.add(new SliderButton(setting)); 45 | } 46 | if (setting.getValue() instanceof String) { 47 | button.settingButtons.add(new StringButton(setting)); 48 | } 49 | } 50 | } 51 | this.moduleButtons.add(button); 52 | } 53 | } 54 | } 55 | 56 | 57 | /** 58 | * draw the screen 59 | * @param mouseX the mouse x, dispatched with the render function 60 | * @param mouseY the mouse y, dispatched with the render function 61 | * @param partialTicks the partialTicks, also dispatched with the render function 62 | */ 63 | @Override 64 | public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { 65 | 66 | final Window window = this.getMinecraft().getWindow(); 67 | 68 | int moduleRelativeY = (int) this.moduleRelativeY; 69 | 70 | int settingRelativeY = (int) this.settingRelativeY; 71 | 72 | final int relativeX = 10; 73 | final int width = (window.getScaledWidth() / 2) - (relativeX * 2); 74 | 75 | final int settingX = relativeX + width + (relativeX * 2); 76 | 77 | for (ModuleButton moduleButton : this.moduleButtons) { 78 | moduleButton.render(matrixStack, mouseX, mouseY, partialTicks, width, this.buttonHeight, relativeX, moduleRelativeY); 79 | moduleRelativeY += this.buttonHeight + 1; 80 | } 81 | 82 | if (this.currentButton != null && !this.currentButton.settingButtons.isEmpty()) { 83 | for (SettingButton button : this.currentButton.settingButtons) { 84 | button.render(matrixStack, mouseX, mouseY, partialTicks, width, this.buttonHeight, settingX, settingRelativeY); 85 | settingRelativeY += this.buttonHeight + 1; 86 | } 87 | } 88 | } 89 | 90 | /** 91 | * runs and processes mouse clicks 92 | * @param mouseX the x pos of the mouse 93 | * @param mouseY the y pos of the mouse 94 | * @param mouseButton the button clicked 95 | */ 96 | public void mouseClicked(double mouseX, double mouseY, int mouseButton) { 97 | for (ModuleButton button : this.moduleButtons) { 98 | if (this.isHovered(mouseX, mouseY, button.width, button.height, button.x, button.y)) { 99 | if (mouseButton == 1) { 100 | this.currentButton = button; 101 | } 102 | button.click(mouseX, mouseY, mouseButton); 103 | return; 104 | } 105 | } 106 | if (this.currentButton != null && !this.currentButton.settingButtons.isEmpty()) { 107 | for (SettingButton settingButton : this.currentButton.settingButtons) { 108 | if (this.isHovered(mouseX, mouseY, settingButton.width, settingButton.height, settingButton.x, settingButton.y)) { 109 | settingButton.click(mouseX, mouseY, mouseButton); 110 | return; 111 | } 112 | } 113 | } 114 | 115 | } 116 | 117 | @Override 118 | public void mouseReleased(double mouseX, double mouseY, int button) { 119 | if (this.currentButton != null) { 120 | for (SettingButton settingButton : this.currentButton.settingButtons) { 121 | settingButton.release(mouseX, mouseY, button); 122 | } 123 | } 124 | } 125 | 126 | @Override 127 | public void keyPressed(int keyCode, int scanCode, int modifiers) { 128 | 129 | char typedChar = 0; 130 | 131 | String str = InputUtil.fromKeyCode(keyCode, 0).getTranslationKey(); 132 | 133 | if (str != null) { 134 | str = str.replaceFirst("key.keyboard.", ""); 135 | 136 | if (str.length() > 0) { 137 | typedChar = str.charAt(0); 138 | } 139 | } 140 | 141 | 142 | for (ModuleButton button : this.moduleButtons) { 143 | button.keyTyped(typedChar, keyCode); 144 | } 145 | } 146 | 147 | @Override 148 | public void mouseScrolled(double mouseX, double mouseY, double amount) { 149 | this.moduleRelativeY += amount; 150 | this.settingRelativeY += amount; 151 | } 152 | } 153 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/gui/scene/module/button/BooleanButton.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.gui.scene.module.button; 2 | 3 | import io.github.vialdevelopment.tori.api.setting.Setting; 4 | import io.github.vialdevelopment.tori.util.FontUtil; 5 | import net.minecraft.client.gui.screen.Screen; 6 | import net.minecraft.client.util.math.MatrixStack; 7 | 8 | import java.awt.*; 9 | 10 | /** 11 | * @author cats 12 | * @since April 30, 2020 13 | */ 14 | public class BooleanButton extends SettingButton { 15 | 16 | public BooleanButton(Setting setting) { 17 | super(setting); 18 | } 19 | 20 | /** 21 | * starts or stops sliding on click 22 | */ 23 | @Override 24 | public void click(double mouseX, double mouseY, int mouseButton) { 25 | this.setting.setValue(!((boolean) this.setting.getValue())); 26 | } 27 | 28 | /** 29 | * I handle the settings in this render 30 | * On render, I draw the settings, and also set them 31 | */ 32 | @Override 33 | public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks, int width, int height, int x, int y) { 34 | 35 | this.width = width; 36 | this.height = height; 37 | this.x = x; 38 | this.y = y; 39 | 40 | Screen.fill(matrixStack, x, y, x + width, y + height, (boolean) this.setting.getValue() ? new Color(0, 0, 255, 175).getRGB() : new Color(128, 128, 128, 175).getRGB()); 41 | // I am going to explain this mess, I use the scale to change the font size 42 | 43 | FontUtil.drawShadowedString(matrixStack, this.text, 44 | x + 2, 45 | y + 2, 46 | -1, 47 | textScale); 48 | 49 | FontUtil.drawShadowedString(matrixStack, this.setting.getValue().toString(), 50 | x + ((width / 2f) 51 | - (FontUtil.getStringWidth(this.setting.getValue().toString(), textScale) / 2)), 52 | y + 2, 53 | -1, 54 | textScale); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/gui/scene/module/button/ModuleButton.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.gui.scene.module.button; 2 | 3 | import io.github.vialdevelopment.tori.api.runnable.module.Module; 4 | import io.github.vialdevelopment.tori.client.gui.api.Button; 5 | import io.github.vialdevelopment.tori.util.FontUtil; 6 | import net.minecraft.client.gui.screen.Screen; 7 | import net.minecraft.client.util.math.MatrixStack; 8 | 9 | import java.awt.*; 10 | import java.util.ArrayList; 11 | 12 | /** 13 | * @author cats 14 | * @since April 30, 2020 15 | * This is used for modules, it's very epic 16 | */ 17 | public class ModuleButton extends Button { 18 | 19 | /** 20 | * the module that this button is 21 | */ 22 | public Module module; 23 | 24 | /** 25 | * the setting buttons that are associated with this module button 26 | */ 27 | public ArrayList settingButtons = new ArrayList<>(); 28 | 29 | public ModuleButton(Module module) { 30 | super(module.getName(), Color.GRAY); 31 | this.module = module; 32 | } 33 | 34 | /** 35 | * dispatches a click for the button, and determines what it does 36 | */ 37 | @Override 38 | public void click(double mouseX, double mouseY, int mouseButton) { 39 | if (mouseButton == 0) this.module.toggle(); 40 | } 41 | 42 | /** 43 | * it renders the button 44 | */ 45 | @Override 46 | public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks, int width, int height, int x, int y) { 47 | this.width = width; 48 | this.height = height; 49 | this.x = x; 50 | this.y = y; 51 | 52 | if (this.module.getState()) { 53 | Color color = new Color(110, 150, 105); 54 | this.color = new Color(color.getRed(), color.getGreen(), color.getBlue(), 240); 55 | } else { 56 | Color color = Color.GRAY; 57 | this.color = new Color(color.getRed(), color.getGreen(), color.getBlue(), 175); 58 | } 59 | 60 | Screen.fill(matrixStack, x, y, x + width, y + height, this.color.getRGB()); 61 | 62 | FontUtil.drawShadowedString(matrixStack, this.text, 63 | x + ((width / 2f) 64 | - (FontUtil.getStringWidth(this.text, textScale) / 2)), 65 | y + 2, 66 | -1, 67 | textScale); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/gui/scene/module/button/SettingButton.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.gui.scene.module.button; 2 | 3 | import io.github.vialdevelopment.tori.api.setting.Setting; 4 | import io.github.vialdevelopment.tori.client.gui.api.Button; 5 | import io.github.vialdevelopment.tori.util.FontUtil; 6 | import net.minecraft.client.gui.screen.Screen; 7 | import net.minecraft.client.util.math.MatrixStack; 8 | 9 | import java.awt.*; 10 | 11 | public class SettingButton extends Button { 12 | /** 13 | * the module setting 14 | */ 15 | public Setting setting; 16 | 17 | public SettingButton(Setting setting) { 18 | super(setting.getName(), Color.GRAY); 19 | this.setting = setting; 20 | } 21 | 22 | /** 23 | * draws the button 24 | */ 25 | @Override 26 | public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks, int width, int height, int x, int y) { 27 | this.width = width; 28 | this.height = height; 29 | this.x = x; 30 | this.y = y; 31 | 32 | Screen.fill(matrixStack, x, y, x + width, y + height, Color.BLUE.darker().getRGB()); 33 | FontUtil.drawShadowedString(matrixStack, this.text, 34 | x + 2, 35 | y + 2, 36 | -1, 37 | textScale); 38 | 39 | FontUtil.drawShadowedString(matrixStack, this.setting.getValue().toString(), 40 | x + ((width / 2f) 41 | - (FontUtil.getStringWidth(this.setting.getValue().toString(), textScale) / 2)), 42 | y + 2, 43 | -1, 44 | textScale); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/gui/scene/module/button/SliderButton.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.gui.scene.module.button; 2 | 3 | import io.github.vialdevelopment.tori.api.setting.Setting; 4 | import io.github.vialdevelopment.tori.util.FontUtil; 5 | import net.minecraft.client.gui.screen.Screen; 6 | import net.minecraft.client.util.math.MatrixStack; 7 | 8 | import java.awt.*; 9 | 10 | /** 11 | * @author cats 12 | * @since April 30, 2020 13 | */ 14 | public class SliderButton extends SettingButton { 15 | 16 | /** 17 | * determines the buttons sliding and if it is being slid 18 | */ 19 | private pos sliderPos = null; 20 | 21 | /** 22 | * the value it starts with 23 | */ 24 | private Object startValue; 25 | 26 | public SliderButton(Setting setting) { 27 | super(setting); 28 | } 29 | 30 | /** 31 | * starts or stops sliding on click 32 | */ 33 | @Override 34 | public void click(double mouseX, double mouseY, int mouseButton) { 35 | if (this.sliderPos == null) { 36 | this.sliderPos = new pos(mouseX, mouseY); 37 | this.startValue = this.setting.getValue(); 38 | } 39 | } 40 | 41 | @Override 42 | public void release(double mouseX, double mouseY, int button) { 43 | if (this.sliderPos != null) { 44 | this.sliderPos = null; 45 | } 46 | } 47 | 48 | /** 49 | * I handle the settings in this render 50 | * On render, I draw the settings, and also set them 51 | */ 52 | @Override 53 | public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks, int width, int height, int x, int y) { 54 | this.width = width; 55 | this.height = height; 56 | this.x = x; 57 | this.y = y; 58 | 59 | if (this.sliderPos != null) { 60 | 61 | double value = (mouseX - this.sliderPos.x)/* * ((double) this.setting.value)*/ / 10f; 62 | 63 | if (this.startValue instanceof Double) { 64 | this.setting.setValue((double) this.startValue + value); 65 | } else if (this.startValue instanceof Float) { 66 | this.setting.setValue((float) ((float) this.startValue + value)); 67 | } else if (this.startValue instanceof Long) { 68 | this.setting.setValue((long) ((long) this.startValue + value)); 69 | } else if (this.startValue instanceof Integer) { 70 | this.setting.setValue((int) ((int) this.startValue + value)); 71 | } 72 | } 73 | 74 | Screen.fill(matrixStack, x, y, x + width, y + height, new Color(0,0, 128, 175).getRGB()); 75 | FontUtil.drawShadowedString(matrixStack, this.text, 76 | x + 2, 77 | y + 2, 78 | -1, 79 | textScale); 80 | 81 | FontUtil.drawShadowedString(matrixStack, this.setting.getValue().toString(), 82 | x + ((width / 2f) 83 | - (FontUtil.getStringWidth(this.setting.getValue().toString(), textScale) / 2)), 84 | y + 2, 85 | -1, 86 | textScale); 87 | } 88 | 89 | /** 90 | * cute little class I use to keep track of pos 91 | */ 92 | static class pos { 93 | public double x; 94 | public double y; 95 | 96 | pos(double x, double y) { 97 | this.x = x; 98 | this.y = y; 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/gui/scene/module/button/StringButton.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.gui.scene.module.button; 2 | 3 | import io.github.vialdevelopment.tori.api.setting.Setting; 4 | import io.github.vialdevelopment.tori.util.FontUtil; 5 | import net.minecraft.client.gui.screen.Screen; 6 | import net.minecraft.client.util.math.MatrixStack; 7 | 8 | import java.awt.*; 9 | 10 | /** 11 | * @author cats 12 | */ 13 | public class StringButton extends SettingButton { 14 | public StringButton(Setting setting) { 15 | super(setting); 16 | } 17 | 18 | /** 19 | * the string drawn 20 | */ 21 | private String currentString; 22 | 23 | /** 24 | * shows if the button is being drawn on 25 | */ 26 | private boolean writing; 27 | 28 | /** 29 | * starts or stops sliding on click 30 | */ 31 | @Override 32 | public void click(double mouseX, double mouseY, int mouseButton) { 33 | this.writing = !this.writing; 34 | } 35 | 36 | /** 37 | * I handle the settings in this render 38 | * On render, I draw the settings, and also set them 39 | */ 40 | @Override 41 | public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks, int width, int height, int x, int y) { 42 | 43 | this.width = width; 44 | this.height = height; 45 | this.x = x; 46 | this.y = y; 47 | 48 | // If we're not writing, set the current string 49 | if (!this.writing) { 50 | this.currentString = (String) this.setting.getValue(); 51 | } 52 | 53 | Screen.fill(matrixStack, x, y, x + width, y + height, Color.PINK.getRGB()); 54 | FontUtil.drawShadowedString(matrixStack, this.text, 55 | x + 2, 56 | y + 2, 57 | -1, 58 | textScale); 59 | 60 | FontUtil.drawShadowedString(matrixStack, this.currentString, 61 | x + ((width / 2f) 62 | - (FontUtil.getStringWidth(this.currentString, textScale)/ 2)), 63 | y + 2, 64 | -1, 65 | textScale); 66 | } 67 | 68 | @Override 69 | public void keyTyped(char typedChar, int keyCode) { 70 | if (this.writing) { 71 | switch(keyCode) { 72 | case 1: 73 | break; 74 | case 14: 75 | if (this.currentString.length() > 0) { 76 | this.currentString = (this.currentString).substring(0, this.currentString.length() - 1); 77 | } 78 | break; 79 | case 28: 80 | this.setSettingString(this.currentString); 81 | break; 82 | default: 83 | this.currentString = this.currentString + typedChar; 84 | } 85 | } 86 | } 87 | 88 | /** 89 | * sets the value 90 | * nice and simple, doesn't need much 91 | */ 92 | private void setSettingString(String string) { 93 | if (this.writing) { 94 | this.setting.setValue(string); 95 | this.writing = false; 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/management/CommandManager.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.management; 2 | 3 | import io.github.vialdevelopment.tori.api.management.RunnableManager; 4 | import io.github.vialdevelopment.tori.api.traits.TraitRunnable; 5 | import io.github.vialdevelopment.tori.api.runnable.command.Command; 6 | import io.github.vialdevelopment.tori.client.commands.CommandsCommand; 7 | import io.github.vialdevelopment.tori.client.commands.LoginCommand; 8 | 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | public class CommandManager implements RunnableManager { 13 | 14 | private final List commands = new ArrayList<>(); 15 | 16 | public String PREFIX = "."; 17 | 18 | @Override 19 | public void addRunnables() { 20 | this.addRunnable(new CommandsCommand()); 21 | this.addRunnable(new LoginCommand()); 22 | } 23 | 24 | @Override 25 | public void addRunnable(TraitRunnable runnable) { 26 | this.getCommands().add((Command) runnable); 27 | } 28 | 29 | @Override 30 | public boolean dispatchRunnable(String message) { 31 | final String[] command = message.split(" "); 32 | for (Command possibleCommand : this.getCommands()) { 33 | if (command[0].equalsIgnoreCase(possibleCommand.getName())) { 34 | final String[] commandArgs = message.replace(command[0] + " ", "").split(" "); 35 | possibleCommand.run(commandArgs); 36 | return true; 37 | } 38 | } 39 | return false; 40 | } 41 | 42 | // getters and setters 43 | 44 | public List getCommands() { 45 | return this.commands; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/management/ConfigManager.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.management; 2 | 3 | import io.github.vialdevelopment.tori.api.config.TraitConfigurable; 4 | import io.github.vialdevelopment.tori.client.Tori; 5 | import io.github.vialdevelopment.tori.client.config.ModuleConfig; 6 | import net.minecraft.client.MinecraftClient; 7 | 8 | import java.io.*; 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | public class ConfigManager { 12 | public final String PATH = MinecraftClient.getInstance().runDirectory + File.separator + Tori.MOD_NAME + File.separator; 13 | 14 | private final List configs = new ArrayList<>(); 15 | 16 | public void init() { 17 | this.addConfigs(); 18 | } 19 | 20 | private void addConfigs() { 21 | this.getConfigs().add(new ModuleConfig()); 22 | } 23 | 24 | /** 25 | * Writes the configuration to Canopy.json 26 | * Friends and Modules 27 | */ 28 | public void writeConfig() { 29 | 30 | File directory = new File(this.PATH); 31 | 32 | if (!directory.exists()) directory.mkdir(); 33 | 34 | for (TraitConfigurable config : this.getConfigs()) { 35 | config.write(); 36 | } 37 | } 38 | 39 | /** 40 | * Loads the modules from the json 41 | */ 42 | public void readConfig() { 43 | for (TraitConfigurable config : this.getConfigs()) { 44 | config.read(); 45 | } 46 | } 47 | 48 | // Getters 49 | 50 | public List getConfigs() { 51 | return this.configs; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/management/KeyBindingManager.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.management; 2 | 3 | import io.github.vialdevelopment.attendance.attender.Attender; 4 | import io.github.vialdevelopment.tori.api.runnable.module.Module; 5 | import io.github.vialdevelopment.tori.client.Tori; 6 | import io.github.vialdevelopment.tori.client.events.TickEvent; 7 | import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; 8 | import net.minecraft.client.options.KeyBinding; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | 13 | public class KeyBindingManager { 14 | 15 | private final List keyBindings = new ArrayList<>(); 16 | 17 | public void init() { 18 | this.addAllKeyBindings(); 19 | for (KeyBinding keyBinding : this.getKeyBindings()) { 20 | KeyBindingHelper.registerKeyBinding(keyBinding); 21 | } 22 | 23 | Tori.INSTANCE.eventManager.registerAttender(this); 24 | Tori.INSTANCE.eventManager.setAttending(this, true); 25 | } 26 | 27 | private final Attender tickEvent = new Attender<>(TickEvent.class, event -> { 28 | for (Module module : Tori.INSTANCE.moduleManager.getModules()) { 29 | if (module.getKeyBind().wasPressed()) { 30 | module.toggle(); 31 | } 32 | } 33 | }); 34 | 35 | private void addAllKeyBindings() { 36 | this.addModuleBinds(); 37 | } 38 | 39 | private void addModuleBinds() { 40 | for (Module module : Tori.INSTANCE.moduleManager.getModules()) { 41 | this.getKeyBindings().add(module.getKeyBind()); 42 | } 43 | } 44 | 45 | // Getter 46 | 47 | public List getKeyBindings() { 48 | return this.keyBindings; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/management/ModuleManager.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.management; 2 | 3 | import io.github.vialdevelopment.tori.api.management.RunnableManager; 4 | import io.github.vialdevelopment.tori.api.setting.Setting; 5 | import io.github.vialdevelopment.tori.api.traits.TraitRunnable; 6 | import io.github.vialdevelopment.tori.api.runnable.module.Module; 7 | import io.github.vialdevelopment.tori.client.Tori; 8 | import io.github.vialdevelopment.tori.client.modules.exploit.ItemTweaksModule; 9 | import io.github.vialdevelopment.tori.client.modules.exploit.SpeedMineModule; 10 | import io.github.vialdevelopment.tori.client.modules.misc.PortalChatModule; 11 | import io.github.vialdevelopment.tori.client.modules.movement.ElytraFlyModule; 12 | import io.github.vialdevelopment.tori.client.modules.movement.JesusModule; 13 | import io.github.vialdevelopment.tori.client.modules.movement.SprintModule; 14 | import io.github.vialdevelopment.tori.client.modules.movement.VelocityModule; 15 | import io.github.vialdevelopment.tori.client.modules.player.FreeCamModule; 16 | import io.github.vialdevelopment.tori.client.modules.player.MultiSessionModule; 17 | import io.github.vialdevelopment.tori.client.modules.render.*; 18 | import io.github.vialdevelopment.tori.util.Logger; 19 | 20 | import java.lang.reflect.Field; 21 | import java.util.ArrayList; 22 | import java.util.List; 23 | 24 | public class ModuleManager implements RunnableManager { 25 | 26 | private final List modules = new ArrayList<>(); 27 | 28 | @Override 29 | public void addRunnables() { 30 | this.addRunnable(new SprintModule()); 31 | this.addRunnable(BrightnessModule.INSTANCE); 32 | this.addRunnable(new ItemTweaksModule()); 33 | this.addRunnable(new FreeCamModule()); 34 | this.addRunnable(new ElytraFlyModule()); 35 | this.addRunnable(new VelocityModule()); 36 | this.addRunnable(new PortalChatModule()); 37 | this.addRunnable(new NoRenderModule()); 38 | this.addRunnable(new HUDModule()); 39 | this.addRunnable(ClickGUIModule.INSTANCE); 40 | this.addRunnable(JesusModule.INSTANCE); 41 | this.addRunnable(new MultiSessionModule()); 42 | this.addRunnable(new ESPModule()); 43 | this.addRunnable(new SpeedMineModule()); 44 | } 45 | 46 | @Override 47 | public void addRunnable(TraitRunnable runnable) { 48 | final Module module = (Module) runnable; 49 | try { 50 | for (Field field : module.getClass().getDeclaredFields()) { 51 | if (Setting.class.isAssignableFrom(field.getType())) { 52 | field.setAccessible(true); 53 | Setting value = (Setting) field.get(module); 54 | module.getSettings().add(value); 55 | } 56 | } 57 | } catch (Exception e) { 58 | e.printStackTrace(); 59 | } 60 | 61 | if (module.shouldAttend()) Tori.INSTANCE.eventManager.registerAttender(module); 62 | 63 | this.modules.add(module); 64 | Logger.log(module.getName()); 65 | } 66 | 67 | @Override 68 | public boolean dispatchRunnable(String message) { 69 | final String[] command = message.split(" "); 70 | for (Module possibleModule : this.getModules()) { 71 | if (command[0].equalsIgnoreCase(possibleModule.getName())) { 72 | final String[] commandArgs = message.replace(command[0] + " ", "").split(" "); 73 | possibleModule.run(commandArgs); 74 | return true; 75 | } 76 | } 77 | return false; 78 | } 79 | 80 | public Module getModule(String name) { 81 | for (Module module : this.getModules()) { 82 | if (module.getName().equalsIgnoreCase(name)) return module; 83 | } 84 | return null; 85 | } 86 | 87 | // getters and setters 88 | 89 | public List getModules() { 90 | return this.modules; 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/modules/exploit/ItemTweaksModule.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.modules.exploit; 2 | 3 | import io.github.vialdevelopment.attendance.attender.Attender; 4 | import io.github.vialdevelopment.tori.api.runnable.module.Category; 5 | import io.github.vialdevelopment.tori.api.runnable.module.Module; 6 | import io.github.vialdevelopment.tori.client.events.GetItemCooldownEvent; 7 | 8 | public class ItemTweaksModule extends Module { 9 | public ItemTweaksModule() { 10 | super("ItemTweaks", "Tweaks the mechanics of some items", Category.EXPLOIT); 11 | } 12 | 13 | private final Attender event = new Attender<>(GetItemCooldownEvent.class, event -> { 14 | event.coolDown = 0f; 15 | }); 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/modules/exploit/SpeedMineModule.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.modules.exploit; 2 | 3 | import io.github.vialdevelopment.attendance.attender.Attender; 4 | import io.github.vialdevelopment.tori.api.runnable.module.Category; 5 | import io.github.vialdevelopment.tori.api.runnable.module.Module; 6 | import io.github.vialdevelopment.tori.client.events.TickEvent; 7 | import io.github.vialdevelopment.tori.mixin.duck.ClientPlayerInteractionManagerDuck; 8 | 9 | public class SpeedMineModule extends Module { 10 | public SpeedMineModule() { 11 | super("SpeedMine", "Mines but faster", Category.EXPLOIT); 12 | } 13 | 14 | private final Attender tickAttender = new Attender<>(TickEvent.class, event -> { 15 | 16 | final ClientPlayerInteractionManagerDuck interactionManager = (ClientPlayerInteractionManagerDuck) mc.interactionManager; 17 | 18 | if (interactionManager != null) { 19 | if (interactionManager.getCurrentBreakingProgress() > 0.75f) { 20 | interactionManager.setCurrentBreakingProgress(1.0f); 21 | } 22 | } 23 | }); 24 | } 25 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/modules/misc/PortalChatModule.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.modules.misc; 2 | 3 | import io.github.vialdevelopment.attendance.attender.Attender; 4 | import io.github.vialdevelopment.tori.api.runnable.module.Category; 5 | import io.github.vialdevelopment.tori.api.runnable.module.Module; 6 | import io.github.vialdevelopment.tori.client.events.TickEvent; 7 | import io.github.vialdevelopment.tori.mixin.duck.EntityDuck; 8 | 9 | public class PortalChatModule extends Module { 10 | public PortalChatModule() { 11 | super("PortalChat", "Lets you talk in a portal because portals are annoying", Category.MISC); 12 | } 13 | 14 | private final Attender tickEventAttender = new Attender<>(TickEvent.class, event -> { 15 | if (mc.player != null) ((EntityDuck) mc.player).setInNetherPortal(false); 16 | }); 17 | } 18 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/modules/movement/ElytraFlyModule.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.modules.movement; 2 | 3 | import io.github.vialdevelopment.attendance.attender.Attender; 4 | import io.github.vialdevelopment.tori.api.runnable.module.Category; 5 | import io.github.vialdevelopment.tori.api.runnable.module.Module; 6 | import io.github.vialdevelopment.tori.client.events.MoveEvent; 7 | import io.github.vialdevelopment.tori.client.settings.BooleanSetting; 8 | import io.github.vialdevelopment.tori.client.settings.number.DoubleSetting; 9 | import io.github.vialdevelopment.tori.util.PlayerUtil; 10 | import net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket; 11 | 12 | public class ElytraFlyModule extends Module { 13 | 14 | private final DoubleSetting speed = new DoubleSetting("Speed", 1d); 15 | private final DoubleSetting descendSpeed = new DoubleSetting("Descent", -0.000101d); 16 | private final BooleanSetting up = new BooleanSetting("Up", true); 17 | private final BooleanSetting infiniteDurability = new BooleanSetting("InfiniteDurability", false); 18 | 19 | public ElytraFlyModule() { 20 | super("ElytraFly", "Vroom", Category.MOVEMENT); 21 | } 22 | 23 | private final Attender moveEvent = new Attender<>(MoveEvent.class, event -> { 24 | 25 | if (mc.player == null) return; 26 | 27 | event.setCanceled(true); 28 | 29 | if (mc.player.isFallFlying()) { 30 | 31 | if (this.infiniteDurability.getBooleanValue()) { 32 | mc.getNetworkHandler().sendPacket(new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.START_FALL_FLYING)); 33 | mc.getNetworkHandler().sendPacket(new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.START_FALL_FLYING)); 34 | } 35 | 36 | if (!this.up.getBooleanValue()) { 37 | if (!mc.options.keyJump.isPressed()) { 38 | if (mc.options.keySneak.isPressed()) { 39 | mc.player.setVelocity(mc.player.getVelocity().x, -(this.speed.getDoubleValue() / 2), mc.player.getVelocity().z); 40 | event.y = -(this.speed.getDoubleValue() / 2); 41 | } else if (event.y != this.descendSpeed.getDoubleValue()) { 42 | event.y = (this.descendSpeed.getDoubleValue()); 43 | mc.player.setVelocity(mc.player.getVelocity().x, this.descendSpeed.getDoubleValue(), mc.player.getVelocity().z); 44 | } 45 | } 46 | } else { 47 | if (!mc.options.keyJump.isPressed() && !mc.options.keySneak.isPressed()) { 48 | if (event.y != this.descendSpeed.getDoubleValue()) { 49 | event.y = (this.descendSpeed.getDoubleValue()); 50 | } 51 | mc.player.setVelocity(mc.player.getVelocity().x, 0, mc.player.getVelocity().z); 52 | } else { 53 | mc.player.setVelocity(mc.player.getVelocity().x, 0, mc.player.getVelocity().z); 54 | double motion = 0; 55 | 56 | if (mc.options.keyJump.isPressed()) { 57 | 58 | motion += this.speed.getDoubleValue() / 2; 59 | } 60 | if (mc.options.keySneak.isPressed()) { 61 | motion -= (this.speed.getDoubleValue() / 2); 62 | } 63 | mc.player.setVelocity(mc.player.getVelocity().x, motion, mc.player.getVelocity().z); 64 | } 65 | } 66 | 67 | PlayerUtil.setXMovement(event, this.speed.getDoubleValue()); 68 | 69 | 70 | if (this.infiniteDurability.getBooleanValue()) { 71 | mc.getNetworkHandler().sendPacket(new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.START_FALL_FLYING)); 72 | mc.getNetworkHandler().sendPacket(new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.START_FALL_FLYING)); 73 | } 74 | } 75 | }); 76 | } 77 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/modules/movement/JesusModule.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.modules.movement; 2 | 3 | import io.github.vialdevelopment.tori.api.runnable.module.Category; 4 | import io.github.vialdevelopment.tori.api.runnable.module.Module; 5 | 6 | public class JesusModule extends Module { 7 | 8 | public static final JesusModule INSTANCE = new JesusModule(); 9 | 10 | public JesusModule() { 11 | super("Jesus", "Lets you walk on water", Category.MOVEMENT); 12 | } 13 | 14 | @Override 15 | public boolean shouldAttend() { 16 | return false; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/modules/movement/SprintModule.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.modules.movement; 2 | 3 | import io.github.vialdevelopment.attendance.attender.Attender; 4 | import io.github.vialdevelopment.tori.api.runnable.module.Category; 5 | import io.github.vialdevelopment.tori.api.runnable.module.Module; 6 | import io.github.vialdevelopment.tori.client.events.SendMovementPacketEvent; 7 | 8 | public class SprintModule extends Module { 9 | public SprintModule() { 10 | super("Sprint", "Sprints for you!", Category.MOVEMENT); 11 | } 12 | 13 | private final Attender sendMovementPacketEvent = new Attender<>(SendMovementPacketEvent.class, event -> { 14 | if (mc.player == null) return; 15 | if (mc.player.input.movementForward != 0 || mc.player.input.movementSideways != 0) { 16 | if (mc.player.getHungerManager().getFoodLevel() > 6) mc.player.setSprinting(true); 17 | } 18 | }); 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/modules/movement/VelocityModule.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.modules.movement; 2 | 3 | import io.github.vialdevelopment.attendance.attender.Attender; 4 | import io.github.vialdevelopment.tori.api.runnable.module.Category; 5 | import io.github.vialdevelopment.tori.api.runnable.module.Module; 6 | import io.github.vialdevelopment.tori.client.events.AddEntityCollisionEvent; 7 | import io.github.vialdevelopment.tori.client.events.PacketEvent; 8 | import net.minecraft.network.packet.s2c.play.EntityVelocityUpdateS2CPacket; 9 | import net.minecraft.network.packet.s2c.play.ExplosionS2CPacket; 10 | 11 | public class VelocityModule extends Module { 12 | public VelocityModule() { 13 | super("Velocity", "Stops you from taking too much knockback", Category.MOVEMENT); 14 | } 15 | 16 | private final Attender packetInEvent = new Attender<>(PacketEvent.In.class, event -> { 17 | if (mc.player == null) return; 18 | if (event.packet instanceof EntityVelocityUpdateS2CPacket) { 19 | EntityVelocityUpdateS2CPacket packet = (EntityVelocityUpdateS2CPacket) event.packet; 20 | if (packet.getId() == mc.player.getEntityId()) event.setCanceled(true); 21 | return; 22 | } 23 | if (event.packet instanceof ExplosionS2CPacket) { 24 | event.setCanceled(true); 25 | //return; 26 | } 27 | }); 28 | 29 | 30 | private final Attender addEntityCollisionEvent = new Attender<>(AddEntityCollisionEvent.class, event -> { 31 | if (event.entity == mc.player) { 32 | event.x = 0; 33 | event.y = 0; 34 | event.z = 0; 35 | } 36 | }); 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/modules/player/FreeCamModule.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.modules.player; 2 | 3 | import io.github.vialdevelopment.attendance.attender.Attender; 4 | import io.github.vialdevelopment.tori.api.event.EventStage; 5 | import io.github.vialdevelopment.tori.api.runnable.module.Category; 6 | import io.github.vialdevelopment.tori.api.runnable.module.Module; 7 | import io.github.vialdevelopment.tori.client.events.InputEvent; 8 | import io.github.vialdevelopment.tori.client.events.UpdateCameraEvent; 9 | import io.github.vialdevelopment.tori.client.settings.number.DoubleSetting; 10 | import net.minecraft.client.input.Input; 11 | import net.minecraft.client.input.KeyboardInput; 12 | 13 | public class FreeCamModule extends Module { 14 | 15 | private final DoubleSetting speed = new DoubleSetting("Speed", 1d); 16 | 17 | public FreeCamModule() { 18 | super("FreeCam", "Allows you to move around freely from your body!", Category.PLAYER); 19 | } 20 | 21 | private double x, y, z; 22 | 23 | private float yaw, pitch; 24 | 25 | private Input input = null; 26 | 27 | @Override 28 | public void onEnable() { 29 | super.onEnable(); 30 | if (mc.getEntityRenderDispatcher() == null) return; 31 | this.x = mc.getEntityRenderDispatcher().camera.getPos().getX(); 32 | 33 | this.y = mc.getEntityRenderDispatcher().camera.getPos().getY(); 34 | 35 | this.z = mc.getEntityRenderDispatcher().camera.getPos().getZ(); 36 | } 37 | 38 | private final Attender inputEventAttender = new Attender<>(InputEvent.class, event -> { 39 | if (mc.player == null || mc.world == null) return; 40 | if (event.getStage() == EventStage.EARLY) { 41 | if (this.input == null) { 42 | this.input = new KeyboardInput(mc.options); 43 | } 44 | if (!mc.options.keyPlayerList.isPressed()) { 45 | this.input.tick(mc.player.shouldSlowDown()); 46 | event.setCanceled(true); 47 | } 48 | } 49 | }); 50 | 51 | public Attender updateCameraEvent = new Attender<>(UpdateCameraEvent.class, event -> { 52 | if (mc.player == null || mc.world == null || this.input == null) return; 53 | this.setMoveSpeed(this.input, this.speed.getDoubleValue()); 54 | event.x = this.x; 55 | event.y = this.y; 56 | event.z = this.z; 57 | event.setCanceled(true); 58 | }); 59 | 60 | private void setMoveSpeed(Input input, double speed) { 61 | double forward = input.movementForward; 62 | double strafe = input.movementSideways; 63 | 64 | double x = 0; 65 | 66 | double y = 0; 67 | 68 | double z = 0; 69 | 70 | if (input.jumping) y += this.speed.getDoubleValue() / 3; 71 | if (input.sneaking) y -= this.speed.getDoubleValue() / 3; 72 | float yaw = mc.player.yaw; 73 | if (forward != 0.0 || strafe != 0.0) { 74 | if (forward != 0.0) { 75 | if (strafe > 0.0) { 76 | yaw += ((forward > 0.0) ? -45 : 45); 77 | } else if (strafe < 0.0) { 78 | yaw += ((forward > 0.0) ? 45 : -45); 79 | } 80 | strafe = 0.0; 81 | if (forward > 0.0) { 82 | forward = 1.0; 83 | } else if (forward < 0.0) { 84 | forward = -1.0; 85 | } 86 | } 87 | 88 | x += forward * speed * -Math.sin(Math.toRadians(yaw)) + strafe * speed * Math.cos(Math.toRadians(yaw)); 89 | 90 | y += y; 91 | 92 | z += forward * speed * Math.cos(Math.toRadians(yaw)) - strafe * speed * -Math.sin(Math.toRadians(yaw)); 93 | } 94 | 95 | this.x += x; 96 | 97 | this.y += y; 98 | 99 | this.z += z; 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/modules/player/MultiSessionModule.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.modules.player; 2 | 3 | import io.github.vialdevelopment.attendance.attender.Attender; 4 | import io.github.vialdevelopment.tori.api.runnable.module.Category; 5 | import io.github.vialdevelopment.tori.api.runnable.module.Module; 6 | import io.github.vialdevelopment.tori.client.events.PacketEvent; 7 | import io.github.vialdevelopment.tori.mixin.duck.HandshakeC2SPacketDuck; 8 | import io.github.vialdevelopment.tori.util.SessionUtil; 9 | import net.minecraft.client.gui.screen.ConnectScreen; 10 | import net.minecraft.client.network.ClientPlayerEntity; 11 | import net.minecraft.client.util.Session; 12 | import net.minecraft.network.packet.c2s.handshake.HandshakeC2SPacket; 13 | 14 | import java.util.HashMap; 15 | 16 | public class MultiSessionModule extends Module { 17 | public MultiSessionModule() { 18 | super("MultiSession", "Allows the use of several sessions at once maybe", Category.PLAYER); 19 | } 20 | 21 | private String ip = "127.0.0.1"; 22 | 23 | private int port = 8080; 24 | 25 | private final HashMap sessionMap = new HashMap<>(); 26 | 27 | private final Attender packetEventAttender = new Attender<>(PacketEvent.Out.class, event -> { 28 | if (event.packet instanceof HandshakeC2SPacket) { 29 | final HandshakeC2SPacketDuck packet = (HandshakeC2SPacketDuck) event.packet; 30 | this.ip = packet.getAddress(); 31 | this.port = packet.getPort(); 32 | } 33 | }); 34 | 35 | @Override 36 | public void run(String[] args) { 37 | if (args.length == 2) { 38 | if (args[0].equalsIgnoreCase("switch")) { 39 | ClientPlayerEntity entity = null; 40 | 41 | for (ClientPlayerEntity clientPlayerEntity : this.sessionMap.keySet()) { 42 | if (clientPlayerEntity.getName().asString().equalsIgnoreCase(args[1])) { 43 | entity = clientPlayerEntity; 44 | break; 45 | } 46 | } 47 | 48 | 49 | SessionUtil.setSession(this.sessionMap.get(entity)); 50 | mc.player = entity; 51 | return; 52 | } 53 | } 54 | 55 | if (args.length == 3) { 56 | if (args[0].equals("login")) { 57 | if (!this.sessionMap.containsKey(mc.player)) this.sessionMap.put(mc.player, mc.getSession()); 58 | 59 | final Session session = SessionUtil.createSession(args[1], args[2]); 60 | 61 | if (session != null) SessionUtil.setSession(session); 62 | 63 | mc.openScreen(new ConnectScreen(null, mc, this.ip, this.port)); 64 | } 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/modules/render/BrightnessModule.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.modules.render; 2 | 3 | import io.github.vialdevelopment.tori.api.runnable.module.Category; 4 | import io.github.vialdevelopment.tori.api.runnable.module.Module; 5 | 6 | public class BrightnessModule extends Module { 7 | 8 | public static final BrightnessModule INSTANCE = new BrightnessModule(); 9 | 10 | private BrightnessModule() { 11 | super("Brightness", "Brightens up your game, making playing a bit easier", Category.RENDER); 12 | } 13 | 14 | @Override 15 | public boolean shouldAttend() { 16 | return false; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/modules/render/ClickGUIModule.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.modules.render; 2 | 3 | import io.github.vialdevelopment.attendance.attender.Attender; 4 | import io.github.vialdevelopment.tori.api.runnable.module.Category; 5 | import io.github.vialdevelopment.tori.api.runnable.module.Module; 6 | import io.github.vialdevelopment.tori.client.Tori; 7 | import io.github.vialdevelopment.tori.client.events.TickEvent; 8 | import io.github.vialdevelopment.tori.client.settings.BooleanSetting; 9 | 10 | public class ClickGUIModule extends Module { 11 | 12 | public static final ClickGUIModule INSTANCE = new ClickGUIModule(); 13 | 14 | public final BooleanSetting debug = new BooleanSetting("Debug", false); 15 | 16 | public ClickGUIModule() { 17 | super("ClickGUI", "Displays a gui that you cn click on!", Category.RENDER); 18 | } 19 | 20 | @Override 21 | public void onEnable() { 22 | super.onEnable(); 23 | try { 24 | mc.openScreen(Tori.INSTANCE.clickGUIScreen); 25 | } catch (Exception e) { 26 | e.printStackTrace(); 27 | } 28 | } 29 | 30 | private final Attender tickEventAttender = new Attender<>(TickEvent.class, event -> { 31 | if (mc.currentScreen != Tori.INSTANCE.clickGUIScreen) { 32 | this.setState(false); 33 | } 34 | }); 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/modules/render/ESPModule.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.modules.render; 2 | 3 | import com.mojang.blaze3d.systems.RenderSystem; 4 | import io.github.vialdevelopment.attendance.attender.Attender; 5 | import io.github.vialdevelopment.tori.api.runnable.module.Category; 6 | import io.github.vialdevelopment.tori.api.runnable.module.Module; 7 | import io.github.vialdevelopment.tori.client.events.Render3DEvent; 8 | import io.github.vialdevelopment.tori.util.RenderUtil; 9 | import net.minecraft.block.entity.BlockEntity; 10 | import net.minecraft.block.entity.ChestBlockEntity; 11 | import net.minecraft.block.entity.FurnaceBlockEntity; 12 | import net.minecraft.entity.Entity; 13 | import net.minecraft.entity.mob.HostileEntity; 14 | import net.minecraft.entity.passive.AnimalEntity; 15 | import net.minecraft.entity.player.PlayerEntity; 16 | import net.minecraft.util.math.Box; 17 | 18 | import java.awt.*; 19 | 20 | public class ESPModule extends Module { 21 | public ESPModule() { 22 | super("ESP", "Shows the locations of some things", Category.RENDER); 23 | } 24 | 25 | private final Attender render3DEvent = new Attender<>(Render3DEvent.class, event -> { 26 | if (mc.world == null) return; 27 | RenderSystem.pushMatrix(); 28 | RenderUtil.startRender(event.matrixStack); 29 | RenderSystem.disableTexture(); 30 | RenderSystem.depthMask(false); 31 | RenderSystem.disableDepthTest(); 32 | 33 | for (Entity entity : mc.world.getEntities()) { 34 | if (entity != mc.player) { 35 | final Color color = this.getEntityColor(entity); 36 | if (color != null) { 37 | 38 | final Box renderBox = RenderUtil.getEntityRenderBox(entity, event.tickDelta); 39 | 40 | // Draw the filled box 41 | RenderUtil.drawFilledBox(renderBox, new Color(color.getRed(), color.getGreen(), color.getBlue(), 40)); 42 | 43 | //draw the outline 44 | RenderSystem.lineWidth(1.5f); 45 | RenderUtil.drawBox(renderBox, color); 46 | } 47 | } 48 | } 49 | 50 | for (BlockEntity blockEntity : mc.world.blockEntities) { 51 | if (blockEntity == null) continue; 52 | if ((blockEntity instanceof ChestBlockEntity) || (blockEntity instanceof FurnaceBlockEntity)) { 53 | 54 | final Box box = new Box(blockEntity.getPos()); 55 | 56 | RenderUtil.drawBox(box, Color.RED); 57 | } 58 | } 59 | 60 | RenderSystem.enableDepthTest(); 61 | RenderSystem.depthMask(true); 62 | RenderSystem.enableTexture(); 63 | RenderUtil.endRender(); 64 | //event.matrixStack.pop(); 65 | RenderSystem.popMatrix(); 66 | }); 67 | 68 | /** 69 | * Get color function 70 | * @param entity the input entity to determine the color returned 71 | * @return the color returned for given entity 72 | */ 73 | private Color getEntityColor(Entity entity) { 74 | if (entity instanceof PlayerEntity) { 75 | return Color.RED; 76 | } 77 | if (entity instanceof HostileEntity) { 78 | return Color.ORANGE.darker(); 79 | } 80 | 81 | if (entity instanceof AnimalEntity) { 82 | return Color.GREEN; 83 | } 84 | return null; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/modules/render/HUDModule.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.modules.render; 2 | 3 | import io.github.vialdevelopment.attendance.attender.Attender; 4 | import io.github.vialdevelopment.tori.api.runnable.module.Category; 5 | import io.github.vialdevelopment.tori.api.runnable.module.Module; 6 | import io.github.vialdevelopment.tori.client.Tori; 7 | import io.github.vialdevelopment.tori.client.events.Render2DEvent; 8 | import io.github.vialdevelopment.tori.client.settings.BooleanSetting; 9 | import io.github.vialdevelopment.tori.client.settings.number.FloatSetting; 10 | import io.github.vialdevelopment.tori.util.FontUtil; 11 | import io.github.vialdevelopment.tori.util.Logger; 12 | import net.minecraft.client.gui.screen.ChatScreen; 13 | import net.minecraft.client.util.Window; 14 | import net.minecraft.client.util.math.MatrixStack; 15 | import net.minecraft.entity.Entity; 16 | import net.minecraft.util.math.Vec3d; 17 | 18 | import java.awt.*; 19 | 20 | public class HUDModule extends Module { 21 | 22 | private final BooleanSetting watermark = new BooleanSetting("Watermark", true); 23 | 24 | private final FloatSetting textScale = new FloatSetting("TextScale", 1f); 25 | 26 | public HUDModule() { 27 | super("HUD", "A heads up display", Category.RENDER); 28 | } 29 | 30 | private final Color color = Color.LIGHT_GRAY; 31 | 32 | private float increment = 0; 33 | 34 | 35 | private final Attender render2DEventAttender = new Attender<>(Render2DEvent.class, event -> { 36 | if (mc.world == null || mc.player == null) return; 37 | this.drawArrayList(event.matrixStack); 38 | this.drawCoordinates(event.matrixStack); 39 | }); 40 | 41 | 42 | private void drawArrayList(MatrixStack matrixStack) { 43 | final float xOffset = 2; 44 | 45 | float currentHeight = 2; 46 | 47 | if (this.watermark.getBooleanValue()) FontUtil.drawShadowedString(matrixStack, Tori.MOD_NAME, xOffset, currentHeight, this.color.getRGB(), this.textScale.getFloatValue()); 48 | 49 | currentHeight += this.getIncrement(); 50 | 51 | if (Tori.INSTANCE.moduleManager.getModules().isEmpty()) Logger.log("WHAT"); 52 | 53 | for (Module module : Tori.INSTANCE.moduleManager.getModules()) { 54 | if (!module.getState()) continue; 55 | FontUtil.drawShadowedString(matrixStack, module.getName() + module.getModuleInfo(), xOffset, currentHeight, Color.WHITE.getRGB(), this.textScale.getFloatValue()); 56 | currentHeight += this.getIncrement(); 57 | } 58 | } 59 | 60 | private void drawCoordinates(MatrixStack matrixStack) { 61 | final Entity player = mc.player; 62 | final Window scaledResolution = mc.getWindow(); 63 | final Vec3d normalCoords = mc.player.getPos(); 64 | final Vec3d otherCoords = (mc.world.getDimension().isUltrawarm()) ? player.getPos().multiply(8) : mc.player.getPos().multiply(1d / 8d); 65 | 66 | final boolean focused = mc.currentScreen instanceof ChatScreen; 67 | 68 | final float fontHeight = FontUtil.getFontHeight(this.textScale.getFloatValue()) + 2; 69 | 70 | FontUtil.drawShadowedString(matrixStack, (int) normalCoords.x + ", " + (int) normalCoords.y + ", " + (int) normalCoords.z, 71 | 2f, scaledResolution.getScaledHeight() - (focused ? 24 : 12), Color.WHITE.getRGB(), this.textScale.getFloatValue()); 72 | 73 | FontUtil.drawShadowedString(matrixStack, (int) otherCoords.x + ", " + (int) otherCoords.y + ", " + (int) otherCoords.z, 74 | 2f, scaledResolution.getScaledHeight() - ((focused ? 24 : 12) + fontHeight + 1), Color.RED.getRGB(), this.textScale.getFloatValue()); 75 | 76 | } 77 | 78 | public float getIncrement() { 79 | if (this.increment == 0) { 80 | this.increment = FontUtil.getFontHeight(this.textScale.getFloatValue()) + 2; 81 | } 82 | return this.increment; 83 | } 84 | 85 | 86 | } 87 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/modules/render/NoRenderModule.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.modules.render; 2 | 3 | import io.github.vialdevelopment.attendance.attender.Attender; 4 | import io.github.vialdevelopment.tori.api.runnable.module.Category; 5 | import io.github.vialdevelopment.tori.api.runnable.module.Module; 6 | import io.github.vialdevelopment.tori.client.events.RenderScreenObstructionEvent; 7 | 8 | public class NoRenderModule extends Module { 9 | 10 | public NoRenderModule() { 11 | super("NoRender", "Stops the rendering of bothersome overlays", Category.RENDER); 12 | } 13 | 14 | private final Attender event = new Attender<>(RenderScreenObstructionEvent.class, event -> event.setCanceled(true)); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/modules/violent/CrystalAuraModule.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.modules.violent; 2 | 3 | import io.github.vialdevelopment.tori.api.runnable.module.Category; 4 | import io.github.vialdevelopment.tori.api.runnable.module.Module; 5 | 6 | public class CrystalAuraModule extends Module { 7 | public CrystalAuraModule() { 8 | super("CrystalAura", "Places and breaks crystals", Category.VIOLENT); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/modules/violent/KillAuraModule.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.modules.violent; 2 | 3 | import io.github.vialdevelopment.tori.api.runnable.module.Category; 4 | import io.github.vialdevelopment.tori.api.runnable.module.Module; 5 | 6 | public class KillAuraModule extends Module { 7 | public KillAuraModule() { 8 | super("KillAura", "Attacks all mobs around you", Category.VIOLENT); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/settings/BooleanSetting.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.settings; 2 | 3 | import io.github.vialdevelopment.tori.api.setting.Setting; 4 | 5 | public class BooleanSetting extends Setting { 6 | 7 | private boolean booleanValue; 8 | 9 | public BooleanSetting(String name, boolean value) { 10 | super(name, value); 11 | this.booleanValue = value; 12 | } 13 | 14 | @Deprecated 15 | @Override 16 | public Boolean getValue() { 17 | return this.getBooleanValue(); 18 | } 19 | 20 | @Deprecated 21 | @Override 22 | public void setValue(Boolean value) { 23 | this.setBooleanValue(value); 24 | } 25 | 26 | public boolean getBooleanValue() { 27 | return this.booleanValue; 28 | } 29 | 30 | public void setBooleanValue(boolean value) { 31 | this.booleanValue = value; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/settings/number/DoubleSetting.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.settings.number; 2 | 3 | import io.github.vialdevelopment.tori.api.setting.Setting; 4 | 5 | public class DoubleSetting extends Setting { 6 | private double doubleValue; 7 | 8 | public DoubleSetting(String name, double value) { 9 | super(name, value); 10 | this.doubleValue = value; 11 | } 12 | 13 | @Deprecated 14 | @Override 15 | public Double getValue() { 16 | return this.getDoubleValue(); 17 | } 18 | 19 | 20 | @Deprecated 21 | @Override 22 | public void setValue(Double value) { 23 | this.setDoubleValue(value); 24 | } 25 | 26 | public double getDoubleValue() { 27 | return this.doubleValue; 28 | } 29 | 30 | public void setDoubleValue(double doubleValue) { 31 | this.doubleValue = doubleValue; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/client/settings/number/FloatSetting.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.client.settings.number; 2 | 3 | import io.github.vialdevelopment.tori.api.setting.Setting; 4 | 5 | public class FloatSetting extends Setting { 6 | 7 | private float floatValue; 8 | 9 | public FloatSetting(String name, float value) { 10 | super(name, value); 11 | this.floatValue = value; 12 | } 13 | 14 | @Deprecated 15 | @Override 16 | public Float getValue() { 17 | return this.getFloatValue(); 18 | } 19 | 20 | @Deprecated 21 | @Override 22 | public void setValue(Float value) { 23 | this.setFloatValue(value); 24 | } 25 | 26 | public float getFloatValue() { 27 | return this.floatValue; 28 | } 29 | 30 | public void setFloatValue(float value) { 31 | this.floatValue = value; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/mixin/duck/ChatHudDuck.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.mixin.duck; 2 | 3 | public interface ChatHudDuck { 4 | boolean invokeIsChatFocused(); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/mixin/duck/ClientPlayerInteractionManagerDuck.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.mixin.duck; 2 | 3 | public interface ClientPlayerInteractionManagerDuck { 4 | float getCurrentBreakingProgress(); 5 | 6 | void setCurrentBreakingProgress(float currentBreakingProgress); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/mixin/duck/EntityDuck.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.mixin.duck; 2 | 3 | public interface EntityDuck { 4 | void setInNetherPortal(boolean inNetherPortal); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/mixin/duck/HandshakeC2SPacketDuck.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.mixin.duck; 2 | 3 | public interface HandshakeC2SPacketDuck { 4 | String getAddress(); 5 | int getPort(); 6 | } 7 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/mixin/duck/MinecraftClientDuck.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.mixin.duck; 2 | 3 | import net.minecraft.client.util.Session; 4 | 5 | public interface MinecraftClientDuck { 6 | void setSession(Session session); 7 | } 8 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/mixin/mixins/MixinBossBarHud.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.mixin.mixins; 2 | 3 | import io.github.vialdevelopment.tori.client.Tori; 4 | import io.github.vialdevelopment.tori.client.events.RenderScreenObstructionEvent; 5 | import net.minecraft.client.gui.hud.BossBarHud; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Inject; 9 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 10 | 11 | @Mixin(BossBarHud.class) 12 | public class MixinBossBarHud { 13 | @Inject(method = "render", at = @At("HEAD"), cancellable = true) 14 | private void render(CallbackInfo ci) { 15 | final RenderScreenObstructionEvent event = new RenderScreenObstructionEvent(RenderScreenObstructionEvent.Type.BOSS); 16 | Tori.INSTANCE.eventManager.dispatch(event); 17 | if (event.isCanceled()) ci.cancel(); 18 | } 19 | } -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/mixin/mixins/MixinCamera.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.mixin.mixins; 2 | 3 | import io.github.vialdevelopment.tori.client.Tori; 4 | import io.github.vialdevelopment.tori.client.events.UpdateCameraEvent; 5 | import net.minecraft.client.render.Camera; 6 | import net.minecraft.entity.Entity; 7 | import net.minecraft.world.BlockView; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.Shadow; 10 | import org.spongepowered.asm.mixin.injection.At; 11 | import org.spongepowered.asm.mixin.injection.Inject; 12 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 13 | 14 | @Mixin(Camera.class) 15 | public abstract class MixinCamera { 16 | @Shadow 17 | protected abstract void setPos(double x, double y, double z); 18 | 19 | @Shadow 20 | protected abstract void setRotation(float yaw, float pitch); 21 | 22 | @Shadow 23 | private float lastCameraY; 24 | 25 | @Shadow 26 | private float cameraY; 27 | 28 | 29 | @Inject(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/Camera;setRotation(FF)V"), cancellable = true) 30 | private void update(BlockView area, Entity focusedEntity, boolean thirdPerson, boolean inverseView, float tickDelta, CallbackInfo ci) { 31 | UpdateCameraEvent event = new UpdateCameraEvent(focusedEntity, tickDelta, this.lastCameraY, this.cameraY); 32 | 33 | Tori.INSTANCE.eventManager.dispatch(event); 34 | 35 | if (event.isCanceled()) { 36 | this.setPos(event.x, event.y, event.z); 37 | 38 | this.setRotation(event.yaw, event.pitch); 39 | 40 | ci.cancel(); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/mixin/mixins/MixinChatHud.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.mixin.mixins; 2 | 3 | import io.github.vialdevelopment.tori.mixin.duck.ChatHudDuck; 4 | import net.minecraft.client.gui.hud.ChatHud; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Invoker; 7 | 8 | @Mixin(ChatHud.class) 9 | public abstract class MixinChatHud implements ChatHudDuck { 10 | @Invoker 11 | public abstract boolean invokeIsChatFocused(); 12 | } 13 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/mixin/mixins/MixinClientConnection.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.mixin.mixins; 2 | 3 | import io.github.vialdevelopment.tori.client.Tori; 4 | import io.github.vialdevelopment.tori.client.events.PacketEvent; 5 | import io.netty.channel.Channel; 6 | import io.netty.channel.ChannelHandlerContext; 7 | import io.netty.util.concurrent.GenericFutureListener; 8 | import net.minecraft.network.ClientConnection; 9 | import net.minecraft.network.Packet; 10 | import org.spongepowered.asm.mixin.Mixin; 11 | import org.spongepowered.asm.mixin.Shadow; 12 | import org.spongepowered.asm.mixin.injection.At; 13 | import org.spongepowered.asm.mixin.injection.Inject; 14 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 15 | 16 | 17 | @Mixin(ClientConnection.class) 18 | public class MixinClientConnection { 19 | @Shadow 20 | private Channel channel; 21 | 22 | @Inject(at = @At("HEAD"), method = "channelRead0", cancellable = true) 23 | private void channelRead0(ChannelHandlerContext channelHandlerContext, Packet packet, CallbackInfo ci) { 24 | if (this.channel.isOpen() && packet != null) { 25 | PacketEvent.In event = new PacketEvent.In(packet); 26 | Tori.INSTANCE.eventManager.dispatch(event); 27 | if (event.isCanceled()) ci.cancel(); 28 | } 29 | } 30 | 31 | @Inject( at = @At("HEAD"), method = "send(Lnet/minecraft/network/Packet;Lio/netty/util/concurrent/GenericFutureListener;)V", cancellable = true) 32 | private void send(Packet packet, GenericFutureListener genericFutureListener, CallbackInfo ci) { 33 | PacketEvent.Out event = new PacketEvent.Out(packet); 34 | Tori.INSTANCE.eventManager.dispatch(event); 35 | if (event.isCanceled()) ci.cancel(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/mixin/mixins/MixinClientPlayerEntity.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.mixin.mixins; 2 | 3 | import com.mojang.authlib.GameProfile; 4 | import com.mojang.brigadier.CommandDispatcher; 5 | import com.mojang.brigadier.ParseResults; 6 | import com.mojang.brigadier.exceptions.CommandSyntaxException; 7 | import io.github.vialdevelopment.tori.api.event.EventStage; 8 | import io.github.vialdevelopment.tori.client.Tori; 9 | import io.github.vialdevelopment.tori.client.events.InputEvent; 10 | import io.github.vialdevelopment.tori.client.events.MoveEvent; 11 | import io.github.vialdevelopment.tori.client.events.SendMovementPacketEvent; 12 | import io.github.vialdevelopment.tori.util.Logger; 13 | import net.minecraft.client.MinecraftClient; 14 | import net.minecraft.client.input.Input; 15 | import net.minecraft.client.input.KeyboardInput; 16 | import net.minecraft.client.network.AbstractClientPlayerEntity; 17 | import net.minecraft.client.network.ClientPlayerEntity; 18 | import net.minecraft.client.world.ClientWorld; 19 | import net.minecraft.entity.LivingEntity; 20 | import net.minecraft.entity.MovementType; 21 | import net.minecraft.util.math.Vec3d; 22 | import org.spongepowered.asm.mixin.Mixin; 23 | import org.spongepowered.asm.mixin.Shadow; 24 | import org.spongepowered.asm.mixin.injection.At; 25 | import org.spongepowered.asm.mixin.injection.Inject; 26 | import org.spongepowered.asm.mixin.injection.Redirect; 27 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 28 | 29 | @Mixin(ClientPlayerEntity.class) 30 | public abstract class MixinClientPlayerEntity extends AbstractClientPlayerEntity { 31 | 32 | private SendMovementPacketEvent sendMovementPacketEvent; 33 | 34 | @Shadow 35 | protected abstract void autoJump(float dx, float dz); 36 | 37 | @Shadow public Input input; 38 | 39 | /** 40 | * keeps the compiler happy 41 | * -famous1622/VFMADD 42 | */ 43 | public MixinClientPlayerEntity(ClientWorld world, GameProfile profile) { 44 | super(world, profile); 45 | } 46 | 47 | @Inject(method = "sendChatMessage", at = @At("HEAD"), cancellable = true) 48 | private void sendChatMessage(String message, CallbackInfo ci) { 49 | 50 | final String prefix = Tori.INSTANCE.commandManager.PREFIX; 51 | 52 | if (message.startsWith(prefix)) { 53 | final String commandInput = message.replaceFirst(prefix, ""); 54 | // if it did not successfully go to a command, go to the module commands 55 | if (!Tori.INSTANCE.commandManager.dispatchRunnable(commandInput)) { 56 | if (!Tori.INSTANCE.moduleManager.dispatchRunnable(commandInput)) { 57 | Logger.log("nothin found D:"); 58 | } 59 | } 60 | ci.cancel(); 61 | } 62 | } 63 | 64 | 65 | /** 66 | * Cancel, otherwise alterations to the event will not take place 67 | * this is to ensure that movements are not made accidentally, as that could be problematic 68 | */ 69 | @Inject(method = "move", at = @At("HEAD"), cancellable = true) 70 | private void move(MovementType type, Vec3d movement, CallbackInfo ci) { 71 | final MoveEvent event = new MoveEvent(movement.x, movement.y, movement.z); 72 | Tori.INSTANCE.eventManager.dispatch(event); 73 | if (event.isCanceled()) { 74 | ci.cancel(); 75 | double d = this.getX(); 76 | double e = this.getZ(); 77 | super.move(type, new Vec3d(event.x, event.y, event.z)); 78 | this.autoJump((float) (this.getX() - d), (float) (this.getZ() - e)); 79 | } 80 | } 81 | 82 | @Inject(method = "tickMovement", at = @At(value = "HEAD"), cancellable = true) 83 | private void tickMovementEarly(CallbackInfo ci) { 84 | final InputEvent event = new InputEvent(EventStage.EARLY); 85 | Tori.INSTANCE.eventManager.dispatch(event); 86 | 87 | if (event.isCanceled()) { 88 | ci.cancel(); 89 | } 90 | } 91 | 92 | /* @Redirect(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/input/Input;tick(Z)V")) 93 | private void tickWrapper(Input input, boolean bl) { 94 | final InputEvent event = new InputEvent(EventStage.EARLY); 95 | event.input = input; 96 | Tori.INSTANCE.eventManager.dispatch(event); 97 | if (!event.isCanceled()) event.input.tick(bl); 98 | }*/ 99 | 100 | @Inject(method = "tickMovement", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;getTutorialManager()Lnet/minecraft/client/tutorial/TutorialManager;")) 101 | private void tickMovementLate(CallbackInfo ci) { 102 | final InputEvent event = new InputEvent(EventStage.LATE); 103 | Tori.INSTANCE.eventManager.dispatch(event); 104 | } 105 | 106 | 107 | /** 108 | * posts an event on send movement packets 109 | * @param ci callback info 110 | */ 111 | @Inject(method = "sendMovementPackets", at = @At("HEAD")) 112 | private void onSendMovementPacketsHead(CallbackInfo ci) { 113 | this.sendMovementPacketEvent = new SendMovementPacketEvent(this.yaw, this.pitch, this.getY(), this.onGround, EventStage.EARLY); 114 | Tori.INSTANCE.eventManager.dispatch(this.sendMovementPacketEvent); 115 | } 116 | 117 | //These all set the updateWalkingPlayer to match with what the event is set to 118 | 119 | @Redirect(method = "sendMovementPackets", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getY()D")) 120 | private double onSendMovementPacketMinY(ClientPlayerEntity clientPlayerEntity) { 121 | return this.sendMovementPacketEvent.y; 122 | } 123 | 124 | @Redirect(method = "sendMovementPackets", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerEntity;onGround:Z")) 125 | private boolean onSendMovementPacketOnGround(ClientPlayerEntity clientPlayerEntity) { 126 | return this.sendMovementPacketEvent.onGround; 127 | } 128 | 129 | @Redirect(method = "sendMovementPackets", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerEntity;yaw:F")) 130 | private float onSendMovementPacketRotationYaw(ClientPlayerEntity clientPlayerEntity) { 131 | return this.sendMovementPacketEvent.yaw; 132 | } 133 | 134 | @Redirect(method = "sendMovementPackets", at = @At(value = "FIELD", target = "Lnet/minecraft/client/network/ClientPlayerEntity;pitch:F")) 135 | private float onSendMovementPacketRotationPitch(ClientPlayerEntity clientPlayerEntity) { 136 | return this.sendMovementPacketEvent.pitch; 137 | } 138 | 139 | /** 140 | * post an event at send movement packets at the return 141 | * @param ci callback info 142 | */ 143 | @Inject(method = "sendMovementPackets", at = @At("RETURN")) 144 | private void onSendMovementPacketReturn(CallbackInfo ci) { 145 | Tori.INSTANCE.eventManager.dispatch(new SendMovementPacketEvent(this.yaw, this.pitch, this.getY(), this.onGround, EventStage.LATE)); 146 | } 147 | } 148 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/mixin/mixins/MixinClientPlayerInteractionManager.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.mixin.mixins; 2 | 3 | import io.github.vialdevelopment.tori.mixin.duck.ClientPlayerInteractionManagerDuck; 4 | import net.minecraft.client.network.ClientPlayerInteractionManager; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | @Mixin(ClientPlayerInteractionManager.class) 9 | public abstract class MixinClientPlayerInteractionManager implements ClientPlayerInteractionManagerDuck { 10 | @Accessor(value = "currentBreakingProgress") 11 | public abstract float getCurrentBreakingProgress(); 12 | 13 | @Accessor(value = "currentBreakingProgress") 14 | public abstract void setCurrentBreakingProgress(float currentBreakingProgress); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/mixin/mixins/MixinEntity.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.mixin.mixins; 2 | 3 | import io.github.vialdevelopment.tori.client.Tori; 4 | import io.github.vialdevelopment.tori.client.events.AddEntityCollisionEvent; 5 | import io.github.vialdevelopment.tori.mixin.duck.EntityDuck; 6 | import net.minecraft.entity.Entity; 7 | import net.minecraft.fluid.FluidState; 8 | import net.minecraft.util.math.BlockPos; 9 | import net.minecraft.util.math.Vec3d; 10 | import net.minecraft.world.BlockView; 11 | import org.spongepowered.asm.mixin.Mixin; 12 | import org.spongepowered.asm.mixin.gen.Accessor; 13 | import org.spongepowered.asm.mixin.injection.At; 14 | import org.spongepowered.asm.mixin.injection.Redirect; 15 | 16 | @Mixin(Entity.class) 17 | public abstract class MixinEntity implements EntityDuck { 18 | 19 | @Accessor(value = "inNetherPortal") 20 | public abstract void setInNetherPortal(boolean inNetherPortal); 21 | 22 | @Redirect(method = "pushAwayFrom", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;addVelocity(DDD)V")) 23 | private void addVelocityWrapper(Entity entity, double x, double y, double z) { 24 | final AddEntityCollisionEvent event = new AddEntityCollisionEvent(entity, x, y, z); 25 | Tori.INSTANCE.eventManager.dispatch(event); 26 | 27 | event.entity.addVelocity(event.x, event.y, event.z); 28 | } 29 | 30 | @Redirect(method = "updateMovementInFluid", at = @At(value = "INVOKE", target = "Lnet/minecraft/fluid/FluidState;getVelocity(Lnet/minecraft/world/BlockView;Lnet/minecraft/util/math/BlockPos;)Lnet/minecraft/util/math/Vec3d;")) 31 | private Vec3d getVelocityWrapper(FluidState fluidState, BlockView world, BlockPos pos) { 32 | 33 | final Vec3d flow = fluidState.getVelocity(world, pos); 34 | AddEntityCollisionEvent event = new AddEntityCollisionEvent(this, flow.x, flow.y, flow.z); 35 | Tori.INSTANCE.eventManager.dispatch(event); 36 | 37 | return new Vec3d(event.x, event.y, event.z); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/mixin/mixins/MixinGameRenderer.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.mixin.mixins; 2 | 3 | import io.github.vialdevelopment.tori.client.Tori; 4 | import io.github.vialdevelopment.tori.client.events.Render3DEvent; 5 | import io.github.vialdevelopment.tori.client.events.RenderScreenObstructionEvent; 6 | import net.minecraft.client.render.GameRenderer; 7 | import net.minecraft.client.util.math.MatrixStack; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Inject; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 12 | 13 | @Mixin(GameRenderer.class) 14 | public class MixinGameRenderer { 15 | 16 | @Inject(method = "renderWorld", at = @At(value = "FIELD", target = "Lnet/minecraft/client/render/GameRenderer;renderHand:Z")) 17 | private void renderWorld(float tickDelta, long limitTime, MatrixStack matrix, CallbackInfo ci) { 18 | final Render3DEvent event = new Render3DEvent(matrix, tickDelta); 19 | Tori.INSTANCE.eventManager.dispatch(event); 20 | } 21 | 22 | @Inject(method = "bobViewWhenHurt", at = @At("HEAD"), cancellable = true) 23 | private void bobViewWhenHurt(MatrixStack matrixStack, float tickDelta, CallbackInfo ci) { 24 | final RenderScreenObstructionEvent event = new RenderScreenObstructionEvent(RenderScreenObstructionEvent.Type.HURT); 25 | Tori.INSTANCE.eventManager.dispatch(event); 26 | if (event.isCanceled()) { 27 | ci.cancel(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/mixin/mixins/MixinHandshakeC2SPacket.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.mixin.mixins; 2 | 3 | import io.github.vialdevelopment.tori.mixin.duck.HandshakeC2SPacketDuck; 4 | import net.minecraft.network.packet.c2s.handshake.HandshakeC2SPacket; 5 | import org.spongepowered.asm.mixin.Mixin; 6 | import org.spongepowered.asm.mixin.gen.Accessor; 7 | 8 | @Mixin(HandshakeC2SPacket.class) 9 | public abstract class MixinHandshakeC2SPacket implements HandshakeC2SPacketDuck { 10 | @Accessor(value = "address") 11 | public abstract String getAddress(); 12 | 13 | @Accessor(value = "port") 14 | public abstract int getPort(); 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/mixin/mixins/MixinInGameHud.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.mixin.mixins; 2 | 3 | import com.mojang.blaze3d.systems.RenderSystem; 4 | import io.github.vialdevelopment.tori.client.Tori; 5 | import io.github.vialdevelopment.tori.client.events.Render2DEvent; 6 | import net.fabricmc.fabric.impl.client.indigo.renderer.IndigoRenderer; 7 | import net.minecraft.client.gui.hud.InGameHud; 8 | import net.minecraft.client.util.math.MatrixStack; 9 | import org.spongepowered.asm.mixin.Mixin; 10 | import org.spongepowered.asm.mixin.injection.At; 11 | import org.spongepowered.asm.mixin.injection.Inject; 12 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 13 | 14 | /** 15 | * @author cats 16 | * @since June 4, 2020 17 | */ 18 | @Mixin(InGameHud.class) 19 | public class MixinInGameHud { 20 | @Inject(at = @At(value = "HEAD"), method = "render", cancellable = true) 21 | private void render(MatrixStack matrixStack, float partialTicks, CallbackInfo ci) { 22 | RenderSystem.pushMatrix(); 23 | final Render2DEvent event = new Render2DEvent(matrixStack, partialTicks); 24 | Tori.INSTANCE.eventManager.dispatch(event); 25 | RenderSystem.popMatrix(); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/mixin/mixins/MixinInGameOverlayRenderer.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.mixin.mixins; 2 | 3 | import io.github.vialdevelopment.tori.client.Tori; 4 | import io.github.vialdevelopment.tori.client.events.RenderScreenObstructionEvent; 5 | import net.minecraft.client.MinecraftClient; 6 | import net.minecraft.client.gui.hud.InGameOverlayRenderer; 7 | import net.minecraft.client.util.math.MatrixStack; 8 | import org.spongepowered.asm.mixin.Mixin; 9 | import org.spongepowered.asm.mixin.injection.At; 10 | import org.spongepowered.asm.mixin.injection.Inject; 11 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 12 | 13 | @Mixin(InGameOverlayRenderer.class) 14 | public class MixinInGameOverlayRenderer { 15 | @Inject(method = "renderFireOverlay", at = @At("HEAD"), cancellable = true) 16 | private static void renderFireOverlay(MinecraftClient client, MatrixStack matrixStack, CallbackInfo ci) { 17 | final RenderScreenObstructionEvent event = new RenderScreenObstructionEvent(RenderScreenObstructionEvent.Type.FIRE); 18 | Tori.INSTANCE.eventManager.dispatch(event); 19 | if (event.isCanceled()) ci.cancel(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/mixin/mixins/MixinItemCooldownManager.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.mixin.mixins; 2 | 3 | import io.github.vialdevelopment.tori.client.Tori; 4 | import io.github.vialdevelopment.tori.client.events.GetItemCooldownEvent; 5 | import net.minecraft.entity.player.ItemCooldownManager; 6 | import net.minecraft.item.Item; 7 | import org.spongepowered.asm.mixin.Mixin; 8 | import org.spongepowered.asm.mixin.injection.At; 9 | import org.spongepowered.asm.mixin.injection.Inject; 10 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 11 | 12 | @Mixin(ItemCooldownManager.class) 13 | public class MixinItemCooldownManager { 14 | @Inject(method = "getCooldownProgress", at = @At("HEAD"), cancellable = true) 15 | private void getCooldownProgress(Item item, float partialTicks, CallbackInfoReturnable cir) { 16 | final GetItemCooldownEvent event = new GetItemCooldownEvent(); 17 | Tori.INSTANCE.eventManager.dispatch(event); 18 | if (event.coolDown != null) { 19 | cir.setReturnValue(event.coolDown); 20 | cir.cancel(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/mixin/mixins/MixinLightmapTextureManager.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.mixin.mixins; 2 | 3 | import io.github.vialdevelopment.tori.client.modules.render.BrightnessModule; 4 | import net.minecraft.client.render.LightmapTextureManager; 5 | import net.minecraft.client.util.math.Vector3f; 6 | import org.spongepowered.asm.mixin.Mixin; 7 | import org.spongepowered.asm.mixin.injection.At; 8 | import org.spongepowered.asm.mixin.injection.Redirect; 9 | 10 | @Mixin(LightmapTextureManager.class) 11 | public class MixinLightmapTextureManager { 12 | @Redirect(method = "update", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/math/Vector3f;lerp(Lnet/minecraft/client/util/math/Vector3f;F)V", ordinal = 5)) 13 | private void lerpWrapper(Vector3f vector3f, Vector3f vector, float delta) { 14 | vector3f.lerp(vector, BrightnessModule.INSTANCE.getState() ? 1000f : delta); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/mixin/mixins/MixinLivingEntity.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.mixin.mixins; 2 | 3 | import io.github.vialdevelopment.tori.client.modules.movement.JesusModule; 4 | import net.minecraft.client.MinecraftClient; 5 | import net.minecraft.client.network.ClientPlayerEntity; 6 | import net.minecraft.entity.Entity; 7 | import net.minecraft.entity.EntityType; 8 | import net.minecraft.entity.LivingEntity; 9 | import net.minecraft.world.World; 10 | import org.spongepowered.asm.mixin.Mixin; 11 | import org.spongepowered.asm.mixin.injection.At; 12 | import org.spongepowered.asm.mixin.injection.Inject; 13 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 14 | 15 | @Mixin(LivingEntity.class) 16 | public abstract class MixinLivingEntity extends Entity { 17 | public MixinLivingEntity(EntityType type, World world) { 18 | super(type, world); 19 | } 20 | 21 | @Inject(method = "canWalkOnFluid", at = @At("HEAD"), cancellable = true) 22 | private void canWalkOnFluid(CallbackInfoReturnable cir) { 23 | if (JesusModule.INSTANCE.getState()) { 24 | if (MinecraftClient.getInstance().player != null) { 25 | if (this.getEntityId() == MinecraftClient.getInstance().player.getEntityId()) { 26 | cir.setReturnValue(true); 27 | cir.cancel(); 28 | } else if (this.getVehicle() != null) { 29 | if (this.getVehicle().getEntityId() == MinecraftClient.getInstance().player.getEntityId()) { 30 | cir.setReturnValue(true); 31 | cir.cancel(); 32 | } 33 | } 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/mixin/mixins/MixinMinecraftClient.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.mixin.mixins; 2 | 3 | import io.github.vialdevelopment.tori.client.Tori; 4 | import io.github.vialdevelopment.tori.client.events.TickEvent; 5 | import io.github.vialdevelopment.tori.mixin.duck.MinecraftClientDuck; 6 | import net.minecraft.client.MinecraftClient; 7 | import net.minecraft.client.util.Session; 8 | import org.spongepowered.asm.mixin.Final; 9 | import org.spongepowered.asm.mixin.Mixin; 10 | import org.spongepowered.asm.mixin.gen.Accessor; 11 | import org.spongepowered.asm.mixin.injection.At; 12 | import org.spongepowered.asm.mixin.injection.Inject; 13 | import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; 14 | 15 | @Mixin(MinecraftClient.class) 16 | public abstract class MixinMinecraftClient implements MinecraftClientDuck { 17 | 18 | @Final 19 | @Accessor(value = "session") 20 | public abstract void setSession(Session session); 21 | 22 | @Inject(method = "close", at = @At("HEAD")) 23 | private void shutdownMinecraftApplet(CallbackInfo ci) { 24 | Tori.INSTANCE.configManager.writeConfig(); 25 | } 26 | 27 | @Inject(method = "tick", at = @At("HEAD")) 28 | private void onTick(CallbackInfo info) { 29 | Tori.INSTANCE.eventManager.dispatch(new TickEvent()); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/util/FontUtil.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.util; 2 | 3 | import net.minecraft.client.MinecraftClient; 4 | import net.minecraft.client.font.TextRenderer; 5 | import net.minecraft.client.util.math.MatrixStack; 6 | import org.lwjgl.opengl.GL11; 7 | 8 | /** 9 | * @author cats 10 | * @since May 23, 2020 11 | */ 12 | public class FontUtil { 13 | 14 | private static final TextRenderer fontRenderer = MinecraftClient.getInstance().textRenderer; 15 | 16 | /** 17 | * draws a shadowed string with the scaling done properly 18 | */ 19 | public static void drawShadowedString(MatrixStack matrixStack, String text, float x, float y, int color, float textScale) { 20 | 21 | GL11.glScaled(textScale, textScale,0); 22 | // I am going to explain this mess, I use the scale to change the font size 23 | getFontRenderer().drawWithShadow(matrixStack, text, 24 | x / textScale, 25 | y / textScale, 26 | color); 27 | GL11.glScaled(1 / textScale, 1 / textScale, 0); 28 | } 29 | 30 | public static float getStringWidth(String text, float textScale) { 31 | return getFontRenderer().getWidth(text) * textScale; 32 | } 33 | 34 | public static float getFontHeight(float textScale) { 35 | return getFontRenderer().fontHeight * textScale; 36 | } 37 | 38 | public static TextRenderer getFontRenderer() { 39 | return fontRenderer; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/util/GLUtils.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.util; 2 | 3 | import com.mojang.blaze3d.systems.RenderSystem; 4 | import net.minecraft.client.MinecraftClient; 5 | import net.minecraft.client.render.BufferBuilder; 6 | import net.minecraft.client.render.Tessellator; 7 | import net.minecraft.client.render.VertexFormats; 8 | 9 | import java.awt.*; 10 | 11 | public class GLUtils { 12 | 13 | private static final Tessellator tessellator = Tessellator.getInstance(); 14 | 15 | private static final MinecraftClient mc = MinecraftClient.getInstance(); 16 | 17 | public static void drawFilledBox(double x, double y, float width, float height, Color color) { 18 | final BufferBuilder buffer = tessellator.getBuffer(); 19 | buffer.begin(7, VertexFormats.POSITION_COLOR); 20 | buffer.vertex(x, y, 0).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).next(); 21 | buffer.vertex(x + width, y, 0).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).next(); 22 | buffer.vertex(x + width, y + height, 0).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).next(); 23 | buffer.vertex(x, y + height, 0).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).next(); 24 | tessellator.draw(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/util/Logger.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.util; 2 | 3 | import io.github.vialdevelopment.tori.client.Tori; 4 | import net.minecraft.client.MinecraftClient; 5 | import net.minecraft.text.TranslatableText; 6 | import net.minecraft.util.Formatting; 7 | 8 | /** 9 | * @author cats 10 | * @since 20 Mar 2020 11 | */ 12 | public class Logger { 13 | 14 | /** 15 | * the thing used to divide the prefix from the message 16 | */ 17 | public static final String divider = " = "; 18 | 19 | /** 20 | * the prefix for logged messages 21 | */ 22 | private static final String prefix = Formatting.DARK_BLUE + Tori.MOD_NAME + Formatting.WHITE + divider; 23 | 24 | 25 | /** 26 | * Logs a message 27 | * @param message the message to log 28 | */ 29 | public static void log(String message) { 30 | final String toSend = prefix + message; 31 | 32 | if (MinecraftClient.getInstance().player != null) { 33 | MinecraftClient.getInstance().player.sendMessage(new TranslatableText(toSend), false); 34 | } else { 35 | System.out.println(toSend); 36 | } 37 | } 38 | 39 | /** 40 | * logs a message without the fancy prefix 41 | * @param message the message to log 42 | */ 43 | public static void logRawText(String message) { 44 | if (MinecraftClient.getInstance().player != null) { 45 | MinecraftClient.getInstance().player.sendMessage(new TranslatableText(message), false); 46 | } else { 47 | System.out.println(message); 48 | } 49 | } 50 | 51 | /** 52 | * logs a message with System.out.println 53 | * @param message the message to log 54 | */ 55 | public static void println(String message) { 56 | System.out.println(message); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/util/PlayerUtil.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.util; 2 | 3 | import io.github.vialdevelopment.tori.client.events.MoveEvent; 4 | import net.minecraft.client.MinecraftClient; 5 | 6 | public class PlayerUtil { 7 | 8 | private static final MinecraftClient mc = MinecraftClient.getInstance(); 9 | 10 | public static void setXMovement(MoveEvent event, double speed) { 11 | double forward = mc.player.input.movementForward; 12 | double strafe = mc.player.input.movementSideways; 13 | float yaw = mc.player.getYaw(mc.getTickDelta()); 14 | if (forward == 0.0 && strafe == 0.0) { 15 | event.x = 0.0; 16 | event.z = 0.0; 17 | mc.player.setVelocity(0, mc.player.getVelocity().y, 0); 18 | } else { 19 | if (forward != 0.0) { 20 | if (strafe > 0.0) { 21 | yaw += ((forward > 0.0) ? -45 : 45); 22 | } else if (strafe < 0.0) { 23 | yaw += ((forward > 0.0) ? 45 : -45); 24 | } 25 | strafe = 0.0; 26 | if (forward > 0.0) { 27 | forward = 1.0; 28 | } else if (forward < 0.0) { 29 | forward = -1.0; 30 | } 31 | } 32 | final double x = forward * speed * -Math.sin(Math.toRadians(yaw)) + strafe * speed * Math.cos(Math.toRadians(yaw)); 33 | 34 | final double z = forward * speed * Math.cos(Math.toRadians(yaw)) - strafe * speed * -Math.sin(Math.toRadians(yaw)); 35 | 36 | event.x = x; 37 | event.z = z; 38 | mc.player.setVelocity(x, mc.player.getVelocity().y, z); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/util/RenderUtil.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.util; 2 | 3 | 4 | import com.mojang.blaze3d.systems.RenderSystem; 5 | import net.minecraft.client.MinecraftClient; 6 | import net.minecraft.client.render.BufferBuilder; 7 | import net.minecraft.client.render.Tessellator; 8 | import net.minecraft.client.render.VertexFormats; 9 | import net.minecraft.client.render.WorldRenderer; 10 | import net.minecraft.client.util.math.MatrixStack; 11 | import net.minecraft.entity.Entity; 12 | import net.minecraft.util.math.Box; 13 | import net.minecraft.util.math.Vec3d; 14 | 15 | import java.awt.*; 16 | 17 | /** 18 | * I hated every moment of writing this 19 | */ 20 | public class RenderUtil { 21 | 22 | private static final Tessellator tessellator = Tessellator.getInstance(); 23 | 24 | private static final MinecraftClient mc = MinecraftClient.getInstance(); 25 | 26 | public static void drawLine(Vec3d startPos, Vec3d endPos, Color color) { 27 | final Vec3d interpolatedStart = RenderUtil.interpolatePos(startPos); 28 | 29 | final Vec3d interpolatedEnd = RenderUtil.interpolatePos(endPos); 30 | 31 | final BufferBuilder buffer = tessellator.getBuffer(); 32 | buffer.begin(3, VertexFormats.POSITION_COLOR); 33 | 34 | buffer.vertex(interpolatedStart.getX(), interpolatedStart.getY(), interpolatedStart.getZ()).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).next(); 35 | buffer.vertex(interpolatedEnd.getX(), interpolatedEnd.getY(), interpolatedEnd.getZ()).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).next(); 36 | 37 | // the draw func runs the end func in the buffer builder 38 | tessellator.draw(); 39 | 40 | } 41 | 42 | public static void drawBox(Box box, Color color) { 43 | 44 | final int r = color.getRed(); 45 | final int g = color.getGreen(); 46 | final int b = color.getBlue(); 47 | final int a = color.getAlpha(); 48 | 49 | final Box interpolatedBox = RenderUtil.interpolateBox(box); 50 | 51 | final BufferBuilder buffer = tessellator.getBuffer(); 52 | 53 | // this is pain 54 | buffer.begin(3, VertexFormats.POSITION_COLOR); 55 | buffer.vertex(interpolatedBox.minX, interpolatedBox.minY, interpolatedBox.minZ).color(r, g, b, a).next(); 56 | buffer.vertex(interpolatedBox.minX, interpolatedBox.minY, interpolatedBox.maxZ).color(r, g, b, a).next(); 57 | buffer.vertex(interpolatedBox.maxX, interpolatedBox.minY, interpolatedBox.maxZ).color(r, g, b, a).next(); 58 | buffer.vertex(interpolatedBox.maxX, interpolatedBox.minY, interpolatedBox.minZ).color(r, g, b, a).next(); 59 | buffer.vertex(interpolatedBox.minX, interpolatedBox.minY, interpolatedBox.minZ).color(r, g, b, a).next(); 60 | buffer.vertex(interpolatedBox.minX, interpolatedBox.maxY, interpolatedBox.minZ).color(r, g, b, a).next(); 61 | buffer.vertex(interpolatedBox.maxX, interpolatedBox.maxY, interpolatedBox.minZ).color(r, g, b, a).next(); 62 | buffer.vertex(interpolatedBox.maxX, interpolatedBox.maxY, interpolatedBox.maxZ).color(r, g, b, a).next(); 63 | buffer.vertex(interpolatedBox.minX, interpolatedBox.maxY, interpolatedBox.maxZ).color(r, g, b, a).next(); 64 | buffer.vertex(interpolatedBox.minX, interpolatedBox.maxY, interpolatedBox.minZ).color(r, g, b, a).next(); 65 | // this one takes us back to a previous spot, which is why the alpha is 0 66 | buffer.vertex(interpolatedBox.minX, interpolatedBox.minY, interpolatedBox.maxZ).color(r, g, b, 0f).next(); 67 | buffer.vertex(interpolatedBox.minX, interpolatedBox.maxY, interpolatedBox.maxZ).color(r, g, b, a).next(); 68 | // Same with this one 69 | buffer.vertex(interpolatedBox.maxX, interpolatedBox.minY, interpolatedBox.maxZ).color(r, g, b, 0f).next(); 70 | buffer.vertex(interpolatedBox.maxX, interpolatedBox.maxY, interpolatedBox.maxZ).color(r, g, b, a).next(); 71 | // aaaand this one 72 | buffer.vertex(interpolatedBox.maxX, interpolatedBox.minY, interpolatedBox.minZ).color(r, g, b, 0f).next(); 73 | buffer.vertex(interpolatedBox.maxX, interpolatedBox.maxY, interpolatedBox.minZ).color(r, g, b, a).next(); 74 | tessellator.draw(); 75 | } 76 | 77 | public static void drawFilledBox(Box box, Color color) { 78 | final Box interpolatedBox = RenderUtil.interpolateBox(box); 79 | 80 | final BufferBuilder buffer = tessellator.getBuffer(); 81 | 82 | RenderUtil.glColor(color); 83 | 84 | // this is pain 85 | buffer.begin(5, VertexFormats.POSITION); 86 | WorldRenderer.drawBox(buffer, 87 | interpolatedBox.minX, interpolatedBox.minY, interpolatedBox.minZ, 88 | interpolatedBox.maxX, interpolatedBox.maxY, interpolatedBox.maxZ, color.getRed(), 89 | color.getGreen(), color.getBlue(), color.getAlpha()); 90 | tessellator.draw(); 91 | } 92 | 93 | public static void glColor(final Color color) { 94 | final float red = color.getRed() / 255F; 95 | final float green = color.getGreen() / 255F; 96 | final float blue = color.getBlue() / 255F; 97 | final float alpha = color.getAlpha() / 255F; 98 | 99 | RenderSystem.color4f(red, green, blue, alpha); 100 | } 101 | 102 | public static Vec3d interpolatePos(Vec3d pos) { 103 | return pos.subtract(mc.getEntityRenderDispatcher().camera.getPos()); 104 | } 105 | 106 | public static Box interpolateBox(Box box) { 107 | return box.offset(mc.getEntityRenderDispatcher().camera.getPos().multiply(-1)); 108 | } 109 | 110 | public static void startRender(MatrixStack matrixStack) { 111 | RenderSystem.multMatrix(matrixStack.peek().getModel()); 112 | //RenderSystem.blendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 113 | RenderSystem.enableBlend(); 114 | //RenderSystem.disableLighting(); 115 | RenderSystem.disableCull(); 116 | // Reset the color here so it doesn't end up breaking things later 117 | RenderSystem.color4f(-1, -1, -1, -1); 118 | } 119 | 120 | 121 | public static void endRender() { 122 | RenderSystem.color4f(-1, -1, -1, -1); 123 | RenderSystem.enableCull(); 124 | RenderSystem.enableLighting(); 125 | RenderSystem.disableBlend(); 126 | } 127 | 128 | 129 | public static Box getEntityRenderBox(Entity entity, float tickDelta) { 130 | final double x = entity.lastRenderX + ((entity.getPos().x - entity.lastRenderX) * tickDelta); 131 | final double y = entity.lastRenderY + ((entity.getPos().y - entity.lastRenderY) * tickDelta); 132 | final double z = entity.lastRenderZ + ((entity.getPos().z - entity.lastRenderZ) * tickDelta); 133 | 134 | final Box entityBox = entity.getBoundingBox(); 135 | 136 | final Vec3d pos = entity.getPos(); 137 | 138 | return new Box(entityBox.minX - pos.x + x, 139 | entityBox.minY - pos.y + y, 140 | entityBox.minZ - pos.z + z, 141 | entityBox.maxX - pos.x + x, 142 | entityBox.maxY - pos.y + y, 143 | entityBox.maxZ - pos.z + z); 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /src/main/java/io/github/vialdevelopment/tori/util/SessionUtil.java: -------------------------------------------------------------------------------- 1 | package io.github.vialdevelopment.tori.util; 2 | 3 | import com.mojang.authlib.Agent; 4 | import com.mojang.authlib.exceptions.AuthenticationException; 5 | import com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService; 6 | import com.mojang.authlib.yggdrasil.YggdrasilUserAuthentication; 7 | import io.github.vialdevelopment.tori.mixin.duck.MinecraftClientDuck; 8 | import net.minecraft.client.MinecraftClient; 9 | import net.minecraft.client.util.Session; 10 | 11 | public class SessionUtil { 12 | public static Session createSession(String username, String password) { 13 | final YggdrasilAuthenticationService service = new YggdrasilAuthenticationService(java.net.Proxy.NO_PROXY, ""); 14 | YggdrasilUserAuthentication auth = (YggdrasilUserAuthentication) service.createUserAuthentication(Agent.MINECRAFT); 15 | auth.setUsername(username); 16 | auth.setPassword(password); 17 | try { 18 | auth.logIn(); 19 | 20 | return new Session(auth.getSelectedProfile().getName(), auth.getSelectedProfile().getId().toString(), auth.getAuthenticatedToken(), "mojang"); 21 | } catch (AuthenticationException localAuthenticationException) { 22 | localAuthenticationException.printStackTrace(); 23 | } 24 | return null; 25 | } 26 | 27 | public static void setSession(Session session) { 28 | ((MinecraftClientDuck) MinecraftClient.getInstance()).setSession(session); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/main/resources/fabric.mod.json: -------------------------------------------------------------------------------- 1 | { 2 | "schemaVersion": 1, 3 | "id": "tori", 4 | "version": "${version}", 5 | 6 | "name": "Tori", 7 | "description": "Tori Utility mod for Minecraft 1.16.1", 8 | "authors": [ 9 | "cats (tragically)" 10 | ], 11 | "contact": { 12 | "homepage": "https://fabricmc.net/", 13 | "sources": "https://github.com/FabricMC/fabric-example-mod" 14 | }, 15 | 16 | "license": "CC0-1.0", 17 | "icon": "assets/modid/icon.png", 18 | 19 | "environment": "*", 20 | "entrypoints": { 21 | "main": [ 22 | "io.github.vialdevelopment.tori.ToriEntryPoint" 23 | ] 24 | }, 25 | "mixins": [ 26 | "tori.mixins.json" 27 | ], 28 | 29 | "depends": { 30 | "fabricloader": ">=0.7.4", 31 | "fabric": "*", 32 | "minecraft": "1.16.x" 33 | }, 34 | "suggests": { 35 | "flamingo": "*" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/resources/tori.mixins.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "package": "io.github.vialdevelopment.tori.mixin.mixins", 4 | "compatibilityLevel": "JAVA_8", 5 | "mixins": [ 6 | "MixinBossBarHud", 7 | "MixinCamera", 8 | "MixinChatHud", 9 | "MixinClientConnection", 10 | "MixinClientPlayerEntity", 11 | "MixinClientPlayerInteractionManager", 12 | "MixinEntity", 13 | "MixinGameRenderer", 14 | "MixinHandshakeC2SPacket", 15 | "MixinInGameHud", 16 | "MixinInGameOverlayRenderer", 17 | "MixinItemCooldownManager", 18 | "MixinLightmapTextureManager", 19 | "MixinLivingEntity", 20 | "MixinMinecraftClient" 21 | ], 22 | "client": [ 23 | ], 24 | "injectors": { 25 | "defaultRequire": 1 26 | } 27 | } --------------------------------------------------------------------------------