Update for 1.17

This commit is contained in:
Zero 2021-06-24 08:39:09 -04:00
parent 54d912ca40
commit 1c860b0deb
8 changed files with 35 additions and 33 deletions

View File

@ -1,15 +1,23 @@
plugins { plugins {
id 'fabric-loom' version '0.5-SNAPSHOT' id 'fabric-loom' version '0.8-SNAPSHOT'
id 'maven-publish' id 'maven-publish'
} }
sourceCompatibility = JavaVersion.VERSION_1_8 sourceCompatibility = JavaVersion.VERSION_16
targetCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_16
archivesBaseName = project.archives_base_name archivesBaseName = project.archives_base_name
version = project.mod_version version = project.mod_version
group = project.maven_group 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 { dependencies {
// To change the versions see the gradle.properties file // To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}" 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. // If Javadoc is generated, this must be specified in that task too.
it.options.encoding = "UTF-8" it.options.encoding = "UTF-8"
// The Minecraft launcher currently installs Java 8 for users, so your mod probably wants to target Java 8 too // Minecraft 1.17 (21w19a) upwards uses Java 16.
// JDK 9 introduced a new way of specifying this that will make sure no newer classes or methods are used. it.options.release = 16
// 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
}
} }
java { java {
@ -74,9 +77,11 @@ publishing {
} }
} }
// Select the repositories you want to publish to // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
// To publish to maven local, no extra repositories are necessary. Just use the task `publishToMavenLocal`.
repositories { 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.
} }
} }

View File

@ -2,16 +2,16 @@
org.gradle.jvmargs=-Xmx1G org.gradle.jvmargs=-Xmx1G
# Fabric Properties # Fabric Properties
# check these on https://fabricmc.net/use # check these on https://fabricmc.net/use
minecraft_version=1.16.5 minecraft_version=1.17
yarn_mappings=1.16.5+build.1 yarn_mappings=1.17+build.13
loader_version=0.11.0 loader_version=0.11.6
# Mod Properties # Mod Properties
mod_version = 1.0.1 mod_version = 1.0.2
maven_group = net.fabricmc maven_group = net.fabricmc
archives_base_name = trample-disabler archives_base_name = trample-disabler
# Dependencies # Dependencies
# currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api # 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 fabric_version=0.36.0+1.17

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists 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 zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

0
gradlew vendored Normal file → Executable file
View File

View File

@ -1,6 +1,5 @@
pluginManagement { pluginManagement {
repositories { repositories {
jcenter()
maven { maven {
name = 'Fabric' name = 'Fabric'
url = 'https://maven.fabricmc.net/' url = 'https://maven.fabricmc.net/'

View File

@ -1,6 +1,7 @@
package zero.trampledisablerfabric.mixin; package zero.trampledisablerfabric.mixin;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.FarmlandBlock; import net.minecraft.block.FarmlandBlock;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
@ -17,9 +18,9 @@ public class MixinFarmlandBlock extends Block {
super(settings); 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) @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, BlockPos pos, Entity entity, float distance, CallbackInfo info) { private void onLandedUpon(World world, BlockState state, BlockPos pos, Entity entity, float distance, CallbackInfo info) {
super.onLandedUpon(world, pos, entity, distance); // Don't cancel fall damage super.onLandedUpon(world, state, pos, entity, distance); // Don't cancel fall damage
info.cancel(); info.cancel();
} }
} }

View File

@ -1,7 +1,7 @@
{ {
"schemaVersion": 1, "schemaVersion": 1,
"id": "trampledisablerfabric", "id": "trampledisablerfabric",
"version": "1.0.1", "version": "1.0.2",
"name": "Trample Disabler", "name": "Trample Disabler",
"description": "Disables farmland trampling", "description": "Disables farmland trampling",
@ -29,9 +29,6 @@
"depends": { "depends": {
"fabricloader": ">=0.7.4", "fabricloader": ">=0.7.4",
"fabric": "*", "fabric": "*",
"minecraft": "1.16.x" "minecraft": "1.17.x"
},
"suggests": {
"another-mod": "*"
} }
} }

View File

@ -2,7 +2,7 @@
"required": true, "required": true,
"minVersion": "0.8", "minVersion": "0.8",
"package": "zero.trampledisablerfabric.mixin", "package": "zero.trampledisablerfabric.mixin",
"compatibilityLevel": "JAVA_8", "compatibilityLevel": "JAVA_16",
"mixins": [ "mixins": [
"MixinFarmlandBlock" "MixinFarmlandBlock"
], ],