Merge remote-tracking branch 'origin/master' into fix_sof_crash

This commit is contained in:
koiNoCirculation 2023-10-17 15:31:33 -07:00
commit 7db1a65132
9 changed files with 222 additions and 99 deletions

View File

@ -1,4 +1,4 @@
//version: 1685785062
//version: 1695323114
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
@ -69,7 +69,7 @@ plugins {
id 'com.diffplug.spotless' version '6.13.0' apply false // 6.13.0 is the last jvm8 supporting version
id 'com.modrinth.minotaur' version '2.+' apply false
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.14'
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.24'
}
print("You might want to check out './gradlew :faq' if your build fails.\n")
@ -115,6 +115,8 @@ propertyDefaultIfUnset("usesMixinDebug", project.usesMixins)
propertyDefaultIfUnset("forceEnableMixins", false)
propertyDefaultIfUnset("channel", "stable")
propertyDefaultIfUnset("mappingsVersion", "12")
propertyDefaultIfUnset("usesMavenPublishing", true)
propertyDefaultIfUnset("mavenPublishUrl", "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases")
propertyDefaultIfUnset("modrinthProjectId", "")
propertyDefaultIfUnset("modrinthRelations", "")
propertyDefaultIfUnset("curseForgeProjectId", "")
@ -357,7 +359,27 @@ catch (Exception ignored) {
String identifiedVersion
String versionOverride = System.getenv("VERSION") ?: null
try {
identifiedVersion = versionOverride == null ? gitVersion() : versionOverride
// Produce a version based on the tag, or for branches something like 0.2.2-configurable-maven-and-extras.38+43090270b6-dirty
if (versionOverride == null) {
def gitDetails = versionDetails()
def isDirty = gitVersion().endsWith(".dirty") // No public API for this, isCleanTag has a different meaning
String branchName = gitDetails.branchName ?: (System.getenv('GIT_BRANCH') ?: 'git')
if (branchName.startsWith('origin/')) {
branchName = branchName.minus('origin/')
}
branchName = branchName.replaceAll("[^a-zA-Z0-9-]+", "-") // sanitize branch names for semver
identifiedVersion = gitDetails.lastTag ?: '${gitDetails.gitHash}'
if (gitDetails.commitDistance > 0) {
identifiedVersion += "-${branchName}.${gitDetails.commitDistance}+${gitDetails.gitHash}"
if (isDirty) {
identifiedVersion += "-dirty"
}
} else if (isDirty) {
identifiedVersion += "-${branchName}+${gitDetails.gitHash}-dirty"
}
} else {
identifiedVersion = versionOverride
}
}
catch (Exception ignored) {
out.style(Style.Failure).text(
@ -379,9 +401,13 @@ if (identifiedVersion == versionOverride) {
group = "com.github.GTNewHorizons"
if (project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
archivesBaseName = customArchiveBaseName
base {
archivesName = customArchiveBaseName
}
} else {
archivesBaseName = modId
base {
archivesName = modId
}
}
@ -465,10 +491,19 @@ sourceSets {
}
}
if (file('addon.gradle').exists()) {
if (file('addon.gradle.kts').exists()) {
apply from: 'addon.gradle.kts'
} else if (file('addon.gradle').exists()) {
apply from: 'addon.gradle'
}
// File for local tweaks not commited to Git
if (file('addon.local.gradle.kts').exists()) {
apply from: 'addon.local.gradle.kts'
} else if (file('addon.local.gradle').exists()) {
apply from: 'addon.local.gradle'
}
// Allow unsafe repos but warn
repositories.configureEach { repo ->
if (repo instanceof org.gradle.api.artifacts.repositories.UrlArtifactRepository) {
@ -479,7 +514,14 @@ repositories.configureEach { repo ->
}
}
apply from: 'repositories.gradle'
if (file('repositories.gradle.kts').exists()) {
apply from: 'repositories.gradle.kts'
} else if (file('repositories.gradle').exists()) {
apply from: 'repositories.gradle'
} else {
logger.error("Neither repositories.gradle.kts nor repositories.gradle was found, make sure you extracted the full ExampleMod template.")
throw new RuntimeException("Missing repositories.gradle[.kts]")
}
configurations {
runtimeClasspath.extendsFrom(runtimeOnlyNonPublishable)
@ -520,9 +562,6 @@ repositories {
maven {
name 'Overmind forge repo mirror'
url 'https://gregtech.overminddl1.com/'
mavenContent {
excludeGroup("net.minecraftforge") // missing the `universal` artefact
}
}
maven {
name = "GTNH Maven"
@ -537,24 +576,34 @@ repositories {
}
}
if (includeWellKnownRepositories.toBoolean()) {
maven {
name "CurseMaven"
url "https://cursemaven.com"
content {
exclusiveContent {
forRepository {
maven {
name "CurseMaven"
url "https://cursemaven.com"
}
}
filter {
includeGroup "curse.maven"
}
}
exclusiveContent {
forRepository {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
}
filter {
includeGroup "maven.modrinth"
}
}
maven {
name = "ic2"
url = "https://maven.ic2.player.to/"
metadataSources {
mavenPom()
artifact()
url = getURL("https://maven.ic2.player.to/", "https://maven2.ic2.player.to/")
content {
includeGroup "net.industrial-craft"
}
}
maven {
name = "ic2-mirror"
url = "https://maven2.ic2.player.to/"
metadataSources {
mavenPom()
artifact()
@ -574,6 +623,8 @@ def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}
def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev"
ext.mixinProviderSpec = mixinProviderSpec
def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json'
dependencies {
if (usesMixins.toBoolean()) {
annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3')
@ -585,7 +636,7 @@ dependencies {
}
}
if (usesMixins.toBoolean()) {
implementation(mixinProviderSpec)
implementation(modUtils.enableMixins(mixinProviderSpec, mixingConfigRefMap))
} else if (forceEnableMixins.toBoolean()) {
runtimeOnlyNonPublishable(mixinProviderSpec)
}
@ -611,12 +662,32 @@ configurations.all {
}
}
apply from: 'dependencies.gradle'
dependencies {
constraints {
def minGtnhLibVersion = "0.0.13"
implementation("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") {
because("fixes duplicate mod errors in java 17 configurations using old gtnhlib")
}
runtimeOnly("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") {
because("fixes duplicate mod errors in java 17 configurations using old gtnhlib")
}
devOnlyNonPublishable("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") {
because("fixes duplicate mod errors in java 17 configurations using old gtnhlib")
}
runtimeOnlyNonPublishable("com.github.GTNewHorizons:GTNHLib:${minGtnhLibVersion}") {
because("fixes duplicate mod errors in java 17 configurations using old gtnhlib")
}
}
}
def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json'
def mixinTmpDir = buildDir.path + File.separator + 'tmp' + File.separator + 'mixins'
def refMap = "${mixinTmpDir}" + File.separator + mixingConfigRefMap
def mixinSrg = "${mixinTmpDir}" + File.separator + "mixins.srg"
if (file('dependencies.gradle.kts').exists()) {
apply from: 'dependencies.gradle.kts'
} else if (file('dependencies.gradle').exists()) {
apply from: 'dependencies.gradle'
} else {
logger.error("Neither dependencies.gradle.kts nor dependencies.gradle was found, make sure you extracted the full ExampleMod template.")
throw new RuntimeException("Missing dependencies.gradle[.kts]")
}
tasks.register('generateAssets') {
group = "GTNH Buildscript"
@ -648,46 +719,17 @@ tasks.register('generateAssets') {
}
if (usesMixins.toBoolean()) {
tasks.named("reobfJar", ReobfuscatedJar).configure {
extraSrgFiles.from(mixinSrg)
}
tasks.named("processResources").configure {
dependsOn("generateAssets")
}
tasks.named("compileJava", JavaCompile).configure {
doFirst {
new File(mixinTmpDir).mkdirs()
}
options.compilerArgs += [
"-AreobfSrgFile=${tasks.reobfJar.srg.get().asFile}",
"-AoutSrgFile=${mixinSrg}",
"-AoutRefMapFile=${refMap}",
// Elan: from what I understand they are just some linter configs so you get some warning on how to properly code
"-XDenableSunApiLintControl",
"-XDignore.symbol.file"
]
}
pluginManager.withPlugin('org.jetbrains.kotlin.kapt') {
kapt {
correctErrorTypes = true
javacOptions {
option("-AreobfSrgFile=${tasks.reobfJar.srg.get().asFile}")
option("-AoutSrgFile=$mixinSrg")
option("-AoutRefMapFile=$refMap")
}
}
tasks.configureEach { task ->
if (task.name == "kaptKotlin") {
task.doFirst {
new File(mixinTmpDir).mkdirs()
}
}
}
}
}
tasks.named("processResources", ProcessResources).configure {
@ -705,7 +747,6 @@ tasks.named("processResources", ProcessResources).configure {
}
if (usesMixins.toBoolean()) {
from refMap
dependsOn("compileJava", "compileScala")
}
}
@ -724,16 +765,16 @@ ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies"
}
dependencies {
def lwjgl3ifyVersion = '1.3.5'
def lwjgl3ifyVersion = '1.4.0'
def asmVersion = '9.4'
if (modId != 'lwjgl3ify') {
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
}
if (modId != 'hodgepodge') {
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.13')
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.26')
}
java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false}
java17PatchDependencies('net.minecraft:launchwrapper:1.17.2') {transitive = false}
java17PatchDependencies("org.ow2.asm:asm:${asmVersion}")
java17PatchDependencies("org.ow2.asm:asm-commons:${asmVersion}")
java17PatchDependencies("org.ow2.asm:asm-tree:${asmVersion}")
@ -979,6 +1020,9 @@ idea {
}
}
runConfigurations {
"0. Build and Test"(Gradle) {
taskNames = ["build"]
}
"1. Run Client"(Gradle) {
taskNames = ["runClient"]
}
@ -1098,6 +1142,14 @@ tasks.named("processIdeaSettings").configure {
dependsOn("injectTags")
}
tasks.named("ideVirtualMainClasses").configure {
// Make IntelliJ "Build project" build the mod jars
dependsOn("jar", "reobfJar")
if (!disableSpotless) {
dependsOn("spotlessCheck")
}
}
// workaround variable hiding in pom processing
def projectConfigs = project.configurations
@ -1118,12 +1170,14 @@ publishing {
}
repositories {
maven {
url = "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases"
allowInsecureProtocol = true
credentials {
username = System.getenv("MAVEN_USER") ?: "NONE"
password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
if (usesMavenPublishing.toBoolean()) {
maven {
url = mavenPublishUrl
allowInsecureProtocol = mavenPublishUrl.startsWith("http://") // Mostly for the GTNH maven
credentials {
username = System.getenv("MAVEN_USER") ?: "NONE"
password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
}
}
}
}
@ -1238,7 +1292,7 @@ def addCurseForgeRelation(String type, String name) {
// Updating
def buildscriptGradleVersion = "8.1.1"
def buildscriptGradleVersion = "8.2.1"
tasks.named('wrapper', Wrapper).configure {
gradleVersion = buildscriptGradleVersion
@ -1344,8 +1398,14 @@ boolean isNewBuildScriptVersionAvailable() {
String currentBuildScript = getFile("build.gradle").getText()
String currentBuildScriptHash = getVersionHash(currentBuildScript)
String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText()
String availableBuildScriptHash = getVersionHash(availableBuildScript)
String availableBuildScriptHash
try {
String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText()
availableBuildScriptHash = getVersionHash(availableBuildScript)
} catch (IOException e) {
logger.warn("Could not check for buildscript update availability: {}", e.message)
return false
}
boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash
return !isUpToDate
@ -1510,3 +1570,36 @@ def getSecondaryArtifacts() {
if (apiPackage) secondaryArtifacts += [apiJar]
return secondaryArtifacts
}
def getURL(String main, String fallback) {
return pingURL(main, 10000) ? main : fallback
}
// credit: https://stackoverflow.com/a/3584332
def pingURL(String url, int timeout) {
url = url.replaceFirst("^https", "http") // Otherwise an exception may be thrown on invalid SSL certificates.
try {
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection()
connection.setConnectTimeout(timeout)
connection.setReadTimeout(timeout)
connection.setRequestMethod("HEAD")
int responseCode = connection.getResponseCode()
return 200 <= responseCode && responseCode <= 399
} catch (IOException ignored) {
return false
}
}
// For easier scripting of things that require variables defined earlier in the buildscript
if (file('addon.late.gradle.kts').exists()) {
apply from: 'addon.late.gradle.kts'
} else if (file('addon.late.gradle').exists()) {
apply from: 'addon.late.gradle'
}
// File for local tweaks not commited to Git
if (file('addon.late.local.gradle.kts').exists()) {
apply from: 'addon.late.local.gradle.kts'
} else if (file('addon.late.local.gradle').exists()) {
apply from: 'addon.late.local.gradle'
}

View File

@ -7,25 +7,25 @@ dependencies {
compile("com.google.code.findbugs:jsr305:3.0.2")
compileOnly("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-195-GTNH:dev") {
compileOnly("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-256-GTNH:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:EnderStorage:1.4.12:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.43.99:dev") {
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.44.19:dev") {
transitive = false
}
compile("com.github.GTNewHorizons:ForestryMC:4.6.6:dev") {
compile("com.github.GTNewHorizons:ForestryMC:4.6.14:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:Railcraft:9.14.1:dev") {
compileOnly("com.github.GTNewHorizons:Railcraft:9.15.0:dev") {
transitive = false
}
compile("com.github.GTNewHorizons:NotEnoughItems:2.3.45-GTNH:dev") {
compile("com.github.GTNewHorizons:NotEnoughItems:2.4.2-GTNH:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:ForgeMultipart:1.3.3:dev") {
compileOnly("com.github.GTNewHorizons:ForgeMultipart:1.3.4:dev") {
transitive = false
}
compile("com.github.GTNewHorizons:CodeChickenLib:1.1.8:dev") {
@ -34,32 +34,32 @@ dependencies {
compile("com.github.GTNewHorizons:CodeChickenCore:1.1.11:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:waila:1.5.24:dev") {
compileOnly("com.github.GTNewHorizons:waila:1.6.0:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:Galacticraft:3.0.68-GTNH:dev") {
compileOnly("com.github.GTNewHorizons:Galacticraft:3.0.73-GTNH:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:TinkersMechworks:0.2.16.4:dev") {
compileOnly("com.github.GTNewHorizons:TinkersMechworks:0.2.17:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:ProjectRed:4.7.9-GTNH:dev") {
compileOnly("com.github.GTNewHorizons:ProjectRed:4.7.12-GTNH:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:BloodMagic:1.4.0:dev") {
compileOnly("com.github.GTNewHorizons:BloodMagic:1.4.3:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:ThaumicEnergistics:1.4.1-GTNH:dev") {
compileOnly("com.github.GTNewHorizons:ThaumicEnergistics:1.4.13-GTNH:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:ExtraCells2:2.5.33:dev") {
compileOnly("com.github.GTNewHorizons:ExtraCells2:2.5.34:dev") {
transitive = false
}
compileOnly('com.github.GTNewHorizons:AE2FluidCraft-Rework:1.1.21-gtnh:dev') {
compileOnly('com.github.GTNewHorizons:AE2FluidCraft-Rework:1.1.42-gtnh:dev') {
transitive = false
}
compile("com.github.GTNewHorizons:EnderCore:0.2.14:dev")
compile("com.github.GTNewHorizons:EnderIO:2.4.11:dev") {
compile("com.github.GTNewHorizons:EnderCore:0.2.17:dev")
compile("com.github.GTNewHorizons:EnderIO:2.4.24:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:Avaritiaddons:1.5.5-GTNH:dev") {
@ -71,7 +71,7 @@ dependencies {
compileOnly("com.github.GTNewHorizons:WirelessRedstone-CBE:1.4.8:dev") {
transitive = false
}
compileOnly("com.github.GTNewHorizons:BuildCraft:7.1.33:dev") {
compileOnly("com.github.GTNewHorizons:BuildCraft:7.1.36:dev") {
transitive = false
}
compileOnly("appeng:RotaryCraft:V5c:api") {

Binary file not shown.

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

7
gradlew vendored
View File

@ -85,9 +85,6 @@ done
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in

View File

@ -13,14 +13,6 @@ repositories {
artifact()
}
}
maven {
name = "ic2"
url = "https://maven.ic2.player.to/"
metadataSources {
mavenPom()
artifact()
}
}
ivy {
name "OC LuaJ/JNLua dependencies"
artifactPattern "http://asie.pl/javadeps/[module]-[revision](-[classifier]).[ext]"

View File

@ -1,6 +1,8 @@
package li.cil.oc.integration.ic2;
import ic2.api.reactor.IReactor;
import ic2.core.block.TileEntityBlock;
import ic2.core.block.reactor.tileentity.TileEntityNuclearReactorElectric;
import li.cil.oc.api.driver.NamedBlock;
import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
@ -38,6 +40,16 @@ public final class DriverReactor extends DriverSidedTileEntity {
return 0;
}
@Callback(doc = "function(active:boolean): boolean -- activate or deactivate the reactor")
public Object[] setActive(final Context context, final Arguments args) {
TileEntityNuclearReactorElectric reactor = (TileEntityNuclearReactorElectric) tileEntity;
if(reactor != null) {
reactor.setRedstoneSignal(args.optBoolean(0, false));
return new Object[]{reactor.receiveredstone()};
}
return new Object[]{false};
}
@Callback(doc = "function():number -- Get the reactor's heat.")
public Object[] getHeat(final Context context, final Arguments args) {
return new Object[] {tileEntity.getHeat()};

View File

@ -2,6 +2,8 @@ package li.cil.oc.integration.ic2;
import ic2.api.reactor.IReactor;
import ic2.api.reactor.IReactorChamber;
import ic2.core.block.TileEntityBlock;
import ic2.core.block.reactor.tileentity.TileEntityNuclearReactorElectric;
import li.cil.oc.api.driver.NamedBlock;
import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
@ -39,6 +41,15 @@ public final class DriverReactorChamber extends DriverSidedTileEntity {
return 0;
}
@Callback(doc = "function(active:boolean): boolean -- activate or deactivate the reactor")
public Object[] setActive(final Context context, final Arguments args) {
TileEntityNuclearReactorElectric reactor = (TileEntityNuclearReactorElectric) tileEntity.getReactor();
if(reactor != null) {
reactor.setRedstoneSignal(args.optBoolean(0, false));
return new Object[]{reactor.receiveredstone()};
}
return new Object[]{false};
}
@Callback(doc = "function():number -- Get the reactor's heat.")
public Object[] getHeat(final Context context, final Arguments args) {
final IReactor reactor = tileEntity.getReactor();

View File

@ -2,6 +2,9 @@ package li.cil.oc.integration.ic2;
import ic2.api.reactor.IReactor;
import ic2.api.reactor.IReactorChamber;
import ic2.core.block.TileEntityBlock;
import ic2.core.block.reactor.tileentity.TileEntityNuclearReactorElectric;
import ic2.core.block.reactor.tileentity.TileEntityReactorChamberElectric;
import ic2.core.block.reactor.tileentity.TileEntityReactorRedstonePort;
import li.cil.oc.api.driver.NamedBlock;
import li.cil.oc.api.machine.Arguments;
@ -52,6 +55,17 @@ public final class DriverReactorRedstonePort extends DriverSidedTileEntity {
}
}
@Callback(doc = "function(active:boolean): boolean -- activate or deactivate the reactor")
public Object[] setActive(final Context context, final Arguments args) {
TileEntityReactorChamberElectric reactorChamberElectric = (TileEntityReactorChamberElectric) tileEntity.getReactor();
TileEntityNuclearReactorElectric reactor = reactorChamberElectric.getReactor();
if(reactor != null) {
reactor.setRedstoneSignal(args.optBoolean(0, false));
return new Object[]{reactor.receiveredstone()};
}
return new Object[]{false};
}
@Callback(doc = "function():number -- Get the reactor's heat.")
public Object[] getHeat(final Context context, final Arguments args) {
final IReactor reactor = getReactor();