- sampling: 删除 SamplingPlatform / SampleMetricMode,采样入口直接使用 JfrAsyncStackSampler, JFR 不可用改为在采样器内降级;SampleMetricContext / SampleStatistics 去掉 DIRECT_INTERVAL 分支; TickSamples 去掉 metricMode 维度;PerfWorkTracker 去掉 Task 发布路径与 TickTaskAccessor。 - ticket/owner: 删除 owner 缓存、TicketPauseService、OwnerChunks 的统计与双视图收集。 - 客户端状态:ClientPerfReportState / ClientPerfReportStore 合并进 ClientPerfMapState。 - 测试:新增 testsupport fixture 与 gametest 混入探针,替换旧探针与 PerfWorkTrackerTest。 - 构建:移除 JEI、Xaero Minimap、curios 依赖声明。
206 lines
7.9 KiB
Groovy
206 lines
7.9 KiB
Groovy
plugins {
|
|
id 'java-library'
|
|
id 'maven-publish'
|
|
id 'idea'
|
|
id 'net.neoforged.moddev' version '2.0.107'
|
|
}
|
|
|
|
version = mod_version
|
|
group = mod_group_id
|
|
|
|
repositories {
|
|
maven { url = "https://moepus.github.io/MixinLite/" }
|
|
maven {
|
|
url "https://cursemaven.com"
|
|
content {
|
|
includeGroup "curse.maven"
|
|
}
|
|
}
|
|
maven {
|
|
name = "Modrinth"
|
|
url = "https://api.modrinth.com/maven"
|
|
}
|
|
maven { url = "https://maven.createmod.net" } // Create, Ponder, Flywheel
|
|
maven { url = "https://mvn.devos.one/snapshots" } // Registrate
|
|
maven { url = "https://raw.githubusercontent.com/Fuzss/modresources/main/maven/" } // ForgeConfigAPIPort
|
|
maven {
|
|
url = "https://chocolateminecraft.com/maven"
|
|
content {
|
|
includeGroup "xaero.lib"
|
|
}
|
|
}
|
|
}
|
|
|
|
base {
|
|
archivesName = "${mod_id}-${minecraft_version}"
|
|
}
|
|
|
|
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
|
|
|
|
neoForge {
|
|
// Specify the version of NeoForge to use.
|
|
version = project.neo_version
|
|
|
|
parchment {
|
|
mappingsVersion = project.parchment_mappings_version
|
|
minecraftVersion = project.parchment_minecraft_version
|
|
}
|
|
|
|
accessTransformers = project.files('src/main/resources/META-INF/accesstransformer.cfg')
|
|
// Default run configurations.
|
|
// These can be tweaked, removed, or duplicated as needed.
|
|
runs {
|
|
client {
|
|
client()
|
|
|
|
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
|
|
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
|
|
}
|
|
|
|
loaderTester {
|
|
client()
|
|
gameDirectory = project.file('run-loader-tester')
|
|
programArguments.addAll '--username', 'LoaderTester'
|
|
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
|
|
}
|
|
|
|
server {
|
|
server()
|
|
systemProperty 'neoforge.enabledGameTestNamespaces', project.mod_id
|
|
}
|
|
|
|
// This run config launches GameTestServer and runs all registered gametests, then exits.
|
|
// By default, the server will crash when no gametests are provided.
|
|
// The gametest system is also enabled by default for other run configs under the /test command.
|
|
gameTestServer {
|
|
type = "gameTestServer"
|
|
sourceSet = sourceSets.test
|
|
systemProperty 'neoforge.gameTestServer', 'true'
|
|
systemProperty 'neoforge.enabledGameTestNamespaces', "${project.mod_id},minecraft"
|
|
}
|
|
|
|
data {
|
|
data()
|
|
|
|
// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
|
|
// gameDirectory = project.file('run-data')
|
|
|
|
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
|
|
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
|
|
}
|
|
|
|
// applies to all the run configs above
|
|
configureEach {
|
|
// Recommended logging data for a userdev environment
|
|
// The markers can be added/remove as needed separated by commas.
|
|
// "SCAN": For mods scan.
|
|
// "REGISTRIES": For firing of registry events.
|
|
// "REGISTRYDUMP": For getting the contents of all registries.
|
|
systemProperty 'forge.logging.markers', 'REGISTRIES'
|
|
|
|
// Recommended logging level for the console
|
|
// You can set various levels here.
|
|
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
|
|
logLevel = org.slf4j.event.Level.DEBUG
|
|
}
|
|
}
|
|
|
|
mods {
|
|
// define mod <-> source bindings
|
|
// these are used to tell the game which sources are for which mod
|
|
// mostly optional in a single mod project
|
|
// but multi mod projects should define one per mod
|
|
"${mod_id}" {
|
|
sourceSet(sourceSets.main)
|
|
sourceSet(sourceSets.test)
|
|
}
|
|
}
|
|
}
|
|
// Include resources generated by data generators.
|
|
sourceSets.main.resources { srcDir 'src/generated/resources' }
|
|
sourceSets.test.compileClasspath += sourceSets.main.compileClasspath
|
|
sourceSets.test.runtimeClasspath += sourceSets.main.runtimeClasspath
|
|
|
|
|
|
dependencies {
|
|
implementation "org.mixinlite:mixinlite:0.2.0"
|
|
annotationProcessor "org.mixinlite:mixinlite:0.2.0"
|
|
jarJar "org.mixinlite:mixinlite:[0.2.0,)"
|
|
|
|
runtimeOnly "curse.maven:architectury-api-419699:8492726"
|
|
|
|
runtimeOnly "curse.maven:spark-361579:6225208"
|
|
|
|
implementation "curse.maven:ftb-chunks-forge-314906:8520252"
|
|
implementation "curse.maven:ftb-teams-forge-404468:7878281"
|
|
runtimeOnly "curse.maven:ftb-library-forge-404465:8519365"
|
|
|
|
implementation "curse.maven:create-power-loader-936020:6549980"
|
|
implementation("com.simibubi.create:create-${minecraft_version}:${create_version}:slim") { transitive = false }
|
|
implementation("net.createmod.ponder:Ponder-NeoForge-${minecraft_version}:${ponder_version}")
|
|
compileOnly("dev.engine-room.flywheel:flywheel-neoforge-api-${minecraft_version}:${flywheel_version}")
|
|
runtimeOnly("dev.engine-room.flywheel:flywheel-neoforge-${minecraft_version}:${flywheel_version}")
|
|
implementation("com.tterrag.registrate:Registrate:${registrate_version}")
|
|
|
|
implementation "curse.maven:xaeros-world-map-317780:8449921"
|
|
compileOnly "xaero.lib:xaerolib-neoforge-1.21.1:1.7.1"
|
|
testRuntimeOnly "xaero.lib:xaerolib-neoforge-1.21.1:1.7.1"
|
|
|
|
testImplementation platform("org.junit:junit-bom:5.10.0")
|
|
testImplementation "org.junit.jupiter:junit-jupiter"
|
|
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
|
|
}
|
|
|
|
tasks.withType(Test).configureEach {
|
|
useJUnitPlatform()
|
|
maxParallelForks = 1
|
|
}
|
|
|
|
// This block of code expands all declared replace properties in the specified resource targets.
|
|
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
|
|
var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) {
|
|
var replaceProperties = [minecraft_version : minecraft_version,
|
|
minecraft_version_range: minecraft_version_range,
|
|
neo_version : neo_version,
|
|
neo_version_range : neo_version_range,
|
|
loader_version_range : loader_version_range,
|
|
mod_id : mod_id,
|
|
mod_name : mod_name,
|
|
mod_license : mod_license,
|
|
mod_version : mod_version,
|
|
mod_authors : mod_authors,
|
|
mod_description : mod_description]
|
|
inputs.properties replaceProperties
|
|
expand replaceProperties
|
|
from "src/main/templates"
|
|
into "build/generated/sources/modMetadata"
|
|
}
|
|
|
|
// Include the output of "generateModMetadata" as an input directory for the build
|
|
// this works with both building through Gradle and the IDE.
|
|
sourceSets.main.resources.srcDir generateModMetadata
|
|
// To avoid having to run "generateModMetadata" manually, make it run on every project reload
|
|
neoForge.ideSyncTask generateModMetadata
|
|
|
|
// Example configuration to allow publishing using the maven-publish plugin
|
|
publishing {
|
|
publications {
|
|
register('mavenJava', MavenPublication) {
|
|
from components.java
|
|
}
|
|
}
|
|
repositories {
|
|
maven {
|
|
url "file://${project.projectDir}/repo"
|
|
}
|
|
}
|
|
}
|
|
|
|
// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
|
|
idea {
|
|
module {
|
|
downloadSources = true
|
|
downloadJavadoc = true
|
|
}
|
|
}
|