diff --git a/buildSrc/src/main/kotlin/dev/engine_room/gradle/jarset/JarTaskSet.kt b/buildSrc/src/main/kotlin/dev/engine_room/gradle/jarset/JarTaskSet.kt index 7ef0b7fc7..0327683d5 100644 --- a/buildSrc/src/main/kotlin/dev/engine_room/gradle/jarset/JarTaskSet.kt +++ b/buildSrc/src/main/kotlin/dev/engine_room/gradle/jarset/JarTaskSet.kt @@ -23,11 +23,11 @@ import org.gradle.language.jvm.tasks.ProcessResources class JarTaskSet( private val project: Project, private val name: String, - private val jar: TaskProvider, - private val sources: TaskProvider, - private val javadocJar: TaskProvider, - private val remapJar: TaskProvider, - private val remapSources: TaskProvider + val jar: TaskProvider, + val sources: TaskProvider, + val javadocJar: TaskProvider, + val remapJar: TaskProvider, + val remapSources: TaskProvider ) { fun publish(artifactId: String) { diff --git a/buildSrc/src/main/kotlin/dev/engine_room/gradle/platform/PlatformExtension.kt b/buildSrc/src/main/kotlin/dev/engine_room/gradle/platform/PlatformExtension.kt index 2addef1dc..55b0d12ac 100644 --- a/buildSrc/src/main/kotlin/dev/engine_room/gradle/platform/PlatformExtension.kt +++ b/buildSrc/src/main/kotlin/dev/engine_room/gradle/platform/PlatformExtension.kt @@ -23,7 +23,7 @@ open class PlatformExtension(val project: Project) { var apiArtifactId: String = "flywheel-${project.name}-api-${project.property("artifact_minecraft_version")}" - private val commonSourceSets: SourceSetContainer by lazy { commonProject.the() } + val commonSourceSets: SourceSetContainer by lazy { commonProject.the() } fun setupLoomMod(vararg sourceSets: SourceSet) { project.the().mods.maybeCreate("main").apply { diff --git a/buildSrc/src/main/kotlin/dev/engine_room/gradle/subproject/SubprojectPlugin.kt b/buildSrc/src/main/kotlin/dev/engine_room/gradle/subproject/SubprojectPlugin.kt index 6c3230f0d..8fa4ff4d4 100644 --- a/buildSrc/src/main/kotlin/dev/engine_room/gradle/subproject/SubprojectPlugin.kt +++ b/buildSrc/src/main/kotlin/dev/engine_room/gradle/subproject/SubprojectPlugin.kt @@ -181,5 +181,11 @@ val processResourcesExpandProperties = listOf( "minecraft_maven_version_range", "fabric_api_version_range", "forge_version_range", + "vanillin_id", + "vanillin_name", + "vanillin_version", + "vanillin_description", + "flywheel_maven_version_range", + "flywheel_semver_version_range", ) diff --git a/common/build.gradle.kts b/common/build.gradle.kts index 5aaf88778..84d63c41c 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -11,6 +11,7 @@ val lib = sourceSets.create("lib") val backend = sourceSets.create("backend") val stubs = sourceSets.create("stubs") val main = sourceSets.getByName("main") +val vanillin = sourceSets.create("vanillin") transitiveSourceSets { compileClasspath = main.compileClasspath @@ -35,10 +36,14 @@ transitiveSourceSets { sourceSet(sourceSets.getByName("test")) { implementation(api, lib, backend) } + sourceSet(vanillin) { + rootCompile() + compile(api, lib) + } } defaultPackageInfos { - sources(api, lib, backend, main) + sources(api, lib, backend, main, vanillin) } jarSets { @@ -48,6 +53,7 @@ jarSets { outgoing("commonBackend", backend) outgoing("commonStubs", stubs) outgoing("commonImpl", main) + outgoing("commonVanillin", vanillin) // For publishing. create("api", api, lib).apply { diff --git a/common/src/main/java/dev/engine_room/flywheel/impl/FlwImpl.java b/common/src/main/java/dev/engine_room/flywheel/impl/FlwImpl.java index 909c39647..3ee7c6352 100644 --- a/common/src/main/java/dev/engine_room/flywheel/impl/FlwImpl.java +++ b/common/src/main/java/dev/engine_room/flywheel/impl/FlwImpl.java @@ -6,7 +6,6 @@ import org.slf4j.LoggerFactory; import dev.engine_room.flywheel.api.Flywheel; import dev.engine_room.flywheel.backend.FlwBackend; import dev.engine_room.flywheel.impl.registry.IdRegistryImpl; -import dev.engine_room.flywheel.vanilla.VanillaVisuals; public final class FlwImpl { public static final Logger LOGGER = LoggerFactory.getLogger(Flywheel.ID); @@ -23,9 +22,6 @@ public final class FlwImpl { // backend FlwBackend.init(FlwConfig.INSTANCE.backendConfig()); - - // vanilla - VanillaVisuals.init(); } public static void freezeRegistries() { diff --git a/common/src/vanillin/java/dev/engine_room/vanillin/Vanillin.java b/common/src/vanillin/java/dev/engine_room/vanillin/Vanillin.java new file mode 100644 index 000000000..2b4fd2efb --- /dev/null +++ b/common/src/vanillin/java/dev/engine_room/vanillin/Vanillin.java @@ -0,0 +1,5 @@ +package dev.engine_room.vanillin; + +public class Vanillin { + public static final String ID = "vanillin"; +} diff --git a/common/src/main/java/dev/engine_room/flywheel/vanilla/BellVisual.java b/common/src/vanillin/java/dev/engine_room/vanillin/visuals/BellVisual.java similarity index 98% rename from common/src/main/java/dev/engine_room/flywheel/vanilla/BellVisual.java rename to common/src/vanillin/java/dev/engine_room/vanillin/visuals/BellVisual.java index c1ebae568..cd6788c67 100644 --- a/common/src/main/java/dev/engine_room/flywheel/vanilla/BellVisual.java +++ b/common/src/vanillin/java/dev/engine_room/vanillin/visuals/BellVisual.java @@ -1,4 +1,4 @@ -package dev.engine_room.flywheel.vanilla; +package dev.engine_room.vanillin.visuals; import java.util.function.Consumer; diff --git a/common/src/main/java/dev/engine_room/flywheel/vanilla/ChestVisual.java b/common/src/vanillin/java/dev/engine_room/vanillin/visuals/ChestVisual.java similarity index 99% rename from common/src/main/java/dev/engine_room/flywheel/vanilla/ChestVisual.java rename to common/src/vanillin/java/dev/engine_room/vanillin/visuals/ChestVisual.java index ebf0d2456..fe4731189 100644 --- a/common/src/main/java/dev/engine_room/flywheel/vanilla/ChestVisual.java +++ b/common/src/vanillin/java/dev/engine_room/vanillin/visuals/ChestVisual.java @@ -1,4 +1,4 @@ -package dev.engine_room.flywheel.vanilla; +package dev.engine_room.vanillin.visuals; import java.util.Calendar; import java.util.EnumMap; diff --git a/common/src/main/java/dev/engine_room/flywheel/vanilla/MinecartVisual.java b/common/src/vanillin/java/dev/engine_room/vanillin/visuals/MinecartVisual.java similarity index 99% rename from common/src/main/java/dev/engine_room/flywheel/vanilla/MinecartVisual.java rename to common/src/vanillin/java/dev/engine_room/vanillin/visuals/MinecartVisual.java index b3c90cdef..e654cc75d 100644 --- a/common/src/main/java/dev/engine_room/flywheel/vanilla/MinecartVisual.java +++ b/common/src/vanillin/java/dev/engine_room/vanillin/visuals/MinecartVisual.java @@ -1,4 +1,4 @@ -package dev.engine_room.flywheel.vanilla; +package dev.engine_room.vanillin.visuals; import org.jetbrains.annotations.Nullable; import org.joml.Matrix4f; diff --git a/common/src/main/java/dev/engine_room/flywheel/vanilla/ShulkerBoxVisual.java b/common/src/vanillin/java/dev/engine_room/vanillin/visuals/ShulkerBoxVisual.java similarity index 98% rename from common/src/main/java/dev/engine_room/flywheel/vanilla/ShulkerBoxVisual.java rename to common/src/vanillin/java/dev/engine_room/vanillin/visuals/ShulkerBoxVisual.java index 699d96c9e..0080041a1 100644 --- a/common/src/main/java/dev/engine_room/flywheel/vanilla/ShulkerBoxVisual.java +++ b/common/src/vanillin/java/dev/engine_room/vanillin/visuals/ShulkerBoxVisual.java @@ -1,4 +1,4 @@ -package dev.engine_room.flywheel.vanilla; +package dev.engine_room.vanillin.visuals; import java.util.Set; import java.util.function.Consumer; diff --git a/common/src/main/java/dev/engine_room/flywheel/vanilla/TntMinecartVisual.java b/common/src/vanillin/java/dev/engine_room/vanillin/visuals/TntMinecartVisual.java similarity index 96% rename from common/src/main/java/dev/engine_room/flywheel/vanilla/TntMinecartVisual.java rename to common/src/vanillin/java/dev/engine_room/vanillin/visuals/TntMinecartVisual.java index 4ba546586..7cf6d0736 100644 --- a/common/src/main/java/dev/engine_room/flywheel/vanilla/TntMinecartVisual.java +++ b/common/src/vanillin/java/dev/engine_room/vanillin/visuals/TntMinecartVisual.java @@ -1,4 +1,4 @@ -package dev.engine_room.flywheel.vanilla; +package dev.engine_room.vanillin.visuals; import org.joml.Matrix4f; diff --git a/common/src/main/java/dev/engine_room/flywheel/vanilla/VanillaVisuals.java b/common/src/vanillin/java/dev/engine_room/vanillin/visuals/VanillaVisuals.java similarity index 98% rename from common/src/main/java/dev/engine_room/flywheel/vanilla/VanillaVisuals.java rename to common/src/vanillin/java/dev/engine_room/vanillin/visuals/VanillaVisuals.java index 3516cd041..eae31e8f2 100644 --- a/common/src/main/java/dev/engine_room/flywheel/vanilla/VanillaVisuals.java +++ b/common/src/vanillin/java/dev/engine_room/vanillin/visuals/VanillaVisuals.java @@ -1,4 +1,4 @@ -package dev.engine_room.flywheel.vanilla; +package dev.engine_room.vanillin.visuals; import static dev.engine_room.flywheel.lib.visualization.SimpleBlockEntityVisualizer.builder; import static dev.engine_room.flywheel.lib.visualization.SimpleEntityVisualizer.builder; diff --git a/fabric/build.gradle.kts b/fabric/build.gradle.kts index b1b04dad8..6f2a7745e 100644 --- a/fabric/build.gradle.kts +++ b/fabric/build.gradle.kts @@ -66,6 +66,13 @@ jarSets { } } +val config = project.configurations.register("flywheelFabric") { + isCanBeConsumed = true + isCanBeResolved = false +} + +project.artifacts.add(config.name, jarSets.mainSet.remapJar) + defaultPackageInfos { sources(api, lib, backend, main) } diff --git a/forge/build.gradle.kts b/forge/build.gradle.kts index 6900fd197..6b1959a84 100644 --- a/forge/build.gradle.kts +++ b/forge/build.gradle.kts @@ -64,6 +64,13 @@ jarSets { } } +val config = project.configurations.register("flywheelForge") { + isCanBeConsumed = true + isCanBeResolved = false +} + +project.artifacts.add(config.name, jarSets.mainSet.remapJar) + defaultPackageInfos { sources(api, lib, backend, main) } diff --git a/gradle.properties b/gradle.properties index 57a9985e6..1741bed76 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,6 +10,12 @@ mod_license = MIT mod_sources = https://github.com/Engine-Room/Flywheel mod_issues = https://github.com/Engine-Room/Flywheel/issues mod_homepage = https://github.com/Engine-Room/Flywheel +vanillin_id=vanillin +vanillin_name=Vanillin +vanillin_version=1.0.0-beta +vanillin_description=Instanced rendering for entities and block entities via Flywheel. +flywheel_maven_version_range=[1.0.0-beta,2.0) +flywheel_semver_version_range=>=1.0.0-beta <2.0.0 # Mod dependency declarations minecraft_semver_version_range = >=1.20.1 <1.20.2 diff --git a/settings.gradle.kts b/settings.gradle.kts index cdaa0ff9f..3f8bd243d 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -18,3 +18,5 @@ rootProject.name = "Flywheel" include("common") include("fabric") include("forge") +include("vanillinForge") +include("vanillinFabric") diff --git a/vanillinFabric/build.gradle.kts b/vanillinFabric/build.gradle.kts new file mode 100644 index 000000000..84adeef1e --- /dev/null +++ b/vanillinFabric/build.gradle.kts @@ -0,0 +1,75 @@ +import dev.engine_room.gradle.jarset.JarTaskSet +import org.gradle.jvm.tasks.Jar + +plugins { + idea + java + `maven-publish` + id("dev.architectury.loom") + id("flywheel.subproject") + id("flywheel.platform") +} + +group = "dev.engine_room.vanillin" + +val main = sourceSets.getByName("main") + +platform { + modArtifactId = "vanillin-fabric-${project.property("artifact_minecraft_version")}" + commonProject = project(":common") + setupLoomRuns() +} + +listOf("api", "lib") + .map { project(":fabric").sourceSets.named(it).get() } + .forEach { main.compileClasspath += it.output } + +val commonSourceSet = platform.commonSourceSets.named("vanillin").get() + +tasks.named("javadoc").configure { + source(commonSourceSet.allJava) + + JarTaskSet.excludeDuplicatePackageInfos(this) +} + +tasks.named("sourcesJar").configure { + from(commonSourceSet.allJava) + + JarTaskSet.excludeDuplicatePackageInfos(this) +} + +tasks.withType().configureEach { + JarTaskSet.excludeDuplicatePackageInfos(this) +} +tasks.named(main.compileJavaTaskName).configure { + source(commonSourceSet.allJava) +} +tasks.named(main.processResourcesTaskName).configure { + from(commonSourceSet.resources) +} + +jarSets { + mainSet.publish(platform.modArtifactId) +} + +defaultPackageInfos { + sources(main) +} + +loom { + mixin { + useLegacyMixinAp = true + add(main, "vanillin.refmap.json") + } +} + +dependencies { + modImplementation("net.fabricmc:fabric-loader:${property("fabric_loader_version")}") + modApi("net.fabricmc.fabric-api:fabric-api:${property("fabric_api_version")}") + + modCompileOnly("maven.modrinth:sodium:${property("sodium_version")}") + + compileOnly(project(path = ":common", configuration = "commonVanillin")) + include(project(path = ":fabric", configuration = "flywheelFabric")) + modRuntimeOnly(project(path = ":fabric", configuration = "flywheelFabric")) +} diff --git a/vanillinFabric/gradle.properties b/vanillinFabric/gradle.properties new file mode 100644 index 000000000..e846a8f57 --- /dev/null +++ b/vanillinFabric/gradle.properties @@ -0,0 +1 @@ +loom.platform=fabric diff --git a/vanillinFabric/src/main/java/dev/engine_room/vanillin/VanillinFabric.java b/vanillinFabric/src/main/java/dev/engine_room/vanillin/VanillinFabric.java new file mode 100644 index 000000000..8b01ad009 --- /dev/null +++ b/vanillinFabric/src/main/java/dev/engine_room/vanillin/VanillinFabric.java @@ -0,0 +1,11 @@ +package dev.engine_room.vanillin; + +import dev.engine_room.vanillin.visuals.VanillaVisuals; +import net.fabricmc.api.ClientModInitializer; + +public class VanillinFabric implements ClientModInitializer { + @Override + public void onInitializeClient() { + VanillaVisuals.init(); + } +} diff --git a/vanillinFabric/src/main/resources/fabric.mod.json b/vanillinFabric/src/main/resources/fabric.mod.json new file mode 100644 index 000000000..fd50a6f89 --- /dev/null +++ b/vanillinFabric/src/main/resources/fabric.mod.json @@ -0,0 +1,34 @@ +{ + "schemaVersion" : 1, + "id" : "${vanillin_id}", + "version" : "${vanillin_version}", + "name" : "${vanillin_name}", + "description" : "${vanillin_description}", + "authors" : [ + "Jozufozu", + "PepperCode1" + ], + "contact" : { + "homepage" : "${mod_homepage}", + "sources" : "${mod_sources}", + "issues" : "${mod_issues}" + }, + "license" : "${mod_license}", + "icon" : "logo.png", + "environment" : "client", + "entrypoints" : { + "client" : [ + "dev.engine_room.vanillin.VanillinFabric" + ] + }, + "mixins" : [ + ], + "depends" : { + "minecraft" : "${minecraft_semver_version_range}", + "fabricloader" : ">=0.15.0", + "fabric-api" : "${fabric_api_version_range}", + "${mod_id}" : "${flywheel_semver_version_range}" + }, + "breaks" : { + } +} diff --git a/vanillinForge/build.gradle.kts b/vanillinForge/build.gradle.kts new file mode 100644 index 000000000..0c72d0ef9 --- /dev/null +++ b/vanillinForge/build.gradle.kts @@ -0,0 +1,86 @@ +import dev.engine_room.gradle.jarset.JarTaskSet +import org.gradle.jvm.tasks.Jar + +plugins { + idea + java + `maven-publish` + id("dev.architectury.loom") + id("flywheel.subproject") + id("flywheel.platform") +} + +group = "dev.engine_room.vanillin" + +val main = sourceSets.getByName("main") + +platform { + modArtifactId = "vanillin-forge-${project.property("artifact_minecraft_version")}" + commonProject = project(":common") + setupLoomRuns() +} + +listOf("api", "lib") + .map { project(":forge").sourceSets.named(it).get() } + .forEach { main.compileClasspath += it.output } + +val commonSourceSet = platform.commonSourceSets.named("vanillin").get() + +tasks.named("javadoc").configure { + source(commonSourceSet.allJava) + + JarTaskSet.excludeDuplicatePackageInfos(this) +} + +tasks.named("sourcesJar").configure { + from(commonSourceSet.allJava) + + JarTaskSet.excludeDuplicatePackageInfos(this) +} + +tasks.withType().configureEach { + JarTaskSet.excludeDuplicatePackageInfos(this) +} +tasks.named(main.compileJavaTaskName).configure { + source(commonSourceSet.allJava) +} +tasks.named(main.processResourcesTaskName).configure { + from(commonSourceSet.resources) +} + +jarSets { + mainSet.publish(platform.modArtifactId) +} + +defaultPackageInfos { + sources(main) +} + +loom { + mixin { + useLegacyMixinAp = true + add(main, "vanillin.refmap.json") + } + + forge { +// mixinConfig("flywheel.backend.mixins.json") +// mixinConfig("flywheel.impl.mixins.json") + } + + runs { + configureEach { + property("forge.logging.markers", "") + property("forge.logging.console.level", "debug") + } + } +} + +dependencies { + forge("net.minecraftforge:forge:${property("minecraft_version")}-${property("forge_version")}") + + modCompileOnly("maven.modrinth:embeddium:${property("embeddium_version")}") + + compileOnly(project(path = ":common", configuration = "commonVanillin")) + include(project(path = ":forge", configuration = "flywheelForge")) + modRuntimeOnly(project(path = ":forge", configuration = "flywheelForge")) +} diff --git a/vanillinForge/gradle.properties b/vanillinForge/gradle.properties new file mode 100644 index 000000000..82425854e --- /dev/null +++ b/vanillinForge/gradle.properties @@ -0,0 +1 @@ +loom.platform=forge diff --git a/vanillinForge/src/main/java/dev/engine_room/vanillin/VanillinForge.java b/vanillinForge/src/main/java/dev/engine_room/vanillin/VanillinForge.java new file mode 100644 index 000000000..7bbe0651b --- /dev/null +++ b/vanillinForge/src/main/java/dev/engine_room/vanillin/VanillinForge.java @@ -0,0 +1,23 @@ +package dev.engine_room.vanillin; + +import dev.engine_room.vanillin.visuals.VanillaVisuals; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.eventbus.api.IEventBus; +import net.minecraftforge.fml.DistExecutor; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; + +@Mod(Vanillin.ID) +public class VanillinForge { + public VanillinForge() { + IEventBus forgeEventBus = MinecraftForge.EVENT_BUS; + IEventBus modEventBus = FMLJavaModLoadingContext.get() + .getModEventBus(); + DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> clientInit(forgeEventBus, modEventBus)); + } + + private static void clientInit(IEventBus forgeEventBus, IEventBus modEventBus) { + VanillaVisuals.init(); + } +} diff --git a/vanillinForge/src/main/resources/META-INF/mods.toml b/vanillinForge/src/main/resources/META-INF/mods.toml new file mode 100644 index 000000000..b550c343b --- /dev/null +++ b/vanillinForge/src/main/resources/META-INF/mods.toml @@ -0,0 +1,33 @@ +modLoader = "javafml" +# The loader version doesn't matter. Modify the Forge and/or Minecraft version ranges instead. +loaderVersion = "[0,)" +license = "${mod_license}" +issueTrackerURL = "${mod_issues}" + +[[mods]] +modId = "${vanillin_id}" +version = "${vanillin_version}" +displayName = "${vanillin_name}" +description = "${vanillin_description}" +logoFile = "logo.png" +authors = "Jozufozu, PepperCode1" +displayURL = "${mod_homepage}" +displayTest = "IGNORE_ALL_VERSION" + +[[dependencies.${ vanillin_id }]] +modId = "minecraft" +mandatory = true +versionRange = "${minecraft_maven_version_range}" +side = "CLIENT" + +[[dependencies.${ vanillin_id }]] +modId = "forge" +mandatory = true +versionRange = "${forge_version_range}" +side = "CLIENT" + +[[dependencies.${ vanillin_id }]] +modId = "${mod_id}" +mandatory = true +versionRange = "${flywheel_maven_version_range}" +side = "CLIENT" diff --git a/vanillinForge/src/main/resources/pack.mcmeta b/vanillinForge/src/main/resources/pack.mcmeta new file mode 100644 index 000000000..d9e46396e --- /dev/null +++ b/vanillinForge/src/main/resources/pack.mcmeta @@ -0,0 +1,6 @@ +{ + "pack": { + "description": "${mod_name} resources", + "pack_format": 15 + } +}