diff --git a/build.gradle.kts b/build.gradle.kts index b0d181d87..5bcd239f6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,6 +2,7 @@ import com.github.minecraftschurlimods.helperplugin.api import com.github.minecraftschurlimods.helperplugin.localGradleProperty import com.github.minecraftschurlimods.helperplugin.version import com.github.minecraftschurlimods.helperplugin.moddependencies.ModDependency +import com.github.minecraftschurlimods.helperplugin.sourceSets plugins { idea @@ -16,12 +17,6 @@ helper.withTestSourceSet() val include: Configuration by configurations.creating { isTransitive = false - dependencies.configureEach { - if (this is ExternalDependency) { - val strictVersion = this.versionConstraint.strictVersion - project.jarJar.ranged(this, strictVersion) - } - } } sourceSets.configureEach { configurations.getByName(implementationConfigurationName).extendsFrom(include) @@ -104,6 +99,7 @@ val embeddium = helper.dependencies.optional("embeddium") dependencies { implementation(helper.neoforge()) + testImplementation(helper.testframework()) // jei for integration val jeiApiDep = helper.minecraftVersion.zip(jei.version) { mc, version -> "mezz.jei:jei-${mc}-common-api:${version}" } @@ -127,8 +123,7 @@ dependencies { // geckolib for animations val geckolibDep = helper.minecraftVersion.zip(geckolib.version) { mc, version -> "software.bernie.geckolib:geckolib-neoforge-${mc}:${version}" } - compileOnly(geckolibDep) - runtimeOnly(geckolibDep) + implementation(geckolibDep) testRuntimeOnly(geckolibDep) "dataRuntimeOnly"(geckolibDep) @@ -151,15 +146,19 @@ dependencies { } // add internal libraries - val codecLibVersion = project.localGradleProperty("dependency.codeclib.version") - val codecLibDep = codecLibVersion.map { "com.github.minecraftschurlimods:codeclib:$it" } - include(codecLibDep) - val betterKeybindLibVersion = project.localGradleProperty("dependency.betterkeybindlib.version") - val betterKeybindLibDep = betterKeybindLibVersion.map { "com.github.minecraftschurlimods:betterkeybindlib:$it" } - include(betterKeybindLibDep) - val betterHudLibVersion = project.localGradleProperty("dependency.betterhudlib.version") - val betterHudLibDep = betterHudLibVersion.map { "com.github.minecraftschurlimods:betterhudlib:$it" } - include(betterHudLibDep) + val codeclib = project.localGradleProperty("dependency.codeclib.version").map { "com.github.minecraftschurlimods:codeclib:$it" } + jarJar(codeclib) + "apiCompileOnly"(codeclib) + implementation(codeclib) + testImplementation(codeclib) + + val betterkeybindlib = project.localGradleProperty("dependency.betterkeybindlib.version").map { "com.github.minecraftschurlimods:betterkeybindlib:$it" } + jarJar(betterkeybindlib) + implementation(betterkeybindlib) + + val betterhudlib = project.localGradleProperty("dependency.betterhudlib.version").map { "com.github.minecraftschurlimods:betterhudlib:$it" } + jarJar(betterhudlib) + implementation(betterhudlib) val easyDatagenLibVersion = project.localGradleProperty("dependency.easydatagenlib.version") val easyDatagenLibApiDep = easyDatagenLibVersion.map { "com.github.minecraftschurlimods:easydatagenlib:${it}:api" } @@ -167,13 +166,9 @@ dependencies { "apiCompileOnly"(easyDatagenLibApiDep) "dataImplementation"(easyDatagenLibDep) - testImplementation("net.neoforged:testframework:${helper.neoVersion.get()}") - - val jetbrainsAnnotations = "org.jetbrains:annotations:23.0.0" - compileOnly(jetbrainsAnnotations) - "apiCompileOnly"(jetbrainsAnnotations) - testCompileOnly(jetbrainsAnnotations) - "dataCompileOnly"(jetbrainsAnnotations) + sourceSets.forEach { + it.compileOnlyConfigurationName("org.jetbrains:annotations:23.0.0") + } } helper.withCommonRuns() @@ -196,6 +191,10 @@ tasks.javadoc { source = sourceSets.api.get().allJava } +tasks.jar { + exclude("com/github/minecraftschurlimods/arsmagicalegacy/api/data") +} + helper.publication.pom { organization { name = "Minecraftschurli Mods" diff --git a/settings.gradle.kts b/settings.gradle.kts index 2b225ba34..3caf8c794 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,7 +1,7 @@ pluginManagement { plugins { - id("net.neoforged.gradle.userdev") version "7.0.80" - id("com.github.minecraftschurlimods.helperplugin") version "1.9" + id("net.neoforged.gradle.userdev") version "7.0.106" + id("com.github.minecraftschurlimods.helperplugin") version "1.11" } repositories { mavenLocal() diff --git a/src/api/java/com/github/minecraftschurlimods/arsmagicalegacy/api/affinity/Ability.java b/src/api/java/com/github/minecraftschurlimods/arsmagicalegacy/api/affinity/Ability.java index f2280eadc..fef81da9b 100644 --- a/src/api/java/com/github/minecraftschurlimods/arsmagicalegacy/api/affinity/Ability.java +++ b/src/api/java/com/github/minecraftschurlimods/arsmagicalegacy/api/affinity/Ability.java @@ -2,7 +2,6 @@ import com.github.minecraftschurlimods.arsmagicalegacy.api.ArsMagicaAPI; import com.github.minecraftschurlimods.arsmagicalegacy.api.util.ITranslatable; -import com.github.minecraftschurlimods.codeclib.CodecHelper; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.advancements.critereon.MinMaxBounds; @@ -14,6 +13,7 @@ import net.minecraft.resources.RegistryFileCodec; import net.minecraft.resources.ResourceKey; import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.ExtraCodecs; import net.minecraft.world.entity.player.Player; import java.util.Objects; @@ -28,8 +28,8 @@ public record Ability(Affinity affinity, MinMaxBounds.Doubles bounds) implements public static final ResourceKey> REGISTRY_KEY = ResourceKey.createRegistryKey(new ResourceLocation(ArsMagicaAPI.MOD_ID, ABILITY)); public static final Codec DIRECT_CODEC = RecordCodecBuilder.create(inst -> inst.group( - CodecHelper.forRegistry(ArsMagicaAPI.get()::getAffinityRegistry).fieldOf("affinity").forGetter(Ability::affinity), - CodecHelper.DOUBLE_MIN_MAX_BOUNDS.fieldOf("bounds").forGetter(Ability::bounds) + ExtraCodecs.lazyInitializedCodec(() -> ArsMagicaAPI.get().getAffinityRegistry().byNameCodec()).fieldOf("affinity").forGetter(Ability::affinity), + MinMaxBounds.Doubles.CODEC.fieldOf("bounds").forGetter(Ability::bounds) ).apply(inst, Ability::new)); public static final Codec> REFERENCE_CODEC = RegistryFileCodec.create(REGISTRY_KEY, DIRECT_CODEC); diff --git a/src/api/java/com/github/minecraftschurlimods/arsmagicalegacy/api/spell/ShapeGroup.java b/src/api/java/com/github/minecraftschurlimods/arsmagicalegacy/api/spell/ShapeGroup.java index 02d6db81e..f464c7008 100644 --- a/src/api/java/com/github/minecraftschurlimods/arsmagicalegacy/api/spell/ShapeGroup.java +++ b/src/api/java/com/github/minecraftschurlimods/arsmagicalegacy/api/spell/ShapeGroup.java @@ -1,9 +1,9 @@ package com.github.minecraftschurlimods.arsmagicalegacy.api.spell; import com.github.minecraftschurlimods.arsmagicalegacy.api.ArsMagicaAPI; -import com.github.minecraftschurlimods.codeclib.CodecHelper; import com.mojang.datafixers.util.Pair; import com.mojang.serialization.Codec; +import net.minecraft.util.ExtraCodecs; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.UnmodifiableView; @@ -15,7 +15,7 @@ * A shape group is a part of a spell, which can be exchanged to change the casting, but not the effect of a spell. */ public record ShapeGroup(List parts, List>> shapesWithModifiers) { - public static final Codec CODEC = CodecHelper.forRegistry(ArsMagicaAPI.get()::getSpellPartRegistry).listOf().xmap(ShapeGroup::of, ShapeGroup::parts); + public static final Codec CODEC = ExtraCodecs.lazyInitializedCodec(() -> ArsMagicaAPI.get().getSpellPartRegistry().byNameCodec()).listOf().xmap(ShapeGroup::of, ShapeGroup::parts); public static final ShapeGroup EMPTY = of(List.of()); /** diff --git a/src/api/java/com/github/minecraftschurlimods/arsmagicalegacy/api/spell/SpellStack.java b/src/api/java/com/github/minecraftschurlimods/arsmagicalegacy/api/spell/SpellStack.java index 987026c38..5c09b05e4 100644 --- a/src/api/java/com/github/minecraftschurlimods/arsmagicalegacy/api/spell/SpellStack.java +++ b/src/api/java/com/github/minecraftschurlimods/arsmagicalegacy/api/spell/SpellStack.java @@ -1,9 +1,9 @@ package com.github.minecraftschurlimods.arsmagicalegacy.api.spell; import com.github.minecraftschurlimods.arsmagicalegacy.api.ArsMagicaAPI; -import com.github.minecraftschurlimods.codeclib.CodecHelper; import com.mojang.datafixers.util.Pair; import com.mojang.serialization.Codec; +import net.minecraft.util.ExtraCodecs; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.UnmodifiableView; @@ -13,7 +13,7 @@ import java.util.Objects; public record SpellStack(List parts, List>> partsWithModifiers) { - public static final Codec CODEC = CodecHelper.forRegistry(ArsMagicaAPI.get()::getSpellPartRegistry).listOf().xmap(SpellStack::of, SpellStack::parts); + public static final Codec CODEC = ExtraCodecs.lazyInitializedCodec(() -> ArsMagicaAPI.get().getSpellPartRegistry().byNameCodec()).listOf().xmap(SpellStack::of, SpellStack::parts); public static final SpellStack EMPTY = of(List.of()); /** diff --git a/src/main/java/com/github/minecraftschurlimods/arsmagicalegacy/common/ritual/requirement/HeightRequirement.java b/src/main/java/com/github/minecraftschurlimods/arsmagicalegacy/common/ritual/requirement/HeightRequirement.java index 57cad2d74..28090e14e 100644 --- a/src/main/java/com/github/minecraftschurlimods/arsmagicalegacy/common/ritual/requirement/HeightRequirement.java +++ b/src/main/java/com/github/minecraftschurlimods/arsmagicalegacy/common/ritual/requirement/HeightRequirement.java @@ -1,7 +1,6 @@ package com.github.minecraftschurlimods.arsmagicalegacy.common.ritual.requirement; import com.github.minecraftschurlimods.arsmagicalegacy.api.ritual.RitualRequirement; -import com.github.minecraftschurlimods.codeclib.CodecHelper; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.advancements.critereon.MinMaxBounds; @@ -10,7 +9,7 @@ import net.minecraft.world.entity.player.Player; public record HeightRequirement(MinMaxBounds.Ints range) implements RitualRequirement { - public static final Codec CODEC = RecordCodecBuilder.create(inst -> inst.group(CodecHelper.INT_MIN_MAX_BOUNDS.fieldOf("height").forGetter(HeightRequirement::range)).apply(inst, HeightRequirement::new)); + public static final Codec CODEC = RecordCodecBuilder.create(inst -> inst.group(MinMaxBounds.Ints.CODEC.fieldOf("height").forGetter(HeightRequirement::range)).apply(inst, HeightRequirement::new)); public static HeightRequirement any() { return new HeightRequirement(MinMaxBounds.Ints.ANY); diff --git a/src/main/java/com/github/minecraftschurlimods/arsmagicalegacy/common/ritual/requirement/ItemRequirement.java b/src/main/java/com/github/minecraftschurlimods/arsmagicalegacy/common/ritual/requirement/ItemRequirement.java index a591a673d..40493668c 100644 --- a/src/main/java/com/github/minecraftschurlimods/arsmagicalegacy/common/ritual/requirement/ItemRequirement.java +++ b/src/main/java/com/github/minecraftschurlimods/arsmagicalegacy/common/ritual/requirement/ItemRequirement.java @@ -1,7 +1,6 @@ package com.github.minecraftschurlimods.arsmagicalegacy.common.ritual.requirement; import com.github.minecraftschurlimods.arsmagicalegacy.api.ritual.RitualRequirement; -import com.github.minecraftschurlimods.codeclib.CodecHelper; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.core.BlockPos; @@ -19,7 +18,7 @@ public record ItemRequirement(List ingredients, int radius) implements RitualRequirement { public static final Codec CODEC = RecordCodecBuilder.create(inst -> inst.group( - CodecHelper.INGREDIENT.listOf().fieldOf("ingredients").forGetter(ItemRequirement::ingredients), + Ingredient.CODEC_NONEMPTY.listOf().fieldOf("ingredients").forGetter(ItemRequirement::ingredients), ExtraCodecs.NON_NEGATIVE_INT.fieldOf("radius").forGetter(ItemRequirement::radius) ).apply(inst, ItemRequirement::new)); diff --git a/src/main/java/com/github/minecraftschurlimods/arsmagicalegacy/common/ritual/requirement/MagicLevelRequirement.java b/src/main/java/com/github/minecraftschurlimods/arsmagicalegacy/common/ritual/requirement/MagicLevelRequirement.java index 2a6aec26b..6a2a96c83 100644 --- a/src/main/java/com/github/minecraftschurlimods/arsmagicalegacy/common/ritual/requirement/MagicLevelRequirement.java +++ b/src/main/java/com/github/minecraftschurlimods/arsmagicalegacy/common/ritual/requirement/MagicLevelRequirement.java @@ -2,7 +2,6 @@ import com.github.minecraftschurlimods.arsmagicalegacy.api.ArsMagicaAPI; import com.github.minecraftschurlimods.arsmagicalegacy.api.ritual.RitualRequirement; -import com.github.minecraftschurlimods.codeclib.CodecHelper; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.advancements.critereon.MinMaxBounds; @@ -11,7 +10,7 @@ import net.minecraft.world.entity.player.Player; public record MagicLevelRequirement(MinMaxBounds.Ints bounds) implements RitualRequirement { - public static final Codec CODEC = RecordCodecBuilder.create(inst -> inst.group(CodecHelper.INT_MIN_MAX_BOUNDS.fieldOf("level").forGetter(MagicLevelRequirement::bounds)).apply(inst, MagicLevelRequirement::new)); + public static final Codec CODEC = RecordCodecBuilder.create(inst -> inst.group(MinMaxBounds.Ints.CODEC.fieldOf("level").forGetter(MagicLevelRequirement::bounds)).apply(inst, MagicLevelRequirement::new)); @Override public Codec codec() { diff --git a/src/main/java/com/github/minecraftschurlimods/arsmagicalegacy/common/ritual/requirement/MoonPhaseRequirement.java b/src/main/java/com/github/minecraftschurlimods/arsmagicalegacy/common/ritual/requirement/MoonPhaseRequirement.java index efdb11273..d75053358 100644 --- a/src/main/java/com/github/minecraftschurlimods/arsmagicalegacy/common/ritual/requirement/MoonPhaseRequirement.java +++ b/src/main/java/com/github/minecraftschurlimods/arsmagicalegacy/common/ritual/requirement/MoonPhaseRequirement.java @@ -1,7 +1,6 @@ package com.github.minecraftschurlimods.arsmagicalegacy.common.ritual.requirement; import com.github.minecraftschurlimods.arsmagicalegacy.api.ritual.RitualRequirement; -import com.github.minecraftschurlimods.codeclib.CodecHelper; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.advancements.critereon.MinMaxBounds; @@ -10,7 +9,7 @@ import net.minecraft.world.entity.player.Player; public record MoonPhaseRequirement(MinMaxBounds.Ints phase) implements RitualRequirement { - public static final Codec CODEC = RecordCodecBuilder.create(inst -> inst.group(CodecHelper.INT_MIN_MAX_BOUNDS.fieldOf("phase").forGetter(MoonPhaseRequirement::phase)).apply(inst, MoonPhaseRequirement::new)); + public static final Codec CODEC = RecordCodecBuilder.create(inst -> inst.group(MinMaxBounds.Ints.CODEC.fieldOf("phase").forGetter(MoonPhaseRequirement::phase)).apply(inst, MoonPhaseRequirement::new)); public static MoonPhaseRequirement any() { return new MoonPhaseRequirement(MinMaxBounds.Ints.ANY); diff --git a/src/main/java/com/github/minecraftschurlimods/arsmagicalegacy/common/ritual/trigger/EntityDeathTrigger.java b/src/main/java/com/github/minecraftschurlimods/arsmagicalegacy/common/ritual/trigger/EntityDeathTrigger.java index b990a1bad..a006a6452 100644 --- a/src/main/java/com/github/minecraftschurlimods/arsmagicalegacy/common/ritual/trigger/EntityDeathTrigger.java +++ b/src/main/java/com/github/minecraftschurlimods/arsmagicalegacy/common/ritual/trigger/EntityDeathTrigger.java @@ -3,7 +3,6 @@ import com.github.minecraftschurlimods.arsmagicalegacy.api.ritual.Context; import com.github.minecraftschurlimods.arsmagicalegacy.api.ritual.Ritual; import com.github.minecraftschurlimods.arsmagicalegacy.api.ritual.RitualTrigger; -import com.github.minecraftschurlimods.codeclib.CodecHelper; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.advancements.critereon.EntityPredicate; @@ -19,7 +18,7 @@ import java.util.Map; public record EntityDeathTrigger(EntityPredicate predicate) implements RitualTrigger { - public static final Codec CODEC = RecordCodecBuilder.create(inst -> inst.group(CodecHelper.ENTITY_PREDICATE.fieldOf("entity").forGetter(EntityDeathTrigger::predicate)).apply(inst, EntityDeathTrigger::new)); + public static final Codec CODEC = RecordCodecBuilder.create(inst -> inst.group(EntityPredicate.CODEC.fieldOf("entity").forGetter(EntityDeathTrigger::predicate)).apply(inst, EntityDeathTrigger::new)); @Override public void register(Ritual ritual) { diff --git a/src/main/java/com/github/minecraftschurlimods/arsmagicalegacy/common/ritual/trigger/EntitySummonTrigger.java b/src/main/java/com/github/minecraftschurlimods/arsmagicalegacy/common/ritual/trigger/EntitySummonTrigger.java index 928bf3fdb..da13d996f 100644 --- a/src/main/java/com/github/minecraftschurlimods/arsmagicalegacy/common/ritual/trigger/EntitySummonTrigger.java +++ b/src/main/java/com/github/minecraftschurlimods/arsmagicalegacy/common/ritual/trigger/EntitySummonTrigger.java @@ -3,7 +3,6 @@ import com.github.minecraftschurlimods.arsmagicalegacy.api.ritual.Context; import com.github.minecraftschurlimods.arsmagicalegacy.api.ritual.Ritual; import com.github.minecraftschurlimods.arsmagicalegacy.api.ritual.RitualTrigger; -import com.github.minecraftschurlimods.codeclib.CodecHelper; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.advancements.critereon.EntityPredicate; @@ -22,7 +21,7 @@ import java.util.Map; public record EntitySummonTrigger(EntityPredicate predicate) implements RitualTrigger { - public static final Codec CODEC = RecordCodecBuilder.create(inst -> inst.group(CodecHelper.ENTITY_PREDICATE.fieldOf("entity").forGetter(EntitySummonTrigger::predicate)).apply(inst, EntitySummonTrigger::new)); + public static final Codec CODEC = RecordCodecBuilder.create(inst -> inst.group(EntityPredicate.CODEC.fieldOf("entity").forGetter(EntitySummonTrigger::predicate)).apply(inst, EntitySummonTrigger::new)); public static EntitySummonTrigger simple(EntityType entityType) { return new EntitySummonTrigger(EntityPredicate.Builder.entity().of(entityType).build());