From c75e64759162bbcfd1ee120a166e44516ea376be Mon Sep 17 00:00:00 2001 From: wine Date: Fri, 10 Aug 2018 15:06:45 +0200 Subject: [PATCH 01/15] Fix Windows gradlew formatting --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9a8fdca1..ed7531e9 100644 --- a/README.md +++ b/README.md @@ -32,19 +32,19 @@ git clone https://github.com/zeroeightysix/KAMI/ cd KAMI ``` -On linux, run `chmod +x gradlew` and for the following commands use `./gradlew` instead of `./gradlew.bat` +On linux, run `chmod +x gradlew` and for the following commands use `./gradlew` instead of `gradlew.bat` ``` -./gradlew.bat setupDecompWorkspace +gradlew.bat setupDecompWorkspace ``` -Import KAMI into your IDE of choice. If you use intelliJ, import from the `build.gradle` file and run `./gradlew.bat genIntellijRuns` +Import KAMI into your IDE of choice. If you use intelliJ, import from the `build.gradle` file and run `gradlew.bat genIntellijRuns` -If you do not wish to run from an IDE, use `./gradlew.bat runClient` to run KAMI. +If you do not wish to run from an IDE, use `gradlew.bat runClient` to run KAMI. ### Building ``` -./gradlew.bat build +gradlew.bat build cd build/libs ``` In `build/libs` you will find a file `KAMI---full.jar` which you can copy to the `mods` folder of a minecraft instance that has forge installed. From 9265b4032bfebb2cb410b46df4c5148e058aeb18 Mon Sep 17 00:00:00 2001 From: wine Date: Fri, 10 Aug 2018 15:07:49 +0200 Subject: [PATCH 02/15] Reformat troubleshooting section --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ed7531e9..a07532e9 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,8 @@ KAMI is a forge mod. Start by downloading the latest version of [forge](https:// 5. Place the `.jar` file in your mods directory. ## Troubleshooting -Please reference the main troubleshooting page: [Troubleshooting](https://github.com/zeroeightysix/KAMI/blob/master/TROUBLESHOOTING.md) +Please reference the main [troubleshooting page](https://github.com/zeroeightysix/KAMI/blob/master/TROUBLESHOOTING.md) + If you experience an issue and it's not listed there, please [open a new issue](https://github.com/zeroeightysix/KAMI/issues/new) and a contributor will help you further. ## Contributing From b0ddd09cedb2dc7580c35ec9895f71dda49886c1 Mon Sep 17 00:00:00 2001 From: wine Date: Fri, 10 Aug 2018 15:09:43 +0200 Subject: [PATCH 03/15] Move troubleshooting documenation to docs folder --- TROUBLESHOOTING.md => docs/TROUBLESHOOTING.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename TROUBLESHOOTING.md => docs/TROUBLESHOOTING.md (100%) diff --git a/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.md similarity index 100% rename from TROUBLESHOOTING.md rename to docs/TROUBLESHOOTING.md From 94d017bb36d63599bd36aa626ab537288c5a2e96 Mon Sep 17 00:00:00 2001 From: wine Date: Fri, 10 Aug 2018 15:09:56 +0200 Subject: [PATCH 04/15] Make troubleshooting link relative --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a07532e9..629ec2ad 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ KAMI is a forge mod. Start by downloading the latest version of [forge](https:// 5. Place the `.jar` file in your mods directory. ## Troubleshooting -Please reference the main [troubleshooting page](https://github.com/zeroeightysix/KAMI/blob/master/TROUBLESHOOTING.md) +Please reference the main [troubleshooting page](docs/TROUBLESHOOTING.md) If you experience an issue and it's not listed there, please [open a new issue](https://github.com/zeroeightysix/KAMI/issues/new) and a contributor will help you further. From ee1e85f2d576cab8ba08526c2c3d06e8e884f643 Mon Sep 17 00:00:00 2001 From: wine Date: Fri, 10 Aug 2018 15:10:20 +0200 Subject: [PATCH 05/15] Make issues link relative --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 629ec2ad..b360bdf1 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ KAMI is a forge mod. Start by downloading the latest version of [forge](https:// ## Troubleshooting Please reference the main [troubleshooting page](docs/TROUBLESHOOTING.md) -If you experience an issue and it's not listed there, please [open a new issue](https://github.com/zeroeightysix/KAMI/issues/new) and a contributor will help you further. +If you experience an issue and it's not listed there, please [open a new issue](issues/new) and a contributor will help you further. ## Contributing From ad7a1eaabdd923863dea0f564d842933306d8025 Mon Sep 17 00:00:00 2001 From: wine Date: Fri, 10 Aug 2018 15:14:19 +0200 Subject: [PATCH 06/15] Make issue link relative (path traverse) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b360bdf1..660eb14f 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ KAMI is a forge mod. Start by downloading the latest version of [forge](https:// ## Troubleshooting Please reference the main [troubleshooting page](docs/TROUBLESHOOTING.md) -If you experience an issue and it's not listed there, please [open a new issue](issues/new) and a contributor will help you further. +If you experience an issue and it's not listed there, please [open a new issue](../../issues/new) and a contributor will help you further. ## Contributing From 7d3e7a438651f9ab3385ca20c3e0c220dc9182b0 Mon Sep 17 00:00:00 2001 From: wine Date: Fri, 10 Aug 2018 15:16:03 +0200 Subject: [PATCH 07/15] Fix capitalization in IntelliJ --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 660eb14f..1adc1a95 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ On linux, run `chmod +x gradlew` and for the following commands use `./gradlew` ``` gradlew.bat setupDecompWorkspace ``` -Import KAMI into your IDE of choice. If you use intelliJ, import from the `build.gradle` file and run `gradlew.bat genIntellijRuns` +Import KAMI into your IDE of choice. If you use IntelliJ, import from the `build.gradle` file and run `gradlew.bat genIntellijRuns` If you do not wish to run from an IDE, use `gradlew.bat runClient` to run KAMI. From 8aa694afc47d5190453c734025bde7429a15a30e Mon Sep 17 00:00:00 2001 From: wine Date: Fri, 10 Aug 2018 15:21:57 +0200 Subject: [PATCH 08/15] Make releases path relative --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1adc1a95..479d1538 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ KAMI is a forge mod. Start by downloading the latest version of [forge](https:// * **Linux**: `~/.minecraft` 3. Navigate to the `mods` directory. If it doesn't exist, create it. 4. Obtain the KAMI `.jar` file. - * By **downloading** it: see [releases](https://github.com/zeroeightysix/KAMI/releases) + * By **downloading** it: see [releases](../../releases) * By **building** it: see [Building](#building). 5. Place the `.jar` file in your mods directory. From e6eff06d0f07b55986c97c76b33831faba324bff Mon Sep 17 00:00:00 2001 From: wine Date: Fri, 10 Aug 2018 15:23:05 +0200 Subject: [PATCH 09/15] Fix capitalization in building --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 479d1538..0a736e99 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ KAMI is a forge mod. Start by downloading the latest version of [forge](https:// 3. Navigate to the `mods` directory. If it doesn't exist, create it. 4. Obtain the KAMI `.jar` file. * By **downloading** it: see [releases](../../releases) - * By **building** it: see [Building](#building). + * By **building** it: see [building](#building). 5. Place the `.jar` file in your mods directory. ## Troubleshooting From 8e4ab8fe7a282ea495ff8a3f2104c79873352e95 Mon Sep 17 00:00:00 2001 From: wine Date: Fri, 10 Aug 2018 15:24:53 +0200 Subject: [PATCH 10/15] Add gitignore --- .gitignore | 270 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 270 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..141e2536 --- /dev/null +++ b/.gitignore @@ -0,0 +1,270 @@ +# Created by https://www.gitignore.io/api/linux,gradle,eclipse,windows,forgegradle,intellij+all,emacs,vim + +### Eclipse ### + +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.settings/ +.loadpath +.recommenders + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# PyDev specific (Python IDE for Eclipse) +*.pydevproject + +# CDT-specific (C/C++ Development Tooling) +.cproject + +# CDT- autotools +.autotools + +# Java annotation processor (APT) +.factorypath + +# PDT-specific (PHP Development Tools) +.buildpath + +# sbteclipse plugin +.target + +# Tern plugin +.tern-project + +# TeXlipse plugin +.texlipse + +# STS (Spring Tool Suite) +.springBeans + +# Code Recommenders +.recommenders/ + +# Annotation Processing +.apt_generated/ + +# Scala IDE specific (Scala & Java development for Eclipse) +.cache-main +.scala_dependencies +.worksheet + +### Eclipse Patch ### +# Eclipse Core +.project + +# JDT-specific (Eclipse Java Development Tools) +.classpath + +# Annotation Processing +.apt_generated + +### Emacs ### +# -*- mode: gitignore; -*- +*~ +\#*\# +/.emacs.desktop +/.emacs.desktop.lock +*.elc +auto-save-list +tramp +.\#* + +# Org-mode +.org-id-locations +*_archive + +# flymake-mode +*_flymake.* + +# eshell files +/eshell/history +/eshell/lastdir + +# elpa packages +/elpa/ + +# reftex files +*.rel + +# AUCTeX auto folder +/auto/ + +# cask packages +.cask/ +dist/ + +# Flycheck +flycheck_*.el + +# server auth directory +/server/ + +# projectiles files +.projectile + +# directory configuration +.dir-locals.el + +### ForgeGradle ### +# Minecraft client/server files +run/ + +### Intellij+all ### +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/modules.xml +# .idea/*.iml +# .idea/modules + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +### Intellij+all Patch ### +# Ignores the whole .idea folder and all .iml files +# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360 + +.idea/ + +# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023 + +*.iml +modules.xml +.idea/misc.xml +*.ipr + +### Linux ### + +# temporary files which can be created if a process still has a handle open of a deleted file +.fuse_hidden* + +# KDE directory preferences +.directory + +# Linux trash folder which might appear on any partition or disk +.Trash-* + +# .nfs files are created when an open file is removed but is still being accessed +.nfs* + +### Vim ### +# Swap +[._]*.s[a-v][a-z] +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session +Session.vim + +# Temporary +.netrwhist +# Auto-generated tag files +tags +# Persistent undo +[._]*.un~ + +### Windows ### +# Windows thumbnail cache files +Thumbs.db +ehthumbs.db +ehthumbs_vista.db + +# Dump file +*.stackdump + +# Folder config file +[Dd]esktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msix +*.msm +*.msp + +# Windows shortcuts +*.lnk + +### Gradle ### +.gradle +/build/ + +# Ignore Gradle GUI config +gradle-app.setting + +# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) +!gradle-wrapper.jar + +# Cache of project +.gradletasknamecache + +# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 +# gradle/wrapper/gradle-wrapper.properties + +# End of https://www.gitignore.io/api/linux,gradle,eclipse,windows,forgegradle,intellij+all,emacs,vim \ No newline at end of file From 1956ecdcaabd159ea2f3f72e2563ee775163119e Mon Sep 17 00:00:00 2001 From: wine Date: Fri, 10 Aug 2018 15:37:55 +0200 Subject: [PATCH 11/15] Refactor brightness variables --- .../kami/module/modules/render/Brightness.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/render/Brightness.java b/src/main/java/me/zeroeightsix/kami/module/modules/render/Brightness.java index e901e909..6f2ae50a 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/render/Brightness.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/render/Brightness.java @@ -13,31 +13,31 @@ public class Brightness extends Module { public float brightness = 8; @Setting(name = "prev_brightness", hidden = true) - public float prevbrightness = 1; + public float prevBrightness = 1; boolean goingDown = false; @Override protected void onEnable() { if (goingDown) { - mc.gameSettings.gammaSetting=prevbrightness; + mc.gameSettings.gammaSetting = prevBrightness; alwaysListening = false; goingDown = false; } - prevbrightness = mc.gameSettings.gammaSetting; + prevBrightness = mc.gameSettings.gammaSetting; } @Override public void onUpdate() { if (goingDown) { - float dif = (prevbrightness-mc.gameSettings.gammaSetting); - mc.gameSettings.gammaSetting += dif*0.1f; - if (Math.abs(dif) <= .05f) { - mc.gameSettings.gammaSetting = prevbrightness; + float diff = (prevBrightness - mc.gameSettings.gammaSetting); + mc.gameSettings.gammaSetting += diff * 0.1f; + if (Math.abs(diff) <= .05f) { + mc.gameSettings.gammaSetting = prevBrightness; setAlwaysListening(false); goingDown = false; } }else - mc.gameSettings.gammaSetting += (brightness-mc.gameSettings.gammaSetting)*0.1f; + mc.gameSettings.gammaSetting += (brightness - mc.gameSettings.gammaSetting) * 0.1f; } @Override From 2856a04c10ef3d50ca25e416a9b0d641c290df2f Mon Sep 17 00:00:00 2001 From: wine Date: Fri, 10 Aug 2018 15:38:51 +0200 Subject: [PATCH 12/15] Inner enums don't have to be static --- .../me/zeroeightsix/kami/module/modules/movement/Flight.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/movement/Flight.java b/src/main/java/me/zeroeightsix/kami/module/modules/movement/Flight.java index 2141fbfd..310cd207 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/movement/Flight.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/movement/Flight.java @@ -62,7 +62,7 @@ public class Flight extends Module { } } - public static enum FlightMode { + public enum FlightMode { VANILLA, STATIC } From 21bbc79899f7fd5d59c3ae99b184184fc85839d7 Mon Sep 17 00:00:00 2001 From: wine Date: Fri, 10 Aug 2018 15:39:24 +0200 Subject: [PATCH 13/15] Rename ignored exception --- .../me/zeroeightsix/kami/module/modules/movement/Sprint.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/movement/Sprint.java b/src/main/java/me/zeroeightsix/kami/module/modules/movement/Sprint.java index e217b047..2f318dbf 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/movement/Sprint.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/movement/Sprint.java @@ -16,7 +16,7 @@ public class Sprint extends Module { mc.player.setSprinting(true); else mc.player.setSprinting(false); - } catch (Exception e) {} + } catch (Exception ignored) {} } } From d53aaa15d5311cdfaf826e28485975b530294859 Mon Sep 17 00:00:00 2001 From: wine Date: Fri, 10 Aug 2018 15:39:45 +0200 Subject: [PATCH 14/15] Rename ignored exception --- src/main/java/me/zeroeightsix/kami/util/Friends.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/me/zeroeightsix/kami/util/Friends.java b/src/main/java/me/zeroeightsix/kami/util/Friends.java index 83573aa9..8da76a03 100644 --- a/src/main/java/me/zeroeightsix/kami/util/Friends.java +++ b/src/main/java/me/zeroeightsix/kami/util/Friends.java @@ -67,7 +67,7 @@ public class Friends extends SettingsClass { String username = split[0]; UUID uuid = UUID.fromString(split[1]); friends.add(new Friend(getUsernameByUUID(uuid, username),uuid)); - } catch (Exception e) {} // Empty line, wrong formatting or something, we don't care + } catch (Exception ignored) {} // Empty line, wrong formatting or something, we don't care } return friends; } From ed1e73ff3d198f46cbec70bd8b54d343b2654044 Mon Sep 17 00:00:00 2001 From: wine Date: Fri, 10 Aug 2018 15:41:41 +0200 Subject: [PATCH 15/15] Replace packets arraylist with queue --- .../zeroeightsix/kami/module/modules/player/Blink.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/main/java/me/zeroeightsix/kami/module/modules/player/Blink.java b/src/main/java/me/zeroeightsix/kami/module/modules/player/Blink.java index 99d2877f..6930989c 100644 --- a/src/main/java/me/zeroeightsix/kami/module/modules/player/Blink.java +++ b/src/main/java/me/zeroeightsix/kami/module/modules/player/Blink.java @@ -7,6 +7,8 @@ import me.zeroeightsix.kami.module.Module; import net.minecraft.network.play.client.CPacketPlayer; import java.util.ArrayList; +import java.util.LinkedList; +import java.util.Queue; /** * Created by 086 on 24/01/2018. @@ -14,7 +16,7 @@ import java.util.ArrayList; @Module.Info(name = "Blink", category = Module.Category.PLAYER) public class Blink extends Module { - ArrayList packets = new ArrayList<>(); + Queue packets = new LinkedList<>(); @EventHandler public Listener listener = new Listener<>(event -> { @@ -26,9 +28,8 @@ public class Blink extends Module { @Override protected void onDisable() { - for (CPacketPlayer cPacketPlayer : packets) - mc.player.connection.sendPacket(cPacketPlayer); - packets.clear(); + while (!packets.isEmpty()) + mc.player.connection.sendPacket(packets.poll()); } @Override