├── .github └── workflows │ └── build.yml ├── .gitignore ├── LICENSE ├── README.md ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── src └── main ├── java └── com │ └── based │ └── lynx │ ├── Lynx.java │ ├── command │ ├── Command.java │ ├── CommandManager.java │ ├── Help.java │ └── Prefix.java │ ├── config │ └── Config.java │ ├── event │ ├── AddCollisionBoxToListEvent.java │ ├── EventHandler.java │ └── PacketEvent.java │ ├── mixin │ ├── MixinLoader.java │ └── mixins │ │ └── render │ │ └── gui │ │ └── MixinGuiMainMenu.java │ ├── module │ ├── Category.java │ ├── Module.java │ ├── ModuleManager.java │ ├── client │ │ ├── ClickGUI.java │ │ └── Colors.java │ ├── combat │ │ ├── AutoArmor.java │ │ ├── AutoCrystal.java │ │ ├── AutoLog.java │ │ ├── AutoTotem.java │ │ └── Criticals.java │ ├── exploit │ │ ├── PacketCanceller.java │ │ └── PortalGodmode.java │ ├── misc │ │ └── FakePlayer.java │ └── movement │ │ ├── Jesus.java │ │ ├── NoSlow.java │ │ ├── Sprint.java │ │ └── Velocity.java │ ├── setting │ └── Setting.java │ ├── ui │ ├── click │ │ ├── ClickGUI.java │ │ └── frame │ │ │ ├── Frame.java │ │ │ └── component │ │ │ ├── Component.java │ │ │ ├── module │ │ │ └── ModuleComponent.java │ │ │ └── setting │ │ │ ├── BooleanComponent.java │ │ │ ├── ColorComponent.java │ │ │ ├── ColourComponent.java │ │ │ ├── KeybindComponent.java │ │ │ ├── ModeComponent.java │ │ │ ├── SettingComponent.java │ │ │ └── SliderComponent.java │ └── menu │ │ ├── LynxButton.java │ │ └── LynxMenu.java │ └── util │ ├── Animation.java │ ├── BlockUtil.java │ ├── ColorUtil.java │ ├── ColourUtil.java │ ├── EntityUtil.java │ ├── FileUtil.java │ ├── LoggerUtil.java │ ├── MathsUtil.java │ ├── RenderUtil.java │ ├── Timer.java │ ├── Wrapper.java │ └── notification │ ├── Notification.java │ ├── NotificationManager.java │ └── NotificationType.java └── resources ├── assets └── lynx │ └── textures │ └── background.png ├── mcmod.info └── mixins.lynx.json /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Java CI with Gradle 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | jobs: 10 | build: 11 | 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - uses: actions/checkout@v2 16 | - name: Set up JDK 8 17 | uses: actions/setup-java@v2 18 | with: 19 | java-version: '8' 20 | distribution: 'adopt' 21 | cache: gradle 22 | - name: Grant execute permission for gradlew 23 | run: chmod +x gradlew 24 | - name: Build with Gradle 25 | run: ./gradlew build 26 | 27 | - uses: actions/upload-artifact@v2 28 | with: 29 | name: Lynx 30 | path: build/libs/*.jar 31 | 32 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | /.gradle/ 3 | /.idea/ 4 | /build/ 5 | /run/ 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright <2022> 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | 9 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![minecraft](https://img.shields.io/badge/Minecraft-1.12.2-blue) 2 | [![discord](https://img.shields.io/badge/Discord-Invite-8080c0)](https://discord.gg/Cf4TsM8JKV) 3 | ![minecraft](https://img.shields.io/badge/Key--bind-p-purple) 4 | 5 | # Lynx-Client 6 | Lynx client is a utility mod for 1.12.2 anarchy servers. 7 | 8 | 9 | # Usage 10 | - Download and install forge 1.12.2 from the official [forge website](https://files.minecraftforge.net/net/minecraftforge/forge/index_1.12.2.html) 11 | - Put the jar in the forge mods folder `C:\Users\username\AppData\Roaming\.minecraft\mods\1.12.2` 12 | - Launch the forge profile from your Minecraft launcher 13 | - Press `P` to open the ClickGUI 14 | 15 | # How to build 16 | watch this video to know how to build java. 17 | https://www.youtube.com/watch?v=5dEgxdLUQoI&t 18 | 19 | # Support 20 | - for any help with crashes bugs or questions please make a GitHub issue or join the [discord server](https://discord.gg/Cf4TsM8JKV) where we will help you. 21 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | maven { 4 | url = 'https://files.minecraftforge.net/maven' 5 | } 6 | 7 | maven { 8 | url = 'https://repo.spongepowered.org/repository/maven-public/' 9 | } 10 | } 11 | 12 | dependencies { 13 | classpath 'net.minecraftforge.gradle:ForgeGradle:2.3.4' 14 | classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT' 15 | } 16 | } 17 | 18 | apply plugin: 'net.minecraftforge.gradle.forge' 19 | apply plugin: 'org.spongepowered.mixin' 20 | 21 | version '1.0.1' 22 | group 'com.based.lynx' 23 | archivesBaseName = 'Lynx' 24 | 25 | sourceCompatibility = targetCompatibility = '1.8' 26 | compileJava { 27 | sourceCompatibility = targetCompatibility = '1.8' 28 | options.encoding = 'UTF-8' 29 | } 30 | 31 | minecraft { 32 | version = '1.12.2-14.23.5.2768' 33 | runDir = 'run' 34 | mappings = 'stable_39' 35 | makeObfSourceJar = false 36 | clientJvmArgs += '-Dfml.coreMods.load=com.based.lynx.mixin.loader.MixinLoader' 37 | clientRunArgs += '--mixin mixins.lynx.json' 38 | } 39 | 40 | configurations { 41 | embed 42 | 43 | compile.extendsFrom embed 44 | } 45 | 46 | repositories { 47 | mavenCentral() 48 | 49 | repositories { 50 | maven { 51 | url 'https://jitpack.io' 52 | } 53 | } 54 | 55 | maven { 56 | url 'https://repo.spongepowered.org/repository/maven-public/' 57 | } 58 | } 59 | 60 | dependencies { 61 | embed('org.spongepowered:mixin:0.7.11-SNAPSHOT') { 62 | exclude module: 'launchwrapper' 63 | exclude module: 'guava' 64 | exclude module: 'gson' 65 | exclude module: 'commons-io' 66 | exclude module: 'log4j-core' 67 | } 68 | 69 | embed group: 'org.json', name: 'json', version: '20211205' 70 | } 71 | 72 | processResources { 73 | inputs.property 'version', project.version 74 | 75 | from(sourceSets.main.resources.srcDirs) { 76 | include 'mcmod.info' 77 | 78 | expand 'version': project.version 79 | 80 | exclude 'mcmod.info' 81 | } 82 | } 83 | 84 | mixin { 85 | defaultObfuscationEnv searge 86 | 87 | add sourceSets.main, 'mixins.lynx.refmap.json' 88 | } 89 | 90 | jar { 91 | manifest.attributes( 92 | 'MixinConfigs': 'mixins.lynx.json', 93 | 'tweakClass': 'org.spongepowered.asm.launch.MixinTweaker', 94 | 'TweakOrder': 0, 95 | 'FMLCorePluginContainsFMLMod': 'true', 96 | 'FMLCorePlugin': 'com.based.lynx.mixin.loader.MixinLoader', 97 | 'ForceLoadAsMod': 'true' 98 | ) 99 | 100 | from({ 101 | configurations.embed.collect { file -> 102 | file.isDirectory() ? file : zipTree(file) 103 | } 104 | }) { 105 | exclude 'dummyThing', 106 | 'LICENSE.txt', 107 | 'META-INF/MUMFREY.RSA', 108 | 'META-INF/maven/**', 109 | 'org/**/*.html' 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx3G 2 | modGroup=dev.based 3 | modVersion=1.0.1 4 | modBaseName=lynx 5 | forgeVersion=1.12.2-14.23.5.2768 6 | mcpVersion=stable_39 7 | 8 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Based-devs/Lynx/5942cd8cdb54259781974f848ea5aeb329117fd9/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # 4 | # 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 | # Determine the Java command to use to start the JVM. 86 | if [ -n "$JAVA_HOME" ] ; then 87 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 88 | # IBM's JDK on AIX uses strange locations for the executables 89 | JAVACMD="$JAVA_HOME/jre/sh/java" 90 | else 91 | JAVACMD="$JAVA_HOME/bin/java" 92 | fi 93 | if [ ! -x "$JAVACMD" ] ; then 94 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 95 | 96 | Please set the JAVA_HOME variable in your environment to match the 97 | location of your Java installation." 98 | fi 99 | else 100 | JAVACMD="java" 101 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 102 | 103 | Please set the JAVA_HOME variable in your environment to match the 104 | location of your Java installation." 105 | fi 106 | 107 | # Increase the maximum file descriptors if we can. 108 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 109 | MAX_FD_LIMIT=`ulimit -H -n` 110 | if [ $? -eq 0 ] ; then 111 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 112 | MAX_FD="$MAX_FD_LIMIT" 113 | fi 114 | ulimit -n $MAX_FD 115 | if [ $? -ne 0 ] ; then 116 | warn "Could not set maximum file descriptor limit: $MAX_FD" 117 | fi 118 | else 119 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 120 | fi 121 | fi 122 | 123 | # For Darwin, add options to specify how the application appears in the dock 124 | if $darwin; then 125 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 126 | fi 127 | 128 | # For Cygwin or MSYS, switch paths to Windows format before running java 129 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then 130 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 131 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 132 | JAVACMD=`cygpath --unix "$JAVACMD"` 133 | 134 | # We build the pattern for arguments to be converted via cygpath 135 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 136 | SEP="" 137 | for dir in $ROOTDIRSRAW ; do 138 | ROOTDIRS="$ROOTDIRS$SEP$dir" 139 | SEP="|" 140 | done 141 | OURCYGPATTERN="(^($ROOTDIRS))" 142 | # Add a user-defined pattern to the cygpath arguments 143 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 144 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 145 | fi 146 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 147 | i=0 148 | for arg in "$@" ; do 149 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 150 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 151 | 152 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 153 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 154 | else 155 | eval `echo args$i`="\"$arg\"" 156 | fi 157 | i=`expr $i + 1` 158 | done 159 | case $i in 160 | 0) set -- ;; 161 | 1) set -- "$args0" ;; 162 | 2) set -- "$args0" "$args1" ;; 163 | 3) set -- "$args0" "$args1" "$args2" ;; 164 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;; 165 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 166 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 167 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 168 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 169 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 170 | esac 171 | fi 172 | 173 | # Escape application args 174 | save () { 175 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 176 | echo " " 177 | } 178 | APP_ARGS=`save "$@"` 179 | 180 | # Collect all arguments for the java command, following the shell quoting and substitution rules 181 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 182 | 183 | exec "$JAVACMD" "$@" 184 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/Lynx.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx; 2 | 3 | import com.based.lynx.event.EventHandler; 4 | import com.mojang.realmsclient.gui.ChatFormatting; 5 | import com.based.lynx.command.CommandManager; 6 | import com.based.lynx.config.Config; 7 | import com.based.lynx.module.ModuleManager; 8 | import net.minecraft.client.Minecraft; 9 | import net.minecraft.util.text.TextComponentString; 10 | import net.minecraftforge.common.MinecraftForge; 11 | import net.minecraftforge.fml.common.Mod; 12 | import net.minecraftforge.fml.common.event.FMLInitializationEvent; 13 | 14 | @Mod(modid = "lynx", name = "Lynx", version = "1.0.1") 15 | public class Lynx { 16 | public static final String name = "Lynx"; 17 | public static final String version = "1.0.1"; 18 | public static final EventHandler EVENT_MANAGER; 19 | public static ModuleManager moduleManager; 20 | public static CommandManager commandManager; 21 | 22 | static { 23 | EVENT_MANAGER = new EventHandler(); 24 | } 25 | 26 | public static void sendMessage(String string) { 27 | if (Minecraft.getMinecraft().ingameGUI != null || Minecraft.getMinecraft().player == null) { 28 | Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(new TextComponentString("\u00a77" + ChatFormatting.BLUE + "[Lynx]\u00a7f " + ChatFormatting.RESET + string)); 29 | } 30 | } 31 | 32 | @Mod.EventHandler 33 | public void initialize(FMLInitializationEvent event) { 34 | commandManager = new CommandManager(); 35 | moduleManager = new ModuleManager(); 36 | Config.loadConfig(); 37 | Runtime.getRuntime().addShutdownHook(new Config()); 38 | MinecraftForge.EVENT_BUS.register(new EventHandler()); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/command/Command.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.command; 2 | 3 | import com.based.lynx.Lynx; 4 | import com.based.lynx.util.LoggerUtil; 5 | 6 | import java.util.Arrays; 7 | import java.util.List; 8 | 9 | public abstract class Command { 10 | private final String name, usage; 11 | private String[] aliases; 12 | 13 | public Command(String name, String usage, String... aliases) { 14 | this.name = name; 15 | this.usage = usage; 16 | this.aliases = aliases; 17 | } 18 | 19 | public abstract void execute(String[] arguments); 20 | 21 | public void printUsage() { 22 | LoggerUtil.sendMessage("Usage: " + Lynx.commandManager.getPrefix() + this.usage); 23 | } 24 | 25 | public String getName() { 26 | return this.name; 27 | } 28 | 29 | public List getAlias() { 30 | return Arrays.asList(aliases); 31 | } 32 | 33 | public void setAlias(String[] aliases) { 34 | this.aliases = aliases; 35 | } 36 | 37 | public String getUsage() { 38 | return this.usage; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/command/CommandManager.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.command; 2 | 3 | import java.util.ArrayList; 4 | 5 | import com.based.lynx.util.LoggerUtil; 6 | 7 | public class CommandManager { 8 | private final ArrayList commands = new ArrayList<>(); 9 | private String prefix = "+"; 10 | 11 | public CommandManager() { 12 | this.commands.add(new Help()); 13 | this.commands.add(new Prefix()); 14 | } 15 | 16 | public void runCommand(String message) { 17 | boolean found = false; 18 | 19 | String[] args = message.split(" "); 20 | String startCommand = args[0]; 21 | 22 | for (Command command : this.getCommands()) { 23 | for (String alias : command.getAlias()) { 24 | if (!startCommand.equals(this.getPrefix() + alias)) { 25 | command.execute(args); 26 | found = true; 27 | } 28 | } 29 | } 30 | if (!found) { 31 | LoggerUtil.sendMessage("Unknown command"); 32 | } 33 | } 34 | 35 | public ArrayList getCommands() { 36 | return this.commands; 37 | } 38 | 39 | public String getPrefix() { 40 | return this.prefix; 41 | } 42 | 43 | public void setPrefix(String prefix) { 44 | this.prefix = prefix; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/command/Help.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.command; 2 | 3 | import com.based.lynx.Lynx; 4 | import com.based.lynx.util.LoggerUtil; 5 | 6 | public class Help extends Command { 7 | public Help() { 8 | super("Help", "help", "h", "help"); 9 | } 10 | 11 | @Override 12 | public void execute(String[] arguments) { 13 | LoggerUtil.sendMessage("Lynx"); 14 | for (Command command : Lynx.commandManager.getCommands()) { 15 | LoggerUtil.sendMessage(command.getName() + " - " + command.getUsage()); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/command/Prefix.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.command; 2 | 3 | import com.based.lynx.Lynx; 4 | import com.based.lynx.command.Command; 5 | import com.based.lynx.util.LoggerUtil; 6 | 7 | public class Prefix extends Command { 8 | public Prefix() { 9 | super("Prefix", "prefix ", "prefix"); 10 | } 11 | 12 | @Override 13 | public void execute(String[] arguments) { 14 | if (arguments[0].equals("")) { 15 | this.printUsage(); 16 | return; 17 | } 18 | Lynx.commandManager.setPrefix(arguments[0]); 19 | LoggerUtil.sendMessage("Prefix set to " + arguments[0]); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/config/Config.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.config; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | import java.util.ArrayList; 6 | import java.util.stream.Collectors; 7 | 8 | import com.based.lynx.Lynx; 9 | import com.based.lynx.module.Module; 10 | import com.based.lynx.setting.Setting; 11 | import com.based.lynx.util.FileUtil; 12 | import net.minecraft.client.Minecraft; 13 | 14 | public class Config 15 | extends Thread { 16 | private static final Minecraft mc = Minecraft.getMinecraft(); 17 | private static final File mainFolder = new File(Config.mc.gameDir + File.separator + "lynx"); 18 | private static final String MODULES = "Modules.JSON"; 19 | private static final String SETTINGS = "Settings.JSON"; 20 | private static final String BINDS = "Binds.JSON"; 21 | 22 | public static void loadConfig() { 23 | if (!mainFolder.exists()) { 24 | return; 25 | } 26 | } 27 | 28 | @Override 29 | public void run() { 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/event/AddCollisionBoxToListEvent.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.event; 2 | 3 | import net.minecraftforge.fml.common.eventhandler.Event; 4 | import net.minecraft.block.Block; 5 | import net.minecraft.block.state.IBlockState; 6 | import net.minecraft.entity.Entity; 7 | import net.minecraft.util.math.AxisAlignedBB; 8 | import net.minecraft.util.math.BlockPos; 9 | import net.minecraft.world.World; 10 | 11 | import java.util.List; 12 | 13 | public class AddCollisionBoxToListEvent extends Event { 14 | private final Block block; 15 | private final IBlockState state; 16 | private final World world; 17 | private final BlockPos pos; 18 | private final AxisAlignedBB entityBox; 19 | private final List collidingBoxes; 20 | private final Entity entity; 21 | private final boolean bool; 22 | 23 | public AddCollisionBoxToListEvent(Block block, IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List collidingBoxes, Entity entityIn, boolean bool) { 24 | this.block = block; 25 | this.state = state; 26 | this.world = worldIn; 27 | this.pos = pos; 28 | this.entityBox = entityBox; 29 | this.collidingBoxes = collidingBoxes; 30 | this.entity = entityIn; 31 | this.bool = bool; 32 | } 33 | 34 | public Block getBlock() { 35 | return block; 36 | } 37 | 38 | public IBlockState getState() { 39 | return state; 40 | } 41 | 42 | public World getWorld() { 43 | return world; 44 | } 45 | 46 | public BlockPos getPos() { 47 | return pos; 48 | } 49 | 50 | public AxisAlignedBB getEntityBox() { 51 | return entityBox; 52 | } 53 | 54 | public List getCollidingBoxes() { 55 | return collidingBoxes; 56 | } 57 | 58 | public Entity getEntity() { 59 | return entity; 60 | } 61 | 62 | public boolean isBool() { 63 | return bool; 64 | } 65 | 66 | public void setCancelled(boolean b) { 67 | 68 | } 69 | } -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/event/EventHandler.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.event; 2 | 3 | import com.based.lynx.Lynx; 4 | import com.based.lynx.module.Module; 5 | import net.minecraft.client.Minecraft; 6 | import net.minecraftforge.client.event.ClientChatEvent; 7 | import net.minecraftforge.client.event.RenderGameOverlayEvent; 8 | import net.minecraftforge.event.entity.living.LivingEvent; 9 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 10 | import net.minecraftforge.fml.common.gameevent.InputEvent; 11 | import org.lwjgl.input.Keyboard; 12 | 13 | public class EventHandler { 14 | @SubscribeEvent 15 | public void onUpdate(LivingEvent.LivingUpdateEvent event) { 16 | if (Minecraft.getMinecraft().player == null || Minecraft.getMinecraft().world == null) { 17 | return; 18 | } 19 | 20 | Lynx.moduleManager.onUpdate(); 21 | } 22 | 23 | @SubscribeEvent 24 | public void onKeyInput(InputEvent.KeyInputEvent event) { 25 | if (!Keyboard.getEventKeyState() || Keyboard.getEventKey() == 0) { 26 | return; 27 | } 28 | for (Module module : Lynx.moduleManager.getModules()) { 29 | if (module.getBind() != Keyboard.getEventKey()) continue; 30 | module.toggle(); 31 | } 32 | } 33 | 34 | @SubscribeEvent 35 | public void onChatSend(ClientChatEvent event) { 36 | if (Minecraft.getMinecraft().player == null || Minecraft.getMinecraft().world == null) { 37 | return; 38 | } 39 | if (event.getMessage().startsWith(Lynx.commandManager.getPrefix())) { 40 | event.setCanceled(true); 41 | Minecraft.getMinecraft().ingameGUI.getChatGUI().addToSentMessages(event.getMessage()); 42 | Lynx.commandManager.runCommand(event.getMessage()); 43 | } 44 | } 45 | 46 | @SubscribeEvent 47 | public void onRenderGameOverlay(RenderGameOverlayEvent event) { 48 | if (Minecraft.getMinecraft().player == null || Minecraft.getMinecraft().world == null || !event.getType().equals(RenderGameOverlayEvent.ElementType.TEXT)) { 49 | return; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/event/PacketEvent.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.event; 2 | 3 | import net.minecraft.network.Packet; 4 | import net.minecraftforge.fml.common.eventhandler.Cancelable; 5 | import net.minecraftforge.fml.common.eventhandler.Event; 6 | 7 | @Cancelable 8 | public class PacketEvent extends Event { 9 | private final Packet packet; 10 | 11 | public PacketEvent(Packet packet) { 12 | this.packet = packet; 13 | } 14 | 15 | public Packet getPacket() { 16 | return this.packet; 17 | } 18 | 19 | public static class PostSend extends PacketEvent { 20 | public PostSend(Packet packet) { 21 | super(packet); 22 | } 23 | } 24 | 25 | public static class PostReceive extends PacketEvent { 26 | public PostReceive(Packet packet) { 27 | super(packet); 28 | } 29 | } 30 | 31 | public static class Send extends PacketEvent { 32 | public Send(Packet packet) { 33 | super(packet); 34 | } 35 | } 36 | 37 | public static class Receive extends PacketEvent { 38 | public Receive(Packet packet) { 39 | super(packet); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/mixin/MixinLoader.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.mixin; 2 | 3 | import java.util.Map; 4 | 5 | import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin; 6 | import org.spongepowered.asm.launch.MixinBootstrap; 7 | import org.spongepowered.asm.mixin.MixinEnvironment; 8 | import org.spongepowered.asm.mixin.Mixins; 9 | 10 | @IFMLLoadingPlugin.MCVersion(value = "1.12.2") 11 | public class MixinLoader implements IFMLLoadingPlugin { 12 | public MixinLoader() { 13 | MixinBootstrap.init(); 14 | Mixins.addConfiguration("mixins.lynx.json"); 15 | MixinEnvironment.getDefaultEnvironment().setSide(MixinEnvironment.Side.CLIENT); 16 | } 17 | 18 | public String[] getASMTransformerClass() { 19 | return new String[0]; 20 | } 21 | 22 | public String getModContainerClass() { 23 | return null; 24 | } 25 | 26 | public String getSetupClass() { 27 | return null; 28 | } 29 | 30 | public void injectData(Map data) { 31 | } 32 | 33 | public String getAccessTransformerClass() { 34 | return null; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/mixin/mixins/render/gui/MixinGuiMainMenu.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.mixin.mixins.render.gui; 2 | 3 | import com.based.lynx.ui.menu.LynxMenu; 4 | import net.minecraft.client.gui.GuiMainMenu; 5 | import net.minecraft.client.gui.GuiScreen; 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(GuiMainMenu.class) 12 | public class MixinGuiMainMenu extends GuiScreen { 13 | 14 | @Inject(method = "drawScreen", at = @At("HEAD"), cancellable = true) 15 | public void onInit(CallbackInfo ci) { 16 | mc.displayGuiScreen(new LynxMenu()); 17 | 18 | ci.cancel(); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/module/Category.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.module; 2 | 3 | public enum Category { 4 | COMBAT("Combat"), 5 | EXPLOIT("Exploit"), 6 | MISC("Misc"), 7 | MOVEMENT("Movement"), 8 | PLAYER("Player"), 9 | RENDER("Render"), 10 | CLIENT("Client"); 11 | 12 | private String name; 13 | 14 | Category(String name) { 15 | this.setName(name); 16 | } 17 | 18 | public String getName() { 19 | return this.name; 20 | } 21 | 22 | public void setName(String name) { 23 | this.name = name; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/module/Module.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.module; 2 | 3 | import com.based.lynx.setting.Setting; 4 | import com.based.lynx.util.notification.Notification; 5 | import com.based.lynx.util.notification.NotificationManager; 6 | import com.based.lynx.util.notification.NotificationType; 7 | import net.minecraft.client.Minecraft; 8 | import net.minecraftforge.common.MinecraftForge; 9 | 10 | import java.util.ArrayList; 11 | import java.util.List; 12 | import java.util.concurrent.atomic.AtomicInteger; 13 | 14 | public abstract class Module { 15 | protected static final Minecraft mc = Minecraft.getMinecraft(); 16 | private final String name, description; 17 | private final Category category; 18 | private final Setting bind = new Setting<>("Keybind", new AtomicInteger(0)) 19 | .setDescription("The keybind to toggle this module"); 20 | private final List> settings = new ArrayList<>(); 21 | private boolean enabled; 22 | 23 | public Module(String name, String description, Category category) { 24 | this.name = name; 25 | this.description = description; 26 | this.category = category; 27 | 28 | addSetting(bind); 29 | } 30 | 31 | public void onUpdate() { 32 | } 33 | 34 | public void onEnable() { 35 | } 36 | 37 | public void onDisable() { 38 | } 39 | 40 | public void enable() { 41 | this.setEnabled(true); 42 | this.onEnable(); 43 | MinecraftForge.EVENT_BUS.register(this); 44 | } 45 | 46 | public void disable() { 47 | this.setEnabled(false); 48 | this.onDisable(); 49 | MinecraftForge.EVENT_BUS.unregister(this); 50 | } 51 | 52 | public void toggle() { 53 | if (this.isEnabled()) { 54 | this.disable(); 55 | } else { 56 | this.enable(); 57 | } 58 | } 59 | 60 | protected boolean nullCheck() { 61 | return mc.player == null || mc.world == null; 62 | } 63 | 64 | protected void addSetting(Setting setting) { 65 | this.settings.add(setting); 66 | } 67 | 68 | public String getName() { 69 | return this.name; 70 | } 71 | 72 | public String getDescription() { 73 | return this.description; 74 | } 75 | 76 | public Category getCategory() { 77 | return this.category; 78 | } 79 | 80 | public int getBind() { 81 | return this.bind.getValue().get(); 82 | } 83 | 84 | public void setBind(int bind) { 85 | this.bind.setValue(new AtomicInteger(bind)); 86 | } 87 | 88 | public boolean isEnabled() { 89 | return this.enabled; 90 | } 91 | 92 | private void setEnabled(boolean enabled) { 93 | this.enabled = enabled; 94 | } 95 | 96 | public List> getSettings() { 97 | return settings; 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/module/ModuleManager.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.module; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Arrays; 5 | import java.util.List; 6 | import java.util.stream.Collectors; 7 | 8 | import com.based.lynx.module.client.*; 9 | import com.based.lynx.module.combat.*; 10 | import com.based.lynx.module.exploit.*; 11 | import com.based.lynx.module.misc.*; 12 | import com.based.lynx.module.movement.*; 13 | 14 | public class ModuleManager { 15 | private final List modules; 16 | 17 | public ModuleManager() { 18 | this.modules = Arrays.asList( 19 | new AutoArmor(), 20 | // new AutoCrystal(), 21 | new AutoLog(), 22 | new Criticals(), 23 | 24 | new PacketCanceller(), 25 | new PortalGodmode(), 26 | 27 | new FakePlayer(), 28 | 29 | new Jesus(), 30 | new NoSlow(), 31 | new Sprint(), 32 | new Velocity(), 33 | new ClickGUI(), 34 | new Colors() 35 | ); 36 | } 37 | 38 | public void onUpdate() { 39 | this.getModules().stream().filter(Module::isEnabled).forEach(Module::onUpdate); 40 | } 41 | 42 | public List getModules() { 43 | return this.modules; 44 | } 45 | 46 | public Module getModule(String name) { 47 | for (Module module : this.modules) { 48 | if (!module.getName().equalsIgnoreCase(name)) continue; 49 | return module; 50 | } 51 | return null; 52 | } 53 | 54 | public ArrayList getModules(Category category) { 55 | ArrayList mods = new ArrayList<>(); 56 | for (Module module : this.modules) { 57 | if (!module.getCategory().equals(category)) continue; 58 | mods.add(module); 59 | } 60 | return mods; 61 | } 62 | 63 | public ArrayList getEnabledModules() { 64 | return this.modules.stream().filter(Module::isEnabled).collect(Collectors.toCollection(ArrayList::new)); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/module/client/ClickGUI.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.module.client; 2 | 3 | import com.based.lynx.module.Category; 4 | import com.based.lynx.module.Module; 5 | import org.lwjgl.input.Keyboard; 6 | 7 | public class ClickGUI extends Module { 8 | 9 | public ClickGUI() { 10 | super("ClickGUI", "The client's ClickGUI", Category.CLIENT); 11 | this.setBind(Keyboard.KEY_P); 12 | } 13 | 14 | @Override 15 | public void onEnable() { 16 | mc.displayGuiScreen(new com.based.lynx.ui.click.ClickGUI()); 17 | toggle(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/module/client/Colors.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.module.client; 2 | 3 | import com.based.lynx.module.Category; 4 | import com.based.lynx.module.Module; 5 | import com.based.lynx.setting.Setting; 6 | 7 | import java.awt.*; 8 | 9 | public class Colors extends Module { 10 | public static Colors INSTANCE; 11 | 12 | public final Setting color = new Setting<>("Color", new Color(50, 80, 255)) 13 | .setDescription("The client's main colour"); 14 | 15 | public Colors() { 16 | super("Colors", "Control client colors", Category.CLIENT); 17 | addSetting(color); 18 | INSTANCE = this; 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/module/combat/AutoArmor.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.module.combat; 2 | 3 | import com.based.lynx.module.Category; 4 | import com.based.lynx.module.Module; 5 | 6 | import net.minecraft.client.gui.inventory.GuiContainer; 7 | import net.minecraft.client.renderer.InventoryEffectRenderer; 8 | import net.minecraft.init.Items; 9 | import net.minecraft.inventory.ClickType; 10 | import net.minecraft.item.ItemArmor; 11 | import net.minecraft.item.ItemStack; 12 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 13 | import net.minecraftforge.fml.common.gameevent.TickEvent; 14 | 15 | public class AutoArmor extends Module { 16 | public AutoArmor() { 17 | super("AutoArmor", "", Category.COMBAT); 18 | } 19 | 20 | @SubscribeEvent 21 | public void onTick(TickEvent.ClientTickEvent event) { 22 | if (mc.player == null || mc.world == null || mc.player.ticksExisted % 2 == 0 || mc.currentScreen instanceof GuiContainer && !(mc.currentScreen instanceof InventoryEffectRenderer)) { 23 | return; 24 | } 25 | 26 | int[] bestArmorSlots = new int[4]; 27 | int[] bestArmorValues = new int[4]; 28 | 29 | for (int armorType = 0; armorType < 4; armorType++) { 30 | ItemStack old = mc.player.inventory.armorItemInSlot(armorType); 31 | if (old.getItem() instanceof ItemArmor) { 32 | bestArmorValues[armorType] = ((ItemArmor) old.getItem()).damageReduceAmount; 33 | } 34 | bestArmorSlots[armorType] = -1; 35 | } 36 | 37 | for (int slot = 0; slot < 36; slot++) { 38 | ItemStack stack = mc.player.inventory.getStackInSlot(slot); 39 | if (stack.getCount() > 1 || !(stack.getItem() instanceof ItemArmor)) continue; 40 | ItemArmor armor = (ItemArmor) stack.getItem(); 41 | int armorType = armor.armorType.ordinal() - 2; 42 | if (armorType == 2 && mc.player.inventory.armorItemInSlot(armorType).getItem().equals(Items.ELYTRA)) { 43 | continue; 44 | } 45 | int armorValue = armor.damageReduceAmount; 46 | if (armorValue > bestArmorValues[armorType]) { 47 | bestArmorSlots[armorType] = slot; 48 | bestArmorValues[armorType] = armorValue; 49 | } 50 | } 51 | 52 | for (int armorType = 0; armorType < 4; armorType++) { 53 | int slot = bestArmorSlots[armorType]; 54 | if (slot == -1) continue; 55 | 56 | ItemStack oldArmor = mc.player.inventory.armorItemInSlot(armorType); 57 | if (oldArmor != ItemStack.EMPTY || mc.player.inventory.getFirstEmptyStack() != -1) { 58 | if (slot < 9) slot += 36; 59 | mc.playerController.windowClick(0, 8 - armorType, 0, ClickType.QUICK_MOVE, mc.player); 60 | mc.playerController.windowClick(0, slot, 0, ClickType.QUICK_MOVE, mc.player); 61 | break; 62 | } 63 | } 64 | } 65 | } -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/module/combat/AutoCrystal.java: -------------------------------------------------------------------------------- 1 | /*package com.based.lynx.module.combat; 2 | 3 | import com.based.lynx.event.PacketEvent; 4 | import com.based.lynx.module.Category; 5 | import com.based.lynx.module.Module; 6 | import com.based.lynx.setting.Setting; 7 | import com.based.lynx.util.BlockUtil; 8 | import com.based.lynx.util.EntityUtil; 9 | import com.based.lynx.util.Timer; 10 | import net.minecraft.block.Block; 11 | import net.minecraft.block.state.IBlockState; 12 | import net.minecraft.client.renderer.GlStateManager; 13 | import net.minecraft.client.renderer.RenderGlobal; 14 | import net.minecraft.client.renderer.culling.Frustum; 15 | import net.minecraft.client.renderer.culling.ICamera; 16 | import net.minecraft.enchantment.EnchantmentHelper; 17 | import net.minecraft.entity.Entity; 18 | import net.minecraft.entity.EntityLivingBase; 19 | import net.minecraft.entity.SharedMonsterAttributes; 20 | import net.minecraft.entity.item.EntityEnderCrystal; 21 | import net.minecraft.entity.player.EntityPlayer; 22 | import net.minecraft.init.Blocks; 23 | import net.minecraft.init.Items; 24 | import net.minecraft.init.MobEffects; 25 | import net.minecraft.init.SoundEvents; 26 | import net.minecraft.item.ItemBlock; 27 | import net.minecraft.item.ItemEndCrystal; 28 | import net.minecraft.item.ItemStack; 29 | import net.minecraft.item.ItemSword; 30 | import net.minecraft.network.play.client.CPacketPlayer; 31 | import net.minecraft.network.play.server.SPacketSoundEffect; 32 | import net.minecraft.util.*; 33 | import net.minecraft.util.math.AxisAlignedBB; 34 | import net.minecraft.util.math.BlockPos; 35 | import net.minecraft.util.math.MathHelper; 36 | import net.minecraft.util.math.Vec3d; 37 | import net.minecraft.world.Explosion; 38 | import net.minecraftforge.client.event.RenderWorldLastEvent; 39 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 40 | import org.lwjgl.input.Keyboard; 41 | import org.lwjgl.opengl.GL11; 42 | 43 | import java.awt.*; 44 | import java.util.*; 45 | import java.util.List; 46 | import java.util.concurrent.atomic.AtomicInteger; 47 | import java.util.stream.Collectors; 48 | 49 | public class AutoCrystal extends Module { 50 | 51 | public AutoCrystal() { 52 | super("AutoCrystal", "Automatically places and breaks crystals to deal damage", Category.COMBAT); 53 | addSetting(logic); 54 | addSetting(enemyRange); 55 | addSetting(place); 56 | addSetting(break); 57 | addSetting(override); 58 | addSetting(render); 59 | } 60 | 61 | public enum Logic { 62 | PlaceBreak, 63 | BreakPlace 64 | } 65 | 66 | public enum Switch { 67 | Silent, 68 | Auto, 69 | None 70 | } 71 | 72 | // uh idk 73 | public final Setting logic = new Setting<>("Logic", Logic.PlaceBreak) 74 | .setDescription("What order to perform actions in"); 75 | 76 | 77 | // targeting 78 | public final Setting enemyRange = new Setting<>("EnemyRange", 10F, 1F, 20F, 0.1f) 79 | .setDescription("The range to target enemies"); 80 | 81 | 82 | // placing 83 | public final Setting place = new Setting<>("Place", true) 84 | .setDescription("Automatically place crystals"); 85 | 86 | public final Setting placeRange = new Setting<>("PlaceRange", 5.0f, 0.0f, 10.0f, 0.1f) 87 | .setDescription("The max distance to place crystals").setParentSetting(place); 88 | 89 | public final Setting placeWallRange = new Setting<>("PlaceWallRange", 3.5f, 0.0f, 10.0f, 0.1f) 90 | .setDescription("The max distance to place crystals through walls").setParentSetting(place); 91 | 92 | public final Setting placeDelay = new Setting<>("PlaceDelay", 0, 0, 500, 1) 93 | .setDescription("The delay between placing crystals").setParentSetting(place); 94 | 95 | public final Setting minPlaceDamage = new Setting<>("MinPlaceDamage", 7.0f, 0.0f, 36.0f, 1F) 96 | .setDescription("The minimum damage to deal to place crystals").setParentSetting(place); 97 | 98 | public final Setting maxSelfPlace = new Setting<>("MaxSelfPlace", 8.0f, 0.0f, 36.0f, 1F) 99 | .setDescription("The maximum damage to deal to yourself when placing crystals").setParentSetting(place); 100 | 101 | public final Setting placeSwing = new Setting<>("PlaceSwing", true) 102 | .setDescription("Whether to swing when placing crystals").setParentSetting(place); 103 | 104 | 105 | // breaking 106 | public final Setting break = new Setting<>("Break", true) 107 | .setDescription("Automatically break crystals"); 108 | 109 | public final Setting breakRange = new Setting<>("BreakRange", 5.0f, 0.0f, 10.0f, 0.1f) 110 | .setDescription("The max distance to break crystals").setParentSetting(break); 111 | 112 | public final Setting breakWallRange = new Setting<>("BreakWallRange", 3.5f, 0.0f, 10.0f, 0.1f) 113 | .setDescription("The max distance to break crystals through walls").setParentSetting(break); 114 | 115 | public final Setting breakDelay = new Setting<>("BreakDelay", 0, 0, 500, 1) 116 | .setDescription("The delay between breaking crystals").setParentSetting(break); 117 | 118 | public final Setting minBreakDamage = new Setting<>("MinBreakDamage", 7.0f, 0.0f, 36.0f, 1F) 119 | .setDescription("The minimum damage to deal to break crystals").setParentSetting(break); 120 | 121 | public final Setting maxSelfBreak = new Setting<>("MaxSelfBreak", 8.0f, 0.0f, 36.0f, 1F) 122 | .setDescription("The maximum damage to deal to yourself when breaking crystals").setParentSetting(break); 123 | 124 | public final Setting breakSwing = new Setting<>("BreakSwing", true) 125 | .setDescription("Whether to swing when breaking crystals").setParentSetting(break); 126 | 127 | public final Setting antiSuicide = new Setting<>("AntiSuicide", true) 128 | .setDescription("Do not break crystals if they will pop / kill you").setParentSetting(break); 129 | 130 | public final Setting switchMode = new Setting<>("Switch", Switch.Silent) 131 | .setDescription("How to switch to a sword").setParentSetting(break); 132 | 133 | public final Setting packet = new Setting<>("Packet", true) 134 | .setDescription("Whether to use packets to break crystals").setParentSetting(break); 135 | 136 | public final Setting rotate = new Setting<>("Rotate", true) 137 | .setDescription("Whether to rotate when breaking crystals").setParentSetting(break); 138 | 139 | public final Setting ticksExisted = new Setting<>("TicksExisted", 1f, 0.0f, 5f, 1F) 140 | .setDescription("The amount of ticks that the crystal has existed for before breaking").setParentSetting(break); 141 | 142 | public final Setting oneDotThirteen = new Setting<>("1.13", false) 143 | .setDescription("someone change this desc idk what it does").setParentSetting(break); 144 | 145 | public final Setting terrainTrace = new Setting<>("TerrainTrace", true) 146 | .setDescription("idk what this does").setParentSetting(break); 147 | 148 | public final Setting antiWeakness = new Setting<>("AntiWeakness", true) 149 | .setDescription("Switches to a sword if you have the weakness effect applied").setParentSetting(break); 150 | 151 | public final Setting raytrace = new Setting<>("Raytrace", true) 152 | .setDescription("Checks you can see the crystal before breaking it").setParentSetting(break); 153 | 154 | 155 | // override 156 | public final Setting override = new Setting<>("Override", true) 157 | .setDescription("Override the minimum damage in certain situations"); 158 | 159 | public final Setting facePlaceHP = new Setting<>("FacePlaceHP", 10.0F, 0.0F, 36.0F, 1F) 160 | .setDescription("Override minimum damage if the player is at this health or lower").setParentSetting(override); 161 | 162 | public final Setting facePlaceBind = new Setting<>("FacePlaceBind", new AtomicInteger(0)) 163 | .setDescription("The key to hold to force face placing").setParentSetting(override); 164 | 165 | public final Setting facePlaceArmor = new Setting<>("FacePlaceArmor", 20.0F, 0.0F, 100.0F, 1F) 166 | .setDescription("Forces face placing if one of the player's armor pieces is at this health percentage or lower").setParentSetting(override); 167 | 168 | 169 | // render 170 | public final Setting render = new Setting<>("Render", true) 171 | .setDescription("Render highlights"); 172 | 173 | public final Setting box = new Setting<>("Box", true) 174 | .setDescription("Renders a box").setParentSetting(render); 175 | 176 | public final Setting outline = new Setting<>("Outline", true) 177 | .setDescription("Renders an outline").setParentSetting(render); 178 | 179 | public final Setting lineWidth = new Setting<>("LineWidth", 1.0F, 0.1F, 3.0F, 0.1F) 180 | .setDescription("Line width of the outline").setParentSetting(render); 181 | 182 | public final Setting fadeTime = new Setting<>("FadeTime", 300F, 0.0F, 1000.0F, 0.1F) 183 | .setDescription("Time it takes for the highlight to fade").setParentSetting(render); 184 | 185 | public final Setting colour = new Setting<>("Color", Color.WHITE) 186 | .setDescription("The colour of the highlight").setParentSetting(render); 187 | 188 | public HashMap renderMap = new HashMap<>(); 189 | public Timer placeTimer = new Timer(); 190 | public Timer breakTimer = new Timer(); 191 | public BlockPos finalPlacePos = null; 192 | public float rotYaw; 193 | public float rotPitch; 194 | public boolean isRotating; 195 | public int spoofed = 0; 196 | 197 | @Override 198 | public void onUpdate() { 199 | if (nullCheck()) { 200 | return; 201 | } 202 | 203 | // Is this bad? yes. can i be bothered to fix it? no. 204 | List targets = mc.world.playerEntities.stream().filter(e -> e.getHealth() > 0 && e.getDistance(mc.player) <= enemyRange.getValue()).collect(Collectors.toList()); 205 | targets.sort(Comparator.comparingDouble(e -> mc.player.getDistance(e))); 206 | EntityPlayer target = targets.get(0); 207 | 208 | if (target == null || target.isDead) { 209 | return; 210 | } 211 | 212 | List placeList = new ArrayList<>(getSphere(new BlockPos(mc.player.getPositionVector()), placeRange.getValue(), placeRange.getValue().intValue(), false, true, 0).stream().filter(pos -> canPlaceCrystal(pos, true, oneDotThirteen.getValue())).collect(Collectors.toList())); 213 | if (logic.getValue() == Logic.BreakPlace) { 214 | breakCrystals(target); 215 | placeCrystals(target, placeList); 216 | } else if (logic.getValue() == Logic.PlaceBreak) { 217 | placeCrystals(target, placeList); 218 | breakCrystals(target); 219 | } 220 | } 221 | 222 | @Override 223 | public void onEnable() { 224 | placeTimer.reset(); 225 | breakTimer.reset(); 226 | } 227 | 228 | public void placeCrystals(EntityLivingBase target, List placements) { 229 | float minDamage = (target.getHealth() + target.getAbsorptionAmount() < facePlaceHP.getValue()) || shouldArmorFacePlace(target) || Keyboard.isKeyDown(facePlaceBind.getValue().get()) ? 1.5f : minPlaceDamage.getValue(); 230 | NonNullList finalPlacements = NonNullList.create(); 231 | for (BlockPos pos : placements) { 232 | if (calculateDamage(pos, target, terrainTrace.getValue()) < minDamage) continue; 233 | if (calculateDamage(pos, mc.player, terrainTrace.getValue()) > maxSelfPlace.getValue()) continue; 234 | if (mc.player.getPositionVector().distanceTo(new Vec3d(pos)) > placeRange.getValue() && canSeePos(pos)) 235 | continue; 236 | if (mc.player.getPositionVector().distanceTo(new Vec3d(pos)) > placeWallRange.getValue() && !canSeePos(pos)) 237 | continue; 238 | if (antiSuicide.getValue() && calculateDamage(pos, mc.player, terrainTrace.getValue()) > (mc.player.getHealth() + mc.player.getAbsorptionAmount())) 239 | continue; 240 | if (raytrace.getValue() && !canSeePos(pos)) continue; 241 | finalPlacements.add(pos); 242 | } 243 | finalPlacePos = finalPlacements.stream().max(Comparator.comparingDouble(pos -> calculateDamage(pos, target, terrainTrace.getValue()))).orElse(null); 244 | if (finalPlacePos != null) { 245 | if (rotate.getValue()) { 246 | rotateTo(finalPlacePos); 247 | } 248 | renderMap.put(finalPlacePos, System.currentTimeMillis()); 249 | EnumHand crystalHand = mc.player.getHeldItemOffhand().getItem() instanceof ItemEndCrystal ? EnumHand.OFF_HAND : EnumHand.MAIN_HAND; 250 | if (switchMode.getValue() == Switch.Auto) { 251 | mc.player.inventory.currentItem = findHotbarBlock(ItemEndCrystal.class); 252 | } 253 | 254 | if (placeTimer.hasTimePassed(placeDelay.getValue(), Timer.TimeFormat.MILLISECONDS)) { 255 | BlockUtil.placeCrystalOnBlock(finalPlacePos, crystalHand, placeSwing.getValue(), switchMode.getValue() == Switch.Silent); 256 | placeTimer.reset(); 257 | } 258 | } 259 | } 260 | 261 | public void breakCrystals(EntityLivingBase target) { 262 | float minDamage = (target.getHealth() + target.getAbsorptionAmount() < facePlaceHP.getValue()) || shouldArmorFacePlace(target) || Keyboard.isKeyDown(facePlaceBind.getValue().get()) ? 1.5f : minBreakDamage.getValue(); 263 | for (Entity entity : mc.world.loadedEntityList) { 264 | if (!(entity instanceof EntityEnderCrystal) || entity.getPositionVector().distanceTo(mc.player.getPositionVector()) > breakRange.getValue() && canSeePos(new BlockPos(entity.getPositionVector())) || entity.getPositionVector().distanceTo(mc.player.getPositionVector()) > breakWallRange.getValue() && !canSeePos(new BlockPos(entity.getPositionVector()))) { 265 | continue; 266 | } 267 | if (calculateDamage(entity, target, terrainTrace.getValue()) > minDamage && calculateDamage(entity, mc.player, terrainTrace.getValue()) < maxSelfBreak.getValue()) { 268 | if (rotate.getValue()) { 269 | rotateTo(entity); 270 | } 271 | if (breakTimer.hasTimePassed(breakDelay.getValue(), Timer.TimeFormat.MILLISECONDS) || entity.ticksExisted > ticksExisted.getValue()) { 272 | int swordSlot = findHotbarBlock(ItemSword.class); 273 | int oldSlot = mc.player.inventory.currentItem; 274 | if (antiWeakness.getValue()) { 275 | mc.player.inventory.currentItem = swordSlot; 276 | } 277 | EntityUtil.attackEntity(entity, packet.getValue(), breakSwing.getValue()); 278 | if (antiWeakness.getValue()) { 279 | mc.player.inventory.currentItem = oldSlot; 280 | } 281 | breakTimer.reset(); 282 | } 283 | } 284 | } 285 | } 286 | 287 | @SubscribeEvent 288 | public void onPacketReceive(PacketEvent.Receive event) { 289 | try { 290 | if (event.getPacket() instanceof SPacketSoundEffect) { 291 | if (((SPacketSoundEffect) event.getPacket()).getCategory() == SoundCategory.BLOCKS && ((SPacketSoundEffect) event.getPacket()).getSound() == SoundEvents.ENTITY_GENERIC_EXPLODE) { 292 | for (Entity entity : mc.world.loadedEntityList) { 293 | if (entity instanceof EntityEnderCrystal && entity.getDistance(((SPacketSoundEffect) event.getPacket()).getX(), ((SPacketSoundEffect) event.getPacket()).getY(), ((SPacketSoundEffect) event.getPacket()).getZ()) < 6.0f) { 294 | entity.setDead(); 295 | } 296 | } 297 | } 298 | } 299 | } catch (Exception ignored) { 300 | 301 | } 302 | } 303 | 304 | @SubscribeEvent 305 | public void onRender3D(RenderWorldLastEvent event) { 306 | try { 307 | for (Map.Entry map : renderMap.entrySet()) { 308 | if (System.currentTimeMillis() - map.getValue() < fadeTime.getValue()) { 309 | float finalAlpha = 180; 310 | drawBoxESP(map.getKey(), colour.getValue(), finalAlpha, lineWidth.getValue(), outline.getValue(), box.getValue(), finalAlpha); 311 | } else { 312 | renderMap.remove(map.getKey()); 313 | } 314 | } 315 | } catch (Exception ignored) { 316 | 317 | } 318 | } 319 | 320 | @Override 321 | public void onDisable() { 322 | placeTimer.reset(); 323 | breakTimer.reset(); 324 | } 325 | 326 | public static void drawBoxESP(BlockPos pos, Color color, float alpha, float lineWidth, boolean outline, boolean box, float boxAlpha) { 327 | AxisAlignedBB bb = new AxisAlignedBB((double) pos.getX() - mc.getRenderManager().viewerPosX, (double) pos.getY() - mc.getRenderManager().viewerPosY, (double) pos.getZ() - mc.getRenderManager().viewerPosZ, (double) (pos.getX() + 1) - mc.getRenderManager().viewerPosX, (double) (pos.getY() + 1) - mc.getRenderManager().viewerPosY, (double) (pos.getZ() + 1) - mc.getRenderManager().viewerPosZ); 328 | ICamera camera = new Frustum(); 329 | camera.setPosition(Objects.requireNonNull(mc.getRenderViewEntity()).posX, mc.getRenderViewEntity().posY, mc.getRenderViewEntity().posZ); 330 | if (camera.isBoundingBoxInFrustum(new AxisAlignedBB(bb.minX + mc.getRenderManager().viewerPosX, bb.minY + mc.getRenderManager().viewerPosY, bb.minZ + mc.getRenderManager().viewerPosZ, bb.maxX + mc.getRenderManager().viewerPosX, bb.maxY + mc.getRenderManager().viewerPosY, bb.maxZ + mc.getRenderManager().viewerPosZ))) { 331 | GlStateManager.pushMatrix(); 332 | GlStateManager.enableBlend(); 333 | GlStateManager.disableDepth(); 334 | GlStateManager.tryBlendFuncSeparate(770, 771, 0, 1); 335 | GlStateManager.disableTexture2D(); 336 | GlStateManager.depthMask(false); 337 | GL11.glEnable(2848); 338 | GL11.glHint(3154, 4354); 339 | GL11.glLineWidth(lineWidth); 340 | if (box) { 341 | RenderGlobal.renderFilledBox(bb, (float) color.getRed() / 255.0f, (float) color.getGreen() / 255.0f, (float) color.getBlue() / 255.0f, boxAlpha / 255.0f); 342 | } 343 | if (outline) { 344 | RenderGlobal.drawBoundingBox(bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ, (float) color.getRed() / 255.0f, (float) color.getGreen() / 255.0f, (float) color.getBlue() / 255.0f, alpha / 255.0f); 345 | } 346 | GL11.glDisable(2848); 347 | GlStateManager.depthMask(true); 348 | GlStateManager.enableDepth(); 349 | GlStateManager.enableTexture2D(); 350 | GlStateManager.disableBlend(); 351 | GlStateManager.popMatrix(); 352 | } 353 | } 354 | 355 | public static int findHotbarBlock(Class clazz) { 356 | for (int i = 0; i < 9; ++i) { 357 | Block block; 358 | ItemStack stack = mc.player.inventory.getStackInSlot(i); 359 | if (stack == ItemStack.EMPTY) continue; 360 | if (clazz.isInstance(stack.getItem())) { 361 | return i; 362 | } 363 | if (!(stack.getItem() instanceof ItemBlock) || !clazz.isInstance(block = ((ItemBlock) stack.getItem()).getBlock())) 364 | continue; 365 | return i; 366 | } 367 | return -1; 368 | } 369 | 370 | public void rotateTo(BlockPos pos) { 371 | float[] angle = calcAngle(mc.player.getPositionEyes(mc.getRenderPartialTicks()), new Vec3d(pos)); 372 | rotYaw = angle[0]; 373 | rotPitch = angle[1]; 374 | isRotating = true; 375 | } 376 | 377 | public void rotateTo(Entity entity) { 378 | float[] angle = calcAngle(mc.player.getPositionEyes(mc.getRenderPartialTicks()), entity.getPositionVector()); 379 | rotYaw = angle[0]; 380 | rotPitch = angle[1]; 381 | isRotating = true; 382 | } 383 | 384 | @SubscribeEvent 385 | public void onPacketSend(PacketEvent.Send event) { 386 | if (event.getPacket() instanceof CPacketPlayer && isRotating && rotate.getValue()) { 387 | // FIX THIS USING AN ACCESSOR 388 | // ((CPacketPlayer) event.getPacket()).yaw = rotYaw; 389 | // ((CPacketPlayer) event.getPacket()).pitch = rotPitch; 390 | 391 | spoofed++; 392 | 393 | if (spoofed >= 1) { 394 | isRotating = false; 395 | spoofed = 0; 396 | } 397 | } 398 | } 399 | 400 | public boolean shouldArmorFacePlace(EntityLivingBase target) { 401 | for (ItemStack stack : target.getArmorInventoryList()) { 402 | if (stack == null || stack.getItem() == Items.AIR || stack != null && ((stack.getMaxDamage() - stack.getItemDamage()) / stack.getMaxDamage()) * 100.0f < facePlaceArmor.getValue()) 403 | return true; 404 | } 405 | return false; 406 | } 407 | 408 | public static boolean rayTraceSolidCheck(Vec3d start, Vec3d end, boolean shouldIgnore) { 409 | if (!Double.isNaN(start.x) && !Double.isNaN(start.y) && !Double.isNaN(start.z)) { 410 | if (!Double.isNaN(end.x) && !Double.isNaN(end.y) && !Double.isNaN(end.z)) { 411 | int currX = MathHelper.floor(start.x); 412 | int currY = MathHelper.floor(start.y); 413 | int currZ = MathHelper.floor(start.z); 414 | int endX = MathHelper.floor(end.x); 415 | int endY = MathHelper.floor(end.y); 416 | int endZ = MathHelper.floor(end.z); 417 | BlockPos blockPos = new BlockPos(currX, currY, currZ); 418 | IBlockState blockState = mc.world.getBlockState(blockPos); 419 | net.minecraft.block.Block block = blockState.getBlock(); 420 | if ((blockState.getCollisionBoundingBox(mc.world, blockPos) != Block.NULL_AABB) && block.canCollideCheck(blockState, false) && (getBlocks().contains(block) || !shouldIgnore)) { 421 | return true; 422 | } 423 | double seDeltaX = end.x - start.x; 424 | double seDeltaY = end.y - start.y; 425 | double seDeltaZ = end.z - start.z; 426 | int steps = 200; 427 | while (steps-- >= 0) { 428 | if (Double.isNaN(start.x) || Double.isNaN(start.y) || Double.isNaN(start.z)) return false; 429 | if (currX == endX && currY == endY && currZ == endZ) return false; 430 | boolean unboundedX = true; 431 | boolean unboundedY = true; 432 | boolean unboundedZ = true; 433 | double stepX = 999.0; 434 | double stepY = 999.0; 435 | double stepZ = 999.0; 436 | double deltaX = 999.0; 437 | double deltaY = 999.0; 438 | double deltaZ = 999.0; 439 | if (endX > currX) { 440 | stepX = currX + 1.0; 441 | } else if (endX < currX) { 442 | stepX = currX; 443 | } else { 444 | unboundedX = false; 445 | } 446 | if (endY > currY) { 447 | stepY = currY + 1.0; 448 | } else if (endY < currY) { 449 | stepY = currY; 450 | } else { 451 | unboundedY = false; 452 | } 453 | if (endZ > currZ) { 454 | stepZ = currZ + 1.0; 455 | } else if (endZ < currZ) { 456 | stepZ = currZ; 457 | } else { 458 | unboundedZ = false; 459 | } 460 | if (unboundedX) deltaX = (stepX - start.x) / seDeltaX; 461 | if (unboundedY) deltaY = (stepY - start.y) / seDeltaY; 462 | if (unboundedZ) deltaZ = (stepZ - start.z) / seDeltaZ; 463 | if (deltaX == 0.0) deltaX = -1.0e-4; 464 | if (deltaY == 0.0) deltaY = -1.0e-4; 465 | if (deltaZ == 0.0) deltaZ = -1.0e-4; 466 | EnumFacing facing; 467 | if (deltaX < deltaY && deltaX < deltaZ) { 468 | facing = endX > currX ? EnumFacing.WEST : EnumFacing.EAST; 469 | start = new Vec3d(stepX, start.y + seDeltaY * deltaX, start.z + seDeltaZ * deltaX); 470 | } else if (deltaY < deltaZ) { 471 | facing = endY > currY ? EnumFacing.DOWN : EnumFacing.UP; 472 | start = new Vec3d(start.x + seDeltaX * deltaY, stepY, start.z + seDeltaZ * deltaY); 473 | } else { 474 | facing = endZ > currZ ? EnumFacing.NORTH : EnumFacing.SOUTH; 475 | start = new Vec3d(start.x + seDeltaX * deltaZ, start.y + seDeltaY * deltaZ, stepZ); 476 | } 477 | currX = MathHelper.floor(start.x) - (facing == EnumFacing.EAST ? 1 : 0); 478 | currY = MathHelper.floor(start.y) - (facing == EnumFacing.UP ? 1 : 0); 479 | currZ = MathHelper.floor(start.z) - (facing == EnumFacing.SOUTH ? 1 : 0); 480 | blockPos = new BlockPos(currX, currY, currZ); 481 | blockState = mc.world.getBlockState(blockPos); 482 | block = blockState.getBlock(); 483 | if (block.canCollideCheck(blockState, false) && (getBlocks().contains(block) || !shouldIgnore)) { 484 | return true; 485 | } 486 | } 487 | } 488 | } 489 | return false; 490 | } 491 | 492 | public static float getDamageFromDifficulty(float damage) { 493 | switch (mc.world.getDifficulty()) { 494 | case PEACEFUL: 495 | return 0; 496 | case EASY: 497 | return Math.min(damage / 2 + 1, damage); 498 | case HARD: 499 | return damage * 3 / 2; 500 | default: 501 | return damage; 502 | } 503 | } 504 | 505 | public static float calculateDamage(BlockPos pos, Entity target, boolean shouldIgnore) { 506 | return getExplosionDamage(target, new Vec3d(pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5), 6.0f, shouldIgnore); 507 | } 508 | 509 | public static float calculateDamage(Entity crystal, Entity target, boolean shouldIgnore) { 510 | return getExplosionDamage(target, new Vec3d(crystal.posX, crystal.posY, crystal.posZ), 6.0f, shouldIgnore); 511 | } 512 | 513 | public static float getExplosionDamage(Entity targetEntity, Vec3d explosionPosition, float explosionPower, boolean shouldIgnore) { 514 | Vec3d entityPosition = new Vec3d(targetEntity.posX, targetEntity.posY, targetEntity.posZ); 515 | if (targetEntity.isImmuneToExplosions()) return 0.0f; 516 | explosionPower *= 2.0f; 517 | double distanceToSize = entityPosition.distanceTo(explosionPosition) / explosionPower; 518 | double blockDensity = 0.0; 519 | AxisAlignedBB bbox = targetEntity.getEntityBoundingBox().offset(targetEntity.getPositionVector().subtract(entityPosition)); 520 | Vec3d bboxDelta = new Vec3d(1.0 / ((bbox.maxX - bbox.minX) * 2.0 + 1.0), 1.0 / ((bbox.maxY - bbox.minY) * 2.0 + 1.0), 1.0 / ((bbox.maxZ - bbox.minZ) * 2.0 + 1.0)); 521 | double xOff = (1.0 - Math.floor(1.0 / bboxDelta.x) * bboxDelta.x) / 2.0; 522 | double zOff = (1.0 - Math.floor(1.0 / bboxDelta.z) * bboxDelta.z) / 2.0; 523 | if (bboxDelta.x >= 0.0 && bboxDelta.y >= 0.0 && bboxDelta.z >= 0.0) { 524 | int nonSolid = 0; 525 | int total = 0; 526 | for (double x = 0.0; x <= 1.0; x += bboxDelta.x) { 527 | for (double y = 0.0; y <= 1.0; y += bboxDelta.y) { 528 | for (double z = 0.0; z <= 1.0; z += bboxDelta.z) { 529 | Vec3d startPos = new Vec3d(xOff + bbox.minX + (bbox.maxX - bbox.minX) * x, bbox.minY + (bbox.maxY - bbox.minY) * y, zOff + bbox.minZ + (bbox.maxZ - bbox.minZ) * z); 530 | if (!rayTraceSolidCheck(startPos, explosionPosition, shouldIgnore)) ++nonSolid; 531 | ++total; 532 | } 533 | } 534 | } 535 | blockDensity = (double) nonSolid / (double) total; 536 | } 537 | double densityAdjust = (1.0 - distanceToSize) * blockDensity; 538 | float damage = (float) (int) ((densityAdjust * densityAdjust + densityAdjust) / 2.0 * 7.0 * explosionPower + 1.0); 539 | if (targetEntity instanceof EntityLivingBase) 540 | damage = getBlastReduction((EntityLivingBase) targetEntity, getDamageFromDifficulty(damage), new Explosion(mc.world, null, explosionPosition.x, explosionPosition.y, explosionPosition.z, explosionPower / 2.0f, false, true)); 541 | return damage; 542 | } 543 | 544 | 545 | public static List getBlocks() { 546 | return Arrays.asList(Blocks.OBSIDIAN, Blocks.BEDROCK, Blocks.COMMAND_BLOCK, Blocks.BARRIER, Blocks.ENCHANTING_TABLE, Blocks.ENDER_CHEST, Blocks.END_PORTAL_FRAME, Blocks.BEACON, Blocks.ANVIL); 547 | } 548 | 549 | public static float getBlastReduction(EntityLivingBase entity, float damageI, Explosion explosion) { 550 | float damage = damageI; 551 | if (entity instanceof EntityPlayer) { 552 | EntityPlayer ep = (EntityPlayer) entity; 553 | DamageSource ds = DamageSource.causeExplosionDamage(explosion); 554 | damage = CombatRules.getDamageAfterAbsorb(damage, (float) ep.getTotalArmorValue(), (float) ep.getEntityAttribute(SharedMonsterAttributes.ARMOR_TOUGHNESS).getAttributeValue()); 555 | int k = 0; 556 | try { 557 | k = EnchantmentHelper.getEnchantmentModifierDamage(ep.getArmorInventoryList(), ds); 558 | } catch (Exception exception) { 559 | } 560 | float f = MathHelper.clamp((float) k, 0.0f, 20.0f); 561 | damage *= 1.0f - f / 25.0f; 562 | if (entity.isPotionActive(MobEffects.RESISTANCE)) { 563 | damage -= damage / 4.0f; 564 | } 565 | damage = Math.max(damage, 0.0f); 566 | return damage; 567 | } 568 | damage = CombatRules.getDamageAfterAbsorb(damage, (float) entity.getTotalArmorValue(), (float) entity.getEntityAttribute(SharedMonsterAttributes.ARMOR_TOUGHNESS).getAttributeValue()); 569 | return damage; 570 | } 571 | 572 | public static float[] calcAngle(Vec3d from, Vec3d to) { 573 | double difX = to.x - from.x; 574 | double difY = (to.y - from.y) * -1.0; 575 | double difZ = to.z - from.z; 576 | double dist = MathHelper.sqrt(difX * difX + difZ * difZ); 577 | return new float[]{(float) MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(difZ, difX)) - 90.0), (float) MathHelper.wrapDegrees(Math.toDegrees(Math.atan2(difY, dist)))}; 578 | } 579 | 580 | public static boolean canSeePos(BlockPos pos) { 581 | return mc.world.rayTraceBlocks(new Vec3d(mc.player.posX, mc.player.posY + (double) mc.player.getEyeHeight(), mc.player.posZ), new Vec3d(pos.getX() + 0.5, pos.getY() + 1, pos.getZ() + 0.5), false, true, false) == null; 582 | } 583 | 584 | public static List getSphere(BlockPos pos, float r, int h, boolean hollow, boolean sphere, int plus_y) { 585 | ArrayList circleblocks = new ArrayList(); 586 | int cx = pos.getX(); 587 | int cy = pos.getY(); 588 | int cz = pos.getZ(); 589 | int x = cx - (int) r; 590 | while ((float) x <= (float) cx + r) { 591 | int z = cz - (int) r; 592 | while ((float) z <= (float) cz + r) { 593 | int y = sphere ? cy - (int) r : cy; 594 | while (true) { 595 | float f = y; 596 | float f2 = sphere ? (float) cy + r : (float) (cy + h); 597 | if (!(f < f2)) break; 598 | double dist = (cx - x) * (cx - x) + (cz - z) * (cz - z) + (sphere ? (cy - y) * (cy - y) : 0); 599 | if (dist < (double) (r * r) && (!hollow || dist >= (double) ((r - 1.0f) * (r - 1.0f)))) { 600 | BlockPos l = new BlockPos(x, y + plus_y, z); 601 | circleblocks.add(l); 602 | } 603 | ++y; 604 | } 605 | ++z; 606 | } 607 | ++x; 608 | } 609 | return circleblocks; 610 | } 611 | 612 | public static boolean canPlaceCrystal(BlockPos blockPos, boolean specialEntityCheck, boolean oneDot15) { 613 | BlockPos boost = blockPos.add(0, 1, 0); 614 | BlockPos boost2 = blockPos.add(0, 2, 0); 615 | try { 616 | if (mc.world.getBlockState(blockPos).getBlock() != Blocks.BEDROCK && mc.world.getBlockState(blockPos).getBlock() != Blocks.OBSIDIAN) { 617 | return false; 618 | } 619 | if (!oneDot15 && mc.world.getBlockState(boost2).getBlock() != Blocks.AIR || mc.world.getBlockState(boost).getBlock() != Blocks.AIR) { 620 | return false; 621 | } 622 | for (Entity entity : mc.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(boost))) { 623 | if (entity.isDead || specialEntityCheck && entity instanceof EntityEnderCrystal) continue; 624 | return false; 625 | } 626 | if (!oneDot15) { 627 | for (Entity entity : mc.world.getEntitiesWithinAABB(Entity.class, new AxisAlignedBB(boost2))) { 628 | if (entity.isDead || specialEntityCheck && entity instanceof EntityEnderCrystal) continue; 629 | return false; 630 | } 631 | } 632 | } catch (Exception ignored) { 633 | return false; 634 | } 635 | return true; 636 | } 637 | 638 | }*/ 639 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/module/combat/AutoLog.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.module.combat; 2 | 3 | import com.based.lynx.module.Category; 4 | import com.based.lynx.module.Module; 5 | import com.based.lynx.setting.Setting; 6 | import net.minecraft.client.gui.GuiMainMenu; 7 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 8 | import net.minecraftforge.fml.common.gameevent.TickEvent; 9 | 10 | public class AutoLog extends Module { 11 | 12 | private final Setting health = new Setting<>("Health", 10F, 1F, 36F, 1F) 13 | .setDescription("The health at which to log out"); 14 | 15 | public AutoLog() { 16 | super("AutoLog", "", Category.COMBAT); 17 | addSetting(health); 18 | } 19 | 20 | @SubscribeEvent 21 | public void onTick(TickEvent.ClientTickEvent event) { 22 | if (nullCheck()) return; 23 | 24 | if (mc.player.getHealth() <= health.getValue()) { 25 | disable(); 26 | mc.world.sendQuittingDisconnectingPacket(); 27 | mc.loadWorld(null); 28 | mc.displayGuiScreen(new GuiMainMenu()); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/module/combat/AutoTotem.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.module.combat; 2 | 3 | import com.based.lynx.Lynx; 4 | import com.based.lynx.event.PacketEvent; 5 | import com.based.lynx.module.Category; 6 | import com.based.lynx.module.Module; 7 | import net.minecraft.client.gui.inventory.GuiContainer; 8 | import net.minecraft.client.gui.inventory.GuiInventory; 9 | import net.minecraft.init.Items; 10 | import net.minecraft.inventory.ClickType; 11 | import net.minecraft.item.Item; 12 | import net.minecraft.network.play.client.CPacketClickWindow; 13 | import net.minecraft.network.play.client.CPacketEntityAction; 14 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 15 | 16 | public class AutoTotem extends Module { 17 | 18 | public AutoTotem() { 19 | super("AutoTotem", "Puts totem in offhand", Category.COMBAT); 20 | } 21 | 22 | 23 | @Override 24 | public void onUpdate() { 25 | if (mc.currentScreen instanceof GuiContainer && !(mc.currentScreen instanceof GuiInventory)) return; 26 | int slot = getItemSlot(Items.TOTEM_OF_UNDYING); 27 | if (mc.player.getHeldItemOffhand().getItem() != Items.TOTEM_OF_UNDYING && slot != -1) { 28 | mc.playerController.windowClick(mc.player.inventoryContainer.windowId, slot, 0, ClickType.PICKUP, mc.player); 29 | mc.playerController.windowClick(mc.player.inventoryContainer.windowId, 45, 0, ClickType.PICKUP, mc.player); 30 | mc.playerController.windowClick(mc.player.inventoryContainer.windowId, slot, 0, ClickType.PICKUP, mc.player); 31 | mc.playerController.updateController(); 32 | } 33 | } 34 | 35 | @SubscribeEvent 36 | public void onPacketSend(PacketEvent.Send event) { 37 | if (event.getPacket() instanceof CPacketClickWindow) { 38 | mc.player.connection.sendPacket(new CPacketEntityAction(mc.player, CPacketEntityAction.Action.STOP_SPRINTING)); 39 | } 40 | } 41 | 42 | public static int getItemSlot(Item items) { 43 | for (int i = 0; i < 36; ++i) { 44 | Item item = mc.player.inventory.getStackInSlot(i).getItem(); 45 | if (item == items) { 46 | if (i < 9) { 47 | i += 36; 48 | } 49 | return i; 50 | } 51 | } 52 | return -1; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/module/combat/Criticals.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.module.combat; 2 | 3 | import com.based.lynx.event.PacketEvent; 4 | import com.based.lynx.module.Category; 5 | import com.based.lynx.module.Module; 6 | 7 | import net.minecraft.network.play.client.CPacketPlayer; 8 | import net.minecraft.network.play.client.CPacketUseEntity; 9 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 10 | 11 | public class Criticals extends Module { 12 | public Criticals() { 13 | super("Criticals", "", Category.COMBAT); 14 | } 15 | 16 | @SubscribeEvent 17 | public void onPacketSend(PacketEvent.Send event) { 18 | if (nullCheck()) return; 19 | 20 | if (event.getPacket() instanceof CPacketUseEntity && ((CPacketUseEntity) event.getPacket()).getAction() == CPacketUseEntity.Action.ATTACK && mc.player.onGround) { 21 | mc.player.connection.sendPacket(new CPacketPlayer.Position(mc.player.posX, mc.player.posY + 0.1, mc.player.posZ, false)); 22 | mc.player.connection.sendPacket(new CPacketPlayer.Position(mc.player.posX, mc.player.posY, mc.player.posZ, false)); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/module/exploit/PacketCanceller.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.module.exploit; 2 | 3 | import java.util.ArrayList; 4 | 5 | import com.based.lynx.event.PacketEvent; 6 | import com.based.lynx.module.Category; 7 | import com.based.lynx.module.Module; 8 | import com.based.lynx.setting.Setting; 9 | import net.minecraft.network.Packet; 10 | import net.minecraft.network.play.client.CPacketEntityAction; 11 | import net.minecraft.network.play.client.CPacketInput; 12 | import net.minecraft.network.play.client.CPacketPlayer; 13 | import net.minecraft.network.play.client.CPacketPlayerAbilities; 14 | import net.minecraft.network.play.client.CPacketPlayerDigging; 15 | import net.minecraft.network.play.client.CPacketPlayerTryUseItem; 16 | import net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock; 17 | import net.minecraft.network.play.client.CPacketUseEntity; 18 | import net.minecraft.network.play.client.CPacketVehicleMove; 19 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 20 | 21 | public final class PacketCanceller 22 | extends Module { 23 | private final Setting CancelCPacketInput = new Setting<>("Input", true) 24 | .setDescription("Cancel the CPacketInput packet"); 25 | 26 | private final Setting CancelPosition = new Setting<>("Position", false) 27 | .setDescription("Cancel the CPacketPlayer packet"); 28 | 29 | private final Setting CancelPositionRotation = new Setting<>("PositionRotation", false) 30 | .setDescription("Cancel the CPacketPlayer Position Rotation packet"); 31 | 32 | private final Setting CancelRotation = new Setting<>("Rotation", false) 33 | .setDescription("Cancel the CPacketPlayer Rotation packet"); 34 | 35 | private final Setting CancelCPacketPlayerAbilities = new Setting<>("PlayerAbilities", false) 36 | .setDescription("Cancel the CPacketPlayerAbilities packet"); 37 | 38 | private final Setting CancelCPacketPlayerDigging = new Setting<>("PlayerDigging", false) 39 | .setDescription("Cancel the CPacketPlayerDigging packet"); 40 | 41 | private final Setting CancelCPacketPlayerTryUseItem = new Setting<>("PlayerTryUseItem", false) 42 | .setDescription("Cancel the CPacketPlayerTryUseItem packet"); 43 | 44 | private final Setting CancelCPacketPlayerTryUseItemOnBlock = new Setting<>("PlayerTryUseItemOnBlock", false) 45 | .setDescription("Cancel the CPacketPlayerTryUseItemOnBlock packet"); 46 | 47 | private final Setting CancelCPacketEntityAction = new Setting<>("EntityAction", false) 48 | .setDescription("Cancel the CPacketEntityAction packet"); 49 | 50 | private final Setting CancelCPacketUseEntity = new Setting<>("UseEntity", false) 51 | .setDescription("Cancel the CPacketUseEntity packet"); 52 | 53 | private final Setting CancelCPacketVehicleMove = new Setting<>("VehicleMove", false) 54 | .setDescription("Cancel the CPacketVehicleMove packet"); 55 | private final ArrayList PacketsToIgnore = new ArrayList(); 56 | private int PacketsCanelled = 0; 57 | 58 | public PacketCanceller() { 59 | super("PacketCanceller", "", Category.EXPLOIT); 60 | 61 | this.addSetting(this.CancelCPacketInput); 62 | this.addSetting(this.CancelPosition); 63 | this.addSetting(this.CancelPositionRotation); 64 | this.addSetting(this.CancelRotation); 65 | this.addSetting(this.CancelCPacketPlayerAbilities); 66 | this.addSetting(this.CancelCPacketPlayerDigging); 67 | this.addSetting(this.CancelCPacketPlayerTryUseItem); 68 | this.addSetting(this.CancelCPacketPlayerTryUseItemOnBlock); 69 | this.addSetting(this.CancelCPacketEntityAction); 70 | this.addSetting(this.CancelCPacketUseEntity); 71 | this.addSetting(this.CancelCPacketVehicleMove); 72 | } 73 | 74 | @Override 75 | public void onDisable() { 76 | super.onDisable(); 77 | this.PacketsCanelled = 0; 78 | } 79 | 80 | @SubscribeEvent 81 | public void onPacketSend(PacketEvent.Send event) { 82 | if (event.getPacket() instanceof CPacketInput && this.CancelCPacketInput.getValue() || event.getPacket() instanceof CPacketPlayer.Position && this.CancelPosition.getValue() || event.getPacket() instanceof CPacketPlayer.PositionRotation && this.CancelPositionRotation.getValue() || event.getPacket() instanceof CPacketPlayer.Rotation && this.CancelRotation.getValue() || event.getPacket() instanceof CPacketPlayerAbilities && this.CancelCPacketPlayerAbilities.getValue() || event.getPacket() instanceof CPacketPlayerDigging && this.CancelCPacketPlayerDigging.getValue() || event.getPacket() instanceof CPacketPlayerTryUseItem && this.CancelCPacketPlayerTryUseItem.getValue() || event.getPacket() instanceof CPacketPlayerTryUseItemOnBlock && this.CancelCPacketPlayerTryUseItemOnBlock.getValue() || event.getPacket() instanceof CPacketEntityAction && this.CancelCPacketEntityAction.getValue() || event.getPacket() instanceof CPacketUseEntity && this.CancelCPacketUseEntity.getValue() || event.getPacket() instanceof CPacketVehicleMove && this.CancelCPacketVehicleMove.getValue()) { 83 | if (this.PacketsToIgnore.contains(event.getPacket())) { 84 | this.PacketsToIgnore.remove(event.getPacket()); 85 | return; 86 | } 87 | ++this.PacketsCanelled; 88 | event.setCanceled(true); 89 | return; 90 | } 91 | } 92 | 93 | public void AddIgnorePacket(Packet p_Packet) { 94 | this.PacketsToIgnore.add(p_Packet); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/module/exploit/PortalGodmode.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.module.exploit; 2 | 3 | import com.based.lynx.module.Category; 4 | import com.based.lynx.module.Module; 5 | import com.based.lynx.event.PacketEvent; 6 | import net.minecraft.network.play.client.CPacketConfirmTeleport; 7 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 8 | 9 | public class PortalGodmode extends Module { 10 | public PortalGodmode() { 11 | super("PortalGodmode", "", Category.EXPLOIT); 12 | } 13 | 14 | @SubscribeEvent 15 | public void onPacket(PacketEvent.Send event) { 16 | if (mc.player == null || mc.world == null) return; 17 | 18 | if (event.getPacket() instanceof CPacketConfirmTeleport) { 19 | event.setCanceled(true); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/module/misc/FakePlayer.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.module.misc; 2 | 3 | import com.based.lynx.module.Category; 4 | import com.based.lynx.module.Module; 5 | import com.mojang.authlib.GameProfile; 6 | import net.minecraft.client.entity.EntityOtherPlayerMP; 7 | 8 | import java.util.UUID; 9 | 10 | public class FakePlayer extends Module { 11 | 12 | public FakePlayer() { 13 | super("FakePlayer", "Creates A Fake Player", Category.MISC); 14 | } 15 | 16 | @Override 17 | public void onEnable() { 18 | if (this.nullCheck()) { 19 | return; 20 | } 21 | EntityOtherPlayerMP fakePlayer = new EntityOtherPlayerMP(mc.world, new GameProfile(UUID.fromString("e4146954-57b4-46fd-ab97-4ab8d8034c31"), "FakePlayer")); 22 | fakePlayer.copyLocationAndAnglesFrom(mc.player); 23 | mc.world.addEntityToWorld(69420, fakePlayer); 24 | } 25 | 26 | @Override 27 | public void onDisable() { 28 | mc.world.removeEntityFromWorld(69420); 29 | } 30 | } -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/module/movement/Jesus.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.module.movement; 2 | 3 | import com.based.lynx.event.AddCollisionBoxToListEvent; 4 | import com.based.lynx.event.PacketEvent; 5 | import com.based.lynx.module.Category; 6 | import com.based.lynx.module.Module; 7 | import com.based.lynx.util.EntityUtil; 8 | import com.based.lynx.util.Wrapper; 9 | import net.minecraft.block.BlockLiquid; 10 | import net.minecraft.entity.Entity; 11 | import net.minecraft.entity.item.EntityBoat; 12 | import net.minecraft.network.play.client.CPacketPlayer; 13 | import net.minecraft.util.math.AxisAlignedBB; 14 | import net.minecraft.util.math.BlockPos; 15 | import net.minecraft.util.math.MathHelper; 16 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 17 | 18 | public class Jesus extends Module { 19 | 20 | private static final AxisAlignedBB WATER_WALK_AA = new AxisAlignedBB(0.D, 0.D, 0.D, 1.D, 0.99D, 1.D); 21 | 22 | public Jesus() { 23 | super("Jesus", "", Category.MOVEMENT); 24 | } 25 | 26 | private static boolean isAboveLand(Entity entity) { 27 | if (entity == null) return false; 28 | 29 | double y = entity.posY - 0.01; 30 | 31 | for (int x = MathHelper.floor(entity.posX); x < MathHelper.ceil(entity.posX); x++) 32 | for (int z = MathHelper.floor(entity.posZ); z < MathHelper.ceil(entity.posZ); z++) { 33 | BlockPos pos = new BlockPos(x, MathHelper.floor(y), z); 34 | 35 | if (Wrapper.getWorld().getBlockState(pos).isFullBlock()) 36 | return true; 37 | } 38 | 39 | return false; 40 | } 41 | 42 | private static boolean isAboveBlock(Entity entity, BlockPos pos) { 43 | return entity.posY >= pos.getY(); 44 | } 45 | 46 | @Override 47 | public void onUpdate() { 48 | if (EntityUtil.isInWater(mc.player) && !mc.player.isSneaking()) { 49 | mc.player.motionY = 0.1; 50 | if (mc.player.getRidingEntity() != null && !(mc.player.getRidingEntity() instanceof EntityBoat)) { 51 | mc.player.getRidingEntity().motionY = 0.3; 52 | } 53 | } 54 | } 55 | 56 | @SubscribeEvent 57 | public void onCollision(AddCollisionBoxToListEvent event) { 58 | if (mc.player != null 59 | && (event.getBlock() instanceof BlockLiquid) 60 | && (EntityUtil.isDrivenByPlayer(event.getEntity()) || event.getEntity() == mc.player) 61 | && !(event.getEntity() instanceof EntityBoat) 62 | && !mc.player.isSneaking() 63 | && mc.player.fallDistance < 3 64 | && !EntityUtil.isInWater(mc.player) 65 | && (EntityUtil.isAboveWater(mc.player, false) || EntityUtil.isAboveWater(mc.player.getRidingEntity(), false)) 66 | && isAboveBlock(mc.player, event.getPos())) { 67 | AxisAlignedBB axisalignedbb = WATER_WALK_AA.offset(event.getPos()); 68 | if (event.getEntityBox().intersects(axisalignedbb)) event.getCollidingBoxes().add(axisalignedbb); 69 | event.setCancelled(true); 70 | } 71 | } 72 | 73 | @SubscribeEvent 74 | public void onPacket(PacketEvent.Send event) { 75 | if (event.getPacket() instanceof CPacketPlayer) { 76 | if (EntityUtil.isAboveWater(mc.player, true) && !EntityUtil.isInWater(mc.player) && !isAboveLand(mc.player)) { 77 | int ticks = mc.player.ticksExisted % 2; 78 | // if (ticks == 0) ((CPacketPlayer) event.getPacket()).y += 0.02D; 79 | } 80 | } 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/module/movement/NoSlow.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.module.movement; 2 | 3 | import com.based.lynx.module.Category; 4 | import com.based.lynx.module.Module; 5 | import net.minecraft.network.play.client.CPacketHeldItemChange; 6 | import net.minecraftforge.client.event.InputUpdateEvent; 7 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 8 | 9 | public class NoSlow extends Module { 10 | 11 | public NoSlow() { 12 | super("NoSlow", "", Category.MOVEMENT); 13 | } 14 | 15 | @SubscribeEvent 16 | public void onInput(InputUpdateEvent event) { 17 | //2b2t bypass 18 | mc.player.connection.sendPacket(new CPacketHeldItemChange(mc.player.inventory.currentItem)); 19 | //Thanks FencingF 20 | } 21 | } -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/module/movement/Sprint.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.module.movement; 2 | 3 | import com.based.lynx.module.Category; 4 | import com.based.lynx.module.Module; 5 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 6 | import net.minecraftforge.fml.common.gameevent.TickEvent; 7 | 8 | public class Sprint extends Module { 9 | 10 | public Sprint() { 11 | super("Sprint", "", Category.MOVEMENT); 12 | } 13 | 14 | @SubscribeEvent 15 | public void onUpdate(final TickEvent.ClientTickEvent event) { 16 | if (mc.world == null) { 17 | return; 18 | } 19 | 20 | if (mc.player.movementInput.moveForward == 0f && mc.player.movementInput.moveStrafe == 0f) return; 21 | 22 | if (!mc.player.isSprinting()) { 23 | mc.player.setSprinting(true); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/module/movement/Velocity.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.module.movement; 2 | 3 | import com.based.lynx.event.PacketEvent; 4 | import com.based.lynx.module.Category; 5 | import com.based.lynx.module.Module; 6 | import net.minecraft.network.play.server.SPacketEntityVelocity; 7 | import net.minecraft.network.play.server.SPacketExplosion; 8 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 9 | import net.minecraftforge.fml.common.gameevent.TickEvent; 10 | 11 | public class Velocity extends Module { 12 | 13 | public Velocity() { 14 | super("Velocity", "", Category.MOVEMENT); 15 | } 16 | 17 | @SubscribeEvent 18 | public void onPacket(PacketEvent.Receive event) { 19 | if (nullCheck()) return; 20 | if (event.getPacket() instanceof SPacketEntityVelocity) { 21 | if (((SPacketEntityVelocity) event.getPacket()).getEntityID() == mc.player.getEntityId()) 22 | event.setCanceled(true); 23 | } 24 | if (event.getPacket() instanceof SPacketExplosion) event.setCanceled(true); 25 | } 26 | 27 | @SubscribeEvent 28 | public void onUpdate(TickEvent.ClientTickEvent event) { 29 | if (nullCheck()) return; 30 | mc.player.entityCollisionReduction = 1.0f; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/setting/Setting.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.setting; 2 | 3 | import java.util.List; 4 | 5 | import com.based.lynx.module.Module; 6 | 7 | import java.util.ArrayList; 8 | import java.util.Arrays; 9 | import java.util.List; 10 | import java.util.function.Supplier; 11 | 12 | public class Setting { 13 | 14 | private final String name; 15 | private final List> subsettings = new ArrayList<>(); 16 | private String description; 17 | // Bad system, we store these values even when they aren't used. 18 | private T value, min, max, incrementation; 19 | private int index; 20 | private Supplier isVisible = () -> true; 21 | private Setting parentSetting; 22 | 23 | /** 24 | * Boolean, mode, and keybind settings 25 | * 26 | * @param name Name of the setting 27 | * @param value Default value 28 | */ 29 | public Setting(String name, T value) { 30 | this.name = name; 31 | this.value = value; 32 | } 33 | 34 | /** 35 | * Numeric settings 36 | * 37 | * @param name Name of the setting 38 | * @param value Default value 39 | * @param min Minimum value 40 | * @param max Maximum value 41 | * @param incrementation How much to increment by 42 | */ 43 | public Setting(String name, T value, T min, T max, T incrementation) { 44 | this.name = name; 45 | this.value = value; 46 | this.min = min; 47 | this.max = max; 48 | this.incrementation = incrementation; 49 | } 50 | 51 | /** 52 | * Sets the visibility of this setting 53 | * 54 | * @param isVisible Supplier that returns true if the setting should be visible 55 | * @return This setting 56 | */ 57 | public Setting setVisibility(Supplier isVisible) { 58 | this.isVisible = isVisible; 59 | return this; 60 | } 61 | 62 | /** 63 | * Gets the name of this setting 64 | * 65 | * @return The name of this setting 66 | */ 67 | public String getName() { 68 | return this.name; 69 | } 70 | 71 | /** 72 | * Gets the description of this setting 73 | * 74 | * @return The description of this setting 75 | */ 76 | public String getDescription() { 77 | return this.description; 78 | } 79 | 80 | /** 81 | * Sets the description of this setting 82 | * 83 | * @param description The new description 84 | * @return This setting 85 | */ 86 | public Setting setDescription(String description) { 87 | this.description = description; 88 | return this; 89 | } 90 | 91 | /** 92 | * Gets the setting's value 93 | * 94 | * @return The setting's value 95 | */ 96 | public T getValue() { 97 | return this.value; 98 | } 99 | 100 | /** 101 | * Sets the value of this setting 102 | * 103 | * @param value The new value 104 | */ 105 | public void setValue(T value) { 106 | this.value = value; 107 | } 108 | 109 | /** 110 | * Gets the minimum value of this setting 111 | * 112 | * @return The minimum value 113 | */ 114 | public T getMin() { 115 | return this.min; 116 | } 117 | 118 | /** 119 | * Gets the maximum value of this setting 120 | * 121 | * @return The maximum value 122 | */ 123 | public T getMax() { 124 | return this.max; 125 | } 126 | 127 | /** 128 | * Gets the incrementation of this setting 129 | * 130 | * @return The incrementation 131 | */ 132 | public T getIncrementation() { 133 | return this.incrementation; 134 | } 135 | 136 | /** 137 | * Gets the next enum we need to switch to 138 | * 139 | * @return The next enum 140 | */ 141 | public T getNextMode() { 142 | // thx linus 143 | 144 | Enum enumVal = (Enum) value; 145 | 146 | String[] values = Arrays.stream(enumVal.getClass().getEnumConstants()).map(Enum::name).toArray(String[]::new); 147 | index = index + 1 > values.length - 1 ? 0 : index + 1; 148 | 149 | return (T) Enum.valueOf(enumVal.getClass(), values[index]); 150 | } 151 | 152 | /** 153 | * Gets whether the setting is visible in the gui 154 | * 155 | * @return Whether the setting is visible 156 | */ 157 | public boolean isVisible() { 158 | return isVisible.get(); 159 | } 160 | 161 | /** 162 | * Gets the parent setting of this setting 163 | * 164 | * @return The parent setting 165 | */ 166 | public Setting getParentSetting() { 167 | return parentSetting; 168 | } 169 | 170 | /** 171 | * Sets the parent setting of this setting 172 | * 173 | * @param parentSetting The parent setting 174 | * @return This setting 175 | */ 176 | public Setting setParentSetting(Setting parentSetting) { 177 | this.parentSetting = parentSetting; 178 | this.parentSetting.getSubsettings().add(this); 179 | return this; 180 | } 181 | 182 | /** 183 | * Gets the subsettings of this setting 184 | * 185 | * @return The subsettings 186 | */ 187 | public List> getSubsettings() { 188 | return this.subsettings; 189 | } 190 | } 191 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/ui/click/ClickGUI.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.ui.click; 2 | 3 | import com.based.lynx.Lynx; 4 | import com.based.lynx.module.Category; 5 | import com.based.lynx.ui.click.frame.Frame; 6 | import net.minecraft.client.gui.GuiScreen; 7 | 8 | import java.io.IOException; 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | 12 | public class ClickGUI extends GuiScreen { 13 | 14 | private List frames = new ArrayList<>(); 15 | 16 | public ClickGUI() { 17 | float xOffset = 20; 18 | for (Category category : Category.values()) { 19 | frames.add(new Frame(xOffset, 20, 95, 16, category)); 20 | xOffset += 100; 21 | } 22 | } 23 | 24 | @Override 25 | public void drawScreen(int mouseX, int mouseY, float partialTicks) { 26 | drawDefaultBackground(); 27 | 28 | frames.forEach(frame -> frame.drawFrame(mouseX, mouseY)); 29 | } 30 | 31 | @Override 32 | protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { 33 | frames.forEach(frame -> frame.mouseClicked(mouseX, mouseY, mouseButton)); 34 | 35 | super.mouseClicked(mouseX, mouseY, mouseButton); 36 | } 37 | 38 | @Override 39 | protected void mouseReleased(int mouseX, int mouseY, int state) { 40 | frames.forEach(frame -> frame.mouseReleased(mouseX, mouseY, state)); 41 | 42 | super.mouseReleased(mouseX, mouseY, state); 43 | } 44 | 45 | @Override 46 | protected void keyTyped(char typedChar, int keyCode) throws IOException { 47 | frames.forEach(frame -> frame.keyTyped(typedChar, keyCode)); 48 | 49 | super.keyTyped(typedChar, keyCode); 50 | } 51 | 52 | @Override 53 | public boolean doesGuiPauseGame() { 54 | return false; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/ui/click/frame/Frame.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.ui.click.frame; 2 | 3 | import com.based.lynx.Lynx; 4 | import com.based.lynx.module.Category; 5 | import com.based.lynx.module.Module; 6 | import com.based.lynx.ui.click.frame.component.Component; 7 | import com.based.lynx.ui.click.frame.component.module.ModuleComponent; 8 | import com.based.lynx.ui.click.frame.component.setting.SettingComponent; 9 | import com.based.lynx.util.Animation; 10 | import com.based.lynx.util.RenderUtil; 11 | import net.minecraft.util.math.MathHelper; 12 | import org.lwjgl.input.Mouse; 13 | 14 | import java.awt.*; 15 | import java.util.ArrayList; 16 | import java.util.List; 17 | 18 | public class Frame { 19 | 20 | private final float maxHeight = 325; 21 | private final Category category; 22 | private final List components = new ArrayList<>(); 23 | private final Animation animation = new Animation(200, true); 24 | private float x; 25 | private float y; 26 | private float width; 27 | private float barHeight; 28 | private float height; 29 | private boolean open = true; 30 | 31 | public Frame(float x, float y, float width, float barHeight, Category category) { 32 | this.x = x; 33 | this.y = y; 34 | this.width = width; 35 | this.barHeight = barHeight; 36 | this.category = category; 37 | 38 | height = maxHeight; 39 | 40 | float yOffset = barHeight; 41 | for (Module module : Lynx.moduleManager.getModules(category)) { 42 | components.add(new ModuleComponent(module, x, y + yOffset, width, 13, this)); 43 | yOffset += 13; 44 | } 45 | } 46 | 47 | public void drawFrame(int mouseX, int mouseY) { 48 | RenderUtil.drawRect(x, y, width, barHeight, isHovered(mouseX, mouseY) ? new Color(40, 40, 45).getRGB() : new Color(35, 35, 40).getRGB()); 49 | 50 | RenderUtil.drawCenteredString(category.getName(), x + width / 2, y + 4, 0xFFFFFF, true); 51 | 52 | float moduleOffset = (components.isEmpty() ? 0 : components.get(0).getY()); 53 | 54 | for (ModuleComponent component : components) { 55 | component.setY(moduleOffset); 56 | moduleOffset += component.getAbsoluteHeight(); 57 | } 58 | 59 | if (mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + height) { 60 | int mouseScroll = Mouse.getDWheel(); 61 | 62 | if (mouseScroll > 0) { 63 | if (components.isEmpty()) { 64 | return; 65 | } 66 | 67 | if (!(components.get(0).getY() >= y + barHeight)) { 68 | for (Component component : components) { 69 | component.setY(component.getY() + 13); 70 | } 71 | } 72 | } else if (mouseScroll < 0) { 73 | if (components.isEmpty()) { 74 | return; 75 | } 76 | 77 | if (!(components.get(components.size() - 1).getY() + components.get(components.size() - 1).getAbsoluteHeight() <= y + maxHeight + 26)) { 78 | for (Component component : components) { 79 | component.setY(component.getY() - 13); 80 | } 81 | } 82 | } 83 | } 84 | 85 | height = MathHelper.clamp((components.isEmpty() ? 0 : components.get(components.size() - 1).getY() - 13) * animation.getAnimationFactor(), 0, maxHeight); 86 | 87 | float h = 0; 88 | for (ModuleComponent component : components) { 89 | h += component.getAbsoluteHeight() * animation.getAnimationFactor(); 90 | } 91 | 92 | if (!components.isEmpty()) { 93 | ModuleComponent lastComponent = components.get(components.size() - 1); 94 | 95 | if (h <= maxHeight) { 96 | components.get(0).setY(y + barHeight); 97 | } 98 | 99 | if (lastComponent.getY() + lastComponent.getHeight() > y + h) { 100 | if (components.get(0).getY() < y && lastComponent.getY() <= maxHeight) { 101 | components.get(0).setY(y + barHeight); 102 | } 103 | 104 | if (lastComponent.getAnimation().getAnimationFactor() > 0 && !lastComponent.getSettingComponents().isEmpty()) { 105 | SettingComponent lastSettingComponent = lastComponent.getSettingComponents().get(lastComponent.getSettingComponents().size() - 1); 106 | 107 | if (lastSettingComponent.getY() + lastSettingComponent.getHeight() < y + h) { 108 | lastSettingComponent.setY(y + h - lastSettingComponent.getHeight()); 109 | } 110 | } else { 111 | if (lastComponent.getY() + lastComponent.getHeight() < y + h) { 112 | lastComponent.setY(y + h - lastComponent.getHeight()); 113 | } 114 | } 115 | } 116 | } 117 | 118 | RenderUtil.startGlScissor(x, y + barHeight - 0.5f, width, MathHelper.clamp(h, 0, maxHeight) + 0.5f); 119 | 120 | for (ModuleComponent component : components) { 121 | component.renderComponent(mouseX, mouseY); 122 | } 123 | 124 | if (!components.isEmpty()) { 125 | RenderUtil.drawRect(x, components.get(components.size() - 1).getY() + components.get(components.size() - 1).getAbsoluteHeight(), width, (height + barHeight + 4) - (components.get(components.size() - 1).getY() + components.get(components.size() - 1).getAbsoluteHeight()), new Color(25, 25, 30).getRGB()); 126 | } 127 | 128 | RenderUtil.endGlScissor(); 129 | 130 | RenderUtil.drawRect(x, y + barHeight + MathHelper.clamp(h, 0, maxHeight), width, 2, new Color(35, 35, 40).getRGB()); 131 | } 132 | 133 | public void mouseClicked(int mouseX, int mouseY, int mouseButton) { 134 | if (isHovered(mouseX, mouseY) && mouseButton == 1) { 135 | open = !open; 136 | animation.setState(open); 137 | } 138 | 139 | if (animation.getAnimationFactor() == 1) { 140 | for (Component component : components) { 141 | component.mouseClicked(mouseX, mouseY, mouseButton); 142 | } 143 | } 144 | } 145 | 146 | public void mouseReleased(int mouseX, int mouseY, int mouseButton) { 147 | if (animation.getAnimationFactor() == 1) { 148 | for (Component component : components) { 149 | component.mouseReleased(mouseX, mouseY, mouseButton); 150 | } 151 | } 152 | } 153 | 154 | public void keyTyped(char typedChar, int keyCode) { 155 | if (animation.getAnimationFactor() == 1) { 156 | for (Component component : components) { 157 | component.keyTyped(typedChar, keyCode); 158 | } 159 | } 160 | } 161 | 162 | public boolean isHovered(int mouseX, int mouseY) { 163 | return mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + barHeight; 164 | } 165 | 166 | public float getY() { 167 | return y; 168 | } 169 | 170 | public float getBarHeight() { 171 | return barHeight; 172 | } 173 | 174 | public float getMaxHeight() { 175 | return maxHeight; 176 | } 177 | } 178 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/ui/click/frame/component/Component.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.ui.click.frame.component; 2 | 3 | public abstract class Component { 4 | 5 | private float x; 6 | private float y; 7 | private float width; 8 | private float height; 9 | 10 | public Component(float x, float y, float width, float height) { 11 | this.x = x; 12 | this.y = y; 13 | this.width = width; 14 | this.height = height; 15 | } 16 | 17 | public abstract void renderComponent(int mouseX, int mouseY); 18 | 19 | public abstract void mouseClicked(int mouseX, int mouseY, int mouseButton); 20 | 21 | public abstract void mouseReleased(int mouseX, int mouseY, int mouseButton); 22 | 23 | public abstract void keyTyped(char typedChar, int keyCode); 24 | 25 | public float getX() { 26 | return x; 27 | } 28 | 29 | public void setX(float x) { 30 | this.x = x; 31 | } 32 | 33 | public float getY() { 34 | return y; 35 | } 36 | 37 | public void setY(float y) { 38 | this.y = y; 39 | } 40 | 41 | public float getWidth() { 42 | return width; 43 | } 44 | 45 | public void setWidth(float width) { 46 | this.width = width; 47 | } 48 | 49 | public float getHeight() { 50 | return height; 51 | } 52 | 53 | public void setHeight(float height) { 54 | this.height = height; 55 | } 56 | 57 | public boolean isHovered(int mouseX, int mouseY) { 58 | return mouseX >= x && mouseX <= x + width && mouseY >= y && mouseY <= y + height; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/ui/click/frame/component/module/ModuleComponent.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.ui.click.frame.component.module; 2 | 3 | import com.based.lynx.module.Module; 4 | import com.based.lynx.module.client.Colors; 5 | import com.based.lynx.setting.Setting; 6 | import com.based.lynx.ui.click.frame.Frame; 7 | import com.based.lynx.ui.click.frame.component.Component; 8 | import com.based.lynx.ui.click.frame.component.setting.*; 9 | import com.based.lynx.util.Animation; 10 | import com.based.lynx.util.RenderUtil; 11 | 12 | import java.awt.*; 13 | import java.util.ArrayList; 14 | import java.util.List; 15 | import java.util.concurrent.atomic.AtomicInteger; 16 | 17 | import static org.lwjgl.opengl.GL11.glScalef; 18 | 19 | public class ModuleComponent extends Component { 20 | 21 | private final Module module; 22 | private final List> settingComponents = new ArrayList<>(); 23 | private final Animation animation = new Animation(200, false); 24 | private final Animation openAnimation = new Animation(200, false); 25 | private boolean open; 26 | private Frame frame; 27 | 28 | public ModuleComponent(Module module, float x, float y, float width, float height, Frame frame) { 29 | super(x, y, width, height); 30 | 31 | this.module = module; 32 | this.frame = frame; 33 | this.animation.setStateHard(module.isEnabled()); 34 | 35 | float yOffset = y + height; 36 | for (Setting setting : module.getSettings()) { 37 | if (setting.getValue() instanceof Boolean) { 38 | settingComponents.add(new BooleanComponent((Setting) setting, x, yOffset, width, height, this)); 39 | yOffset += height; 40 | } else if (setting.getValue() instanceof Enum) { 41 | settingComponents.add(new ModeComponent((Setting>) setting, x, yOffset, width, height, this)); 42 | yOffset += height; 43 | } else if (setting.getValue() instanceof Color) { 44 | settingComponents.add(new ColorComponent((Setting) setting, x, yOffset, width, height, this)); 45 | yOffset += height; 46 | } else if (setting.getValue() instanceof AtomicInteger) { 47 | settingComponents.add(new KeybindComponent((Setting) setting, x, yOffset, width, height, this)); 48 | yOffset += height; 49 | } else if (setting.getValue() instanceof Float || setting.getValue() instanceof Double) { 50 | settingComponents.add(new SliderComponent((Setting) setting, x, yOffset, width, height, this)); 51 | yOffset += height; 52 | } 53 | } 54 | } 55 | 56 | @Override 57 | public void renderComponent(int mouseX, int mouseY) { 58 | RenderUtil.drawRect(getX(), getY(), getWidth(), getHeight(), isHovered(mouseX, mouseY) ? new Color(35, 35, 40).getRGB() : new Color(30, 30, 35).getRGB()); 59 | 60 | glScalef(0.75f, 0.75f, 0.75f); 61 | float scaleFactor = 1 / 0.75f; 62 | 63 | RenderUtil.drawStringWithShadow(module.getName(), (getX() + 5 + (2 * animation.getAnimationFactor())) * scaleFactor, (getY() + 4) * scaleFactor, -1, true); 64 | 65 | glScalef(scaleFactor, scaleFactor, scaleFactor); 66 | 67 | if (openAnimation.getAnimationFactor() > 0) { 68 | float yOffset = getY() + getHeight(); 69 | for (SettingComponent component : settingComponents) { 70 | component.setY(yOffset); 71 | component.renderComponent(mouseX, mouseY); 72 | RenderUtil.drawRect(getX(), yOffset, 1, component.getHeight(), Colors.INSTANCE.color.getValue().getRGB()); 73 | yOffset += component.getAbsoluteHeight(); 74 | } 75 | } 76 | 77 | RenderUtil.drawRect(getX(), getY() + getHeight() - (getHeight() * animation.getAnimationFactor()), 1, getHeight() * animation.getAnimationFactor(), Colors.INSTANCE.color.getValue().getRGB()); 78 | } 79 | 80 | @Override 81 | public void mouseClicked(int mouseX, int mouseY, int mouseButton) { 82 | if (isHovered(mouseX, mouseY) && getY() >= frame.getY() + frame.getBarHeight() && getY() <= frame.getY() + frame.getBarHeight() + frame.getMaxHeight() - 13) { 83 | if (mouseButton == 0) { 84 | module.toggle(); 85 | this.animation.setState(module.isEnabled()); 86 | } else if (mouseButton == 1) { 87 | open = !open; 88 | this.openAnimation.setState(open); 89 | } 90 | } 91 | 92 | if (open) { 93 | for (Component component : settingComponents) { 94 | if (component.getY() >= frame.getY() + frame.getBarHeight() && component.getY() <= frame.getY() + frame.getBarHeight() + frame.getMaxHeight() - 13) { 95 | component.mouseClicked(mouseX, mouseY, mouseButton); 96 | } 97 | } 98 | } 99 | } 100 | 101 | @Override 102 | public void mouseReleased(int mouseX, int mouseY, int mouseButton) { 103 | if (open) { 104 | for (Component component : settingComponents) { 105 | if (component.getY() >= frame.getY() + frame.getBarHeight() && component.getY() <= frame.getY() + frame.getBarHeight() + frame.getMaxHeight() - 13) { 106 | component.mouseReleased(mouseX, mouseY, mouseButton); 107 | } 108 | } 109 | } 110 | } 111 | 112 | @Override 113 | public void keyTyped(char typedChar, int keyCode) { 114 | if (open) { 115 | for (Component component : settingComponents) { 116 | if (component.getY() >= frame.getY() + frame.getBarHeight() && component.getY() <= frame.getY() + frame.getBarHeight() + frame.getMaxHeight() - 13) { 117 | component.keyTyped(typedChar, keyCode); 118 | } 119 | } 120 | } 121 | } 122 | 123 | public float getAbsoluteHeight() { 124 | float settingHeight = 0; 125 | 126 | for (SettingComponent component : settingComponents) { 127 | settingHeight += component.getAbsoluteHeight(); 128 | } 129 | 130 | return getHeight() + (settingHeight * openAnimation.getAnimationFactor()); 131 | } 132 | 133 | public List> getSettingComponents() { 134 | return settingComponents; 135 | } 136 | 137 | public Animation getAnimation() { 138 | return animation; 139 | } 140 | 141 | public Frame getFrame() { 142 | return frame; 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/ui/click/frame/component/setting/BooleanComponent.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.ui.click.frame.component.setting; 2 | 3 | import com.based.lynx.module.client.Colors; 4 | import com.based.lynx.setting.Setting; 5 | import com.based.lynx.ui.click.frame.component.module.ModuleComponent; 6 | import com.based.lynx.util.Animation; 7 | import com.based.lynx.util.RenderUtil; 8 | 9 | import java.awt.*; 10 | 11 | import static org.lwjgl.opengl.GL11.glScalef; 12 | 13 | public class BooleanComponent extends SettingComponent { 14 | 15 | private final Animation animation = new Animation(200, false); 16 | 17 | public BooleanComponent(Setting setting, float x, float y, float width, float height, ModuleComponent moduleComponent) { 18 | super(setting, x, y, width, height, moduleComponent); 19 | 20 | animation.setStateHard(setting.getValue()); 21 | } 22 | 23 | @Override 24 | public void renderComponent(int mouseX, int mouseY) { 25 | RenderUtil.drawRect(getX(), getY(), getWidth(), getHeight(), isHovered(mouseX, mouseY) ? new Color(30, 30, 35).getRGB() : new Color(25, 25, 30).getRGB()); 26 | 27 | glScalef(0.75f, 0.75f, 0.75f); 28 | float scaleFactor = 1 / 0.75f; 29 | 30 | RenderUtil.drawStringWithShadow(getSetting().getName(), (getX() + 7) * scaleFactor, (getY() + 4) * scaleFactor, -1, true); 31 | 32 | glScalef(scaleFactor, scaleFactor, scaleFactor); 33 | 34 | RenderUtil.drawRect(getX() + getWidth() - 12, getY() + 1.5f, 10, 10, new Color(20, 20, 25).getRGB()); 35 | RenderUtil.drawRect((getX() + getWidth() - 12) + (5 * (1 - animation.getAnimationFactor())), getY() + 1.5f + (5 * (1 - animation.getAnimationFactor())), 10 * animation.getAnimationFactor(), 10 * animation.getAnimationFactor(), Colors.INSTANCE.color.getValue().getRGB()); 36 | 37 | super.renderComponent(mouseX, mouseY); 38 | } 39 | 40 | @Override 41 | public void mouseClicked(int mouseX, int mouseY, int mouseButton) { 42 | if (isHovered(mouseX, mouseY) && mouseButton == 0) { 43 | getSetting().setValue(!getSetting().getValue()); 44 | animation.setState(getSetting().getValue()); 45 | } 46 | 47 | super.mouseClicked(mouseX, mouseY, mouseButton); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/ui/click/frame/component/setting/ColorComponent.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.ui.click.frame.component.setting; 2 | 3 | import com.based.lynx.setting.Setting; 4 | import com.based.lynx.ui.click.frame.component.module.ModuleComponent; 5 | import com.based.lynx.util.*; 6 | import net.minecraft.client.renderer.BufferBuilder; 7 | import net.minecraft.client.renderer.GlStateManager; 8 | import net.minecraft.client.renderer.Tessellator; 9 | import net.minecraft.client.renderer.vertex.DefaultVertexFormats; 10 | import org.lwjgl.input.Mouse; 11 | 12 | import java.awt.*; 13 | import java.util.ArrayList; 14 | import java.util.List; 15 | 16 | import static org.lwjgl.opengl.GL11.glScalef; 17 | 18 | public class ColorComponent extends SettingComponent { 19 | 20 | private final Animation animation = new Animation(200, false); 21 | private final List> pickerComponents = new ArrayList<>(); 22 | private final Setting hueSetting = new Setting<>("Hue", 0f, 0f, 360f, 1f); 23 | private final Setting alphaSetting = new Setting<>("Alpha", 0f, 0f, 255f, 1f); 24 | private boolean open; 25 | private boolean draggingPicker; 26 | private Color finalColor; 27 | 28 | public ColorComponent(Setting setting, float x, float y, float width, float height, ModuleComponent moduleComponent) { 29 | super(setting, x, y, width, height, moduleComponent); 30 | 31 | float[] hsbValues = Color.RGBtoHSB(setting.getValue().getRed(), setting.getValue().getGreen(), setting.getValue().getBlue(), null); 32 | 33 | this.hueSetting.setValue((int) (hsbValues[0] * 360)); 34 | this.alphaSetting.setValue(setting.getValue().getAlpha()); 35 | 36 | pickerComponents.add(new SliderComponent(hueSetting, x + 2, y + 61, width - 2, 13, moduleComponent)); 37 | pickerComponents.add(new SliderComponent(alphaSetting, x + 2, y + 74, width - 2, 13, moduleComponent)); 38 | 39 | this.finalColor = setting.getValue(); 40 | } 41 | 42 | @Override 43 | public void renderComponent(int mouseX, int mouseY) { 44 | RenderUtil.drawRect(getX(), getY(), getWidth(), getHeight(), isHovered(mouseX, mouseY) ? new Color(30, 30, 35).getRGB() : new Color(25, 25, 30).getRGB()); 45 | 46 | glScalef(0.75f, 0.75f, 0.75f); 47 | float scaleFactor = 1 / 0.75f; 48 | 49 | RenderUtil.drawStringWithShadow(getSetting().getName(), (getX() + 5 + (2 * animation.getAnimationFactor())) * scaleFactor, (getY() + 4) * scaleFactor, -1, true); 50 | 51 | glScalef(scaleFactor, scaleFactor, scaleFactor); 52 | 53 | if (!Mouse.isButtonDown(0)) { 54 | this.draggingPicker = false; 55 | } 56 | 57 | if (animation.getAnimationFactor() > 0) { 58 | float offset = getY() + 75; 59 | for (SettingComponent component : this.pickerComponents) { 60 | component.setX(getX() + 2); 61 | component.setY(offset); 62 | offset += component.getAbsoluteHeight(); 63 | } 64 | 65 | this.pickerComponents.forEach(component -> component.renderComponent(mouseX, mouseY)); 66 | 67 | float hue = this.hueSetting.getValue().floatValue(); 68 | 69 | // Picker attributes 70 | Color color = Color.getHSBColor(hue / 360, 1, 1); 71 | 72 | float pickerX = getX() + 4; 73 | float pickerY = getY() + 14; 74 | float pickerWidth = 85; 75 | float pickerHeight = 60; 76 | 77 | // GL shit pt 1 78 | GlStateManager.pushMatrix(); 79 | GlStateManager.disableTexture2D(); 80 | GlStateManager.enableBlend(); 81 | GlStateManager.disableAlpha(); 82 | GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); 83 | GlStateManager.shadeModel(7425); 84 | 85 | BufferBuilder bufferbuilder = Tessellator.getInstance().getBuffer(); 86 | 87 | // Add positions 88 | bufferbuilder.begin(7, DefaultVertexFormats.POSITION_COLOR); 89 | bufferbuilder.pos(pickerX + pickerWidth, pickerY, 0).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex(); 90 | bufferbuilder.pos(pickerX, pickerY, 0).color(255, 255, 255, 255).endVertex(); 91 | bufferbuilder.pos(pickerX, pickerY + pickerHeight, 0).color(0, 0, 0, 255).endVertex(); 92 | bufferbuilder.pos(pickerX + pickerWidth, pickerY + pickerHeight, 0).color(0, 0, 0, 255).endVertex(); 93 | 94 | // Draw rect 95 | Tessellator.getInstance().draw(); 96 | 97 | // GL shit pt 2 98 | GlStateManager.shadeModel(7424); 99 | GlStateManager.enableAlpha(); 100 | GlStateManager.enableTexture2D(); 101 | GlStateManager.popMatrix(); 102 | 103 | // awful thing to check if we are dragging the hue slider 104 | for (SettingComponent settingComponent : this.pickerComponents) { 105 | if (settingComponent.getSetting() == this.hueSetting && ((SliderComponent) settingComponent).isDragging()) { 106 | hue = this.hueSetting.getValue().floatValue(); 107 | float[] hsb2 = Color.RGBtoHSB(this.finalColor.getRed(), this.finalColor.getGreen(), this.finalColor.getBlue(), null); 108 | this.finalColor = new Color(Color.HSBtoRGB(hue / 360, hsb2[1], hsb2[2])); 109 | } 110 | 111 | // If we are dragging a slider, we don't want to pick a color 112 | if (settingComponent instanceof SliderComponent && ((SliderComponent) settingComponent).isDragging()) { 113 | this.draggingPicker = false; 114 | } 115 | } 116 | 117 | if (this.draggingPicker) { 118 | float saturation, brightness, satDiff = Math.min(pickerWidth, Math.max(0, mouseX - pickerX)); 119 | 120 | if (satDiff == 0) { 121 | saturation = 0; 122 | } else { 123 | saturation = (float) MathsUtil.roundDouble(((satDiff / pickerWidth) * 100), 0); 124 | } 125 | 126 | float brightDiff = Math.min(pickerHeight, Math.max(0, pickerY + pickerHeight - mouseY)); 127 | 128 | if (brightDiff == 0) { 129 | brightness = 0; 130 | } else { 131 | brightness = (float) MathsUtil.roundDouble(((brightDiff / pickerHeight) * 100), 0); 132 | } 133 | 134 | this.finalColor = new Color(Color.HSBtoRGB(hue / 360, saturation / 100, brightness / 100)); 135 | } 136 | 137 | // Get final HSB colors 138 | float[] finHSB = Color.RGBtoHSB(this.finalColor.getRed(), this.finalColor.getGreen(), this.finalColor.getBlue(), null); 139 | 140 | // Picker X and Y 141 | float pickerIndicatorX = pickerX + (finHSB[1]) * pickerWidth; 142 | float pickerIndicatorY = pickerY + (1 - (finHSB[2])) * pickerHeight; 143 | 144 | // Draw picker indicator (is that the right word? idfk) 145 | RenderUtil.drawRect(pickerIndicatorX - 1.5f, pickerIndicatorY - 1.5f, 3, 3, -1); 146 | RenderUtil.drawRect(pickerIndicatorX - 1, pickerIndicatorY - 1, 2, 2, this.finalColor.getRGB()); 147 | } 148 | 149 | this.getSetting().setValue(ColorUtil.integrateAlpha(this.finalColor, this.alphaSetting.getValue().floatValue())); 150 | 151 | super.renderComponent(mouseX, mouseY); 152 | } 153 | 154 | @Override 155 | public void mouseClicked(int mouseX, int mouseY, int mouseButton) { 156 | if (isHovered(mouseX, mouseY) && mouseButton == 1) { 157 | open = !open; 158 | animation.setState(open); 159 | } 160 | 161 | if (this.open) { 162 | this.pickerComponents.forEach(component -> component.mouseClicked(mouseX, mouseY, mouseButton)); 163 | 164 | if (mouseX >= getX() + 3 && mouseX <= getX() + 91 && mouseY >= getY() + 14 && mouseY <= getY() + 74) { 165 | this.draggingPicker = true; 166 | } 167 | } 168 | 169 | super.mouseClicked(mouseX, mouseY, mouseButton); 170 | } 171 | 172 | @Override 173 | public void mouseReleased(int mouseX, int mouseY, int mouseButton) { 174 | this.draggingPicker = false; 175 | 176 | super.mouseReleased(mouseX, mouseY, mouseButton); 177 | } 178 | 179 | @Override 180 | public float getHeight() { 181 | return 13 + (91 * animation.getAnimationFactor()); 182 | } 183 | } 184 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/ui/click/frame/component/setting/ColourComponent.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.ui.click.frame.component.setting; 2 | 3 | import com.based.lynx.setting.Setting; 4 | import com.based.lynx.ui.click.frame.component.module.ModuleComponent; 5 | import com.based.lynx.util.*; 6 | import net.minecraft.client.renderer.BufferBuilder; 7 | import net.minecraft.client.renderer.GlStateManager; 8 | import net.minecraft.client.renderer.Tessellator; 9 | import net.minecraft.client.renderer.vertex.DefaultVertexFormats; 10 | import org.lwjgl.input.Mouse; 11 | 12 | import java.awt.*; 13 | import java.util.ArrayList; 14 | import java.util.List; 15 | 16 | import static org.lwjgl.opengl.GL11.glScalef; 17 | 18 | public class ColourComponent extends SettingComponent { 19 | 20 | private final Animation animation = new Animation(200, false); 21 | private final List> pickerComponents = new ArrayList<>(); 22 | private final Setting hueSetting = new Setting<>("Hue", 0f, 0f, 360f, 1f); 23 | private final Setting alphaSetting = new Setting<>("Alpha", 0f, 0f, 255f, 1f); 24 | private boolean open; 25 | private boolean draggingPicker; 26 | private Color finalColour; 27 | 28 | public ColourComponent(Setting setting, float x, float y, float width, float height, ModuleComponent moduleComponent) { 29 | super(setting, x, y, width, height, moduleComponent); 30 | 31 | float[] hsbValues = Color.RGBtoHSB(setting.getValue().getRed(), setting.getValue().getGreen(), setting.getValue().getBlue(), null); 32 | 33 | this.hueSetting.setValue((int) (hsbValues[0] * 360)); 34 | this.alphaSetting.setValue(setting.getValue().getAlpha()); 35 | 36 | pickerComponents.add(new SliderComponent(hueSetting, x + 2, y + 61, width - 2, 13, moduleComponent)); 37 | pickerComponents.add(new SliderComponent(alphaSetting, x + 2, y + 74, width - 2, 13, moduleComponent)); 38 | 39 | this.finalColour = setting.getValue(); 40 | } 41 | 42 | @Override 43 | public void renderComponent(int mouseX, int mouseY) { 44 | RenderUtil.drawRect(getX(), getY(), getWidth(), getHeight(), isHovered(mouseX, mouseY) ? new Color(30, 30, 35).getRGB() : new Color(25, 25, 30).getRGB()); 45 | 46 | glScalef(0.75f, 0.75f, 0.75f); 47 | float scaleFactor = 1 / 0.75f; 48 | 49 | RenderUtil.drawStringWithShadow(getSetting().getName(), (getX() + 5 + (2 * animation.getAnimationFactor())) * scaleFactor, (getY() + 4) * scaleFactor, -1, true); 50 | 51 | glScalef(scaleFactor, scaleFactor, scaleFactor); 52 | 53 | if (!Mouse.isButtonDown(0)) { 54 | this.draggingPicker = false; 55 | } 56 | 57 | if (animation.getAnimationFactor() > 0) { 58 | float offset = getY() + 75; 59 | for (SettingComponent component : this.pickerComponents) { 60 | component.setX(getX() + 2); 61 | component.setY(offset); 62 | offset += component.getAbsoluteHeight(); 63 | } 64 | 65 | this.pickerComponents.forEach(component -> component.renderComponent(mouseX, mouseY)); 66 | 67 | float hue = this.hueSetting.getValue().floatValue(); 68 | 69 | // Picker attributes 70 | Color colour = Color.getHSBColor(hue / 360, 1, 1); 71 | 72 | float pickerX = getX() + 4; 73 | float pickerY = getY() + 14; 74 | float pickerWidth = 85; 75 | float pickerHeight = 60; 76 | 77 | // GL shit pt 1 78 | GlStateManager.pushMatrix(); 79 | GlStateManager.disableTexture2D(); 80 | GlStateManager.enableBlend(); 81 | GlStateManager.disableAlpha(); 82 | GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); 83 | GlStateManager.shadeModel(7425); 84 | 85 | BufferBuilder bufferbuilder = Tessellator.getInstance().getBuffer(); 86 | 87 | // Add positions 88 | bufferbuilder.begin(7, DefaultVertexFormats.POSITION_COLOR); 89 | bufferbuilder.pos(pickerX + pickerWidth, pickerY, 0).color(colour.getRed(), colour.getGreen(), colour.getBlue(), colour.getAlpha()).endVertex(); 90 | bufferbuilder.pos(pickerX, pickerY, 0).color(255, 255, 255, 255).endVertex(); 91 | bufferbuilder.pos(pickerX, pickerY + pickerHeight, 0).color(0, 0, 0, 255).endVertex(); 92 | bufferbuilder.pos(pickerX + pickerWidth, pickerY + pickerHeight, 0).color(0, 0, 0, 255).endVertex(); 93 | 94 | // Draw rect 95 | Tessellator.getInstance().draw(); 96 | 97 | // GL shit pt 2 98 | GlStateManager.shadeModel(7424); 99 | GlStateManager.enableAlpha(); 100 | GlStateManager.enableTexture2D(); 101 | GlStateManager.popMatrix(); 102 | 103 | // awful thing to check if we are dragging the hue slider 104 | for (SettingComponent settingComponent : this.pickerComponents) { 105 | if (settingComponent.getSetting() == this.hueSetting && ((SliderComponent) settingComponent).isDragging()) { 106 | hue = this.hueSetting.getValue().floatValue(); 107 | float[] hsb2 = Color.RGBtoHSB(this.finalColour.getRed(), this.finalColour.getGreen(), this.finalColour.getBlue(), null); 108 | this.finalColour = new Color(Color.HSBtoRGB(hue / 360, hsb2[1], hsb2[2])); 109 | } 110 | 111 | // If we are dragging a slider, we don't want to pick a colour 112 | if (settingComponent instanceof SliderComponent && ((SliderComponent) settingComponent).isDragging()) { 113 | this.draggingPicker = false; 114 | } 115 | } 116 | 117 | if (this.draggingPicker) { 118 | float saturation, brightness, satDiff = Math.min(pickerWidth, Math.max(0, mouseX - pickerX)); 119 | 120 | if (satDiff == 0) { 121 | saturation = 0; 122 | } else { 123 | saturation = (float) MathsUtil.roundDouble(((satDiff / pickerWidth) * 100), 0); 124 | } 125 | 126 | float brightDiff = Math.min(pickerHeight, Math.max(0, pickerY + pickerHeight - mouseY)); 127 | 128 | if (brightDiff == 0) { 129 | brightness = 0; 130 | } else { 131 | brightness = (float) MathsUtil.roundDouble(((brightDiff / pickerHeight) * 100), 0); 132 | } 133 | 134 | this.finalColour = new Color(Color.HSBtoRGB(hue / 360, saturation / 100, brightness / 100)); 135 | } 136 | 137 | // Get final HSB colours 138 | float[] finHSB = Color.RGBtoHSB(this.finalColour.getRed(), this.finalColour.getGreen(), this.finalColour.getBlue(), null); 139 | 140 | // Picker X and Y 141 | float pickerIndicatorX = pickerX + (finHSB[1]) * pickerWidth; 142 | float pickerIndicatorY = pickerY + (1 - (finHSB[2])) * pickerHeight; 143 | 144 | // Draw picker indicator (is that the right word? idfk) 145 | RenderUtil.drawRect(pickerIndicatorX - 1.5f, pickerIndicatorY - 1.5f, 3, 3, -1); 146 | RenderUtil.drawRect(pickerIndicatorX - 1, pickerIndicatorY - 1, 2, 2, this.finalColour.getRGB()); 147 | } 148 | 149 | this.getSetting().setValue(ColourUtil.integrateAlpha(this.finalColour, this.alphaSetting.getValue().floatValue())); 150 | 151 | super.renderComponent(mouseX, mouseY); 152 | } 153 | 154 | @Override 155 | public void mouseClicked(int mouseX, int mouseY, int mouseButton) { 156 | if (isHovered(mouseX, mouseY) && mouseButton == 1) { 157 | open = !open; 158 | animation.setState(open); 159 | } 160 | 161 | if (this.open) { 162 | this.pickerComponents.forEach(component -> component.mouseClicked(mouseX, mouseY, mouseButton)); 163 | 164 | if (mouseX >= getX() + 3 && mouseX <= getX() + 91 && mouseY >= getY() + 14 && mouseY <= getY() + 74) { 165 | this.draggingPicker = true; 166 | } 167 | } 168 | 169 | super.mouseClicked(mouseX, mouseY, mouseButton); 170 | } 171 | 172 | @Override 173 | public void mouseReleased(int mouseX, int mouseY, int mouseButton) { 174 | this.draggingPicker = false; 175 | 176 | super.mouseReleased(mouseX, mouseY, mouseButton); 177 | } 178 | 179 | @Override 180 | public float getHeight() { 181 | return 13 + (91 * animation.getAnimationFactor()); 182 | } 183 | } 184 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/ui/click/frame/component/setting/KeybindComponent.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.ui.click.frame.component.setting; 2 | 3 | import com.based.lynx.setting.Setting; 4 | import com.based.lynx.ui.click.frame.component.module.ModuleComponent; 5 | import com.based.lynx.util.RenderUtil; 6 | import net.minecraft.client.Minecraft; 7 | import org.lwjgl.input.Keyboard; 8 | 9 | import java.awt.*; 10 | import java.util.concurrent.atomic.AtomicInteger; 11 | 12 | import static org.lwjgl.opengl.GL11.glScalef; 13 | 14 | public class KeybindComponent extends SettingComponent { 15 | 16 | private boolean listening; 17 | 18 | public KeybindComponent(Setting setting, float x, float y, float width, float height, ModuleComponent moduleComponent) { 19 | super(setting, x, y, width, height, moduleComponent); 20 | } 21 | 22 | @Override 23 | public void renderComponent(int mouseX, int mouseY) { 24 | RenderUtil.drawRect(getX(), getY(), getWidth(), getHeight(), isHovered(mouseX, mouseY) ? new Color(30, 30, 35).getRGB() : new Color(25, 25, 30).getRGB()); 25 | 26 | glScalef(0.75f, 0.75f, 0.75f); 27 | float scaleFactor = 1 / 0.75f; 28 | 29 | RenderUtil.drawStringWithShadow(getSetting().getName(), (getX() + 5) * scaleFactor, (getY() + 4) * scaleFactor, -1, true); 30 | 31 | String character = Keyboard.getKeyName(getSetting().getValue().get()); 32 | float modeX = (getX() + getWidth() - 2 - (Minecraft.getMinecraft().fontRenderer.getStringWidth(listening ? "..." : character) * 0.75f)) * scaleFactor; 33 | RenderUtil.drawStringWithShadow(listening ? "..." : character, modeX, (getY() + 4) * scaleFactor, new Color(175, 175, 175).getRGB(), true); 34 | 35 | glScalef(scaleFactor, scaleFactor, scaleFactor); 36 | 37 | super.renderComponent(mouseX, mouseY); 38 | } 39 | 40 | @Override 41 | public void mouseClicked(int mouseX, int mouseY, int mouseButton) { 42 | if (isHovered(mouseX, mouseY) && mouseButton == 0) { 43 | listening = !listening; 44 | } 45 | 46 | super.mouseClicked(mouseX, mouseY, mouseButton); 47 | } 48 | 49 | @Override 50 | public void keyTyped(char typedChar, int keyCode) { 51 | if (listening) { 52 | if (keyCode == Keyboard.KEY_ESCAPE || keyCode == Keyboard.KEY_RETURN || keyCode == Keyboard.KEY_DELETE) { 53 | listening = false; 54 | getSetting().setValue(new AtomicInteger(0)); 55 | return; 56 | } 57 | 58 | getSetting().setValue(new AtomicInteger(keyCode)); 59 | listening = false; 60 | } 61 | super.keyTyped(typedChar, keyCode); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/ui/click/frame/component/setting/ModeComponent.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.ui.click.frame.component.setting; 2 | 3 | import com.based.lynx.setting.Setting; 4 | import com.based.lynx.ui.click.frame.component.module.ModuleComponent; 5 | import com.based.lynx.util.RenderUtil; 6 | import net.minecraft.client.Minecraft; 7 | 8 | import java.awt.*; 9 | 10 | import static org.lwjgl.opengl.GL11.glScalef; 11 | 12 | public class ModeComponent extends SettingComponent> { 13 | 14 | public ModeComponent(Setting> setting, float x, float y, float width, float height, ModuleComponent moduleComponent) { 15 | super(setting, x, y, width, height, moduleComponent); 16 | } 17 | 18 | @Override 19 | public void renderComponent(int mouseX, int mouseY) { 20 | RenderUtil.drawRect(getX(), getY(), getWidth(), getHeight(), isHovered(mouseX, mouseY) ? new Color(30, 30, 35).getRGB() : new Color(25, 25, 30).getRGB()); 21 | 22 | glScalef(0.75f, 0.75f, 0.75f); 23 | float scaleFactor = 1 / 0.75f; 24 | 25 | RenderUtil.drawStringWithShadow(getSetting().getName(), (getX() + 5) * scaleFactor, (getY() + 4) * scaleFactor, -1, true); 26 | 27 | float modeX = (getX() + getWidth() - 2 - (Minecraft.getMinecraft().fontRenderer.getStringWidth(this.getSetting().getValue().name()) * 0.75f)) * scaleFactor; 28 | RenderUtil.drawStringWithShadow(getSetting().getValue().name(), modeX, (getY() + 4) * scaleFactor, new Color(175, 175, 175).getRGB(), true); 29 | 30 | glScalef(scaleFactor, scaleFactor, scaleFactor); 31 | 32 | super.renderComponent(mouseX, mouseY); 33 | } 34 | 35 | @Override 36 | public void mouseClicked(int mouseX, int mouseY, int mouseButton) { 37 | if (isHovered(mouseX, mouseY) && mouseButton == 0) { 38 | getSetting().setValue(getSetting().getNextMode()); 39 | } 40 | 41 | super.mouseClicked(mouseX, mouseY, mouseButton); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/ui/click/frame/component/setting/SettingComponent.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.ui.click.frame.component.setting; 2 | 3 | import com.based.lynx.module.client.Colors; 4 | import com.based.lynx.setting.Setting; 5 | import com.based.lynx.ui.click.frame.component.Component; 6 | import com.based.lynx.ui.click.frame.component.module.ModuleComponent; 7 | import com.based.lynx.util.Animation; 8 | import com.based.lynx.util.RenderUtil; 9 | 10 | import java.awt.*; 11 | import java.util.ArrayList; 12 | import java.util.List; 13 | import java.util.concurrent.atomic.AtomicInteger; 14 | 15 | public class SettingComponent extends Component { 16 | 17 | private final Setting setting; 18 | private final List> subsettings = new ArrayList<>(); 19 | private final Animation openAnimation = new Animation(200, false); 20 | private boolean open; 21 | private ModuleComponent moduleComponent; 22 | 23 | public SettingComponent(Setting setting, float x, float y, float width, float height, ModuleComponent moduleComponent) { 24 | super(x, y, width, height); 25 | this.setting = setting; 26 | 27 | this.moduleComponent = moduleComponent; 28 | 29 | float yOffset = getY() + 13; 30 | for (Setting subsetting : setting.getSubsettings()) { 31 | if (subsetting.getValue() instanceof Boolean) { 32 | subsettings.add(new BooleanComponent((Setting) subsetting, x + 1, yOffset, width - 1, height, moduleComponent)); 33 | yOffset += height; 34 | } else if (subsetting.getValue() instanceof Enum) { 35 | subsettings.add(new ModeComponent((Setting>) subsetting, x + 1, yOffset, width - 1, height, moduleComponent)); 36 | yOffset += height; 37 | } else if (subsetting.getValue() instanceof Color) { 38 | subsettings.add(new ColorComponent((Setting) subsetting, x + 1, yOffset, width - 1, height, moduleComponent)); 39 | yOffset += height; 40 | } else if (subsetting.getValue() instanceof AtomicInteger) { 41 | subsettings.add(new KeybindComponent((Setting) subsetting, x + 1, yOffset, width - 1, height, moduleComponent)); 42 | yOffset += height; 43 | } else if (subsetting.getValue() instanceof Float || setting.getValue() instanceof Double) { 44 | subsettings.add(new SliderComponent((Setting) subsetting, x + 1, yOffset, width - 1, height, moduleComponent)); 45 | yOffset += height; 46 | } 47 | } 48 | } 49 | 50 | @Override 51 | public void renderComponent(int mouseX, int mouseY) { 52 | if (openAnimation.getAnimationFactor() > 0) { 53 | float yOffset = getY() + getHeight(); 54 | for (SettingComponent subcomponent : subsettings) { 55 | if (!subcomponent.getSetting().isVisible()) { 56 | continue; 57 | } 58 | 59 | subcomponent.setY(yOffset); 60 | subcomponent.renderComponent(mouseX, mouseY); 61 | RenderUtil.drawRect(getX(), yOffset, 2, subcomponent.getHeight(), Colors.INSTANCE.color.getValue().getRGB()); 62 | yOffset += subcomponent.getAbsoluteHeight(); 63 | } 64 | } 65 | } 66 | 67 | @Override 68 | public void mouseClicked(int mouseX, int mouseY, int mouseButton) { 69 | if (isHovered(mouseX, mouseY) && mouseButton == 1) { 70 | open = !open; 71 | openAnimation.setState(open); 72 | } 73 | 74 | if (open) { 75 | subsettings.forEach(subsetting -> { 76 | subsetting.mouseClicked(mouseX, mouseY, mouseButton); 77 | }); 78 | } 79 | } 80 | 81 | @Override 82 | public void mouseReleased(int mouseX, int mouseY, int mouseButton) { 83 | if (open) { 84 | subsettings.forEach(subsetting -> { 85 | subsetting.mouseReleased(mouseX, mouseY, mouseButton); 86 | }); 87 | } 88 | } 89 | 90 | @Override 91 | public void keyTyped(char typedChar, int keyCode) { 92 | if (open) { 93 | subsettings.forEach(subsetting -> { 94 | subsetting.keyTyped(typedChar, keyCode); 95 | }); 96 | } 97 | } 98 | 99 | public float getAbsoluteHeight() { 100 | float settingHeight = 0; 101 | 102 | for (SettingComponent subcomponent : subsettings) { 103 | settingHeight += subcomponent.getAbsoluteHeight(); 104 | } 105 | 106 | return getHeight() + (settingHeight * openAnimation.getAnimationFactor()); 107 | } 108 | 109 | public Setting getSetting() { 110 | return setting; 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/ui/click/frame/component/setting/SliderComponent.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.ui.click.frame.component.setting; 2 | 3 | import com.based.lynx.module.client.Colors; 4 | import com.based.lynx.setting.Setting; 5 | import com.based.lynx.ui.click.frame.component.module.ModuleComponent; 6 | import com.based.lynx.util.RenderUtil; 7 | import net.minecraft.client.Minecraft; 8 | import org.lwjgl.input.Mouse; 9 | 10 | import java.awt.*; 11 | 12 | import static org.lwjgl.opengl.GL11.glScalef; 13 | 14 | public class SliderComponent extends SettingComponent { 15 | 16 | private boolean dragging; 17 | 18 | public SliderComponent(Setting setting, float x, float y, float width, float height, ModuleComponent moduleComponent) { 19 | super(setting, x, y, width, height, moduleComponent); 20 | } 21 | 22 | @Override 23 | public void renderComponent(int mouseX, int mouseY) { 24 | RenderUtil.drawRect(getX(), getY(), getWidth(), getHeight(), isHovered(mouseX, mouseY) ? new Color(30, 30, 35).getRGB() : new Color(25, 25, 30).getRGB()); 25 | 26 | glScalef(0.75f, 0.75f, 0.75f); 27 | float scaleFactor = 1 / 0.75f; 28 | 29 | RenderUtil.drawStringWithShadow(getSetting().getName(), (getX() + 5) * scaleFactor, (getY() + 4) * scaleFactor, -1, true); 30 | 31 | float modeX = (getX() + getWidth() - 2 - (Minecraft.getMinecraft().fontRenderer.getStringWidth(String.valueOf(getSetting().getValue())) * 0.75f)) * scaleFactor; 32 | RenderUtil.drawStringWithShadow(String.valueOf(getSetting().getValue()), modeX, (getY() + 4) * scaleFactor, new Color(175, 175, 175).getRGB(), true); 33 | 34 | glScalef(scaleFactor, scaleFactor, scaleFactor); 35 | 36 | float difference = Math.min(getWidth() - 5, Math.max(0, mouseX - (getX() + 5))); 37 | 38 | float min = getSetting().getMin().floatValue(); 39 | float max = getSetting().getMax().floatValue(); 40 | 41 | if (!Mouse.isButtonDown(0)) { 42 | this.dragging = false; 43 | } 44 | 45 | if (this.dragging) { 46 | if (difference == 0) { 47 | this.getSetting().setValue(this.getSetting().getMin()); 48 | } else { 49 | float value = ((difference / (getWidth() - 5)) * (max - min) + min); 50 | 51 | float precision = 1 / this.getSetting().getIncrementation().floatValue(); 52 | this.getSetting().setValue(Math.round(Math.max(this.getSetting().getMin().floatValue(), Math.min(this.getSetting().getMax().floatValue(), value)) * precision) / precision); 53 | } 54 | } 55 | 56 | float renderWidth = ((getWidth() - 5) * (this.getSetting().getValue().floatValue() - min) / (max - min)); 57 | RenderUtil.drawRect(getX() + 5, getY() + getHeight() - 1, renderWidth, 1, Colors.INSTANCE.color.getValue().getRGB()); 58 | 59 | super.renderComponent(mouseX, mouseY); 60 | } 61 | 62 | @Override 63 | public void mouseClicked(int mouseX, int mouseY, int mouseButton) { 64 | if (isHovered(mouseX, mouseY) && mouseButton == 0) { 65 | dragging = true; 66 | } 67 | 68 | super.mouseClicked(mouseX, mouseY, mouseButton); 69 | } 70 | 71 | public boolean isDragging() { 72 | return dragging; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/ui/menu/LynxButton.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.ui.menu; 2 | 3 | import com.based.lynx.module.client.Colors; 4 | import com.based.lynx.util.RenderUtil; 5 | import net.minecraft.client.Minecraft; 6 | import net.minecraft.client.gui.GuiButton; 7 | import net.minecraft.client.renderer.GlStateManager; 8 | 9 | public class LynxButton extends GuiButton { 10 | 11 | public LynxButton(int buttonId, int x, int y, int widthIn, int heightIn, String buttonText) { 12 | super(buttonId, x, y, widthIn, heightIn, buttonText); 13 | } 14 | 15 | @Override 16 | public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) { 17 | if (this.visible) { 18 | GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); 19 | this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height; 20 | int i = this.getHoverState(this.hovered); 21 | GlStateManager.enableBlend(); 22 | GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); 23 | GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); 24 | 25 | RenderUtil.drawRect(this.x, this.y, this.width, this.height, this.hovered ? 0x70000000 : 0x90000000); 26 | 27 | this.mouseDragged(mc, mouseX, mouseY); 28 | 29 | this.drawCenteredString(mc.fontRenderer, this.displayString, this.x + this.width / 2, this.y + (this.height - 8) / 2, this.hovered ? Colors.INSTANCE.color.getValue().getRGB() : -1); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/ui/menu/LynxMenu.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.ui.menu; 2 | 3 | import com.based.lynx.util.RenderUtil; 4 | import net.minecraft.client.Minecraft; 5 | import net.minecraft.client.gui.*; 6 | import net.minecraft.util.ResourceLocation; 7 | 8 | import java.io.IOException; 9 | 10 | import static org.lwjgl.opengl.GL11.*; 11 | 12 | public class LynxMenu extends GuiScreen { 13 | 14 | @Override 15 | public void initGui() { 16 | this.addButton(new LynxButton(0, width / 2 - 100, height / 2 + 10, 200, 20, "Singleplayer")); 17 | this.addButton(new LynxButton(1, width / 2 - 100, height / 2 + 35, 200, 20, "Multiplayer")); 18 | this.addButton(new LynxButton(2, width / 2 - 100, height / 2 + 60, 95, 20, "Options")); 19 | this.addButton(new LynxButton(3, width / 2 + 5, height / 2 + 60, 95, 20, "Quit")); 20 | } 21 | 22 | @Override 23 | public void drawScreen(int mouseX, int mouseY, float partialTicks) { 24 | float xOffset = -1.0f * ((mouseX - this.width / 2.0f) / (this.width / 10.0f)); 25 | float yOffset = -1.0f * ((mouseY - this.height / 2.0f) / (this.height / 10.0f)); 26 | 27 | Minecraft.getMinecraft().getTextureManager().bindTexture(new ResourceLocation("lynx", "textures/background.png")); 28 | RenderUtil.drawModalRectWithCustomSizedTexture(-10.0f + xOffset, -10.0f + yOffset, 0, 0, this.width + 10f, this.height + 10f, this.width + 10f, this.height + 10f); 29 | 30 | glPushMatrix(); 31 | glScalef(4, 4, 4); 32 | drawCenteredString(mc.fontRenderer, "Lynx", (width / 4) / 2, ((height - 70) / 4) / 2, 0xFFFFFF); 33 | glPopMatrix(); 34 | 35 | super.drawScreen(mouseX, mouseY, partialTicks); 36 | } 37 | 38 | @Override 39 | protected void actionPerformed(GuiButton button) throws IOException { 40 | switch (button.id) { 41 | case 0: 42 | mc.displayGuiScreen(new GuiWorldSelection(this)); 43 | break; 44 | case 1: 45 | mc.displayGuiScreen(new GuiMultiplayer(this)); 46 | break; 47 | case 2: 48 | mc.displayGuiScreen(new GuiOptions(this, mc.gameSettings)); 49 | break; 50 | case 3: 51 | mc.shutdown(); 52 | break; 53 | } 54 | } 55 | 56 | @Override 57 | protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { 58 | super.mouseClicked(mouseX, mouseY, mouseButton); 59 | } 60 | 61 | @Override 62 | protected void mouseReleased(int mouseX, int mouseY, int state) { 63 | super.mouseReleased(mouseX, mouseY, state); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/util/Animation.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.util; 2 | 3 | import net.minecraft.util.math.MathHelper; 4 | 5 | /** 6 | * @author Tigermouthbear, linustouchtips 7 | * @since 06/08/2021 //rewrite this so its not skidded -Master7720 8 | */ 9 | public class Animation { 10 | 11 | // animation time 12 | public float time; 13 | 14 | // animation current state 15 | private State currentState = State.STATIC; 16 | private long currentStateStart = 0; 17 | 18 | // animation previous state 19 | private State previousState = State.STATIC; 20 | private boolean initialState; 21 | 22 | public Animation(int time, boolean initialState) { 23 | this.time = time; 24 | this.initialState = initialState; 25 | 26 | // start as expanded 27 | if (initialState) { 28 | previousState = State.EXPANDING; 29 | } 30 | } 31 | 32 | /** 33 | * Gets the animation length (0 to 1) 34 | * 35 | * @return The animation length (0 to 1) 36 | */ 37 | public float getAnimationFactor() { 38 | if (currentState.equals(State.EXPANDING)) { 39 | return MathHelper.clamp((System.currentTimeMillis() - currentStateStart) / time, 0, 1); 40 | } 41 | 42 | if (currentState.equals(State.RETRACTING)) { 43 | return MathHelper.clamp(((long) time - (System.currentTimeMillis() - currentStateStart)) / time, 0, 1); 44 | } 45 | 46 | return previousState.equals(State.EXPANDING) ? 1 : 0; 47 | } 48 | 49 | /** 50 | * Gets the initial state 51 | * 52 | * @return The initial state 53 | */ 54 | public boolean getState() { 55 | return initialState; 56 | } 57 | 58 | /** 59 | * Sets the state 60 | * 61 | * @param expand Expand or retract 62 | */ 63 | public void setState(boolean expand) { 64 | if (expand) { 65 | currentState = State.EXPANDING; 66 | initialState = true; 67 | } else { 68 | currentState = State.RETRACTING; 69 | } 70 | 71 | // reset time 72 | currentStateStart = System.currentTimeMillis(); 73 | } 74 | 75 | /** 76 | * Sets the state (no animation) 77 | * 78 | * @param expand Expand or retract 79 | */ 80 | public void setStateHard(boolean expand) { 81 | if (expand) { 82 | currentState = State.EXPANDING; 83 | initialState = true; 84 | 85 | // reset time 86 | currentStateStart = System.currentTimeMillis(); 87 | } else { 88 | previousState = State.RETRACTING; 89 | currentState = State.RETRACTING; 90 | initialState = false; 91 | } 92 | } 93 | 94 | public enum State { 95 | 96 | /** 97 | * Expands the animation 98 | */ 99 | EXPANDING, 100 | 101 | /** 102 | * Retracts the animation 103 | */ 104 | RETRACTING, 105 | 106 | /** 107 | * No animation 108 | */ 109 | STATIC 110 | } 111 | } -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/util/BlockUtil.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.util; 2 | 3 | import net.minecraft.network.play.client.CPacketHeldItemChange; 4 | import net.minecraft.util.EnumFacing; 5 | import net.minecraft.util.EnumHand; 6 | import net.minecraft.util.math.BlockPos; 7 | import net.minecraft.util.math.Vec3d; 8 | 9 | public class BlockUtil { 10 | 11 | public static void placeCrystalOnBlock(BlockPos pos, EnumHand hand, boolean swing, boolean silentSwitch) { 12 | int oldSlot = Wrapper.getPlayer().inventory.currentItem; 13 | int crystalSlot = -1; 14 | 15 | for (int i = 0; i < 9; i++) { 16 | if (Wrapper.getPlayer().inventory.getStackInSlot(i).getItem() == Wrapper.getPlayer().getHeldItem(hand).getItem()) { 17 | crystalSlot = i; 18 | break; 19 | } 20 | } 21 | 22 | if (crystalSlot > -1) { 23 | Wrapper.getPlayer().inventory.currentItem = crystalSlot; 24 | Wrapper.getPlayer().connection.sendPacket(new CPacketHeldItemChange(crystalSlot)); 25 | } 26 | 27 | Wrapper.getMinecraft().playerController.processRightClickBlock(Wrapper.getPlayer(), Wrapper.getMinecraft().world, pos, EnumFacing.UP, new Vec3d(0, 0, 0), hand); 28 | 29 | if (swing) { 30 | Wrapper.getPlayer().swingArm(hand); 31 | } 32 | 33 | if (silentSwitch) { 34 | Wrapper.getPlayer().inventory.currentItem = oldSlot; 35 | Wrapper.getPlayer().connection.sendPacket(new CPacketHeldItemChange(oldSlot)); 36 | } 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/util/ColorUtil.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.util; 2 | 3 | import java.awt.*; 4 | 5 | public class ColorUtil { 6 | 7 | public static Color integrateAlpha(Color color, float alpha) { 8 | float red = color.getRed() / 255f; 9 | float green = color.getGreen() / 255f; 10 | float blue = color.getBlue() / 255f; 11 | 12 | return new Color(red, green, blue, alpha / 255f); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/util/ColourUtil.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.util; 2 | 3 | import java.awt.*; 4 | 5 | public class ColourUtil { 6 | 7 | public static Color integrateAlpha(Color colour, float alpha) { 8 | float red = colour.getRed() / 255f; 9 | float green = colour.getGreen() / 255f; 10 | float blue = colour.getBlue() / 255f; 11 | 12 | return new Color(red, green, blue, alpha / 255f); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/util/EntityUtil.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.util; 2 | 3 | import net.minecraft.block.BlockLiquid; 4 | import net.minecraft.client.Minecraft; 5 | import net.minecraft.entity.Entity; 6 | import net.minecraft.entity.EntityAgeable; 7 | import net.minecraft.entity.EntityLivingBase; 8 | import net.minecraft.entity.EnumCreatureType; 9 | import net.minecraft.entity.monster.EntityEnderman; 10 | import net.minecraft.entity.monster.EntityIronGolem; 11 | import net.minecraft.entity.monster.EntityPigZombie; 12 | import net.minecraft.entity.passive.*; 13 | import net.minecraft.entity.player.EntityPlayer; 14 | import net.minecraft.network.play.client.CPacketUseEntity; 15 | import net.minecraft.util.EnumHand; 16 | import net.minecraft.util.math.BlockPos; 17 | import net.minecraft.util.math.MathHelper; 18 | import net.minecraft.util.math.Vec3d; 19 | 20 | public class EntityUtil { 21 | 22 | public static boolean isPassive(Entity e) { 23 | if (e instanceof EntityWolf && ((EntityWolf) e).isAngry()) return false; 24 | if (e instanceof EntityAgeable || e instanceof EntityAmbientCreature || e instanceof EntitySquid) 25 | return true; 26 | return e instanceof EntityIronGolem && ((EntityIronGolem) e).getRevengeTarget() == null; 27 | } 28 | 29 | public static boolean isLiving(Entity e) { 30 | return e instanceof EntityLivingBase; 31 | } 32 | 33 | public static boolean isFakeLocalPlayer(Entity entity) { 34 | return entity != null && entity.getEntityId() == -100 && Wrapper.getPlayer() != entity; 35 | } 36 | 37 | public static Vec3d getInterpolatedAmount(Entity entity, double x, double y, double z) { 38 | return new Vec3d( 39 | (entity.posX - entity.lastTickPosX) * x, 40 | (entity.posY - entity.lastTickPosY) * y, 41 | (entity.posZ - entity.lastTickPosZ) * z 42 | ); 43 | } 44 | 45 | public static Vec3d getInterpolatedAmount(Entity entity, Vec3d vec) { 46 | return getInterpolatedAmount(entity, vec.x, vec.y, vec.z); 47 | } 48 | 49 | public static Vec3d getInterpolatedAmount(Entity entity, double ticks) { 50 | return getInterpolatedAmount(entity, ticks, ticks, ticks); 51 | } 52 | 53 | public static boolean isMobAggressive(Entity entity) { 54 | if (entity instanceof EntityPigZombie) { 55 | if (((EntityPigZombie) entity).isArmsRaised() || ((EntityPigZombie) entity).isAngry()) { 56 | return true; 57 | } 58 | } else if (entity instanceof EntityWolf) { 59 | return ((EntityWolf) entity).isAngry() && 60 | !Wrapper.getPlayer().equals(((EntityWolf) entity).getOwner()); 61 | } else if (entity instanceof EntityEnderman) { 62 | return ((EntityEnderman) entity).isScreaming(); 63 | } 64 | return isHostileMob(entity); 65 | } 66 | 67 | public static boolean isNeutralMob(Entity entity) { 68 | return entity instanceof EntityPigZombie || 69 | entity instanceof EntityWolf || 70 | entity instanceof EntityEnderman; 71 | } 72 | 73 | public static boolean isFriendlyMob(Entity entity) { 74 | return (entity.isCreatureType(EnumCreatureType.CREATURE, false) && !EntityUtil.isNeutralMob(entity)) || 75 | (entity.isCreatureType(EnumCreatureType.AMBIENT, false)) || 76 | entity instanceof EntityVillager || 77 | entity instanceof EntityIronGolem || 78 | (isNeutralMob(entity) && !EntityUtil.isMobAggressive(entity)); 79 | } 80 | 81 | public static boolean isHostileMob(Entity entity) { 82 | return (entity.isCreatureType(EnumCreatureType.MONSTER, false) && !EntityUtil.isNeutralMob(entity)); 83 | } 84 | 85 | public static Vec3d getInterpolatedPos(Entity entity, float ticks) { 86 | return new Vec3d(entity.lastTickPosX, entity.lastTickPosY, entity.lastTickPosZ).add(getInterpolatedAmount(entity, ticks)); 87 | } 88 | 89 | public static Vec3d getInterpolatedRenderPos(Entity entity, float ticks) { 90 | return getInterpolatedPos(entity, ticks).subtract(Wrapper.getMinecraft().getRenderManager().viewerPosX, Wrapper.getMinecraft().getRenderManager().viewerPosY, Wrapper.getMinecraft().getRenderManager().viewerPosZ); 91 | } 92 | 93 | public static Vec3d getInterpolatedEyePos(Entity entity, float ticks) { 94 | return getInterpolatedPos(entity, ticks).add(0, entity.getEyeHeight(), 0); 95 | } 96 | 97 | public static boolean isInWater(Entity entity) { 98 | if (entity == null) return false; 99 | 100 | double y = entity.posY + 0.01; 101 | 102 | for (int x = MathHelper.floor(entity.posX); x < MathHelper.ceil(entity.posX); x++) 103 | for (int z = MathHelper.floor(entity.posZ); z < MathHelper.ceil(entity.posZ); z++) { 104 | BlockPos pos = new BlockPos(x, (int) y, z); 105 | 106 | if (Wrapper.getWorld().getBlockState(pos).getBlock() instanceof BlockLiquid) return true; 107 | } 108 | 109 | return false; 110 | } 111 | 112 | public static boolean isDrivenByPlayer(Entity entityIn) { 113 | return Wrapper.getPlayer() != null && entityIn != null && entityIn.equals(Wrapper.getPlayer().getRidingEntity()); 114 | } 115 | 116 | public static boolean isAboveWater(Entity entity) { 117 | return isAboveWater(entity, false); 118 | } 119 | 120 | public static boolean isAboveWater(Entity entity, boolean packet) { 121 | if (entity == null) return false; 122 | 123 | double y = entity.posY - (packet ? 0.03 : (EntityUtil.isPlayer(entity) ? 0.2 : 0.5)); // increasing this seems to flag more in NCP but needs to be increased so the player lands on solid water 124 | 125 | for (int x = MathHelper.floor(entity.posX); x < MathHelper.ceil(entity.posX); x++) 126 | for (int z = MathHelper.floor(entity.posZ); z < MathHelper.ceil(entity.posZ); z++) { 127 | BlockPos pos = new BlockPos(x, MathHelper.floor(y), z); 128 | 129 | if (Wrapper.getWorld().getBlockState(pos).getBlock() instanceof BlockLiquid) return true; 130 | } 131 | 132 | return false; 133 | } 134 | 135 | public static double[] calculateLookAt(double px, double py, double pz, EntityPlayer me) { 136 | double dirx = me.posX - px; 137 | double diry = me.posY - py; 138 | double dirz = me.posZ - pz; 139 | 140 | double len = Math.sqrt(dirx * dirx + diry * diry + dirz * dirz); 141 | 142 | dirx /= len; 143 | diry /= len; 144 | dirz /= len; 145 | 146 | double pitch = Math.asin(diry); 147 | double yaw = Math.atan2(dirz, dirx); 148 | 149 | pitch = pitch * 180.0d / Math.PI; 150 | yaw = yaw * 180.0d / Math.PI; 151 | 152 | yaw += 90f; 153 | 154 | return new double[]{yaw, pitch}; 155 | } 156 | 157 | public static boolean isPlayer(Entity entity) { 158 | return entity instanceof EntityPlayer; 159 | } 160 | 161 | public static double getRelativeX(float yaw) { 162 | return MathHelper.sin(-yaw * 0.017453292F); 163 | } 164 | 165 | public static double getRelativeZ(float yaw) { 166 | return MathHelper.cos(yaw * 0.017453292F); 167 | } 168 | 169 | public static void attackEntity(Entity entity, boolean packet, boolean swing) { 170 | if (packet) { 171 | Wrapper.getPlayer().connection.sendPacket(new CPacketUseEntity(entity)); 172 | } else { 173 | Wrapper.getPlayer().attackEntityAsMob(entity); 174 | } 175 | 176 | if (swing) { 177 | Wrapper.getPlayer().swingArm(EnumHand.MAIN_HAND); 178 | } 179 | } 180 | 181 | } 182 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/util/FileUtil.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.util; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.BufferedWriter; 5 | import java.io.DataInputStream; 6 | import java.io.File; 7 | import java.io.FileInputStream; 8 | import java.io.FileWriter; 9 | import java.io.IOException; 10 | import java.io.InputStreamReader; 11 | import java.util.ArrayList; 12 | 13 | public class FileUtil { 14 | public static void saveFile(File file, ArrayList content) throws IOException { 15 | BufferedWriter out = new BufferedWriter(new FileWriter(file)); 16 | for (String s : content) { 17 | out.write(s); 18 | out.write("\r\n"); 19 | } 20 | out.close(); 21 | } 22 | 23 | public static ArrayList loadFile(File file) throws IOException { 24 | String line; 25 | ArrayList content = new ArrayList(); 26 | FileInputStream stream = new FileInputStream(file.getAbsolutePath()); 27 | DataInputStream in = new DataInputStream(stream); 28 | BufferedReader br = new BufferedReader(new InputStreamReader(in)); 29 | while ((line = br.readLine()) != null) { 30 | content.add(line); 31 | } 32 | br.close(); 33 | return content; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/util/LoggerUtil.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.util; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.util.text.TextComponentString; 5 | 6 | public class LoggerUtil { 7 | public static void sendMessage(String message) { 8 | LoggerUtil.sendMessage(message, true); 9 | } 10 | 11 | public static void sendMessage(String message, boolean waterMark) { 12 | StringBuilder messageBuilder = new StringBuilder(); 13 | if (waterMark) { 14 | messageBuilder.append("&9[&9Lynx&9] "); 15 | } 16 | messageBuilder.append("&7").append(message); 17 | Minecraft.getMinecraft().ingameGUI.getChatGUI().printChatMessage(new TextComponentString(messageBuilder.toString().replace("&", "\u00a7"))); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/util/MathsUtil.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.util; 2 | 3 | import java.math.BigDecimal; 4 | import java.math.RoundingMode; 5 | 6 | public class MathsUtil { 7 | 8 | public static double roundDouble(double number, int scale) { 9 | BigDecimal bd = new BigDecimal(number); 10 | bd = bd.setScale(scale, RoundingMode.HALF_UP); 11 | return bd.doubleValue(); 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/util/RenderUtil.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.util; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.client.gui.ScaledResolution; 5 | import net.minecraft.client.renderer.BufferBuilder; 6 | import net.minecraft.client.renderer.GlStateManager; 7 | import net.minecraft.client.renderer.Tessellator; 8 | import net.minecraft.client.renderer.vertex.DefaultVertexFormats; 9 | 10 | import static org.lwjgl.opengl.GL11.*; 11 | import static org.lwjgl.opengl.GL11.glScissor; 12 | 13 | public class RenderUtil { 14 | 15 | public static void drawRect(float x, float y, float width, float height, int color) { 16 | float c = (float) (color >> 24 & 255) / 255.0F; 17 | float c1 = (float) (color >> 16 & 255) / 255.0F; 18 | float c2 = (float) (color >> 8 & 255) / 255.0F; 19 | float c3 = (float) (color & 255) / 255.0F; 20 | 21 | GlStateManager.pushMatrix(); 22 | GlStateManager.disableTexture2D(); 23 | GlStateManager.enableBlend(); 24 | GlStateManager.disableAlpha(); 25 | GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); 26 | GlStateManager.shadeModel(7425); 27 | Tessellator tessellator = Tessellator.getInstance(); 28 | BufferBuilder bufferbuilder = tessellator.getBuffer(); 29 | bufferbuilder.begin(7, DefaultVertexFormats.POSITION_COLOR); 30 | bufferbuilder.pos(x + width, y, 0).color(c1, c2, c3, c).endVertex(); 31 | bufferbuilder.pos(x, y, 0).color(c1, c2, c3, c).endVertex(); 32 | bufferbuilder.pos(x, y + height, 0).color(c1, c2, c3, c).endVertex(); 33 | bufferbuilder.pos(x + width, y + height, 0).color(c1, c2, c3, c).endVertex(); 34 | tessellator.draw(); 35 | GlStateManager.shadeModel(7424); 36 | GlStateManager.enableAlpha(); 37 | GlStateManager.enableTexture2D(); 38 | GlStateManager.popMatrix(); 39 | } 40 | 41 | public static void drawModalRectWithCustomSizedTexture(float x, float y, float u, float v, float width, float height, float textureWidth, float textureHeight) { 42 | float f = 1.0F / textureWidth; 43 | float f1 = 1.0F / textureHeight; 44 | Tessellator tessellator = Tessellator.getInstance(); 45 | BufferBuilder bufferbuilder = tessellator.getBuffer(); 46 | bufferbuilder.begin(7, DefaultVertexFormats.POSITION_TEX); 47 | bufferbuilder.pos(x, (y + height), 0.0D).tex((u * f), ((v + height) * f1)).endVertex(); 48 | bufferbuilder.pos((x + width), (y + height), 0.0D).tex(((u + width) * f), ((v + height) * f1)).endVertex(); 49 | bufferbuilder.pos((x + width), y, 0.0D).tex(((u + width) * f), (v * f1)).endVertex(); 50 | bufferbuilder.pos(x, y, 0.0D).tex((u * f), (v * f1)).endVertex(); 51 | tessellator.draw(); 52 | } 53 | 54 | public static void startGlScissor(double x, double y, double width, double height) { 55 | glPushAttrib(GL_SCISSOR_BIT); 56 | { 57 | scissorRect(x, y, width, height); 58 | glEnable(GL_SCISSOR_TEST); 59 | } 60 | } 61 | 62 | public static void endGlScissor() { 63 | glDisable(GL_SCISSOR_TEST); 64 | glPopAttrib(); 65 | } 66 | 67 | public static void scissorRect(double x, double y, double width, double height) { 68 | ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft()); 69 | final double scale = sr.getScaleFactor(); 70 | 71 | y = sr.getScaledHeight() - y; 72 | 73 | x *= scale; 74 | y *= scale; 75 | width *= scale; 76 | height *= scale; 77 | 78 | glScissor((int) x, (int) (y - height), (int) width, (int) height); 79 | } 80 | 81 | public static void drawStringWithShadow(String name, float x, float y, int color, boolean shadow) { 82 | Wrapper.getMinecraft().fontRenderer.drawString(name, x, y, color, shadow); 83 | } 84 | 85 | public static void drawCenteredString(String name, float x, float y, int color, boolean shadow) { 86 | Wrapper.getMinecraft().fontRenderer.drawString(name, x - (Wrapper.getMinecraft().fontRenderer.getStringWidth(name) / 2f), y, color, shadow); 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/util/Timer.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.util; 2 | 3 | import net.minecraftforge.common.MinecraftForge; 4 | import net.minecraftforge.event.entity.living.LivingEvent; 5 | import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; 6 | 7 | public class Timer { 8 | 9 | public long milliseconds; 10 | 11 | public Timer() { 12 | milliseconds = -1; 13 | 14 | MinecraftForge.EVENT_BUS.register(this); 15 | } 16 | 17 | @SubscribeEvent 18 | public void onClientTick(LivingEvent.LivingUpdateEvent event) { 19 | if (Wrapper.getWorld() == null || Wrapper.getPlayer() == null) { 20 | milliseconds = -1; 21 | } 22 | } 23 | 24 | public boolean hasTimePassed(long time, TimeFormat format) { 25 | switch (format) { 26 | case MILLISECONDS: 27 | return (System.currentTimeMillis() - milliseconds) >= time; 28 | case SECONDS: 29 | return (System.currentTimeMillis() - milliseconds) >= (time * 1000); 30 | } 31 | 32 | return false; 33 | } 34 | 35 | public void reset() { 36 | milliseconds = System.currentTimeMillis(); 37 | } 38 | 39 | public enum TimeFormat { 40 | /** 41 | * Time in milliseconds 42 | */ 43 | MILLISECONDS, 44 | 45 | /** 46 | * Time in seconds 47 | */ 48 | SECONDS 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/util/Wrapper.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.util; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.client.entity.EntityPlayerSP; 5 | import net.minecraft.entity.Entity; 6 | import net.minecraft.world.World; 7 | import org.lwjgl.input.Keyboard; 8 | 9 | public interface Wrapper { 10 | Minecraft mc = Minecraft.getMinecraft(); 11 | 12 | static Minecraft getMinecraft() { 13 | return Minecraft.getMinecraft(); 14 | } 15 | 16 | static EntityPlayerSP getPlayer() { 17 | return Wrapper.getMinecraft().player; 18 | } 19 | 20 | static Entity getRenderEntity() { 21 | return mc.getRenderViewEntity(); 22 | } 23 | 24 | static World getWorld() { 25 | return Wrapper.getMinecraft().world; 26 | } 27 | 28 | static int getKey(String keyname) { 29 | return Keyboard.getKeyIndex(keyname.toUpperCase()); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/util/notification/Notification.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.util.notification; 2 | 3 | import net.minecraft.client.Minecraft; 4 | import net.minecraft.client.gui.FontRenderer; 5 | import net.minecraft.client.renderer.BufferBuilder; 6 | import net.minecraft.client.renderer.GlStateManager; 7 | import net.minecraft.client.renderer.Tessellator; 8 | import net.minecraft.client.renderer.vertex.DefaultVertexFormats; 9 | 10 | import java.awt.*; 11 | 12 | public class Notification { 13 | private NotificationType type; 14 | private String title; 15 | 16 | private String messsage; 17 | private long start; 18 | 19 | private long fadedIn; 20 | private long fadeOut; 21 | private long end; 22 | 23 | 24 | public Notification(NotificationType type, String title, String messsage, int length) { 25 | this.type = type; 26 | this.title = title; 27 | this.messsage = messsage; 28 | 29 | fadedIn = 200 * length; 30 | fadeOut = fadedIn + 500 * length; 31 | end = fadeOut + fadedIn; 32 | } 33 | 34 | public void show() { 35 | start = System.currentTimeMillis(); 36 | } 37 | 38 | public boolean isShown() { 39 | return getTime() <= end; 40 | } 41 | 42 | private long getTime() { 43 | return System.currentTimeMillis() - start; 44 | } 45 | 46 | public void render() { 47 | double offset = 0; 48 | int width = 120; 49 | int height = 30; 50 | long time = getTime(); 51 | 52 | if (time < fadedIn) { 53 | offset = Math.tanh(time / (double) (fadedIn) * 3.0) * width; 54 | } else if (time > fadeOut) { 55 | offset = (Math.tanh(3.0 - (time - fadeOut) / (double) (end - fadeOut) * 3.0) * width); 56 | } else { 57 | offset = width; 58 | } 59 | 60 | Color color = new Color(0, 0, 0, 220); 61 | Color color1; 62 | 63 | if (type == NotificationType.Info) 64 | color1 = new Color(0, 26, 169); 65 | else if (type == NotificationType.Warning) 66 | color1 = new Color(204, 193, 0); 67 | else { 68 | color1 = new Color(204, 0, 18); 69 | int i = Math.max(0, Math.min(255, (int) (Math.sin(time / 100.0) * 255.0 / 2 + 127.5))); 70 | color = new Color(i, 0, 0, 220); 71 | } 72 | 73 | FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer; 74 | 75 | drawRect(Minecraft.getMinecraft().displayWidth - offset, Minecraft.getMinecraft().displayHeight - 5 - height, Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight - 5, color.getRGB()); 76 | drawRect(Minecraft.getMinecraft().displayWidth - offset, Minecraft.getMinecraft().displayHeight - 5 - height, Minecraft.getMinecraft().displayWidth - offset + 4, Minecraft.getMinecraft().displayHeight - 5, color1.getRGB()); 77 | 78 | fontRenderer.drawString(title, (int) (Minecraft.getMinecraft().displayWidth - offset + 8), Minecraft.getMinecraft().displayHeight - 2 - height, -1); 79 | fontRenderer.drawString(messsage, (int) (Minecraft.getMinecraft().displayWidth - offset + 8), Minecraft.getMinecraft().displayHeight - 15, -1); 80 | } 81 | 82 | public static void drawRect(double left, double top, double right, double bottom, int color) { 83 | if (left < right) { 84 | double i = left; 85 | left = right; 86 | right = i; 87 | } 88 | 89 | if (top < bottom) { 90 | double j = top; 91 | top = bottom; 92 | bottom = j; 93 | } 94 | 95 | float f3 = (float) (color >> 24 & 255) / 255.0F; 96 | float f = (float) (color >> 16 & 255) / 255.0F; 97 | float f1 = (float) (color >> 8 & 255) / 255.0F; 98 | float f2 = (float) (color & 255) / 255.0F; 99 | Tessellator tessellator = Tessellator.getInstance(); 100 | BufferBuilder worldrenderer = tessellator.getBuffer(); 101 | GlStateManager.enableBlend(); 102 | GlStateManager.disableTexture2D(); 103 | GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); 104 | GlStateManager.color(f, f1, f2, f3); 105 | worldrenderer.begin(7, DefaultVertexFormats.POSITION); 106 | worldrenderer.pos(left, bottom, 0.0D).endVertex(); 107 | worldrenderer.pos(right, bottom, 0.0D).endVertex(); 108 | worldrenderer.pos(right, top, 0.0D).endVertex(); 109 | worldrenderer.pos(left, top, 0.0D).endVertex(); 110 | tessellator.draw(); 111 | GlStateManager.enableTexture2D(); 112 | GlStateManager.disableBlend(); 113 | } 114 | 115 | public static void drawRect(int mode, double left, double top, double right, double bottom, int color) { 116 | if (left < right) { 117 | double i = left; 118 | left = right; 119 | right = i; 120 | } 121 | 122 | if (top < bottom) { 123 | double j = top; 124 | top = bottom; 125 | bottom = j; 126 | } 127 | 128 | float f3 = (float) (color >> 24 & 255) / 255.0F; 129 | float f = (float) (color >> 16 & 255) / 255.0F; 130 | float f1 = (float) (color >> 8 & 255) / 255.0F; 131 | float f2 = (float) (color & 255) / 255.0F; 132 | Tessellator tessellator = Tessellator.getInstance(); 133 | BufferBuilder worldrenderer = tessellator.getBuffer(); 134 | GlStateManager.enableBlend(); 135 | GlStateManager.disableTexture2D(); 136 | GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); 137 | GlStateManager.color(f, f1, f2, f3); 138 | worldrenderer.begin(mode, DefaultVertexFormats.POSITION); 139 | worldrenderer.pos(left, bottom, 0.0D).endVertex(); 140 | worldrenderer.pos(right, bottom, 0.0D).endVertex(); 141 | worldrenderer.pos(right, top, 0.0D).endVertex(); 142 | worldrenderer.pos(left, top, 0.0D).endVertex(); 143 | tessellator.draw(); 144 | GlStateManager.enableTexture2D(); 145 | GlStateManager.disableBlend(); 146 | } 147 | 148 | 149 | } -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/util/notification/NotificationManager.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.util.notification; 2 | 3 | import java.util.concurrent.LinkedBlockingQueue; 4 | 5 | public class NotificationManager { 6 | //https://github.com/superblaubeere27/NotificationSystem/blob/master/me/superblaubeere27/client/notifications/NotificationManager.java 7 | //credit ^^^ 8 | 9 | private static LinkedBlockingQueue pendingNotifications = new LinkedBlockingQueue<>(); 10 | private static Notification currentNotification = null; 11 | 12 | public static void show(Notification notification) { 13 | pendingNotifications.add(notification); 14 | } 15 | 16 | public static void update() { 17 | if (currentNotification != null && !currentNotification.isShown()) { 18 | currentNotification = null; 19 | } 20 | 21 | if (currentNotification == null && !pendingNotifications.isEmpty()) { 22 | currentNotification = pendingNotifications.poll(); 23 | currentNotification.show(); 24 | } 25 | 26 | } 27 | 28 | public static void render() { 29 | update(); 30 | 31 | if (currentNotification != null) 32 | currentNotification.render(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/based/lynx/util/notification/NotificationType.java: -------------------------------------------------------------------------------- 1 | package com.based.lynx.util.notification; 2 | 3 | public enum NotificationType { 4 | Info, 5 | Error, 6 | Warning 7 | } 8 | -------------------------------------------------------------------------------- /src/main/resources/assets/lynx/textures/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Based-devs/Lynx/5942cd8cdb54259781974f848ea5aeb329117fd9/src/main/resources/assets/lynx/textures/background.png -------------------------------------------------------------------------------- /src/main/resources/mcmod.info: -------------------------------------------------------------------------------- 1 | { 2 | "modid": "lynx", 3 | "name": "Lynx", 4 | "description": "Minecraft 1.12.2 utility mod for anarchy servers", 5 | "version": "1.0.0", 6 | "mcversion": "1.12.2", 7 | "url": "", 8 | "updateUrl": "", 9 | "authorList": [ 10 | "based ppl" 11 | ], 12 | "credits": "", 13 | "logoFile": "", 14 | "screenshots": [], 15 | "dependencies": [] 16 | } 17 | 18 | -------------------------------------------------------------------------------- /src/main/resources/mixins.lynx.json: -------------------------------------------------------------------------------- 1 | { 2 | "required": true, 3 | "compatibilityLevel": "JAVA_8", 4 | "package": "com.based.lynx.mixin.mixins", 5 | "refmap": "mixins.lynx.refmap.json", 6 | "mixins": [ 7 | "render.gui.MixinGuiMainMenu" 8 | ] 9 | } --------------------------------------------------------------------------------