Merge remote-tracking branch 'architectury/1.17' into 1.18

This commit is contained in:
shedaniel
2021-10-14 16:53:13 +08:00
8 changed files with 117 additions and 81 deletions

View File

@@ -7,8 +7,17 @@ loom {
accessWidenerPath = file("src/main/resources/architectury.accessWidener")
}
architectury {
platformSetupLoomIde()
fabric()
}
configurations {
shadowCommon
common
shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this.
compileClasspath.extendsFrom common
runtimeClasspath.extendsFrom common
developmentFabric.extendsFrom common
dev
}
@@ -16,11 +25,6 @@ artifacts {
dev(jar)
}
architectury {
platformSetupLoomIde()
fabric()
}
repositories {
maven { url "https://maven.terraformersmc.com/releases/" }
}
@@ -30,15 +34,8 @@ dependencies {
modImplementation "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
modCompileOnly("com.terraformersmc:modmenu:${rootProject.mod_menu_version}") { transitive false }
implementation(project(path: ":common", configuration: "dev")) {
transitive = false
}
developmentFabric(project(path: ":common", configuration: "dev")) {
transitive = false
}
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) {
transitive = false
}
common(project(path: ":common", configuration: "dev")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
}
processResources {
@@ -50,13 +47,17 @@ processResources {
shadowJar {
configurations = [project.configurations.shadowCommon]
classifier "shadow"
classifier "dev-shadow"
}
remapJar {
dependsOn(shadowJar)
input.set(shadowJar.archiveFile)
archiveClassifier = "fabric"
input.set shadowJar.archiveFile
dependsOn shadowJar
classifier null
}
jar {
classifier "dev"
}
sourcesJar {
@@ -71,17 +72,17 @@ sourcesJar {
}
}
components.java {
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
skip()
}
}
publishing {
publications {
mavenFabric(MavenPublication) {
artifactId = rootProject.archivesBaseName + "-fabric"
artifact(remapJar) { classifier null }
afterEvaluate {
artifact(remapSourcesJar.output) {
builtBy remapSourcesJar
classifier "sources"
}
}
from components.java
}
}

View File

@@ -20,8 +20,6 @@
package dev.architectury.mixin.fabric;
import dev.architectury.event.events.common.EntityEvent;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.player.RemotePlayer;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
@@ -30,7 +28,7 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(value = {LocalPlayer.class, Player.class, RemotePlayer.class})
@Mixin(value = {Player.class})
public class PlayerAttackInvoker {
@Inject(method = "hurt", at = @At("HEAD"), cancellable = true)
private void hurt(DamageSource damageSource, float f, CallbackInfoReturnable<Boolean> cir) {

View File

@@ -0,0 +1,41 @@
/*
* This file is part of architectury.
* Copyright (C) 2020, 2021 architectury
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package dev.architectury.mixin.fabric.client;
import dev.architectury.event.events.common.EntityEvent;
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.client.player.RemotePlayer;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.entity.LivingEntity;
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;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(value = {LocalPlayer.class, RemotePlayer.class})
public class ClientPlayerAttackInvoker {
@Inject(method = "hurt", at = @At("HEAD"), cancellable = true)
private void hurt(DamageSource damageSource, float f, CallbackInfoReturnable<Boolean> cir) {
if (EntityEvent.LIVING_HURT.invoker().hurt((LivingEntity) (Object) this, damageSource, f).isFalse() && (Object) this instanceof Player) {
cir.setReturnValue(false);
}
}
}

View File

@@ -16,7 +16,8 @@
"client.MixinMouseHandler",
"client.MixinMultiPlayerGameMode",
"client.MixinScreen",
"client.MixinTextureAtlas"
"client.MixinTextureAtlas",
"client.ClientPlayerAttackInvoker"
],
"mixins": [
"ExplosionPreInvoker",

View File

@@ -32,7 +32,7 @@
"accessWidener": "architectury.accessWidener",
"icon": "icon.png",
"depends": {
"minecraft": ">=1.16.4"
"minecraft": "~1.17.1"
},
"custom": {
"modmenu:api": true

View File

@@ -10,8 +10,17 @@ loom {
}
}
architectury {
platformSetupLoomIde()
forge()
}
configurations {
shadowCommon
common
shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this.
compileClasspath.extendsFrom common
runtimeClasspath.extendsFrom common
developmentForge.extendsFrom common
dev
}
@@ -19,23 +28,11 @@ artifacts {
dev(jar)
}
architectury {
platformSetupLoomIde()
forge()
}
dependencies {
forge "net.minecraftforge:forge:${rootProject.architectury.minecraft}-${rootProject.forge_version}"
implementation(project(path: ":common", configuration: "dev")) {
transitive = false
}
developmentForge(project(path: ":common", configuration: "dev")) {
transitive = false
}
shadowCommon(project(path: ":common", configuration: "transformProductionForge")) {
transitive = false
}
common(project(path: ":common", configuration: "dev")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive false }
}
processResources {
@@ -50,13 +47,17 @@ shadowJar {
exclude "architectury-common.accessWidener"
configurations = [project.configurations.shadowCommon]
classifier "shadow"
classifier "dev-shadow"
}
remapJar {
dependsOn(shadowJar)
input.set(shadowJar.archivePath)
archiveClassifier = "forge"
input.set shadowJar.archiveFile
dependsOn shadowJar
classifier null
}
jar {
classifier "dev"
}
sourcesJar {
@@ -71,17 +72,17 @@ sourcesJar {
}
}
components.java {
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
skip()
}
}
publishing {
publications {
mavenForge(MavenPublication) {
artifactId = rootProject.archivesBaseName + "-forge"
artifact(remapJar) { classifier null }
afterEvaluate {
artifact(remapSourcesJar.output) {
builtBy remapSourcesJar
classifier "sources"
}
}
from components.java
}
}

View File

@@ -12,21 +12,18 @@ architectury {
fabric()
}
configurations {
common
compileClasspath.extendsFrom common
runtimeClasspath.extendsFrom common
developmentFabric.extendsFrom common
}
dependencies {
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${rootProject.fabric_api_version}"
implementation project(path: ":fabric", configuration: "dev")
implementation(project(path: ":common", configuration: "dev")) {
transitive = false
}
developmentFabric(project(path: ":common", configuration: "dev")) {
transitive = false
}
implementation(project(path: ":testmod-common", configuration: "dev")) {
transitive = false
}
developmentFabric(project(path: ":testmod-common", configuration: "dev")) {
transitive = false
}
common(project(path: ":common", configuration: "dev")) { transitive = false }
common(project(path: ":testmod-common", configuration: "dev")) { transitive false }
}

View File

@@ -20,20 +20,17 @@ architectury {
forge()
}
configurations {
common
compileClasspath.extendsFrom common
runtimeClasspath.extendsFrom common
developmentForge.extendsFrom common
}
dependencies {
forge "net.minecraftforge:forge:${gradle.rootProject.architectury.minecraft}-${rootProject.forge_version}"
implementation project(path: ":forge", configuration: "dev")
implementation(project(path: ":common", configuration: "dev")) {
transitive = false
}
developmentForge(project(path: ":common", configuration: "dev")) {
transitive = false
}
implementation(project(path: ":testmod-common", configuration: "dev")) {
transitive = false
}
developmentForge(project(path: ":testmod-common", configuration: "dev")) {
transitive = false
}
common(project(path: ":common", configuration: "dev")) { transitive false }
common(project(path: ":testmod-common", configuration: "dev")) { transitive false }
}