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 {
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.
}
}

View File

@ -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

View File

@ -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

0
gradlew vendored Normal file → Executable file
View File

View File

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

View File

@ -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();
}
}

View File

@ -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"
}
}

View File

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