Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 111 additions & 0 deletions .github/runtime-test-config/random_complement.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# Configuration file

general {
# Enable additional item information prompts
B:ExTooltip=true

ae2 {
# Sets the texture index used for the crafting item slot
# Min: 0
# Max: 6
I:CraftingSlotTextureIndex=1

# Enable the whole AE ecosystem integration
B:Enable=false

# Disable the Build permission check for AE2's security station
B:SecurityCache=true

# Make the grid always think it's full of energy
B:debugEnergy=false

# Drag item from JEI into the search box to automatically enter the name
B:dragJeiItemToSearchBox=true

# Allow multiple pattern to synthesize the same product
# May have potential performance implications; consider disabling if not needed.
B:enableBranchCraft=true

# Enable miss craft feature
B:enableMissCraft=true

# Use the new Patten Terminal Gui
# Closing will cause all patterns created while enabled to become invalid.
B:newPattenGui=true
}

ic2 {
# The additional energy storage provided by each Energy Storage Upgrade
I:energyStorageEnergy=10000

# The increased energy consumption caused by each Overclocker Upgrade
D:overclockerEnergy=1.6

# The reduced processing time effected by each Overclocker Upgrade
D:overclockerTime=0.7
}

lazyae {
# Fixes related to the lazy ae feature may occasionally introduce errors; disabling it can prevent such issues.
B:EnableRepair=true
}

te5 {
# Set the efficiency of the Fuel Catalyzer, which defaults to 15
I:FuelCatalyzer=15

# Whether to enable energy consumption boost, just like the original upgrade state
B:FuelCatalyzerQuantityChanges=true

# Whether to enable energy consumption boost, just like the original upgrade state
B:IncreasedEnergyConsumption=false

# The maximum chance of modifying an item to be reused is 100
B:SecondaryProbability=true

# Prevent the Thermal Expansion Cyclic Assembler from operating when the output slot contains items to avoid potential bugs
B:SequentialFabricatorMixin=true
}

ftbu {
# Change the name of the nbtedit command of FTB
B:ModifyCmdEditNBT=false
}

tf5 {
# When the offhand has a red map and the player is crouching, cancel the clear setting
B:RedDiagramOfTheDeputy=true
}

botania {
# Allow the use of sparks on Botanical Brewery
B:BrewerySparkSupport=false

# Fix some bugs. If there is a problem as a result, it should be closed
B:BugFix=true

# Allow flor geradora to directly link to the mana pool
B:FlowerLinkPool=false

# Allow the use of sparks on Runic Altar
B:RuneAltarSparkSupport=false

# If false, Spark Support will not take effect
B:SparkSupport=false
}

cofhcohe {
# Modify the number of upgrades that can be placed in slots
# Min: 1
# Max: 64
I:SocketLimitModified=1
}

nee {
# Whether to enable NEE compatibility for ae2exttable.
B:ae2e=true
}

}


25 changes: 10 additions & 15 deletions gradle/scripts/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ repositories {
name = 'Modrinth'
url = 'https://api.modrinth.com/maven'
}
maven {
name = 'jitpack'
url = 'https://jitpack.io'
}
maven {
name = "GTNH Maven"
url = uri("https://nexus.gtnewhorizons.com/repository/public/")
Expand Down Expand Up @@ -107,16 +111,10 @@ dependencies {
modImplementation 'curse.maven:the-one-probe-245211:2667280'
modCompileOnly 'curse.maven:FTB-Library-237167:2985811'
modCompileOnly 'curse.maven:FTBU-237102:3157548'
modImplementation 'curse.maven:ae2-extended-life-570458:6302098'
modCompileOnly 'curse.maven:better-meteorite-1264853:6525827'
modImplementation 'curse.maven:ae2fluidcraft-rework-unofficial-1404390:7742544'
modCompileOnly('curse.maven:MekanismEnergistics-1027681:5775101') {
accessTransformers.configure(it) {
config = project.file('accesstransformers/mekanism-energistics.cfg')
}
}
modCompileOnly 'curse.maven:nae2-884359:5380800'
modImplementation 'curse.maven:CodeChickenLib-242818:2779848'
modImplementation 'com.github.FormlessDragon:AppliedCompatibility:v1.0.1:dev'
modImplementation 'com.github.FormlessDragon:Applied-Energistics-2-Supergiant:v1.1.0:dev'
modCompileOnly 'com.github.FormlessDragon:Applied-Mekanistics:v1.2.1:dev'
modImplementation 'curse.maven:codechicken-lib-cre-1328922:6898525'
modImplementation 'curse.maven:wanionlib-253043:4623135'
modCompileOnly 'curse.maven:avaritia-1-1x-unofficial-1165010:7939693'
modCompileOnly 'curse.maven:eternal-singularity-253077:2922583'
Expand Down Expand Up @@ -148,7 +146,6 @@ dependencies {
modCompileOnly 'curse.maven:more-electric-tools-366298:3491973'
modCompileOnly 'curse.maven:extrabotany-299086:3112313'
modCompileOnly 'curse.maven:libnine-322344:3073839'
modCompileOnly 'curse.maven:lazy-ae2-322347:3254160'
modCompileOnly 'curse.maven:better-chat-363860:3048407'
modCompileOnly 'curse.maven:lunatriuscore-225605:2489549'
modCompileOnly 'curse.maven:immersive-petroleum-268250:3382321'
Expand All @@ -165,7 +162,7 @@ dependencies {
modCompileOnly 'curse.maven:guide-api-228832:2645992'
modCompileOnly 'curse.maven:patchouli-306770:3162874'
modCompileOnly 'curse.maven:libvulpes-236541:3801015'
modCompileOnly 'curse.maven:random-complement-1198138:9009274'
modCompileOnly 'curse.maven:random-complement-1198138:8828633'
modCompileOnly 'curse.maven:actually-additions-228404:3117927'
modCompileOnly 'curse.maven:artemislib-313590:2741812'
modImplementation 'curse.maven:brandons-core-231382:3408276'
Expand Down Expand Up @@ -212,7 +209,6 @@ dependencies {
config = project.file('accesstransformers/astral-sorcery.cfg')
}
}
modCompileOnly 'curse.maven:ae2-crafting-tree-legacy-1121489:5814089'
modCompileOnly 'curse.maven:applecore-224472:2969118'
modCompileOnly 'curse.maven:spice-of-life-carrot-edition-277616:2959847'
modCompileOnly 'curse.maven:just-enough-resources-jer-240630:4440935'
Expand All @@ -228,7 +224,6 @@ dependencies {
modCompileOnly 'curse.maven:athenaeum-284350:3063275'
modCompileOnly 'curse.maven:better-builders-wands-238403:2691084'
modCompileOnly 'curse.maven:better-loading-screen-229302:6771073'
modCompileOnly 'curse.maven:betterer-p2p-943734:7231397'
modCompileOnly 'curse.maven:celeritas-extra-1451214:9182637'
modCompileOnly 'curse.maven:electroblobs-wizardry-265642:8320066'
modCompileOnly 'curse.maven:ender-core-ceu-1530852:8734025'
Expand All @@ -252,7 +247,6 @@ dependencies {
modCompileOnly 'curse.maven:more-flux-storage-1492345:7805126'
modCompileOnly 'curse.maven:more-overlays-243478:2745657'
modCompileOnly 'curse.maven:mrcrayfish-furniture-mod-55438:3865259'
modCompileOnly 'curse.maven:not-enough-energistics-515565:6325382'
modCompileOnly 'curse.maven:omlib-254334:3466259'
modCompileOnly 'curse.maven:openmodularturrets-224663:3466431'
modCompileOnly 'curse.maven:packagedauto-308380:7329681'
Expand Down Expand Up @@ -348,4 +342,5 @@ dependencies {
config = project.file('accesstransformers/thermal-foundation.cfg')
}
}
modCompileOnly "curse.maven:mouse-tweaks-unofficial-461660:5876158"
}
195 changes: 195 additions & 0 deletions gradle/scripts/extra.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,201 @@ tasks.register('installRuntimeTestClient', JavaExec) {
}
}

def runtimeTestConfigDir = layout.projectDirectory.dir('.github/runtime-test-config')
def runtimeTestServerConfigDir = layout.buildDirectory.dir('runtime-test/server/config')
def runtimeTestInstanceTemplate = layout.buildDirectory.file(
'runtime-test/cleanroom-instance-template.zip'
)
def runtimeTestTemplateRequiredEntries = [
'instance.cfg',
'mmc-pack.json',
'patches/net.minecraft.json',
'patches/net.minecraftforge.json',
'patches/org.lwjgl3.json'
]

def runtimeTestConfigFiles = providers.provider {
def dir = runtimeTestConfigDir.asFile
if (!dir.isDirectory()) {
return []
}
def files = dir.listFiles({ candidate ->
candidate.isFile() && candidate.name.endsWith('.cfg')
} as FileFilter)
if (files == null) {
return []
}
return files.toList().sort { left, right -> left.name <=> right.name }
}

def downloadRuntimeTestTemplate = { String downloadUrl, File target ->
def partial = new File(target.parentFile, "${target.name}.part")
def lastError = null
for (int attempt = 1; attempt <= 3; attempt++) {
try {
java.net.HttpURLConnection connection =
java.net.URI.create(downloadUrl).toURL().openConnection()
connection.setConnectTimeout(30000)
connection.setReadTimeout(120000)
connection.setInstanceFollowRedirects(true)
connection.setRequestProperty('User-Agent', 'novaeng-runtime-test')
def status = connection.getResponseCode()
if (status != 200) {
throw new GradleException("HTTP ${status}")
}
partial.withOutputStream { output ->
connection.getInputStream().withCloseable { input ->
input.transferTo(output)
}
}
connection.disconnect()
return partial
} catch (Exception error) {
lastError = error
partial.delete()
logger.lifecycle(
"[RuntimeTest] 模板下载第 ${attempt} 次失败:${error.message}"
)
if (attempt < 3) {
Thread.sleep(2000L * attempt)
}
}
}
throw new GradleException(
"无法下载 Cleanroom 模板 ${downloadUrl}:${lastError}"
)
}

def stageRuntimeTestServerConfig = tasks.register('stageRuntimeTestServerConfig', Sync) {
group = 'unimined'
description = '把 .github/runtime-test-config 下的 cfg 放到运行时测试服务端的 config 目录。'
from(runtimeTestConfigDir) {
include '*.cfg'
}
into(runtimeTestServerConfigDir)
duplicatesStrategy = DuplicatesStrategy.FAIL
}

def injectRuntimeTestClientConfig = tasks.register('injectRuntimeTestClientConfig') {
group = 'unimined'
description = '把运行时测试配置注入 Cleanroom MMC 模板 zip,解压后即成为客户端的 config。'
inputs.files(runtimeTestConfigFiles)
inputs.property('cleanroomVersion', cleanroomVersion)
inputs.property('requiredEntries', runtimeTestTemplateRequiredEntries)
outputs.upToDateWhen { false }
doLast {
def configFiles = runtimeTestConfigFiles.get()
if (configFiles.isEmpty()) {
logger.lifecycle(
'[RuntimeTest] .github/runtime-test-config 下没有 cfg,跳过客户端配置注入。'
)
return
}

def templateFile = runtimeTestInstanceTemplate.get().asFile
if (!templateFile.isFile()) {
templateFile.parentFile.mkdirs()
def templateUrl = 'https://github.com/CleanroomMC/Cleanroom/releases/download/' +
"${cleanroomVersion}/cleanroom-${cleanroomVersion}.zip"
logger.lifecycle("[RuntimeTest] 本地缺少模板,开始下载:${templateUrl}")
def downloaded = downloadRuntimeTestTemplate(templateUrl, templateFile)
java.nio.file.Files.move(
downloaded.toPath(),
templateFile.toPath(),
java.nio.file.StandardCopyOption.REPLACE_EXISTING
)
}

def additions = new LinkedHashMap<String, File>()
configFiles.each { configFile ->
additions.put("minecraft/config/${configFile.name}".toString(), configFile)
}

def rewritten = new File(templateFile.parentFile, "${templateFile.name}.injected")
rewritten.delete()
def written = new LinkedHashSet<String>()
new java.util.zip.ZipFile(templateFile).withCloseable { sourceZip ->
def rawOutput = new FileOutputStream(rewritten)
try {
new java.util.zip.ZipOutputStream(
new BufferedOutputStream(rawOutput)
).withCloseable { targetZip ->
sourceZip.entries().each { entry ->
if (additions.containsKey(entry.name)) {
// 模板自带同名配置:丢弃,稍后写入我们的版本。
return
}
def copied = new java.util.zip.ZipEntry(entry.name)
copied.time = entry.time
if (entry.comment != null) {
copied.comment = entry.comment
}
if (entry.extra != null) {
copied.extra = entry.extra
}
targetZip.putNextEntry(copied)
if (!entry.isDirectory()) {
sourceZip.getInputStream(entry).withCloseable { input ->
input.transferTo(targetZip)
}
}
targetZip.closeEntry()
written.add(entry.name)
}
additions.each { entryName, configFile ->
def added = new java.util.zip.ZipEntry(entryName)
added.time = configFile.lastModified()
targetZip.putNextEntry(added)
configFile.withInputStream { input ->
input.transferTo(targetZip)
}
targetZip.closeEntry()
written.add(entryName)
}
}
} finally {
rawOutput.close()
}
}

runtimeTestTemplateRequiredEntries.each { requiredEntry ->
if (!written.contains(requiredEntry)) {
rewritten.delete()
throw new GradleException(
"Cleanroom 模板缺少 ${requiredEntry},已放弃写入注入后的模板。"
)
}
}
additions.keySet().each { injectedEntry ->
if (!written.contains(injectedEntry)) {
rewritten.delete()
throw new GradleException("配置注入失败:${injectedEntry} 未写入模板。")
}
}
if (rewritten.length() <= 0L) {
rewritten.delete()
throw new GradleException('注入后的模板为空,已放弃覆盖原模板。')
}

java.nio.file.Files.move(
rewritten.toPath(),
templateFile.toPath(),
java.nio.file.StandardCopyOption.REPLACE_EXISTING
)
logger.lifecycle(
"[RuntimeTest] 已向客户端模板注入 ${additions.size()} 个配置:" +
additions.keySet().join(', ')
)
}
}

tasks.named('stageRuntimeTestMods') {
dependsOn stageRuntimeTestServerConfig
}
tasks.named('installRuntimeTestClient') {
dependsOn injectRuntimeTestClientConfig
}

tasks.register('printRuntimeTestPaths') {
doLast {
println "runtimeTestModsDir=${runtimeTestModsDir.get().asFile.absolutePath}"
Expand Down
Loading