mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2025-01-23 03:17:53 +01:00
No need to get spicy
- Move common vanillin stuffs to a "vanillin" sourceset - Add vanillinForge and vanillinFabric subprojects - Mostly do gradling from scratch - Export remap jars from platform projects to `include` in vanillin projects
This commit is contained in:
parent
b379be57ae
commit
6bea04ffee
25 changed files with 322 additions and 17 deletions
|
@ -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<Jar>,
|
||||
private val sources: TaskProvider<Jar>,
|
||||
private val javadocJar: TaskProvider<Jar>,
|
||||
private val remapJar: TaskProvider<RemapJarTask>,
|
||||
private val remapSources: TaskProvider<RemapSourcesJarTask>
|
||||
val jar: TaskProvider<Jar>,
|
||||
val sources: TaskProvider<Jar>,
|
||||
val javadocJar: TaskProvider<Jar>,
|
||||
val remapJar: TaskProvider<RemapJarTask>,
|
||||
val remapSources: TaskProvider<RemapSourcesJarTask>
|
||||
) {
|
||||
|
||||
fun publish(artifactId: String) {
|
||||
|
|
|
@ -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<SourceSetContainer>() }
|
||||
val commonSourceSets: SourceSetContainer by lazy { commonProject.the<SourceSetContainer>() }
|
||||
|
||||
fun setupLoomMod(vararg sourceSets: SourceSet) {
|
||||
project.the<LoomGradleExtensionAPI>().mods.maybeCreate("main").apply {
|
||||
|
|
|
@ -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",
|
||||
)
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
package dev.engine_room.vanillin;
|
||||
|
||||
public class Vanillin {
|
||||
public static final String ID = "vanillin";
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package dev.engine_room.flywheel.vanilla;
|
||||
package dev.engine_room.vanillin.visuals;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package dev.engine_room.flywheel.vanilla;
|
||||
package dev.engine_room.vanillin.visuals;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.EnumMap;
|
|
@ -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;
|
|
@ -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;
|
|
@ -1,4 +1,4 @@
|
|||
package dev.engine_room.flywheel.vanilla;
|
||||
package dev.engine_room.vanillin.visuals;
|
||||
|
||||
import org.joml.Matrix4f;
|
||||
|
|
@ -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;
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -18,3 +18,5 @@ rootProject.name = "Flywheel"
|
|||
include("common")
|
||||
include("fabric")
|
||||
include("forge")
|
||||
include("vanillinForge")
|
||||
include("vanillinFabric")
|
||||
|
|
75
vanillinFabric/build.gradle.kts
Normal file
75
vanillinFabric/build.gradle.kts
Normal file
|
@ -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>("javadoc").configure {
|
||||
source(commonSourceSet.allJava)
|
||||
|
||||
JarTaskSet.excludeDuplicatePackageInfos(this)
|
||||
}
|
||||
|
||||
tasks.named<Jar>("sourcesJar").configure {
|
||||
from(commonSourceSet.allJava)
|
||||
|
||||
JarTaskSet.excludeDuplicatePackageInfos(this)
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile>().configureEach {
|
||||
JarTaskSet.excludeDuplicatePackageInfos(this)
|
||||
}
|
||||
tasks.named<JavaCompile>(main.compileJavaTaskName).configure {
|
||||
source(commonSourceSet.allJava)
|
||||
}
|
||||
tasks.named<ProcessResources>(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"))
|
||||
}
|
1
vanillinFabric/gradle.properties
Normal file
1
vanillinFabric/gradle.properties
Normal file
|
@ -0,0 +1 @@
|
|||
loom.platform=fabric
|
|
@ -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();
|
||||
}
|
||||
}
|
34
vanillinFabric/src/main/resources/fabric.mod.json
Normal file
34
vanillinFabric/src/main/resources/fabric.mod.json
Normal file
|
@ -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" : {
|
||||
}
|
||||
}
|
86
vanillinForge/build.gradle.kts
Normal file
86
vanillinForge/build.gradle.kts
Normal file
|
@ -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>("javadoc").configure {
|
||||
source(commonSourceSet.allJava)
|
||||
|
||||
JarTaskSet.excludeDuplicatePackageInfos(this)
|
||||
}
|
||||
|
||||
tasks.named<Jar>("sourcesJar").configure {
|
||||
from(commonSourceSet.allJava)
|
||||
|
||||
JarTaskSet.excludeDuplicatePackageInfos(this)
|
||||
}
|
||||
|
||||
tasks.withType<JavaCompile>().configureEach {
|
||||
JarTaskSet.excludeDuplicatePackageInfos(this)
|
||||
}
|
||||
tasks.named<JavaCompile>(main.compileJavaTaskName).configure {
|
||||
source(commonSourceSet.allJava)
|
||||
}
|
||||
tasks.named<ProcessResources>(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"))
|
||||
}
|
1
vanillinForge/gradle.properties
Normal file
1
vanillinForge/gradle.properties
Normal file
|
@ -0,0 +1 @@
|
|||
loom.platform=forge
|
|
@ -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();
|
||||
}
|
||||
}
|
33
vanillinForge/src/main/resources/META-INF/mods.toml
Normal file
33
vanillinForge/src/main/resources/META-INF/mods.toml
Normal file
|
@ -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"
|
6
vanillinForge/src/main/resources/pack.mcmeta
Normal file
6
vanillinForge/src/main/resources/pack.mcmeta
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"pack": {
|
||||
"description": "${mod_name} resources",
|
||||
"pack_format": 15
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue