diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8fc3827..2606ecd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,7 @@ jobs: - name: setup jdk uses: actions/setup-java@v4 with: - java-version: '21' + java-version: '25' distribution: 'microsoft' - name: make gradle wrapper executable run: chmod +x ./gradlew diff --git a/build.gradle b/build.gradle index d69cc9d..c3bf9a5 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version "${loom_version}" + id 'net.fabricmc.fabric-loom' version "${loom_version}" id 'maven-publish' } @@ -7,7 +7,7 @@ version = project.mod_version group = project.maven_group base { - archivesName = "${archives_base_name}-fabric-${minecraft_version}" + archivesName = "${archives_base_name}-fabric-${release_name}" } repositories { @@ -21,17 +21,16 @@ repositories { dependencies { minecraft "com.mojang:minecraft:${project.minecraft_version}" - mappings loom.officialMojangMappings() - modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + implementation "net.fabricmc:fabric-loader:${project.loader_version}" - modImplementation "com.github.ForwarD-NerN:fconfiglib:${project.fconfig_version}" - modApi("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}") { + implementation "com.github.ForwarD-NerN:fconfiglib:${project.fconfig_version}" + api("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}") { exclude(group: "net.fabricmc.fabric-api") } - modApi "com.terraformersmc:modmenu:${modmenu_version}" + api "com.terraformersmc:modmenu:${modmenu_version}" // Fabric API. This is technically optional, but you probably want it anyway. - modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" + implementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" } @@ -44,7 +43,7 @@ processResources { } tasks.withType(JavaCompile).configureEach { - it.options.release = 21 + it.options.release = 25 } java { @@ -53,8 +52,8 @@ java { // If you remove this line, sources will not be generated. withSourcesJar() - sourceCompatibility = JavaVersion.VERSION_21 - targetCompatibility = JavaVersion.VERSION_21 + sourceCompatibility = JavaVersion.VERSION_25 + targetCompatibility = JavaVersion.VERSION_25 } jar { diff --git a/gradle.properties b/gradle.properties index 9b700e6..7e4db45 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,18 +4,18 @@ org.gradle.parallel=true # Fabric Properties # check these on https://fabricmc.net/develop -minecraft_version=1.21.10 -yarn_mappings=1.21.10+build.3 -loader_version=0.18.1 -loom_version=1.13-SNAPSHOT +minecraft_version=26.1.2 +release_name=26.x +loader_version=0.19.3 +loom_version=1.17.7 # Mod Properties -mod_version=0.7.4 +mod_version=0.7.5 maven_group=ru.nern archives_base_name=playerladder # Dependencies -fabric_version=0.138.3+1.21.10 -cloth_config_version=20.0.149 -modmenu_version=16.0.0-rc.1 +fabric_version=0.151.0+26.1.2 +cloth_config_version=26.1.154 +modmenu_version=18.0.0-beta.1 fconfig_version=1.1.1 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e644113..b1b8ef5 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2e11132..df6a6ad 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,9 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip networkTimeout=10000 +retries=0 +retryBackOffMs=500 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 23d15a9..b9bb139 100644 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ #!/bin/sh # -# Copyright © 2015-2021 the original authors. +# Copyright © 2015 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -57,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. @@ -114,7 +114,6 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH="\\\"\\\"" # Determine the Java command to use to start the JVM. @@ -172,7 +171,6 @@ fi # For Cygwin or MSYS, switch paths to Windows format before running java if "$cygwin" || "$msys" ; then APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) - CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) JAVACMD=$( cygpath --unix "$JAVACMD" ) @@ -212,7 +210,6 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ - -classpath "$CLASSPATH" \ -jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \ "$@" diff --git a/gradlew.bat b/gradlew.bat index db3a6ac..24c62d5 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -23,8 +23,8 @@ @rem @rem ########################################################################## -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal +@rem Set local scope for the variables, and ensure extensions are enabled +setlocal EnableExtensions set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. @@ -51,7 +51,7 @@ 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 +"%COMSPEC%" /c exit 1 :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% @@ -65,30 +65,18 @@ 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 +"%COMSPEC%" /c exit 1 :execute @rem Setup the command line -set CLASSPATH= @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* +@rem endlocal doesn't take effect until after the line is parsed and variables are expanded +@rem which allows us to clear the local environment before executing the java command +endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel -:end -@rem End local scope for the variables with windows NT shell -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! -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 +:exitWithErrorLevel +@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts +"%COMSPEC%" /c exit %ERRORLEVEL% diff --git a/src/main/java/ru/nern/playerladder/SharedHandler.java b/src/main/java/ru/nern/playerladder/SharedHandler.java index 4f01337..e699ff7 100644 --- a/src/main/java/ru/nern/playerladder/SharedHandler.java +++ b/src/main/java/ru/nern/playerladder/SharedHandler.java @@ -1,10 +1,11 @@ package ru.nern.playerladder; import com.google.common.collect.Sets; -import net.minecraft.ResourceLocationException; +import net.minecraft.IdentifierException; +import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.network.protocol.game.ClientboundSetPassengersPacket; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.server.level.ServerPlayer; import net.minecraft.tags.TagKey; import net.minecraft.world.InteractionHand; @@ -66,7 +67,7 @@ private static boolean canPickUpOrRideLiving(Entity entity) { return config().server.interactWithAnyLiving && !entityTypesToExclude.contains(entity.getType()) && - entityTagsToExclude.stream().noneMatch(tag -> entity.getType().is(tag)); + entityTagsToExclude.stream().noneMatch(tag -> entity.is(tag)); } public static void onMount(Entity vehicle, Entity passenger) { @@ -97,16 +98,16 @@ public static void onGameModeChange(Player player, GameType gameMode) { private static void addExcludedEntityType(String entity) { try { - Optional> type = EntityType.byString(entity); + Optional> type = BuiltInRegistries.ENTITY_TYPE.getOptional(Identifier.parse(entity)); type.ifPresent(entityTypesToExclude::add); - } catch (ResourceLocationException ignored) {} + } catch (IdentifierException ignored) {} } private static void addExcludedEntityTag(String tag) { try { - TagKey> tagKey = TagKey.create(Registries.ENTITY_TYPE, ResourceLocation.parse(tag.substring(1))); + TagKey> tagKey = TagKey.create(Registries.ENTITY_TYPE, Identifier.parse(tag.substring(1))); entityTagsToExclude.add(tagKey); - } catch (ResourceLocationException ignored) {} + } catch (IdentifierException ignored) {} } public static void setExcludedEntries(List entries) { diff --git a/src/main/java/ru/nern/playerladder/mixin/shared/EntityMixin.java b/src/main/java/ru/nern/playerladder/mixin/shared/EntityMixin.java index 4f35155..83078c3 100644 --- a/src/main/java/ru/nern/playerladder/mixin/shared/EntityMixin.java +++ b/src/main/java/ru/nern/playerladder/mixin/shared/EntityMixin.java @@ -2,8 +2,10 @@ import com.llamalad7.mixinextras.injector.wrapoperation.Operation; import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; +import com.llamalad7.mixinextras.sugar.Local; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.player.Player; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -27,7 +29,7 @@ public class EntityMixin { method = "startRiding(Lnet/minecraft/world/entity/Entity;ZZ)Z", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/EntityType;canSerialize()Z") ) - private boolean playerladder$allowRidingPlayers(EntityType instance, Operation original) { - return instance == EntityType.PLAYER || original.call(instance); + private boolean playerladder$allowRidingPlayers(EntityType instance, Operation original, @Local(argsOnly = true) Entity vehicle) { + return vehicle instanceof Player || original.call(instance); } } diff --git a/src/main/java/ru/nern/playerladder/mixin/shared/RideCommandMixin.java b/src/main/java/ru/nern/playerladder/mixin/shared/RideCommandMixin.java index 1f9014c..c68db96 100644 --- a/src/main/java/ru/nern/playerladder/mixin/shared/RideCommandMixin.java +++ b/src/main/java/ru/nern/playerladder/mixin/shared/RideCommandMixin.java @@ -1,19 +1,17 @@ package ru.nern.playerladder.mixin.shared; +import com.llamalad7.mixinextras.injector.ModifyExpressionValue; import net.minecraft.server.commands.RideCommand; -import net.minecraft.world.entity.Entity; -import net.minecraft.world.entity.EntityType; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Redirect; import ru.nern.playerladder.PlayerLadder; @Mixin(RideCommand.class) public class RideCommandMixin { - @Redirect(method = "mount", - at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;getType()Lnet/minecraft/world/entity/EntityType;")) - private static EntityType playerladder$rideExtension(Entity entity) { - return PlayerLadder.config().server.rideExtension ? null : entity.getType(); + @ModifyExpressionValue(method = "mount", + at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/Entity;is(Ljava/lang/Object;)Z")) + private static boolean playerladder$rideExtension(boolean isPlayer) { + return isPlayer && !PlayerLadder.config().server.rideExtension; } } \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 75ecfc1..405b9bc 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -26,9 +26,9 @@ "playerladder.mixins.json" ], "depends": { - "fabricloader": ">=0.16.0", - "minecraft": ">=1.21.10", - "java": ">=21", + "fabricloader": ">=0.18.4", + "minecraft": ">=26.1 <26.4", + "java": ">=25", "fabric-api": "*", "fconfiglib": ">=1.1.1" }