Fix NPE with Lumbermill (#35)

* Remove outdated script

* updateBuildScript

* Update dependencies

* Fix NPE with Lumbermill

---------

Co-authored-by: Martin Robertz <dream-master@gmx.net>
This commit is contained in:
miozuneandMartin Robertz authored and GitHub committed 2023-08-19 12:34:10 +02:00
1 parent 669aee5ba6
commit ef877e2f7d
8 files changed
+49 -116

No files matched your search

-33
View File
@@ -1,33 +0,0 @@
#!/usr/bin/env bash
RUNDIR="run"
CRASH="crash-reports"
SERVERLOG="server.log"
if [[ -d $RUNDIR/$CRASH ]]; then
echo "Crash reports detected:"
cat $RUNDIR/$CRASH/crash*.txt
exit 1
fi
if grep --quiet "Fatal errors were detected" $SERVERLOG; then
echo "Fatal errors detected:"
cat server.log
exit 1
fi
if grep --quiet "The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED" $SERVERLOG; then
echo "Server force stopped:"
cat server.log
exit 1
fi
if ! grep --quiet -Po '.+Done \(.+\)\! For help, type "help" or "\?"' $SERVERLOG; then
echo "Server didn't finish startup:"
cat server.log
exit 1
fi
echo "No crash reports detected"
exit 0
+37 -48
View File
@@ -1,4 +1,4 @@
//version: 1689409577 //version: 1691351470
/* /*
DO NOT CHANGE THIS FILE! DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available. 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.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.modrinth.minotaur' version '2.+' apply false
id 'com.matthewprenger.cursegradle' version '1.4.0' apply false id 'com.matthewprenger.cursegradle' version '1.4.0' apply false
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.19' id 'com.gtnewhorizons.retrofuturagradle' version '1.3.24'
} }
print("You might want to check out './gradlew :faq' if your build fails.\n") print("You might want to check out './gradlew :faq' if your build fails.\n")
@@ -401,9 +401,13 @@ if (identifiedVersion == versionOverride) {
group = "com.github.GTNewHorizons" group = "com.github.GTNewHorizons"
if (project.hasProperty("customArchiveBaseName") && customArchiveBaseName) { if (project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
archivesBaseName = customArchiveBaseName base {
archivesName = customArchiveBaseName
}
} else { } else {
archivesBaseName = modId base {
archivesName = modId
}
} }
@@ -575,13 +579,28 @@ repositories {
} }
} }
if (includeWellKnownRepositories.toBoolean()) { if (includeWellKnownRepositories.toBoolean()) {
maven { exclusiveContent {
name "CurseMaven" forRepository {
url "https://cursemaven.com" maven {
content { name "CurseMaven"
url "https://cursemaven.com"
}
}
filter {
includeGroup "curse.maven" includeGroup "curse.maven"
} }
} }
exclusiveContent {
forRepository {
maven {
name = "Modrinth"
url = "https://api.modrinth.com/maven"
}
}
filter {
includeGroup "maven.modrinth"
}
}
maven { maven {
name = "ic2" name = "ic2"
url = "https://maven.ic2.player.to/" url = "https://maven.ic2.player.to/"
@@ -612,6 +631,8 @@ def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}
def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev" def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev"
ext.mixinProviderSpec = mixinProviderSpec ext.mixinProviderSpec = mixinProviderSpec
def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json'
dependencies { dependencies {
if (usesMixins.toBoolean()) { if (usesMixins.toBoolean()) {
annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3') annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3')
@@ -623,7 +644,7 @@ dependencies {
} }
} }
if (usesMixins.toBoolean()) { if (usesMixins.toBoolean()) {
implementation(mixinProviderSpec) implementation(modUtils.enableMixins(mixinProviderSpec, mixingConfigRefMap))
} else if (forceEnableMixins.toBoolean()) { } else if (forceEnableMixins.toBoolean()) {
runtimeOnlyNonPublishable(mixinProviderSpec) runtimeOnlyNonPublishable(mixinProviderSpec)
} }
@@ -676,11 +697,6 @@ if (file('dependencies.gradle.kts').exists()) {
throw new RuntimeException("Missing dependencies.gradle[.kts]") throw new RuntimeException("Missing dependencies.gradle[.kts]")
} }
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"
tasks.register('generateAssets') { tasks.register('generateAssets') {
group = "GTNH Buildscript" group = "GTNH Buildscript"
description = "Generates a mixin config file at /src/main/resources/mixins.modid.json if needed" description = "Generates a mixin config file at /src/main/resources/mixins.modid.json if needed"
@@ -711,46 +727,17 @@ tasks.register('generateAssets') {
} }
if (usesMixins.toBoolean()) { if (usesMixins.toBoolean()) {
tasks.named("reobfJar", ReobfuscatedJar).configure {
extraSrgFiles.from(mixinSrg)
}
tasks.named("processResources").configure { tasks.named("processResources").configure {
dependsOn("generateAssets") dependsOn("generateAssets")
} }
tasks.named("compileJava", JavaCompile).configure { tasks.named("compileJava", JavaCompile).configure {
doFirst {
new File(mixinTmpDir).mkdirs()
}
options.compilerArgs += [ 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 // Elan: from what I understand they are just some linter configs so you get some warning on how to properly code
"-XDenableSunApiLintControl", "-XDenableSunApiLintControl",
"-XDignore.symbol.file" "-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 { tasks.named("processResources", ProcessResources).configure {
@@ -768,7 +755,6 @@ tasks.named("processResources", ProcessResources).configure {
} }
if (usesMixins.toBoolean()) { if (usesMixins.toBoolean()) {
from refMap
dependsOn("compileJava", "compileScala") dependsOn("compileJava", "compileScala")
} }
} }
@@ -793,10 +779,10 @@ dependencies {
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}") java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
} }
if (modId != 'hodgepodge') { if (modId != 'hodgepodge') {
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.19') 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:${asmVersion}")
java17PatchDependencies("org.ow2.asm:asm-commons:${asmVersion}") java17PatchDependencies("org.ow2.asm:asm-commons:${asmVersion}")
java17PatchDependencies("org.ow2.asm:asm-tree:${asmVersion}") java17PatchDependencies("org.ow2.asm:asm-tree:${asmVersion}")
@@ -1166,7 +1152,10 @@ tasks.named("processIdeaSettings").configure {
tasks.named("ideVirtualMainClasses").configure { tasks.named("ideVirtualMainClasses").configure {
// Make IntelliJ "Build project" build the mod jars // Make IntelliJ "Build project" build the mod jars
dependsOn("jar", "reobfJar", "spotlessCheck") dependsOn("jar", "reobfJar")
if (!disableSpotless) {
dependsOn("spotlessCheck")
}
} }
// workaround variable hiding in pom processing // workaround variable hiding in pom processing
@@ -1311,7 +1300,7 @@ def addCurseForgeRelation(String type, String name) {
// Updating // Updating
def buildscriptGradleVersion = "8.1.1" def buildscriptGradleVersion = "8.2.1"
tasks.named('wrapper', Wrapper).configure { tasks.named('wrapper', Wrapper).configure {
gradleVersion = buildscriptGradleVersion gradleVersion = buildscriptGradleVersion
+3 -4
View File
@@ -1,12 +1,11 @@
// Add your dependencies here // Add your dependencies here
dependencies { dependencies {
api('com.github.GTNewHorizons:ForestryMC:4.6.14:dev')
implementation('com.github.GTNewHorizons:GTNHLib:0.0.13:dev') implementation('com.github.GTNewHorizons:GTNHLib:0.0.13:dev')
compile('com.github.GTNewHorizons:ForestryMC:4.6.13:dev')
compile('com.github.GTNewHorizons:NotEnoughItems:2.3.76-GTNH:dev')
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.34:api') devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.3.81-GTNH:dev')
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.36:api')
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev') compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
compileOnly('curse.maven:cofh-lib-220333:2388748')
} }
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists 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 networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
Vendored
+4 -3
View File
@@ -85,9 +85,6 @@ done
APP_BASE_NAME=${0##*/} APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit 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. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done done
fi 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; # Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in # shell script including quotes and variable substitutions, so put them in
-22
View File
@@ -1,26 +1,4 @@
// Add any additional repositories for your dependencies here // Add any additional repositories for your dependencies here
repositories { repositories {
maven {
name 'GTNH Maven'
url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/'
allowInsecureProtocol
}
maven {
name 'ic2'
url 'http://maven.ic2.player.to/'
metadataSources {
mavenPom()
artifact()
}
}
maven {
url 'https://cursemaven.com'
content {
includeGroup 'curse.maven'
}
}
maven {
url 'https://jitpack.io'
}
} }
@@ -29,19 +29,18 @@ public class Lumbermill {
public static Map<ItemStack, ItemStack> recipes = new HashMap<>(); public static Map<ItemStack, ItemStack> recipes = new HashMap<>();
public static ItemStack getPlankProduct(ItemStack item) { public static ItemStack getPlankProduct(ItemStack item) {
ItemStack stack = null;
if (Lumbermill.recipes.isEmpty()) { if (Lumbermill.recipes.isEmpty()) {
calculateLumbermillProducts(); calculateLumbermillProducts();
} }
for (Map.Entry<ItemStack, ItemStack> entry : Lumbermill.recipes.entrySet()) { for (Map.Entry<ItemStack, ItemStack> entry : Lumbermill.recipes.entrySet()) {
if (entry.getKey().isItemEqual(item)) { if (entry.getKey().isItemEqual(item)) {
stack = entry.getValue().copy(); ItemStack stack = entry.getValue().copy();
break; stack.stackSize = 6;
return stack;
} }
} }
stack.stackSize = 6; return null;
return stack;
} }
public static void calculateLumbermillProducts() { public static void calculateLumbermillProducts() {