Skip to content

Commit

Permalink
Merge branch 'master' into murder-mystery
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueGradientHorizon authored Apr 4, 2024
2 parents 8305944 + eb43316 commit 381d2c4
Show file tree
Hide file tree
Showing 13 changed files with 88 additions and 26 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
uses: actions/checkout@v4

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
uses: gradle/wrapper-validation-action@v2

- name: Set up Java 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'microsoft'
Expand All @@ -33,7 +33,7 @@ jobs:
run: chmod +x gradlew

- name: Setup Gradle
uses: gradle/gradle-build-action@v2
uses: gradle/gradle-build-action@v3

- name: Check code style with Spotless
id: spotless_check
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
}

plugins {
id 'fabric-loom' version '1.5-SNAPSHOT'
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'maven-publish'
id 'com.diffplug.spotless' version '6.23.3'
}
Expand Down Expand Up @@ -88,7 +88,7 @@ spotless {
// configure the maven publication
publishing {
publications {
mavenJava(MavenPublication) {
create("mavenJava", MavenPublication) {
from components.java
}
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ org.gradle.parallel=true
# https://www.curseforge.com/minecraft/mc-mods/fabric-api
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.3
loader_version=0.15.7
loader_version=0.15.9

#Fabric api
fabric_version=0.96.11+1.20.4
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 1 addition & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -246,4 +246,4 @@ eval "set -- $(
tr '\n' ' '
)" '"$@"'

exec "$JAVACMD" "$@"
exec "$JAVACMD" "$@"
22 changes: 11 additions & 11 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
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 @@ -57,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 Down Expand Up @@ -89,4 +89,4 @@ exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
:omega
6 changes: 3 additions & 3 deletions src/main/java/net/wurstclient/hacks/AutoLibrarianHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ private void breakJobSite()
// damage block and swing hand
if(MC.interactionManager.updateBlockBreakingProgress(jobSite,
params.side()))
swingHand.getSelected().swing(Hand.MAIN_HAND);
swingHand.swing(Hand.MAIN_HAND);

// update progress
overlay.updateProgress();
Expand Down Expand Up @@ -359,7 +359,7 @@ private void placeJobSite()

// swing hand
if(result.isAccepted() && result.shouldSwingHand())
swingHand.getSelected().swing(hand);
swingHand.swing(hand);

// reset sneak
((IKeyBinding)MC.options.sneakKey).resetPressedState();
Expand Down Expand Up @@ -401,7 +401,7 @@ private void openTradeScreen()

// swing hand
if(actionResult.isAccepted() && actionResult.shouldSwingHand())
swingHand.getSelected().swing(hand);
swingHand.swing(hand);

// set cooldown
MC.itemUseCooldown = 4;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/wurstclient/hacks/TreeBotHack.java
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ private boolean breakBlock(BlockPos pos)
// damage block and swing hand
if(MC.interactionManager.updateBlockBreakingProgress(pos,
params.side()))
swingHand.getSelected().swing(Hand.MAIN_HAND);
swingHand.swing(Hand.MAIN_HAND);

// update progress
overlay.updateProgress();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Copyright (c) 2014-2024 Wurst-Imperium and contributors.
*
* This source code is subject to the terms of the GNU General Public
* License, version 3. If a copy of the GPL was not distributed with this
* file, You can obtain one at: https://www.gnu.org/licenses/gpl-3.0.txt
*/
package net.wurstclient.settings;

import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.util.Locale;

public final class RoundingPrecisionSetting extends SliderSetting
{
private static final DecimalFormatSymbols SYMBOLS =
new DecimalFormatSymbols(Locale.ENGLISH);

private final DecimalFormat[] FORMATS;

public RoundingPrecisionSetting(String name, String description, int value,
int min, int max)
{
super(name, description, value, min, max, 1,
ValueDisplay.ROUNDING_PRECISION);

if(min < 0)
throw new IllegalArgumentException(
"min must be greater than or equal to 0");

FORMATS = new DecimalFormat[max + 1];
}

public DecimalFormat getFormat()
{
int value = getValueI();

if(FORMATS[value] == null)
{
String pattern = "0";
if(value > 0)
pattern += "." + "#".repeat(value);

FORMATS[value] = new DecimalFormat(pattern, SYMBOLS);
}

return FORMATS[value];
}

public String format(double value)
{
return getFormat().format(value);
}
}
3 changes: 3 additions & 0 deletions src/main/java/net/wurstclient/settings/SliderSetting.java
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,9 @@ public String getValueString(double v)

public static final ValueDisplay DEGREES = INTEGER.withSuffix("\u00b0");

public static final ValueDisplay ROUNDING_PRECISION =
v -> (int)v == 0 ? "1" : "0." + "0".repeat((int)v - 1) + "1";

public static final ValueDisplay NONE = v -> "";

public String getValueString(double value);
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/net/wurstclient/settings/SwingHandSetting.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ public SwingHandSetting(String name, String description, SwingHand selected)
super(name, description, SwingHand.values(), selected);
}

public void swing(Hand hand)
{
getSelected().swing(hand);
}

public enum SwingHand
{
OFF("Off", hand -> {}),
Expand All @@ -44,8 +49,8 @@ public enum SwingHand

CLIENT("Client-side", hand -> MC.player.swingHand(hand));

private String name;
private Consumer<Hand> swing;
private final String name;
private final Consumer<Hand> swing;

private SwingHand(String name, Consumer<Hand> swing)
{
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"accessWidener" : "wurst.accesswidener",

"depends": {
"fabricloader": ">=0.15.0",
"fabricloader": ">=0.15.9",
"fabric-api": ">=0.91.1",
"minecraft": "~1.20.3-beta.3",
"java": ">=17"
Expand Down

0 comments on commit 381d2c4

Please sign in to comment.