Skip to content

Commit

Permalink
1.20.6 update
Browse files Browse the repository at this point in the history
  • Loading branch information
MiranCZ committed Jun 12, 2024
1 parent 602828d commit 2b95b30
Show file tree
Hide file tree
Showing 35 changed files with 376 additions and 120 deletions.
25 changes: 20 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,18 @@ plugins {
apply plugin: 'fabric-loom'
apply plugin: 'com.replaymod.preprocess'

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
preprocess {
patternAnnotation.set("adris.altoclef.multiversion.Pattern")
}

sourceCompatibility = mcVersion >= 12006 ? JavaVersion.VERSION_21 : JavaVersion.VERSION_17
targetCompatibility = sourceCompatibility



tasks.withType(JavaCompile).configureEach {
options.release = mcVersion >= 12006 ? 21 : 17
}

archivesBaseName = project.archives_base_name
version = "${project.name}-${project.mod_version}"
Expand All @@ -29,38 +39,43 @@ def mappingsVersions = [
12001: "1.20.1+build.10",
12002: "1.20.2+build.4",
12004: "1.20.4+build.3",
12006: "1.20.6+build.3",
]

def fabricApiVersions = [
12001: "0.92.2+1.20.1",
12002: "0.91.2+1.20.2",
12004: "0.96.3+1.20.4",
12006: "0.100.0+1.20.6",
]

def baritoneVersions = [
12001: "1.20.1-beta1",
12002: "1.20.2-beta1",
12004: "1.20.4-beta1",
12006: "1.20.6-beta1",
]

def baritoneApiPaths = [
12001: "baritone-unoptimized",
12002: "baritone-unoptimized-fabric",
12004: "baritone-unoptimized-fabric",
12006: "baritone-unoptimized-fabric",
]

def baritonePaths = [
12001: "baritone-unoptimized",
12002: "baritone-unoptimized",
12004: "baritone-unoptimized-fabric",
12006: "baritone-unoptimized-fabric",
]

repositories {
mavenCentral()
maven {
name = "MarvionKiritoRepo"
url = "https://marvionkirito.github.io/maven/"
artifactUrls("https://marvionkirito.github.io/maven/cabaletta/baritone-unoptimized/${baritoneVersions[mcVersion]}")
name = "MiranCZRepo"
url = "https://mirancz.github.io/maven/"
artifactUrls("https://mirancz.github.io/maven/cabaletta/baritone-unoptimized/${baritoneVersions[mcVersion]}")
}
maven {
name = 'babbaj-repo'
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
org.gradle.caching=true
org.gradle.warning.mode=all

loader_version=0.15.7
loader_version=0.15.11
# Mod Properties
mod_version=0.16
maven_group=gaucho-matrero.altoclef
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.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
45 changes: 31 additions & 14 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,13 +80,11 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down Expand Up @@ -127,26 +125,35 @@ if [ -n "$JAVA_HOME" ] ; then
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi

# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -191,18 +198,28 @@ if "$cygwin" || "$msys" ; then
done
fi

# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.

set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand All @@ -229,4 +246,4 @@ eval "set -- $(
tr '\n' ' '
)" '"$@"'

exec "$JAVACMD" "$@"
exec "$JAVACMD" "$@"
37 changes: 20 additions & 17 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,15 +76,17 @@ 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

:omega
:omega
4 changes: 3 additions & 1 deletion root.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id("fabric-loom") version "1.1-SNAPSHOT" apply false
id("fabric-loom") version "1.6-SNAPSHOT" apply false
id("com.replaymod.preprocess") version "b09f534"
}

Expand All @@ -16,10 +16,12 @@ subprojects {
}

preprocess {
val mc12006 = createNode("1.20.6", 12006, "yarn")
val mc12004 = createNode("1.20.4", 12004, "yarn")
val mc12002 = createNode("1.20.2", 12002, "yarn")
val mc12001 = createNode("1.20.1", 12001, "yarn")

mc12006.link(mc12004)
mc12004.link(mc12002)
mc12002.link(mc12001)
}
1 change: 1 addition & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ rootProject.name = "altoclef"
rootProject.buildFileName = "root.gradle.kts"

listOf(
"1.20.6",
"1.20.4",
"1.20.2",
"1.20.1"
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/adris/altoclef/chains/DeathMenuChain.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public float getPriority(AltoClef mod) {
Debug.logWarning("Failed to re-connect to server, no server entry cached.");
} else {
MinecraftClient client = MinecraftClient.getInstance();
ConnectScreen.connect(screen, client, ServerAddress.parse(prevServerEntry.address), prevServerEntry, false);
ConnectScreen.connect(screen, client, ServerAddress.parse(prevServerEntry.address), prevServerEntry, false,null);
//ConnectScreen.connect(screen, client, ServerAddress.parse(_prevServerEntry.address), _prevServerEntry);
//client.setScreen(new ConnectScreen(screen, client, _prevServerEntry));
}
Expand Down
12 changes: 7 additions & 5 deletions src/main/java/adris/altoclef/chains/FoodChain.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import adris.altoclef.AltoClef;
import adris.altoclef.Settings;
import adris.altoclef.multiversion.FoodComponentWrapper;
import adris.altoclef.multiversion.ItemVer;
import adris.altoclef.tasks.resources.CollectFoodTask;
import adris.altoclef.tasks.speedrun.DragonBreathTracker;
import adris.altoclef.tasksystem.TaskRunner;
Expand All @@ -13,7 +15,6 @@
import net.minecraft.entity.Entity;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.entity.mob.HostileEntity;
import net.minecraft.item.FoodComponent;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
Expand Down Expand Up @@ -243,7 +244,8 @@ public boolean needsToEat() {
if (foodLevel < config.alwaysEatWhenBelowHungerAndPerfectFit && cachedPerfectFood.isPresent()) {
int need = 20 - foodLevel;
Item best = cachedPerfectFood.get();
int fills = (best.getFoodComponent() != null) ? best.getFoodComponent().getHunger() : -1;

int fills = (ItemVer.getFoodComponent(best) != null) ? ItemVer.getFoodComponent(best).getHunger() : -1;
return fills == need;
}

Expand All @@ -261,7 +263,7 @@ private Pair<Integer, Optional<Item>> calculateFood(AltoClef mod) {
float saturation = player != null ? player.getHungerManager().getSaturationLevel() : 20;
// Get best food item + calculate food total
for (ItemStack stack : mod.getItemStorage().getItemStacksPlayerInventory(true)) {
if (stack.isFood()) {
if (ItemVer.isFood(stack)) {
// Ignore protected items
if (!ItemHelper.canThrowAwayStack(mod, stack)) continue;

Expand All @@ -270,7 +272,7 @@ private Pair<Integer, Optional<Item>> calculateFood(AltoClef mod) {
continue;
}

FoodComponent food = stack.getItem().getFoodComponent();
FoodComponentWrapper food = ItemVer.getFoodComponent(stack.getItem());

assert food != null;
float hungerIfEaten = Math.min(hunger + food.getHunger(), 20);
Expand Down Expand Up @@ -298,7 +300,7 @@ private Pair<Integer, Optional<Item>> calculateFood(AltoClef mod) {
bestFood = stack.getItem();
}

foodTotal += Objects.requireNonNull(stack.getItem().getFoodComponent()).getHunger() * stack.getCount();
foodTotal += Objects.requireNonNull(ItemVer.getFoodComponent(stack.getItem())).getHunger() * stack.getCount();
}
}

Expand Down
Loading

0 comments on commit 2b95b30

Please sign in to comment.