diff --git a/build.gradle b/build.gradle index f92795a2..fbe53a65 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ plugins { id "architectury-plugin" version "3.4-SNAPSHOT" id "dev.architectury.loom" version "0.7.3-SNAPSHOT" apply false - id "org.cadixdev.licenser" version "0.5.0" + id "org.cadixdev.licenser" version "0.6.1" id "com.matthewprenger.cursegradle" version "1.4.0" apply false id "maven-publish" } diff --git a/common/build.gradle b/common/build.gradle index dfacb2c5..45d0b45d 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -1,5 +1,5 @@ loom { - accessWidener = file("src/main/resources/architectury.accessWidener") + accessWidener = file("src/main/resources/architectury-common.accessWidener") } dependencies { @@ -15,11 +15,6 @@ architectury { common() } -task sourcesJar(type: Jar, dependsOn: classes) { - classifier = "sources" - from sourceSets.main.allSource -} - publishing { publications { mavenCommon(MavenPublication) { diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/EntityHooks.java b/common/src/main/java/me/shedaniel/architectury/hooks/EntityHooks.java index 37d57329..6d6bed2e 100644 --- a/common/src/main/java/me/shedaniel/architectury/hooks/EntityHooks.java +++ b/common/src/main/java/me/shedaniel/architectury/hooks/EntityHooks.java @@ -22,15 +22,20 @@ package me.shedaniel.architectury.hooks; import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.world.entity.Entity; import net.minecraft.world.phys.shapes.CollisionContext; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; public final class EntityHooks { private EntityHooks() { } - @ExpectPlatform + /** + * @deprecated Use the field directly. + */ + @Deprecated + @ApiStatus.ScheduledForRemoval public static String getEncodeId(Entity entity) { - throw new AssertionError(); + return entity.getEncodeId(); } @Nullable diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/ExplosionHooks.java b/common/src/main/java/me/shedaniel/architectury/hooks/ExplosionHooks.java index 3676dd3c..fcd9c3ee 100644 --- a/common/src/main/java/me/shedaniel/architectury/hooks/ExplosionHooks.java +++ b/common/src/main/java/me/shedaniel/architectury/hooks/ExplosionHooks.java @@ -23,6 +23,7 @@ import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.Explosion; import net.minecraft.world.phys.Vec3; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.Nullable; public final class ExplosionHooks { @@ -34,19 +35,31 @@ public final class ExplosionHooks { throw new AssertionError(); } + /** + * @deprecated Use the field directly. + */ @Nullable - @ExpectPlatform + @Deprecated + @ApiStatus.ScheduledForRemoval public static Entity getSource(Explosion explosion) { - throw new AssertionError(); + return explosion.source; } - @ExpectPlatform + /** + * @deprecated Use the field directly. + */ + @Deprecated + @ApiStatus.ScheduledForRemoval public static float getRadius(Explosion explosion) { - throw new AssertionError(); + return explosion.radius; } - @ExpectPlatform + /** + * @deprecated Use the field directly. + */ + @Deprecated + @ApiStatus.ScheduledForRemoval public static void setRadius(Explosion explosion, float radius) { - throw new AssertionError(); + explosion.radius = radius; } } diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/LevelResourceHooks.java b/common/src/main/java/me/shedaniel/architectury/hooks/LevelResourceHooks.java index d47b486a..d91a9267 100644 --- a/common/src/main/java/me/shedaniel/architectury/hooks/LevelResourceHooks.java +++ b/common/src/main/java/me/shedaniel/architectury/hooks/LevelResourceHooks.java @@ -20,11 +20,17 @@ package me.shedaniel.architectury.hooks; import net.minecraft.world.level.storage.LevelResource; +import org.jetbrains.annotations.ApiStatus; public class LevelResourceHooks { private LevelResourceHooks() { } + /** + * @deprecated Use the constructor directly. + */ + @Deprecated + @ApiStatus.ScheduledForRemoval public static LevelResource create(String id) { return new LevelResource(id); } diff --git a/common/src/main/java/me/shedaniel/architectury/hooks/PlayerHooks.java b/common/src/main/java/me/shedaniel/architectury/hooks/PlayerHooks.java index fec28850..d6e0ef37 100644 --- a/common/src/main/java/me/shedaniel/architectury/hooks/PlayerHooks.java +++ b/common/src/main/java/me/shedaniel/architectury/hooks/PlayerHooks.java @@ -21,6 +21,8 @@ package me.shedaniel.architectury.hooks; import dev.architectury.injectables.annotations.ExpectPlatform; import net.minecraft.world.entity.player.Player; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.Nullable; public final class PlayerHooks { private PlayerHooks() { @@ -31,8 +33,12 @@ public final class PlayerHooks { throw new AssertionError(); } - @ExpectPlatform + /** + * @deprecated Use the method directly. + */ + @Deprecated + @ApiStatus.ScheduledForRemoval public static void closeContainer(Player player) { - throw new AssertionError(); + player.closeContainer(); } } diff --git a/common/src/main/resources/architectury.accessWidener b/common/src/main/resources/architectury-common.accessWidener similarity index 88% rename from common/src/main/resources/architectury.accessWidener rename to common/src/main/resources/architectury-common.accessWidener index 4cadb32d..76c6123c 100644 --- a/common/src/main/resources/architectury.accessWidener +++ b/common/src/main/resources/architectury-common.accessWidener @@ -1,4 +1,4 @@ -accessWidener v1 named +accessWidener v2 named accessible method net/minecraft/world/level/block/state/BlockBehaviour$Properties (Lnet/minecraft/world/level/material/Material;Ljava/util/function/Function;)V accessible field net/minecraft/world/level/biome/Biome climateSettings Lnet/minecraft/world/level/biome/Biome$ClimateSettings; accessible field net/minecraft/world/level/biome/Biome depth F @@ -39,13 +39,19 @@ accessible field net/minecraft/world/level/biome/BiomeSpecialEffects ambientAddi mutable field net/minecraft/world/level/biome/BiomeSpecialEffects ambientAdditionsSettings Ljava/util/Optional; accessible field net/minecraft/world/level/biome/BiomeSpecialEffects backgroundMusic Ljava/util/Optional; mutable field net/minecraft/world/level/biome/BiomeSpecialEffects backgroundMusic Ljava/util/Optional; -accessible method net/minecraft/world/level/storage/LevelResource (Ljava/lang/String;)V -accessible field net/minecraft/world/item/AxeItem STRIPABLES Ljava/util/Map; +transitive-accessible method net/minecraft/world/entity/Entity getEncodeId ()Ljava/lang/String; +transitive-accessible method net/minecraft/world/level/storage/LevelResource (Ljava/lang/String;)V +transitive-accessible field net/minecraft/world/item/AxeItem STRIPABLES Ljava/util/Map; mutable field net/minecraft/world/item/AxeItem STRIPABLES Ljava/util/Map; accessible field net/minecraft/world/item/ShovelItem FLATTENABLES Ljava/util/Map; mutable field net/minecraft/world/item/ShovelItem FLATTENABLES Ljava/util/Map; accessible field net/minecraft/world/item/HoeItem TILLABLES Ljava/util/Map; mutable field net/minecraft/world/item/HoeItem TILLABLES Ljava/util/Map; +transitive-accessible field net/minecraft/world/level/Explosion source Lnet/minecraft/world/entity/Entity; +transitive-mutable field net/minecraft/world/level/Explosion source Lnet/minecraft/world/entity/Entity; +transitive-accessible field net/minecraft/world/level/Explosion radius F +transitive-mutable field net/minecraft/world/level/Explosion radius F +transitive-accessible method net/minecraft/world/entity/player/Player closeContainer ()V accessible field net/minecraft/world/item/trading/MerchantOffer baseCostA Lnet/minecraft/world/item/ItemStack; mutable field net/minecraft/world/item/trading/MerchantOffer baseCostA Lnet/minecraft/world/item/ItemStack; diff --git a/common/src/main/resources/architectury.common.json b/common/src/main/resources/architectury.common.json new file mode 100644 index 00000000..ec48b539 --- /dev/null +++ b/common/src/main/resources/architectury.common.json @@ -0,0 +1,3 @@ +{ + "accessWidener": "architectury-common.accessWidener" +} \ No newline at end of file diff --git a/fabric/build.gradle b/fabric/build.gradle index 413ea040..c86b2deb 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -8,12 +8,11 @@ loom { } configurations { - shadowCommon - dev -} - -artifacts { - dev(jar) + 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 } architectury { @@ -34,15 +33,8 @@ dependencies { implementation "net.jodah:typetools:0.6.2" shadowCommon "net.jodah:typetools:0.6.2" - implementation(project(path: ":common")) { - transitive = false - } - developmentFabric(project(path: ":common")) { - transitive = false - } - shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { - transitive = false - } + common(project(path: ":common", configuration: "namedElements")) { transitive false } + shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false } } processResources { @@ -53,6 +45,9 @@ processResources { } shadowJar { + exclude "architectury-common.accessWidener" + exclude "architectury.common.json" + relocate "net.jodah.typetools", "me.shedaniel.architectury.shadowed.impl.net.jodah.typetools" configurations = [project.configurations.shadowCommon] classifier "shadow" diff --git a/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/ExplosionHooksImpl.java b/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/ExplosionHooksImpl.java index bf18cc78..42f2be6e 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/ExplosionHooksImpl.java +++ b/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/ExplosionHooksImpl.java @@ -19,7 +19,6 @@ package me.shedaniel.architectury.hooks.fabric; -import net.minecraft.world.entity.Entity; import net.minecraft.world.level.Explosion; import net.minecraft.world.phys.Vec3; @@ -28,25 +27,7 @@ public class ExplosionHooksImpl { return ((ExplosionExtensions) explosion).architectury_getPosition(); } - public static Entity getSource(Explosion explosion) { - return ((ExplosionExtensions) explosion).architectury_getSource(); - } - - public static float getRadius(Explosion explosion) { - return ((ExplosionExtensions) explosion).architectury_getRadius(); - } - - public static void setRadius(Explosion explosion, float radius) { - ((ExplosionExtensions) explosion).architectury_setRadius(radius); - } - public interface ExplosionExtensions { Vec3 architectury_getPosition(); - - Entity architectury_getSource(); - - float architectury_getRadius(); - - void architectury_setRadius(float v); } } diff --git a/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/PlayerHooksImpl.java b/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/PlayerHooksImpl.java index 9febe502..d1515b70 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/PlayerHooksImpl.java +++ b/fabric/src/main/java/me/shedaniel/architectury/hooks/fabric/PlayerHooksImpl.java @@ -25,8 +25,4 @@ public class PlayerHooksImpl { public static boolean isFake(Player player) { return false; } - - public static void closeContainer(Player player) { - player.closeContainer(); - } } diff --git a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinExplosion.java b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinExplosion.java index 31d93e08..6f5d1c76 100644 --- a/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinExplosion.java +++ b/fabric/src/main/java/me/shedaniel/architectury/mixin/fabric/MixinExplosion.java @@ -50,14 +50,6 @@ public class MixinExplosion implements ExplosionHooksImpl.ExplosionExtensions { @Shadow @Final private double z; - @Shadow - @Final - @Nullable - private Entity source; - @Shadow - @Final - @Mutable - private float radius; @Unique Vec3 position; @@ -74,19 +66,4 @@ public class MixinExplosion implements ExplosionHooksImpl.ExplosionExtensions { } return position; } - - @Override - public Entity architectury_getSource() { - return source; - } - - @Override - public float architectury_getRadius() { - return radius; - } - - @Override - public void architectury_setRadius(float v) { - radius = v; - } } diff --git a/fabric/src/main/resources/architectury.accessWidener b/fabric/src/main/resources/architectury.accessWidener index 3e7541a0..b97e2751 100644 --- a/fabric/src/main/resources/architectury.accessWidener +++ b/fabric/src/main/resources/architectury.accessWidener @@ -1,4 +1,4 @@ -accessWidener v1 named +accessWidener v2 named accessible method net/minecraft/client/gui/screens/Screen addButton (Lnet/minecraft/client/gui/components/AbstractWidget;)Lnet/minecraft/client/gui/components/AbstractWidget; accessible method net/minecraft/client/gui/screens/Screen addWidget (Lnet/minecraft/client/gui/components/events/GuiEventListener;)Lnet/minecraft/client/gui/components/events/GuiEventListener; accessible field net/minecraft/client/gui/screens/Screen buttons Ljava/util/List; @@ -114,3 +114,7 @@ accessible field net/minecraft/world/item/trading/MerchantOffer priceMultiplier accessible field net/minecraft/world/item/trading/MerchantOffer xp I accessible method net/minecraft/client/renderer/item/ItemProperties registerGeneric (Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/client/renderer/item/ItemPropertyFunction;)Lnet/minecraft/client/renderer/item/ItemPropertyFunction; accessible method net/minecraft/client/renderer/item/ItemProperties register (Lnet/minecraft/world/item/Item;Lnet/minecraft/resources/ResourceLocation;Lnet/minecraft/client/renderer/item/ItemPropertyFunction;)V +accessible field net/minecraft/world/level/Explosion source Lnet/minecraft/world/entity/Entity; +mutable field net/minecraft/world/level/Explosion source Lnet/minecraft/world/entity/Entity; +accessible field net/minecraft/world/level/Explosion radius F +mutable field net/minecraft/world/level/Explosion radius F diff --git a/forge/build.gradle b/forge/build.gradle index d0aec345..ad9294df 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -8,12 +8,11 @@ loom { } configurations { - shadowCommon - dev -} - -artifacts { - dev(jar) + 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 } architectury { @@ -28,15 +27,8 @@ dependencies { implementation "net.jodah:typetools:0.6.2" shadowCommon "net.jodah:typetools:0.6.2" - implementation(project(path: ":common")) { - transitive = false - } - developmentForge(project(path: ":common")) { - transitive = false - } - shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { - transitive = false - } + common(project(path: ":common", configuration: "namedElements")) { transitive false } + shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive false } } processResources { @@ -50,6 +42,7 @@ shadowJar { relocate "net.jodah.typetools", "me.shedaniel.architectury.shadowed.impl.net.jodah.typetools" exclude "fabric.mod.json" exclude "architectury-common.accessWidener" + exclude "architectury.common.json" configurations = [project.configurations.shadowCommon] classifier "shadow" diff --git a/forge/src/main/java/me/shedaniel/architectury/hooks/forge/EntityHooksImpl.java b/forge/src/main/java/me/shedaniel/architectury/hooks/forge/EntityHooksImpl.java index 68e1a21c..f8136e9f 100644 --- a/forge/src/main/java/me/shedaniel/architectury/hooks/forge/EntityHooksImpl.java +++ b/forge/src/main/java/me/shedaniel/architectury/hooks/forge/EntityHooksImpl.java @@ -24,10 +24,6 @@ import net.minecraft.world.phys.shapes.CollisionContext; import org.jetbrains.annotations.Nullable; public class EntityHooksImpl { - public static String getEncodeId(Entity entity) { - return entity.getEncodeId(); - } - @Nullable public static Entity fromCollision(CollisionContext ctx) { return ctx.getEntity(); diff --git a/forge/src/main/java/me/shedaniel/architectury/hooks/forge/ExplosionHooksImpl.java b/forge/src/main/java/me/shedaniel/architectury/hooks/forge/ExplosionHooksImpl.java index c21e947a..cbed497c 100644 --- a/forge/src/main/java/me/shedaniel/architectury/hooks/forge/ExplosionHooksImpl.java +++ b/forge/src/main/java/me/shedaniel/architectury/hooks/forge/ExplosionHooksImpl.java @@ -19,7 +19,6 @@ package me.shedaniel.architectury.hooks.forge; -import net.minecraft.world.entity.Entity; import net.minecraft.world.level.Explosion; import net.minecraft.world.phys.Vec3; @@ -27,16 +26,4 @@ public class ExplosionHooksImpl { public static Vec3 getPosition(Explosion explosion) { return explosion.getPosition(); } - - public static Entity getSource(Explosion explosion) { - return explosion.getExploder(); - } - - public static float getRadius(Explosion explosion) { - return explosion.radius; - } - - public static void setRadius(Explosion explosion, float v) { - explosion.radius = v; - } } diff --git a/forge/src/main/java/me/shedaniel/architectury/hooks/forge/PlayerHooksImpl.java b/forge/src/main/java/me/shedaniel/architectury/hooks/forge/PlayerHooksImpl.java index 915b0b7e..6623e9ed 100644 --- a/forge/src/main/java/me/shedaniel/architectury/hooks/forge/PlayerHooksImpl.java +++ b/forge/src/main/java/me/shedaniel/architectury/hooks/forge/PlayerHooksImpl.java @@ -26,8 +26,4 @@ public class PlayerHooksImpl { public static boolean isFake(Player playerEntity) { return playerEntity instanceof FakePlayer; } - - public static void closeContainer(Player playerEntity) { - playerEntity.closeContainer(); - } } diff --git a/gradle.properties b/gradle.properties index 30c5cd96..e81cbe9f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ supported_version=1.16.4/5 archives_base_name=architectury archives_base_name_snapshot=architectury-snapshot -base_version=1.25 +base_version=1.26 maven_group=me.shedaniel fabric_loader_version=0.11.1 diff --git a/testmod-fabric/build.gradle b/testmod-fabric/build.gradle index d19a1741..a0e6bf00 100644 --- a/testmod-fabric/build.gradle +++ b/testmod-fabric/build.gradle @@ -14,17 +14,7 @@ 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")) { - transitive = false - } - developmentFabric(project(path: ":common")) { - transitive = false - } - implementation(project(path: ":testmod-common")) { - transitive = false - } - developmentFabric(project(path: ":testmod-common")) { - transitive = false - } + implementation project(path: ":fabric", configuration: "namedElements") + common(project(path: ":common", configuration: "namedElements")) { transitive false } + common(project(path: ":testmod-common", configuration: "namedElements")) { transitive false } } diff --git a/testmod-forge/build.gradle b/testmod-forge/build.gradle index 8cd8ffb9..ca8af2ee 100644 --- a/testmod-forge/build.gradle +++ b/testmod-forge/build.gradle @@ -21,17 +21,7 @@ dependencies { mappings loom.officialMojangMappings() forge "net.minecraftforge:forge:${gradle.rootProject.architectury.minecraft}-${rootProject.forge_version}" - implementation project(path: ":forge", configuration: "dev") - implementation(project(path: ":common")) { - transitive = false - } - developmentForge(project(path: ":common")) { - transitive = false - } - implementation(project(path: ":testmod-common")) { - transitive = false - } - developmentForge(project(path: ":testmod-common")) { - transitive = false - } + implementation project(path: ":forge", configuration: "namedElements") + common(project(path: ":common", configuration: "namedElements")) { transitive false } + common(project(path: ":testmod-common", configuration: "namedElements")) { transitive false } }