From 1c860b0debf177a2fa857da4f7c3acfa686e9bb7 Mon Sep 17 00:00:00 2001 From: Zero Date: Thu, 24 Jun 2021 08:39:09 -0400 Subject: [PATCH] Update for 1.17 --- build.gradle | 31 +++++++++++-------- gradle.properties | 18 +++++------ gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 0 settings.gradle | 1 - .../mixin/MixinFarmlandBlock.java | 7 +++-- src/main/resources/fabric.mod.json | 7 ++--- .../trampledisablerfabric.mixins.json | 2 +- 8 files changed, 35 insertions(+), 33 deletions(-) mode change 100644 => 100755 gradlew diff --git a/build.gradle b/build.gradle index 62083f9..f807b77 100644 --- a/build.gradle +++ b/build.gradle @@ -1,15 +1,23 @@ plugins { - id 'fabric-loom' version '0.5-SNAPSHOT' + id 'fabric-loom' version '0.8-SNAPSHOT' id 'maven-publish' } -sourceCompatibility = JavaVersion.VERSION_1_8 -targetCompatibility = JavaVersion.VERSION_1_8 +sourceCompatibility = JavaVersion.VERSION_16 +targetCompatibility = JavaVersion.VERSION_16 archivesBaseName = project.archives_base_name version = project.mod_version group = project.maven_group +repositories { + // Add repositories to retrieve artifacts from in here. + // You should only use this when depending on other mods because + // Loom adds the essential maven repositories to download Minecraft and libraries from automatically. + // See https://docs.gradle.org/current/userguide/declaring_repositories.html + // for more information about repositories. +} + dependencies { // To change the versions see the gradle.properties file minecraft "com.mojang:minecraft:${project.minecraft_version}" @@ -38,13 +46,8 @@ tasks.withType(JavaCompile).configureEach { // If Javadoc is generated, this must be specified in that task too. it.options.encoding = "UTF-8" - // The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too - // JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used. - // We'll use that if it's available, but otherwise we'll use the older option. - def targetVersion = 8 - if (JavaVersion.current().isJava9Compatible()) { - it.options.release = targetVersion - } + // Minecraft 1.17 (21w19a) upwards uses Java 16. + it.options.release = 16 } java { @@ -74,9 +77,11 @@ publishing { } } - // Select the repositories you want to publish to - // To publish to maven local, no extra repositories are necessary. Just use the task `publishToMavenLocal`. + // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. repositories { - // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. + // Add repositories to publish to here. + // Notice: This block does NOT have the same function as the block in the top level. + // The repositories here will be used for publishing your artifact, not for + // retrieving dependencies. } } diff --git a/gradle.properties b/gradle.properties index e37c14c..5255789 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,16 +2,16 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties - # check these on https://fabricmc.net/use - minecraft_version=1.16.5 - yarn_mappings=1.16.5+build.1 - loader_version=0.11.0 +# check these on https://fabricmc.net/use +minecraft_version=1.17 +yarn_mappings=1.17+build.13 +loader_version=0.11.6 # Mod Properties - mod_version = 1.0.1 - maven_group = net.fabricmc - archives_base_name = trample-disabler +mod_version = 1.0.2 +maven_group = net.fabricmc +archives_base_name = trample-disabler # Dependencies - # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api - fabric_version=0.29.3+1.16 +# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api +fabric_version=0.36.0+1.17 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index da9702f..0f80bbf 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 diff --git a/settings.gradle b/settings.gradle index 5b60df3..f91a4fe 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,6 +1,5 @@ pluginManagement { repositories { - jcenter() maven { name = 'Fabric' url = 'https://maven.fabricmc.net/' diff --git a/src/main/java/zero/trampledisablerfabric/mixin/MixinFarmlandBlock.java b/src/main/java/zero/trampledisablerfabric/mixin/MixinFarmlandBlock.java index a99f02e..3312545 100644 --- a/src/main/java/zero/trampledisablerfabric/mixin/MixinFarmlandBlock.java +++ b/src/main/java/zero/trampledisablerfabric/mixin/MixinFarmlandBlock.java @@ -1,6 +1,7 @@ package zero.trampledisablerfabric.mixin; import net.minecraft.block.Block; +import net.minecraft.block.BlockState; import net.minecraft.block.FarmlandBlock; import net.minecraft.entity.Entity; import net.minecraft.util.math.BlockPos; @@ -17,9 +18,9 @@ public class MixinFarmlandBlock extends Block { super(settings); } - @Inject(method = {"onLandedUpon(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/entity/Entity;F)V"}, at = {@At("HEAD")}, cancellable = true) - private void onLandedUpon(World world, BlockPos pos, Entity entity, float distance, CallbackInfo info) { - super.onLandedUpon(world, pos, entity, distance); // Don't cancel fall damage + @Inject(method = {"onLandedUpon(Lnet/minecraft/world/World;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/entity/Entity;F)V"}, at = {@At("HEAD")}, cancellable = true) + private void onLandedUpon(World world, BlockState state, BlockPos pos, Entity entity, float distance, CallbackInfo info) { + super.onLandedUpon(world, state, pos, entity, distance); // Don't cancel fall damage info.cancel(); } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 46089dd..b7c15ba 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "id": "trampledisablerfabric", - "version": "1.0.1", + "version": "1.0.2", "name": "Trample Disabler", "description": "Disables farmland trampling", @@ -29,9 +29,6 @@ "depends": { "fabricloader": ">=0.7.4", "fabric": "*", - "minecraft": "1.16.x" - }, - "suggests": { - "another-mod": "*" + "minecraft": "1.17.x" } } diff --git a/src/main/resources/trampledisablerfabric.mixins.json b/src/main/resources/trampledisablerfabric.mixins.json index 5275fcb..21b45d7 100644 --- a/src/main/resources/trampledisablerfabric.mixins.json +++ b/src/main/resources/trampledisablerfabric.mixins.json @@ -2,7 +2,7 @@ "required": true, "minVersion": "0.8", "package": "zero.trampledisablerfabric.mixin", - "compatibilityLevel": "JAVA_8", + "compatibilityLevel": "JAVA_16", "mixins": [ "MixinFarmlandBlock" ],