Skip to content

Commit

Permalink
feat: update to 1.21.3 (#27)
Browse files Browse the repository at this point in the history
* chore(deps): gradle 8.6 -> 8.11

* chore(deps): loom 1.6 -> 1.8

* feat: update to 1.21.3
  • Loading branch information
uku3lig authored Nov 23, 2024
1 parent e8620af commit da92871
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 36 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.8-SNAPSHOT'
}

version = "${project.mod_version}+mc${project.minecraft_version}"
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/develop/
minecraft_version=1.21.1
yarn_mappings=1.21.1+build.3
loader_version=0.16.2
minecraft_version=1.21.3
yarn_mappings=1.21.3+build.2
loader_version=0.16.9

# Fabric API
fabric_version=0.102.1+1.21.1
fabric_version=0.109.0+1.21.3

# Mod Properties
mod_version=0.1.5
Expand All @@ -18,4 +18,4 @@ maven_group=com.github.getchoo

# Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api
mod_menu_version=11.0.1
mod_menu_version=12.0.0-beta.1
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.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
14 changes: 7 additions & 7 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@ 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=SC3045
# 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=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down Expand Up @@ -202,11 +202,11 @@ fi
# 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, 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.
# 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" \
Expand Down
20 changes: 10 additions & 10 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
27 changes: 16 additions & 11 deletions src/main/java/com/github/getchoo/smoothboot/mixin/UtilMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@
import com.github.getchoo.smoothboot.util.LoggingForkJoinWorkerThread;
import net.minecraft.util.Util;
import net.minecraft.util.math.MathHelper;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
import org.spongepowered.asm.mixin.Shadow;
import net.minecraft.util.thread.NameableExecutor;
import org.spongepowered.asm.mixin.*;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
Expand All @@ -26,10 +24,10 @@ public abstract class UtilMixin {
private static ExecutorService BOOTSTRAP_EXECUTOR;*/

@Shadow @Final @Mutable
private static ExecutorService MAIN_WORKER_EXECUTOR;
private static NameableExecutor MAIN_WORKER_EXECUTOR;

@Shadow @Final @Mutable
private static ExecutorService IO_WORKER_EXECUTOR;
private static NameableExecutor IO_WORKER_EXECUTOR;

@Shadow
private static void uncaughtExceptionHandler(Thread thread, Throwable throwable) {}
Expand Down Expand Up @@ -64,16 +62,17 @@ private static void onGetIoWorkerExecutor(CallbackInfoReturnable<Executor> ci) {
/**
* Replace
*/
private static ExecutorService replWorker(String name) {
@Unique
private static NameableExecutor replWorker(String name) {
if (!SmoothBoot.initConfig) {
SmoothBoot.regConfig();
SmoothBoot.initConfig = true;
}

AtomicInteger atomicInteger = new AtomicInteger(1);

return new ForkJoinPool(MathHelper.clamp(select(name, SmoothBoot.config.threadCount.bootstrap,
SmoothBoot.config.threadCount.main), 1, 0x7fff), (forkJoinPool) -> {
ExecutorService service = new ForkJoinPool(MathHelper.clamp(select(name, SmoothBoot.config.threadCount.bootstrap,
SmoothBoot.config.threadCount.main), 1, 0x7fff), forkJoinPool -> {
String workerName = "Worker-" + name + "-" + atomicInteger.getAndIncrement();
SmoothBoot.LOGGER.debug("Initialized " + workerName);

Expand All @@ -83,15 +82,18 @@ private static ExecutorService replWorker(String name) {
forkJoinWorkerThread.setName(workerName);
return forkJoinWorkerThread;
}, UtilMixin::uncaughtExceptionHandler, true);

return new NameableExecutor(service);
}

/**
* Replace
*/
private static ExecutorService replIoWorker() {
@Unique
private static NameableExecutor replIoWorker() {
AtomicInteger atomicInteger = new AtomicInteger(1);

return Executors.newCachedThreadPool((runnable) -> {
ExecutorService service = Executors.newCachedThreadPool(runnable -> {
String workerName = "IO-Worker-" + atomicInteger.getAndIncrement();
SmoothBoot.LOGGER.debug("Initialized " + workerName);

Expand All @@ -102,8 +104,11 @@ private static ExecutorService replIoWorker() {
thread.setUncaughtExceptionHandler(UtilMixin::uncaughtExceptionHandler);
return thread;
});

return new NameableExecutor(service);
}

@Unique
private static <T> T select(String name, T bootstrap, T main) {
return Objects.equals(name, "Bootstrap") ? bootstrap : main;
}
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 @@ -23,7 +23,7 @@
"depends": {
"fabricloader": ">=0.15",
"fabric-api": "*",
"minecraft": "~1.21.1",
"minecraft": "~1.21.3",
"java": ">=21"
}
}

0 comments on commit da92871

Please sign in to comment.