Skip to content

Commit

Permalink
Merge pull request #58 from AdyTech99/main
Browse files Browse the repository at this point in the history
Fixes #54, #55, #56, #57
  • Loading branch information
MichaelHillcox authored Jun 22, 2024
2 parents 0247e81 + 7c1e5f8 commit 7aaa431
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 23 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'fabric-loom' version '1.7-SNAPSHOT'
id 'maven-publish'
id 'pro.mikey.plugins.insaniam' version "0.1-SNAPSHOT"
id "me.modmuss50.mod-publish-plugin" version "0.5.1"
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
35 changes: 19 additions & 16 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
Expand All @@ -25,7 +25,8 @@
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand All @@ -40,13 +41,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -56,11 +57,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2

goto fail

Expand All @@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal
Expand Down
11 changes: 6 additions & 5 deletions src/main/java/pro/mikey/autoclicker/AutoClicker.java
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ private void clientTickEvent(MinecraftClient mc) {
if (mc.player == null || mc.world == null) {
return;
}
if(!mc.player.isAlive()) this.isActive = false;

if (this.isActive) {
if (leftHolding.isActive()) {
Expand Down Expand Up @@ -196,7 +197,7 @@ private void handleActiveHolding(MinecraftClient mc, Holding key) {
// Normal holding or cool down behaviour
// respect cool down
if (key.isRespectCooldown()) {
// Don't do anything if they're not looking at somethign
// Don't do anything if they're not looking at something
if (key instanceof Holding.AttackHolding && ((Holding.AttackHolding) key).isMobMode() && !this.isPlayerLookingAtMob(mc)) {
if (key.getKey().isPressed()) {
key.getKey().setPressed(false);
Expand Down Expand Up @@ -242,7 +243,7 @@ private boolean isShielding(ClientPlayerEntity player) {

private boolean isPlayerLookingAtMob(MinecraftClient mc) {
HitResult rayTrace = mc.crosshairTarget;
return rayTrace instanceof EntityHitResult && ((EntityHitResult) rayTrace).getEntity() instanceof LivingEntity;
return rayTrace instanceof EntityHitResult && ((EntityHitResult) rayTrace).getEntity() instanceof LivingEntity livingEntity && livingEntity.isAlive() && livingEntity.isAttackable();
}

private void keyInputEvent(MinecraftClient mc) {
Expand All @@ -258,9 +259,9 @@ private void keyInputEvent(MinecraftClient mc) {
);

if (!this.isActive) {
leftHolding.getKey().setPressed(false);
rightHolding.getKey().setPressed(false);
jumpHolding.getKey().setPressed(false);
if(leftHolding.isActive()) leftHolding.getKey().setPressed(false);
if(rightHolding.isActive()) rightHolding.getKey().setPressed(false);
if(jumpHolding.isActive()) jumpHolding.getKey().setPressed(false);
}
}

Expand Down

0 comments on commit 7aaa431

Please sign in to comment.