mirror of
https://github.com/GTNewHorizons/CraftTweaker.git
synced 2026-11-24 22:04:23 +00:00
Compare commits
5
Commits
3.3.0
..
translator
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8fcb36d394 | ||
|
|
f9db90268e | ||
|
|
e7cd5e602d | ||
|
|
65e1f469ae | ||
|
|
7fe4150afc |
No files matched your search
Executable
+51
@@ -0,0 +1,51 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# bashsupport disable=BP5006 # Global environment variables
|
||||||
|
RUNDIR="run" \
|
||||||
|
CRASH="crash-reports" \
|
||||||
|
SERVERLOG="server.log"
|
||||||
|
|
||||||
|
# enable nullglob to get 0 results when no match rather than the pattern
|
||||||
|
shopt -s nullglob
|
||||||
|
|
||||||
|
# store matches in array
|
||||||
|
crash_reports=("$RUNDIR/$CRASH/crash"*.txt)
|
||||||
|
|
||||||
|
# if array not empty there are crash_reports
|
||||||
|
if [ "${#crash_reports[@]}" -gt 0 ]; then
|
||||||
|
# get the latest crash_report from array
|
||||||
|
latest_crash_report="${crash_reports[-1]}"
|
||||||
|
{
|
||||||
|
printf 'Latest crash report detected %s:\n' "${latest_crash_report##*/}"
|
||||||
|
cat "$latest_crash_report"
|
||||||
|
} >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep --quiet --fixed-strings 'Fatal errors were detected' "$SERVERLOG"; then
|
||||||
|
{
|
||||||
|
printf 'Fatal errors detected:\n'
|
||||||
|
cat server.log
|
||||||
|
} >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep --quiet --fixed-strings 'The state engine was in incorrect state ERRORED and forced into state SERVER_STOPPED' \
|
||||||
|
"$SERVERLOG"; then
|
||||||
|
{
|
||||||
|
printf 'Server force stopped:'
|
||||||
|
cat server.log
|
||||||
|
} >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! grep --quiet --perl-regexp --only-matching '.+Done \(.+\)\! For help, type "help" or "\?"' "$SERVERLOG"; then
|
||||||
|
{
|
||||||
|
printf 'Server did not finish startup:'
|
||||||
|
cat server.log
|
||||||
|
} >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf 'No crash reports detected'
|
||||||
|
exit 0
|
||||||
+111
-239
@@ -1,4 +1,4 @@
|
|||||||
//version: 1704751096
|
//version: 1682280358
|
||||||
/*
|
/*
|
||||||
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.
|
||||||
@@ -28,11 +28,27 @@ import java.util.concurrent.TimeUnit
|
|||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
repositories {
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
|
||||||
|
maven {
|
||||||
|
name 'forge'
|
||||||
|
url 'https://maven.minecraftforge.net'
|
||||||
|
}
|
||||||
maven {
|
maven {
|
||||||
// GTNH RetroFuturaGradle and ASM Fork
|
// GTNH RetroFuturaGradle and ASM Fork
|
||||||
name "GTNH Maven"
|
name "GTNH Maven"
|
||||||
url "https://nexus.gtnewhorizons.com/repository/public/"
|
url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
||||||
|
allowInsecureProtocol = true
|
||||||
}
|
}
|
||||||
|
maven {
|
||||||
|
name 'sonatype'
|
||||||
|
url 'https://oss.sonatype.org/content/repositories/snapshots/'
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
name 'Scala CI dependencies'
|
||||||
|
url 'https://repo1.maven.org/maven2/'
|
||||||
|
}
|
||||||
|
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,16 +64,13 @@ plugins {
|
|||||||
id 'org.ajoberstar.grgit' version '4.1.1' // 4.1.1 is the last jvm8 supporting version, unused, available for addon.gradle
|
id 'org.ajoberstar.grgit' version '4.1.1' // 4.1.1 is the last jvm8 supporting version, unused, available for addon.gradle
|
||||||
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
|
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
|
||||||
id 'com.palantir.git-version' version '3.0.0' apply false
|
id 'com.palantir.git-version' version '3.0.0' apply false
|
||||||
id 'de.undercouch.download' version '5.5.0'
|
id 'de.undercouch.download' version '5.4.0'
|
||||||
id 'com.github.gmazzo.buildconfig' version '3.1.0' apply false // Unused, available for addon.gradle
|
id 'com.github.gmazzo.buildconfig' version '3.1.0' apply false // Unused, available for addon.gradle
|
||||||
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.27'
|
id 'com.gtnewhorizons.retrofuturagradle' version '1.3.2'
|
||||||
}
|
}
|
||||||
|
|
||||||
print("You might want to check out './gradlew :faq' if your build fails.\n")
|
|
||||||
|
|
||||||
boolean settingsupdated = verifySettingsGradle()
|
boolean settingsupdated = verifySettingsGradle()
|
||||||
settingsupdated = verifyGitAttributes() || settingsupdated
|
settingsupdated = verifyGitAttributes() || settingsupdated
|
||||||
if (settingsupdated)
|
if (settingsupdated)
|
||||||
@@ -73,23 +86,6 @@ def out = services.get(StyledTextOutputFactory).create('an-output')
|
|||||||
def projectJavaVersion = JavaLanguageVersion.of(8)
|
def projectJavaVersion = JavaLanguageVersion.of(8)
|
||||||
|
|
||||||
boolean disableSpotless = project.hasProperty("disableSpotless") ? project.disableSpotless.toBoolean() : false
|
boolean disableSpotless = project.hasProperty("disableSpotless") ? project.disableSpotless.toBoolean() : false
|
||||||
boolean disableCheckstyle = project.hasProperty("disableCheckstyle") ? project.disableCheckstyle.toBoolean() : false
|
|
||||||
|
|
||||||
final String CHECKSTYLE_CONFIG = """
|
|
||||||
<!DOCTYPE module PUBLIC
|
|
||||||
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
|
|
||||||
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
|
|
||||||
<module name="Checker">
|
|
||||||
<module name="TreeWalker">
|
|
||||||
<!-- Use CHECKSTYLE:OFF and CHECKSTYLE:ON comments to suppress checkstyle lints in a block -->
|
|
||||||
<module name="SuppressionCommentFilter"/>
|
|
||||||
<module name="AvoidStarImport">
|
|
||||||
<!-- Allow static wildcard imports for cases like Opcodes and LWJGL classes, these don't get created accidentally by the IDE -->
|
|
||||||
<property name="allowStaticMemberImports" value="true"/>
|
|
||||||
</module>
|
|
||||||
</module>
|
|
||||||
</module>
|
|
||||||
"""
|
|
||||||
|
|
||||||
checkPropertyExists("modName")
|
checkPropertyExists("modName")
|
||||||
checkPropertyExists("modId")
|
checkPropertyExists("modId")
|
||||||
@@ -116,8 +112,6 @@ propertyDefaultIfUnset("usesMixinDebug", project.usesMixins)
|
|||||||
propertyDefaultIfUnset("forceEnableMixins", false)
|
propertyDefaultIfUnset("forceEnableMixins", false)
|
||||||
propertyDefaultIfUnset("channel", "stable")
|
propertyDefaultIfUnset("channel", "stable")
|
||||||
propertyDefaultIfUnset("mappingsVersion", "12")
|
propertyDefaultIfUnset("mappingsVersion", "12")
|
||||||
propertyDefaultIfUnset("usesMavenPublishing", true)
|
|
||||||
propertyDefaultIfUnset("mavenPublishUrl", "https://nexus.gtnewhorizons.com/repository/releases/")
|
|
||||||
propertyDefaultIfUnset("modrinthProjectId", "")
|
propertyDefaultIfUnset("modrinthProjectId", "")
|
||||||
propertyDefaultIfUnset("modrinthRelations", "")
|
propertyDefaultIfUnset("modrinthRelations", "")
|
||||||
propertyDefaultIfUnset("curseForgeProjectId", "")
|
propertyDefaultIfUnset("curseForgeProjectId", "")
|
||||||
@@ -141,17 +135,6 @@ if (!disableSpotless) {
|
|||||||
apply from: Blowdryer.file('spotless.gradle')
|
apply from: Blowdryer.file('spotless.gradle')
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!disableCheckstyle) {
|
|
||||||
apply plugin: 'checkstyle'
|
|
||||||
tasks.named("checkstylePatchedMc") { enabled = false }
|
|
||||||
tasks.named("checkstyleMcLauncher") { enabled = false }
|
|
||||||
tasks.named("checkstyleIdeVirtualMain") { enabled = false }
|
|
||||||
tasks.named("checkstyleInjectedTags") { enabled = false }
|
|
||||||
checkstyle {
|
|
||||||
config = resources.text.fromString(CHECKSTYLE_CONFIG)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String javaSourceDir = "src/main/java/"
|
String javaSourceDir = "src/main/java/"
|
||||||
String scalaSourceDir = "src/main/scala/"
|
String scalaSourceDir = "src/main/scala/"
|
||||||
String kotlinSourceDir = "src/main/kotlin/"
|
String kotlinSourceDir = "src/main/kotlin/"
|
||||||
@@ -236,8 +219,6 @@ if (enableModernJavaSyntax.toBoolean()) {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.0'
|
annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.0'
|
||||||
// workaround for https://github.com/bsideup/jabel/issues/174
|
|
||||||
annotationProcessor 'net.java.dev.jna:jna-platform:5.13.0'
|
|
||||||
compileOnly('com.github.bsideup.jabel:jabel-javac-plugin:1.0.0') {
|
compileOnly('com.github.bsideup.jabel:jabel-javac-plugin:1.0.0') {
|
||||||
transitive = false // We only care about the 1 annotation class
|
transitive = false // We only care about the 1 annotation class
|
||||||
}
|
}
|
||||||
@@ -286,7 +267,7 @@ if (apiPackage) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (accessTransformersFile) {
|
if (accessTransformersFile) {
|
||||||
for (atFile in accessTransformersFile.split(" ")) {
|
for (atFile in accessTransformersFile.split(",")) {
|
||||||
String targetFile = "src/main/resources/META-INF/" + atFile.trim()
|
String targetFile = "src/main/resources/META-INF/" + atFile.trim()
|
||||||
if (!getFile(targetFile).exists()) {
|
if (!getFile(targetFile).exists()) {
|
||||||
throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile)
|
throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile)
|
||||||
@@ -371,27 +352,7 @@ catch (Exception ignored) {
|
|||||||
String identifiedVersion
|
String identifiedVersion
|
||||||
String versionOverride = System.getenv("VERSION") ?: null
|
String versionOverride = System.getenv("VERSION") ?: null
|
||||||
try {
|
try {
|
||||||
// Produce a version based on the tag, or for branches something like 0.2.2-configurable-maven-and-extras.38+43090270b6-dirty
|
identifiedVersion = versionOverride == null ? gitVersion() : versionOverride
|
||||||
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) {
|
catch (Exception ignored) {
|
||||||
out.style(Style.Failure).text(
|
out.style(Style.Failure).text(
|
||||||
@@ -413,13 +374,9 @@ if (identifiedVersion == versionOverride) {
|
|||||||
|
|
||||||
group = "com.github.GTNewHorizons"
|
group = "com.github.GTNewHorizons"
|
||||||
if (project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
|
if (project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
|
||||||
base {
|
archivesBaseName = customArchiveBaseName
|
||||||
archivesName = customArchiveBaseName
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
base {
|
archivesBaseName = modId
|
||||||
archivesName = modId
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -503,19 +460,10 @@ sourceSets {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file('addon.gradle.kts').exists()) {
|
if (file('addon.gradle').exists()) {
|
||||||
apply from: 'addon.gradle.kts'
|
|
||||||
} else if (file('addon.gradle').exists()) {
|
|
||||||
apply from: 'addon.gradle'
|
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
|
// Allow unsafe repos but warn
|
||||||
repositories.configureEach { repo ->
|
repositories.configureEach { repo ->
|
||||||
if (repo instanceof org.gradle.api.artifacts.repositories.UrlArtifactRepository) {
|
if (repo instanceof org.gradle.api.artifacts.repositories.UrlArtifactRepository) {
|
||||||
@@ -526,14 +474,7 @@ repositories.configureEach { repo ->
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (file('repositories.gradle.kts').exists()) {
|
apply from: 'repositories.gradle'
|
||||||
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 {
|
configurations {
|
||||||
runtimeClasspath.extendsFrom(runtimeOnlyNonPublishable)
|
runtimeClasspath.extendsFrom(runtimeOnlyNonPublishable)
|
||||||
@@ -571,16 +512,17 @@ afterEvaluate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
maven {
|
|
||||||
name = "GTNH Maven"
|
|
||||||
url = "https://nexus.gtnewhorizons.com/repository/public/"
|
|
||||||
// Links for convenience:
|
|
||||||
// Simple HTML browsing: https://nexus.gtnewhorizons.com/service/rest/repository/browse/releases/
|
|
||||||
// Rich web UI browsing: https://nexus.gtnewhorizons.com/#browse/browse:releases
|
|
||||||
}
|
|
||||||
maven {
|
maven {
|
||||||
name 'Overmind forge repo mirror'
|
name 'Overmind forge repo mirror'
|
||||||
url 'https://gregtech.overminddl1.com/'
|
url 'https://gregtech.overminddl1.com/'
|
||||||
|
mavenContent {
|
||||||
|
excludeGroup("net.minecraftforge") // missing the `universal` artefact
|
||||||
|
}
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
name = "GTNH Maven"
|
||||||
|
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
||||||
|
allowInsecureProtocol = true
|
||||||
}
|
}
|
||||||
maven {
|
maven {
|
||||||
name 'sonatype'
|
name 'sonatype'
|
||||||
@@ -590,34 +532,24 @@ repositories {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (includeWellKnownRepositories.toBoolean()) {
|
if (includeWellKnownRepositories.toBoolean()) {
|
||||||
exclusiveContent {
|
maven {
|
||||||
forRepository {
|
name "CurseMaven"
|
||||||
maven {
|
url "https://cursemaven.com"
|
||||||
name "CurseMaven"
|
content {
|
||||||
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 = getURL("https://maven2.ic2.player.to/", "https://maven.ic2.player.to/")
|
url = "https://maven.ic2.player.to/"
|
||||||
content {
|
metadataSources {
|
||||||
includeGroup "net.industrial-craft"
|
mavenPom()
|
||||||
|
artifact()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
name = "ic2-mirror"
|
||||||
|
url = "https://maven2.ic2.player.to/"
|
||||||
metadataSources {
|
metadataSources {
|
||||||
mavenPom()
|
mavenPom()
|
||||||
artifact()
|
artifact()
|
||||||
@@ -632,12 +564,9 @@ repositories {
|
|||||||
|
|
||||||
def mixinProviderGroup = "io.github.legacymoddingmc"
|
def mixinProviderGroup = "io.github.legacymoddingmc"
|
||||||
def mixinProviderModule = "unimixins"
|
def mixinProviderModule = "unimixins"
|
||||||
def mixinProviderVersion = "0.1.13"
|
def mixinProviderVersion = "0.1.6"
|
||||||
def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}:${mixinProviderVersion}"
|
def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}:${mixinProviderVersion}"
|
||||||
def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev"
|
def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev"
|
||||||
ext.mixinProviderSpec = mixinProviderSpec
|
|
||||||
|
|
||||||
def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json'
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
if (usesMixins.toBoolean()) {
|
if (usesMixins.toBoolean()) {
|
||||||
@@ -650,7 +579,7 @@ dependencies {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (usesMixins.toBoolean()) {
|
if (usesMixins.toBoolean()) {
|
||||||
implementation(modUtils.enableMixins(mixinProviderSpec, mixingConfigRefMap))
|
implementation(mixinProviderSpec)
|
||||||
} else if (forceEnableMixins.toBoolean()) {
|
} else if (forceEnableMixins.toBoolean()) {
|
||||||
runtimeOnlyNonPublishable(mixinProviderSpec)
|
runtimeOnlyNonPublishable(mixinProviderSpec)
|
||||||
}
|
}
|
||||||
@@ -673,37 +602,15 @@ configurations.all {
|
|||||||
substitute module('com.github.GTNewHorizons:SpongePoweredMixin') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods")
|
substitute module('com.github.GTNewHorizons:SpongePoweredMixin') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods")
|
||||||
substitute module('com.github.GTNewHorizons:SpongeMixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods")
|
substitute module('com.github.GTNewHorizons:SpongeMixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods")
|
||||||
substitute module('io.github.legacymoddingmc:unimixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Our previous unimixins upload was missing the dev classifier")
|
substitute module('io.github.legacymoddingmc:unimixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Our previous unimixins upload was missing the dev classifier")
|
||||||
|
|
||||||
substitute module('org.scala-lang:scala-library:2.11.1') using module('org.scala-lang:scala-library:2.11.5') because('To allow mixing with Java 8 targets')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
apply from: 'dependencies.gradle'
|
||||||
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")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file('dependencies.gradle.kts').exists()) {
|
def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json'
|
||||||
apply from: 'dependencies.gradle.kts'
|
def mixinTmpDir = buildDir.path + File.separator + 'tmp' + File.separator + 'mixins'
|
||||||
} else if (file('dependencies.gradle').exists()) {
|
def refMap = "${mixinTmpDir}" + File.separator + mixingConfigRefMap
|
||||||
apply from: 'dependencies.gradle'
|
def mixinSrg = "${mixinTmpDir}" + File.separator + "mixins.srg"
|
||||||
} 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') {
|
tasks.register('generateAssets') {
|
||||||
group = "GTNH Buildscript"
|
group = "GTNH Buildscript"
|
||||||
@@ -735,17 +642,46 @@ 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 {
|
||||||
@@ -763,6 +699,7 @@ tasks.named("processResources", ProcessResources).configure {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (usesMixins.toBoolean()) {
|
if (usesMixins.toBoolean()) {
|
||||||
|
from refMap
|
||||||
dependsOn("compileJava", "compileScala")
|
dependsOn("compileJava", "compileScala")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -781,14 +718,23 @@ ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies"
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
def lwjgl3ifyVersion = '1.5.7'
|
def lwjgl3ifyVersion = '1.3.5'
|
||||||
|
def asmVersion = '9.4'
|
||||||
if (modId != 'lwjgl3ify') {
|
if (modId != 'lwjgl3ify') {
|
||||||
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
|
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
|
||||||
}
|
}
|
||||||
if (modId != 'hodgepodge') {
|
if (modId != 'hodgepodge') {
|
||||||
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.4.4')
|
java17Dependencies('com.github.GTNewHorizons:Hodgepodge:2.2.8')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
java17PatchDependencies('net.minecraft:launchwrapper:1.15') {transitive = false}
|
||||||
|
java17PatchDependencies("org.ow2.asm:asm:${asmVersion}")
|
||||||
|
java17PatchDependencies("org.ow2.asm:asm-commons:${asmVersion}")
|
||||||
|
java17PatchDependencies("org.ow2.asm:asm-tree:${asmVersion}")
|
||||||
|
java17PatchDependencies("org.ow2.asm:asm-analysis:${asmVersion}")
|
||||||
|
java17PatchDependencies("org.ow2.asm:asm-util:${asmVersion}")
|
||||||
|
java17PatchDependencies('org.ow2.asm:asm-deprecated:7.1')
|
||||||
|
java17PatchDependencies("org.apache.commons:commons-lang3:3.12.0")
|
||||||
java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") {transitive = false}
|
java17PatchDependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}:forgePatches") {transitive = false}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -871,18 +817,6 @@ public abstract class RunHotswappableMinecraftTask extends RunMinecraftTask {
|
|||||||
}
|
}
|
||||||
this.classpath(project.java17DependenciesCfg)
|
this.classpath(project.java17DependenciesCfg)
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setup(Project project) {
|
|
||||||
super.setup(project)
|
|
||||||
if (project.usesMixins.toBoolean()) {
|
|
||||||
this.extraJvmArgs.addAll(project.provider(() -> {
|
|
||||||
def mixinCfg = project.configurations.detachedConfiguration(project.dependencies.create(project.mixinProviderSpec))
|
|
||||||
mixinCfg.canBeConsumed = false
|
|
||||||
mixinCfg.transitive = false
|
|
||||||
enableHotswap ? ["-javaagent:" + mixinCfg.singleFile.absolutePath] : []
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def runClient17Task = tasks.register("runClient17", RunHotswappableMinecraftTask, Distribution.CLIENT, "runClient")
|
def runClient17Task = tasks.register("runClient17", RunHotswappableMinecraftTask, Distribution.CLIENT, "runClient")
|
||||||
@@ -961,7 +895,8 @@ if (usesShadowedDependencies.toBoolean()) {
|
|||||||
configurations.runtimeElements.outgoing.artifact(tasks.named("shadowJar", ShadowJar))
|
configurations.runtimeElements.outgoing.artifact(tasks.named("shadowJar", ShadowJar))
|
||||||
configurations.apiElements.outgoing.artifact(tasks.named("shadowJar", ShadowJar))
|
configurations.apiElements.outgoing.artifact(tasks.named("shadowJar", ShadowJar))
|
||||||
tasks.named("jar", Jar) {
|
tasks.named("jar", Jar) {
|
||||||
archiveClassifier.set('dev-preshadow')
|
enabled = false
|
||||||
|
finalizedBy(tasks.shadowJar)
|
||||||
}
|
}
|
||||||
tasks.named("reobfJar", ReobfuscatedJar) {
|
tasks.named("reobfJar", ReobfuscatedJar) {
|
||||||
inputJar.set(tasks.named("shadowJar", ShadowJar).flatMap({it.archiveFile}))
|
inputJar.set(tasks.named("shadowJar", ShadowJar).flatMap({it.archiveFile}))
|
||||||
@@ -970,6 +905,11 @@ if (usesShadowedDependencies.toBoolean()) {
|
|||||||
javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements) {
|
javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements) {
|
||||||
skip()
|
skip()
|
||||||
}
|
}
|
||||||
|
for (runTask in ["runClient", "runServer", "runClient17", "runServer17"]) {
|
||||||
|
tasks.named(runTask).configure {
|
||||||
|
dependsOn("shadowJar")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ext.publishableDevJar = usesShadowedDependencies.toBoolean() ? tasks.shadowJar : tasks.jar
|
ext.publishableDevJar = usesShadowedDependencies.toBoolean() ? tasks.shadowJar : tasks.jar
|
||||||
ext.publishableObfJar = tasks.reobfJar
|
ext.publishableObfJar = tasks.reobfJar
|
||||||
@@ -1021,9 +961,6 @@ idea {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
runConfigurations {
|
runConfigurations {
|
||||||
"0. Build and Test"(Gradle) {
|
|
||||||
taskNames = ["build"]
|
|
||||||
}
|
|
||||||
"1. Run Client"(Gradle) {
|
"1. Run Client"(Gradle) {
|
||||||
taskNames = ["runClient"]
|
taskNames = ["runClient"]
|
||||||
}
|
}
|
||||||
@@ -1143,14 +1080,6 @@ tasks.named("processIdeaSettings").configure {
|
|||||||
dependsOn("injectTags")
|
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
|
// workaround variable hiding in pom processing
|
||||||
def projectConfigs = project.configurations
|
def projectConfigs = project.configurations
|
||||||
|
|
||||||
@@ -1169,15 +1098,14 @@ publishing {
|
|||||||
version = System.getenv("RELEASE_VERSION") ?: identifiedVersion
|
version = System.getenv("RELEASE_VERSION") ?: identifiedVersion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
if (usesMavenPublishing.toBoolean() && System.getenv("MAVEN_USER") != null) {
|
maven {
|
||||||
maven {
|
url = "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases"
|
||||||
url = mavenPublishUrl
|
allowInsecureProtocol = true
|
||||||
allowInsecureProtocol = mavenPublishUrl.startsWith("http://")
|
credentials {
|
||||||
credentials {
|
username = System.getenv("MAVEN_USER") ?: "NONE"
|
||||||
username = System.getenv("MAVEN_USER") ?: "NONE"
|
password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
|
||||||
password = System.getenv("MAVEN_PASSWORD") ?: "NONE"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1292,7 +1220,7 @@ def addCurseForgeRelation(String type, String name) {
|
|||||||
|
|
||||||
// Updating
|
// Updating
|
||||||
|
|
||||||
def buildscriptGradleVersion = "8.5"
|
def buildscriptGradleVersion = "8.1.1"
|
||||||
|
|
||||||
tasks.named('wrapper', Wrapper).configure {
|
tasks.named('wrapper', Wrapper).configure {
|
||||||
gradleVersion = buildscriptGradleVersion
|
gradleVersion = buildscriptGradleVersion
|
||||||
@@ -1324,23 +1252,6 @@ if (!project.getGradle().startParameter.isOffline() && !Boolean.getBoolean('DISA
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If you want to add more cases to this task, implement them as arguments if total amount to print gets too large
|
|
||||||
tasks.register('faq') {
|
|
||||||
group = 'GTNH Buildscript'
|
|
||||||
description = 'Prints frequently asked questions about building a project'
|
|
||||||
|
|
||||||
doLast {
|
|
||||||
print("If your build fails to fetch dependencies, run './gradlew updateDependencies'. " +
|
|
||||||
"Or you can manually check if the versions are still on the distributing sites - " +
|
|
||||||
"the links can be found in repositories.gradle and build.gradle:repositories, " +
|
|
||||||
"but not build.gradle:buildscript.repositories - those ones are for gradle plugin metadata.\n\n" +
|
|
||||||
"If your build fails to recognize the syntax of new Java versions, enable Jabel in your " +
|
|
||||||
"gradle.properties. See how it's done in GTNH ExampleMod/gradle.properties. " +
|
|
||||||
"However, keep in mind that Jabel enables only syntax features, but not APIs that were introduced in " +
|
|
||||||
"Java 9 or later.")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static URL availableBuildScriptUrl() {
|
static URL availableBuildScriptUrl() {
|
||||||
new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/build.gradle")
|
new URL("https://raw.githubusercontent.com/GTNewHorizons/ExampleMod1.7.10/master/build.gradle")
|
||||||
}
|
}
|
||||||
@@ -1398,14 +1309,8 @@ boolean isNewBuildScriptVersionAvailable() {
|
|||||||
|
|
||||||
String currentBuildScript = getFile("build.gradle").getText()
|
String currentBuildScript = getFile("build.gradle").getText()
|
||||||
String currentBuildScriptHash = getVersionHash(currentBuildScript)
|
String currentBuildScriptHash = getVersionHash(currentBuildScript)
|
||||||
String availableBuildScriptHash
|
String availableBuildScript = availableBuildScriptUrl().newInputStream(parameters).getText()
|
||||||
try {
|
String availableBuildScriptHash = getVersionHash(availableBuildScript)
|
||||||
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
|
boolean isUpToDate = currentBuildScriptHash.empty || availableBuildScriptHash.empty || currentBuildScriptHash == availableBuildScriptHash
|
||||||
return !isUpToDate
|
return !isUpToDate
|
||||||
@@ -1570,36 +1475,3 @@ def getSecondaryArtifacts() {
|
|||||||
if (apiPackage) secondaryArtifacts += [apiJar]
|
if (apiPackage) secondaryArtifacts += [apiJar]
|
||||||
return secondaryArtifacts
|
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'
|
|
||||||
}
|
|
||||||
@@ -7,7 +7,7 @@ plugins {
|
|||||||
java {
|
java {
|
||||||
toolchain {
|
toolchain {
|
||||||
languageVersion.set(JavaLanguageVersion.of(8))
|
languageVersion.set(JavaLanguageVersion.of(8))
|
||||||
vendor.set(JvmVendorSpec.AZUL)
|
vendor.set(JvmVendorSpec.ADOPTIUM)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
dependencies {
|
dependencies {
|
||||||
shadowImplementation("com.github.GTNewHorizons:ZenScript:1.0.0-GTNH")
|
shadowImplementation("com.github.GTNewHorizons:ZenScript:1.0.0-GTNH")
|
||||||
implementation("com.github.GTNewHorizons:NotEnoughItems:2.5.3-GTNH:dev")
|
implementation("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev")
|
||||||
compileOnly("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev")
|
implementation("com.github.GTNewHorizons:NotEnoughItems:2.3.45-GTNH:dev")
|
||||||
}
|
}
|
||||||
@@ -78,6 +78,3 @@ customArchiveBaseName = CraftTweaker
|
|||||||
|
|
||||||
# Optional parameter to prevent the source code from being published
|
# Optional parameter to prevent the source code from being published
|
||||||
# noPublishedSources =
|
# noPublishedSources =
|
||||||
|
|
||||||
# TODO: Remove when you modify this repository, it's been put in for automatic buildscript updates
|
|
||||||
disableCheckstyle = true
|
|
||||||
Vendored
BIN
Binary file not shown.
+1
-2
@@ -1,7 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
||||||
networkTimeout=10000
|
networkTimeout=10000
|
||||||
validateDistributionUrl=true
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
@@ -83,8 +83,10 @@ done
|
|||||||
# This is normally unused
|
# This is normally unused
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && 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
|
||||||
@@ -131,13 +133,10 @@ location of your Java installation."
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD=java
|
JAVACMD=java
|
||||||
if ! command -v java >/dev/null 2>&1
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
then
|
|
||||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
@@ -145,7 +144,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
max*)
|
max*)
|
||||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
# shellcheck disable=SC2039,SC3045
|
# shellcheck disable=SC3045
|
||||||
MAX_FD=$( ulimit -H -n ) ||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
warn "Could not query maximum file descriptor limit"
|
warn "Could not query maximum file descriptor limit"
|
||||||
esac
|
esac
|
||||||
@@ -153,7 +152,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|||||||
'' | soft) :;; #(
|
'' | soft) :;; #(
|
||||||
*)
|
*)
|
||||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
# shellcheck disable=SC2039,SC3045
|
# shellcheck disable=SC3045
|
||||||
ulimit -n "$MAX_FD" ||
|
ulimit -n "$MAX_FD" ||
|
||||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
esac
|
esac
|
||||||
@@ -198,15 +197,11 @@ if "$cygwin" || "$msys" ; then
|
|||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Collect all arguments for the java command;
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
# shell script including quotes and variable substitutions, so put them in
|
||||||
|
# double quotes to make sure that they get re-expanded; and
|
||||||
# Collect all arguments for the java command:
|
# * put everything else in single quotes, so that it's not re-expanded.
|
||||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
|
||||||
# and any embedded shellness will be escaped.
|
|
||||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
|
||||||
# treated as '${Hostname}' itself on the command line.
|
|
||||||
|
|
||||||
set -- \
|
set -- \
|
||||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
|||||||
@@ -1,4 +1,11 @@
|
|||||||
// 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/"
|
||||||
|
}
|
||||||
|
maven {
|
||||||
|
url "https://cursemaven.com"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+5
-4
@@ -4,9 +4,10 @@ pluginManagement {
|
|||||||
maven {
|
maven {
|
||||||
// RetroFuturaGradle
|
// RetroFuturaGradle
|
||||||
name "GTNH Maven"
|
name "GTNH Maven"
|
||||||
url "https://nexus.gtnewhorizons.com/repository/public/"
|
url "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
|
||||||
|
allowInsecureProtocol = true
|
||||||
mavenContent {
|
mavenContent {
|
||||||
includeGroupByRegex("com\\.gtnewhorizons\\..+")
|
includeGroup("com.gtnewhorizons.retrofuturagradle")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
@@ -16,8 +17,8 @@ pluginManagement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id 'com.diffplug.blowdryerSetup' version '1.7.1'
|
id 'com.diffplug.blowdryerSetup' version '1.6.0'
|
||||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.7.0' // Provides java toolchains
|
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0' // Provides java toolchains
|
||||||
}
|
}
|
||||||
|
|
||||||
blowdryerSetup {
|
blowdryerSetup {
|
||||||
|
|||||||
@@ -6,10 +6,20 @@ import java.lang.reflect.InvocationTargetException;
|
|||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
|
||||||
|
import cpw.mods.fml.common.registry.GameRegistry;
|
||||||
import minetweaker.annotations.BracketHandler;
|
import minetweaker.annotations.BracketHandler;
|
||||||
import minetweaker.annotations.ModOnly;
|
import minetweaker.annotations.ModOnly;
|
||||||
import minetweaker.api.client.IClient;
|
import minetweaker.api.client.IClient;
|
||||||
@@ -17,8 +27,13 @@ import minetweaker.api.compat.*;
|
|||||||
import minetweaker.api.event.IEventManager;
|
import minetweaker.api.event.IEventManager;
|
||||||
import minetweaker.api.formatting.IFormatter;
|
import minetweaker.api.formatting.IFormatter;
|
||||||
import minetweaker.api.game.IGame;
|
import minetweaker.api.game.IGame;
|
||||||
|
import minetweaker.api.item.IIngredient;
|
||||||
|
import minetweaker.api.item.IItemStack;
|
||||||
|
import minetweaker.api.item.IngredientItem;
|
||||||
import minetweaker.api.mods.ILoadedMods;
|
import minetweaker.api.mods.ILoadedMods;
|
||||||
import minetweaker.api.oredict.IOreDict;
|
import minetweaker.api.oredict.IOreDict;
|
||||||
|
import minetweaker.api.oredict.IOreDictEntry;
|
||||||
|
import minetweaker.api.oredict.IngredientOreDict;
|
||||||
import minetweaker.api.recipes.IFurnaceManager;
|
import minetweaker.api.recipes.IFurnaceManager;
|
||||||
import minetweaker.api.recipes.IRecipeManager;
|
import minetweaker.api.recipes.IRecipeManager;
|
||||||
import minetweaker.api.server.IServer;
|
import minetweaker.api.server.IServer;
|
||||||
@@ -38,18 +53,178 @@ import stanhebben.zenscript.type.natives.JavaMethod;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides access to the MineTweaker API.
|
* Provides access to the MineTweaker API.
|
||||||
*
|
*
|
||||||
* An implementing platform needs to do the following: - Set a logger - Set the ore dictionary - Set the recipe manager
|
* An implementing platform needs to do the following: - Set a logger - Set the ore dictionary - Set the recipe manager
|
||||||
* - Set the furnace manager - Set event manager - Set resource manager
|
* - Set the furnace manager - Set event manager - Set resource manager
|
||||||
*
|
*
|
||||||
* - Register additional global symbols to the GlobalRegistry (recipes, minetweaker, oreDict, logger, as well as the
|
* - Register additional global symbols to the GlobalRegistry (recipes, minetweaker, oreDict, logger, as well as the
|
||||||
* official set of functions) - Register native classes using the GlobalRegistry - Register bracket handlers to resolve
|
* official set of functions) - Register native classes using the GlobalRegistry - Register bracket handlers to resolve
|
||||||
* block/item/... references using the bracket syntax
|
* block/item/... references using the bracket syntax
|
||||||
*
|
*
|
||||||
* @author Stan Hebben
|
* @author Stan Hebben
|
||||||
*/
|
*/
|
||||||
public class MineTweakerAPI {
|
public class MineTweakerAPI {
|
||||||
|
|
||||||
|
private static final org.apache.logging.log4j.Logger TRANSLATORLOGGER = LogManager
|
||||||
|
.getLogger("[SCRIPTS TO CODE TRANSLATOR]");
|
||||||
|
|
||||||
|
public static void info(String log) {
|
||||||
|
TRANSLATORLOGGER.info(log);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String convertStack(ItemStack stack) {
|
||||||
|
if (stack == null) return "null";
|
||||||
|
GameRegistry.UniqueIdentifier itemIdentifier = GameRegistry.findUniqueIdentifierFor(stack.getItem());
|
||||||
|
int meta = stack.getItemDamage();
|
||||||
|
int size = stack.stackSize;
|
||||||
|
NBTTagCompound tagCompound = stack.stackTagCompound;
|
||||||
|
if (tagCompound == null || tagCompound.hasNoTags()) {
|
||||||
|
return "getModItem(\"" + itemIdentifier.modId
|
||||||
|
+ "\", \""
|
||||||
|
+ itemIdentifier.name
|
||||||
|
+ "\", "
|
||||||
|
+ size
|
||||||
|
+ ", "
|
||||||
|
+ meta
|
||||||
|
+ ", missing)";
|
||||||
|
} else {
|
||||||
|
return "createItemStack(\"" + itemIdentifier.modId
|
||||||
|
+ "\", \""
|
||||||
|
+ itemIdentifier.name
|
||||||
|
+ "\", "
|
||||||
|
+ size
|
||||||
|
+ ", "
|
||||||
|
+ meta
|
||||||
|
+ ", "
|
||||||
|
+ "\""
|
||||||
|
+ tagCompound.toString().replace("\"", "\\\"")
|
||||||
|
+ "\""
|
||||||
|
+ ", missing)";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String convertStack(IIngredient ingredient) {
|
||||||
|
Object internal = ingredient.getInternal();
|
||||||
|
if (internal instanceof ItemStack) return convertStack((ItemStack) internal);
|
||||||
|
else return "ERRORSTACK";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String convertStackOrOre(IIngredient ingredient) {
|
||||||
|
Object internal = ingredient.getInternal();
|
||||||
|
if (internal instanceof ItemStack) return convertStack((ItemStack) internal);
|
||||||
|
else if (internal instanceof String) return "\"" + (String) internal + "\"";
|
||||||
|
else return "ERRORSTACK";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String convertArrayInLine(Object[] arr) {
|
||||||
|
StringBuilder arrayString = new StringBuilder();
|
||||||
|
for (int i = 0, arrLength = arr.length; i < arrLength; i++) {
|
||||||
|
Object o = arr[i];
|
||||||
|
if (o instanceof String) arrayString.append("\"").append((String) o).append("\"");
|
||||||
|
else if (o instanceof Character) arrayString.append("'").append((char) o).append("'");
|
||||||
|
else if (o instanceof ItemStack) arrayString.append(convertStack((ItemStack) o));
|
||||||
|
else if (o instanceof IItemStack || o instanceof IngredientItem)
|
||||||
|
arrayString.append(convertStack((IIngredient) o));
|
||||||
|
else if (o instanceof IOreDictEntry)
|
||||||
|
arrayString.append("\"").append((String) ((IOreDictEntry) o).getInternal()).append("\"");
|
||||||
|
else if (o instanceof IngredientOreDict)
|
||||||
|
arrayString.append("\"").append((String) ((IngredientOreDict) o).getInternal()).append("\"");
|
||||||
|
else if (o == null) arrayString.append("null");
|
||||||
|
else arrayString.append(o);
|
||||||
|
if (i + 1 < arrLength) arrayString.append(", ");
|
||||||
|
}
|
||||||
|
return arrayString.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String convert2DArrayInLine(Object[][] arr) {
|
||||||
|
StringBuilder arrayString = new StringBuilder();
|
||||||
|
for (int i = 0, arrLength = arr.length; i < arrLength; i++) {
|
||||||
|
for (int j = 0, jarrLength = arr[i].length; j < jarrLength; j++) {
|
||||||
|
Object o = arr[i][j];
|
||||||
|
if (o instanceof String) arrayString.append("\"").append((String) o).append("\"");
|
||||||
|
else if (o instanceof Character) arrayString.append("'").append((char) o).append("'");
|
||||||
|
else if (o instanceof ItemStack) arrayString.append(convertStack((ItemStack) o));
|
||||||
|
else if (o instanceof IItemStack || o instanceof IngredientItem)
|
||||||
|
arrayString.append(convertStack((IIngredient) o));
|
||||||
|
else if (o instanceof IOreDictEntry)
|
||||||
|
arrayString.append("\"").append((String) ((IOreDictEntry) o).getInternal()).append("\"");
|
||||||
|
else if (o instanceof IngredientOreDict)
|
||||||
|
arrayString.append("\"").append((String) ((IngredientOreDict) o).getInternal()).append("\"");
|
||||||
|
else if (o == null) arrayString.append("null");
|
||||||
|
else arrayString.append(o);
|
||||||
|
if (i + 1 < arrLength || j + 1 < jarrLength) arrayString.append(", ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return arrayString.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void logGTRecipe(ItemStack[] itemInputs, ItemStack[] itemOutputs, int[] chances,
|
||||||
|
FluidStack[] fluidInputs, FluidStack[] fluidOutputs, int duration, int eut, Integer specialValue,
|
||||||
|
String recipeMapVariable) {
|
||||||
|
StringBuilder builder = new StringBuilder("GT_Values.RA.stdBuilder()");
|
||||||
|
Function<ItemStack[], ItemStack[]> isAllObjectsNullItemStack = arr -> {
|
||||||
|
if (arr == null || arr.length == 0 || Arrays.stream(arr).allMatch(Objects::isNull)) return null;
|
||||||
|
return Arrays.stream(arr).filter(Objects::nonNull).toArray(ItemStack[]::new);
|
||||||
|
};
|
||||||
|
Function<FluidStack[], FluidStack[]> isAllObjectsNullFluidStack = arr -> {
|
||||||
|
if (arr == null || arr.length == 0 || Arrays.stream(arr).allMatch(Objects::isNull)) return null;
|
||||||
|
return Arrays.stream(arr).filter(Objects::nonNull).toArray(FluidStack[]::new);
|
||||||
|
};
|
||||||
|
itemInputs = isAllObjectsNullItemStack.apply(itemInputs);
|
||||||
|
itemOutputs = isAllObjectsNullItemStack.apply(itemOutputs);
|
||||||
|
fluidInputs = isAllObjectsNullFluidStack.apply(fluidInputs);
|
||||||
|
fluidOutputs = isAllObjectsNullFluidStack.apply(fluidOutputs);
|
||||||
|
if (itemInputs == null || itemInputs.length == 0) builder.append(".noItemInputs()");
|
||||||
|
else builder.append(".itemInputs(").append(convertArrayInLine(itemInputs)).append(")");
|
||||||
|
if (itemOutputs == null || itemOutputs.length == 0) builder.append(".noItemOutputs()");
|
||||||
|
else builder.append(".itemOutputs(").append(convertArrayInLine(itemOutputs)).append(")");
|
||||||
|
if (chances != null && chances.length > 0) builder.append(".outputChances(")
|
||||||
|
.append(convertArrayInLine(Arrays.stream(chances).boxed().toArray(Integer[]::new))).append(")");
|
||||||
|
if (fluidInputs == null || fluidInputs.length == 0) builder.append(".noFluidInputs()");
|
||||||
|
else builder.append(".fluidInputs(").append(convertArrayInLine(fluidInputs)).append(")");
|
||||||
|
if (fluidOutputs == null || fluidOutputs.length == 0) builder.append(".noFluidOutputs()");
|
||||||
|
else builder.append(".fluidOutputs(").append(convertArrayInLine(fluidOutputs)).append(")");
|
||||||
|
builder.append(".duration(").append(duration).append(")");
|
||||||
|
builder.append(".eut(").append(eut).append(")");
|
||||||
|
if (specialValue != null) builder.append(".specialValue(").append(specialValue.intValue()).append(")");
|
||||||
|
builder.append(".addTo(").append(recipeMapVariable).append(");");
|
||||||
|
|
||||||
|
info(builder.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void logGTRecipe(ItemStack[] itemInputs, ItemStack[] itemOutputs, FluidStack[] fluidInputs,
|
||||||
|
FluidStack[] fluidOutputs, int duration, int eut, String recipeMapVariable) {
|
||||||
|
logGTRecipe(itemInputs, itemOutputs, null, fluidInputs, fluidOutputs, duration, eut, null, recipeMapVariable);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void logGTRecipe(ItemStack[] itemInputs, ItemStack[] itemOutputs, int[] chances,
|
||||||
|
FluidStack[] fluidInputs, FluidStack[] fluidOutputs, int duration, int eut, String recipeMapVariable) {
|
||||||
|
logGTRecipe(
|
||||||
|
itemInputs,
|
||||||
|
itemOutputs,
|
||||||
|
chances,
|
||||||
|
fluidInputs,
|
||||||
|
fluidOutputs,
|
||||||
|
duration,
|
||||||
|
eut,
|
||||||
|
null,
|
||||||
|
recipeMapVariable);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void logGTRecipe(ItemStack[] itemInputs, ItemStack[] itemOutputs, FluidStack[] fluidInputs,
|
||||||
|
FluidStack[] fluidOutputs, int duration, int eut, int specialValue, String recipeMapVariable) {
|
||||||
|
logGTRecipe(
|
||||||
|
itemInputs,
|
||||||
|
itemOutputs,
|
||||||
|
null,
|
||||||
|
fluidInputs,
|
||||||
|
fluidOutputs,
|
||||||
|
duration,
|
||||||
|
eut,
|
||||||
|
specialValue,
|
||||||
|
recipeMapVariable);
|
||||||
|
}
|
||||||
|
|
||||||
public static final String[] COLOR_NAMES = { "White", "Orange", "Magenta", "Light Blue", "Yellow", "Lime", "Pink",
|
public static final String[] COLOR_NAMES = { "White", "Orange", "Magenta", "Light Blue", "Yellow", "Lime", "Pink",
|
||||||
"Gray", "Light Gray", "Cyan", "Purple", "Blue", "Brown", "Green", "Red", "Black" };
|
"Gray", "Light Gray", "Cyan", "Purple", "Blue", "Brown", "Green", "Red", "Black" };
|
||||||
private static IJEIRecipeRegistry ijeiRecipeRegistry = new DummyJEIRecipeRegistry();
|
private static IJEIRecipeRegistry ijeiRecipeRegistry = new DummyJEIRecipeRegistry();
|
||||||
@@ -85,7 +260,7 @@ public class MineTweakerAPI {
|
|||||||
/**
|
/**
|
||||||
* The logger can be used to write logging messages to the client. Error and warning messages should be relayed to
|
* The logger can be used to write logging messages to the client. Error and warning messages should be relayed to
|
||||||
* admins for further handling.
|
* admins for further handling.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static final ILogger getLogger() {
|
public static final ILogger getLogger() {
|
||||||
@@ -149,7 +324,7 @@ public class MineTweakerAPI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Applies this given action.
|
* Applies this given action.
|
||||||
*
|
*
|
||||||
* @param action action object
|
* @param action action object
|
||||||
*/
|
*/
|
||||||
public static void apply(IUndoableAction action) {
|
public static void apply(IUndoableAction action) {
|
||||||
@@ -158,7 +333,7 @@ public class MineTweakerAPI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs a command message. Commands messages are those generated as output in response to a command.
|
* Logs a command message. Commands messages are those generated as output in response to a command.
|
||||||
*
|
*
|
||||||
* @param message command message
|
* @param message command message
|
||||||
*/
|
*/
|
||||||
public static void logCommand(String message) {
|
public static void logCommand(String message) {
|
||||||
@@ -168,7 +343,7 @@ public class MineTweakerAPI {
|
|||||||
/**
|
/**
|
||||||
* Logs an info message. Info messages have low priority and will only be displayed in the log files, but not
|
* Logs an info message. Info messages have low priority and will only be displayed in the log files, but not
|
||||||
* directly to players in-game.
|
* directly to players in-game.
|
||||||
*
|
*
|
||||||
* @param message info message
|
* @param message info message
|
||||||
*/
|
*/
|
||||||
public static void logInfo(String message) {
|
public static void logInfo(String message) {
|
||||||
@@ -179,7 +354,7 @@ public class MineTweakerAPI {
|
|||||||
* Logs a warning message. Warning messages are displayed to admins and indicate that there is an issue. However,
|
* Logs a warning message. Warning messages are displayed to admins and indicate that there is an issue. However,
|
||||||
* the issue is not a large problem, and everything should run fine - besides perhaps a few things not entirely
|
* the issue is not a large problem, and everything should run fine - besides perhaps a few things not entirely
|
||||||
* working as expected.
|
* working as expected.
|
||||||
*
|
*
|
||||||
* @param message warning message
|
* @param message warning message
|
||||||
*/
|
*/
|
||||||
public static void logWarning(String message) {
|
public static void logWarning(String message) {
|
||||||
@@ -190,7 +365,7 @@ public class MineTweakerAPI {
|
|||||||
* Logs an error message. Error messages indicate a real problem and indicate that things won't run properly. The
|
* Logs an error message. Error messages indicate a real problem and indicate that things won't run properly. The
|
||||||
* scripting system will still make a best-effort attempt at executing the rest of the scripts, but that might cause
|
* scripting system will still make a best-effort attempt at executing the rest of the scripts, but that might cause
|
||||||
* additional errors and issues.
|
* additional errors and issues.
|
||||||
*
|
*
|
||||||
* @param message error message
|
* @param message error message
|
||||||
*/
|
*/
|
||||||
public static void logError(String message) {
|
public static void logError(String message) {
|
||||||
@@ -201,7 +376,7 @@ public class MineTweakerAPI {
|
|||||||
* Logs an error message. Error messages indicate a real problem and indicate that things won't run properly. The
|
* Logs an error message. Error messages indicate a real problem and indicate that things won't run properly. The
|
||||||
* scripting system will still make a best-effort attempt at executing the rest of the scripts, but that might cause
|
* scripting system will still make a best-effort attempt at executing the rest of the scripts, but that might cause
|
||||||
* additional errors and issues.
|
* additional errors and issues.
|
||||||
*
|
*
|
||||||
* @param message error message
|
* @param message error message
|
||||||
* @param exception exception that was caught related to the error
|
* @param exception exception that was caught related to the error
|
||||||
*/
|
*/
|
||||||
@@ -216,7 +391,7 @@ public class MineTweakerAPI {
|
|||||||
/**
|
/**
|
||||||
* Register a class registry class. Such class must have (at least) a public static method called "getClasses" with
|
* Register a class registry class. Such class must have (at least) a public static method called "getClasses" with
|
||||||
* accepts a List of classes and which stores its classes into that list.
|
* accepts a List of classes and which stores its classes into that list.
|
||||||
*
|
*
|
||||||
* @param registryClass
|
* @param registryClass
|
||||||
*/
|
*/
|
||||||
public static void registerClassRegistry(Class registryClass) {
|
public static void registerClassRegistry(Class registryClass) {
|
||||||
@@ -226,7 +401,7 @@ public class MineTweakerAPI {
|
|||||||
/**
|
/**
|
||||||
* Register a class registry class. Such class must have (at least) a public static method called "getClasses" with
|
* Register a class registry class. Such class must have (at least) a public static method called "getClasses" with
|
||||||
* accepts a List of classes and which stores its classes into that list.
|
* accepts a List of classes and which stores its classes into that list.
|
||||||
*
|
*
|
||||||
* @param registryClass
|
* @param registryClass
|
||||||
* @param description
|
* @param description
|
||||||
*/
|
*/
|
||||||
@@ -270,7 +445,7 @@ public class MineTweakerAPI {
|
|||||||
/**
|
/**
|
||||||
* Registers a class registry. Will attempt to resolve the given class name. Does nothing if the class could not be
|
* Registers a class registry. Will attempt to resolve the given class name. Does nothing if the class could not be
|
||||||
* loaded.
|
* loaded.
|
||||||
*
|
*
|
||||||
* @param className class name to be loaded
|
* @param className class name to be loaded
|
||||||
* @return true if registration was successful
|
* @return true if registration was successful
|
||||||
*/
|
*/
|
||||||
@@ -281,7 +456,7 @@ public class MineTweakerAPI {
|
|||||||
/**
|
/**
|
||||||
* Registers a class registry. Will attempt to resolve the given class name. Does nothing if the class could not be
|
* Registers a class registry. Will attempt to resolve the given class name. Does nothing if the class could not be
|
||||||
* loaded.
|
* loaded.
|
||||||
*
|
*
|
||||||
* @param className class name to be loaded
|
* @param className class name to be loaded
|
||||||
* @param description
|
* @param description
|
||||||
* @return true if registration was successful
|
* @return true if registration was successful
|
||||||
@@ -298,7 +473,7 @@ public class MineTweakerAPI {
|
|||||||
/**
|
/**
|
||||||
* Registers an annotated class. A class is annotated with either @ZenClass or @ZenExpansion. Classes not annotated
|
* Registers an annotated class. A class is annotated with either @ZenClass or @ZenExpansion. Classes not annotated
|
||||||
* with either of these will be ignored.
|
* with either of these will be ignored.
|
||||||
*
|
*
|
||||||
* @param annotatedClass
|
* @param annotatedClass
|
||||||
*/
|
*/
|
||||||
public static void registerClass(Class annotatedClass) {
|
public static void registerClass(Class annotatedClass) {
|
||||||
@@ -327,7 +502,7 @@ public class MineTweakerAPI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a global symbol. Global symbols are immediately accessible from anywhere in the scripts.
|
* Registers a global symbol. Global symbols are immediately accessible from anywhere in the scripts.
|
||||||
*
|
*
|
||||||
* @param name symbol name
|
* @param name symbol name
|
||||||
* @param symbol symbol
|
* @param symbol symbol
|
||||||
*/
|
*/
|
||||||
@@ -337,7 +512,7 @@ public class MineTweakerAPI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Registers a recipe remover. Removers are called when the global minetweaker.remove() function is called.
|
* Registers a recipe remover. Removers are called when the global minetweaker.remove() function is called.
|
||||||
*
|
*
|
||||||
* @param remover recipe remover
|
* @param remover recipe remover
|
||||||
*/
|
*/
|
||||||
public static void registerRemover(IRecipeRemover remover) {
|
public static void registerRemover(IRecipeRemover remover) {
|
||||||
@@ -347,7 +522,7 @@ public class MineTweakerAPI {
|
|||||||
/**
|
/**
|
||||||
* Registers a bracket handler. Is capable of converting the bracket syntax to an actual value. This new handler
|
* Registers a bracket handler. Is capable of converting the bracket syntax to an actual value. This new handler
|
||||||
* will be added last - it can thus not intercept values that are already handled by the system.
|
* will be added last - it can thus not intercept values that are already handled by the system.
|
||||||
*
|
*
|
||||||
* @param handler bracket handler to be added
|
* @param handler bracket handler to be added
|
||||||
*/
|
*/
|
||||||
public static void registerBracketHandler(IBracketHandler handler) {
|
public static void registerBracketHandler(IBracketHandler handler) {
|
||||||
@@ -356,7 +531,7 @@ public class MineTweakerAPI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a symbol that refers to a java method.
|
* Creates a symbol that refers to a java method.
|
||||||
*
|
*
|
||||||
* @param cls class that contains the method
|
* @param cls class that contains the method
|
||||||
* @param name method name
|
* @param name method name
|
||||||
* @param arguments method argument types
|
* @param arguments method argument types
|
||||||
@@ -370,7 +545,7 @@ public class MineTweakerAPI {
|
|||||||
/**
|
/**
|
||||||
* Creates a symbol that refers to a java getter. The getter must be a method with no arguments. The given symbol
|
* Creates a symbol that refers to a java getter. The getter must be a method with no arguments. The given symbol
|
||||||
* will act as a variable of which the value can be retrieved but not set.
|
* will act as a variable of which the value can be retrieved but not set.
|
||||||
*
|
*
|
||||||
* @param cls class that contains the getter method
|
* @param cls class that contains the getter method
|
||||||
* @param name name of the method
|
* @param name name of the method
|
||||||
* @return corresponding symbol
|
* @return corresponding symbol
|
||||||
@@ -383,7 +558,7 @@ public class MineTweakerAPI {
|
|||||||
/**
|
/**
|
||||||
* Creates a symbol that refers to a static field. The field must be an existing public field in the given class.
|
* Creates a symbol that refers to a static field. The field must be an existing public field in the given class.
|
||||||
* The field will act as a variable that can be retrieved but not set.
|
* The field will act as a variable that can be retrieved but not set.
|
||||||
*
|
*
|
||||||
* @param cls class that contains the field
|
* @param cls class that contains the field
|
||||||
* @param name field name (must be public)
|
* @param name field name (must be public)
|
||||||
* @return corresponding symbol
|
* @return corresponding symbol
|
||||||
@@ -401,7 +576,7 @@ public class MineTweakerAPI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Loads a Java method from an existing class.
|
* Loads a Java method from an existing class.
|
||||||
*
|
*
|
||||||
* @param cls method class
|
* @param cls method class
|
||||||
* @param name method name
|
* @param name method name
|
||||||
* @param arguments argument types
|
* @param arguments argument types
|
||||||
|
|||||||
@@ -112,6 +112,7 @@ public class MCFurnaceManager implements IFurnaceManager {
|
|||||||
public void apply() {
|
public void apply() {
|
||||||
for (ItemStack item : items) {
|
for (ItemStack item : items) {
|
||||||
FurnaceRecipes.smelting().getSmeltingList().remove(item);
|
FurnaceRecipes.smelting().getSmeltingList().remove(item);
|
||||||
|
MineTweakerAPI.info("GT_ModHandler.removeFurnaceSmelting(" + MineTweakerAPI.convertStack(item) + ");");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,6 +162,11 @@ public class MCFurnaceManager implements IFurnaceManager {
|
|||||||
public void apply() {
|
public void apply() {
|
||||||
for (ItemStack inputStack : input) {
|
for (ItemStack inputStack : input) {
|
||||||
FurnaceRecipes.smelting().func_151394_a(inputStack, output, (float) xp);
|
FurnaceRecipes.smelting().func_151394_a(inputStack, output, (float) xp);
|
||||||
|
MineTweakerAPI.info(
|
||||||
|
"GT_ModHandler.addSmeltingRecipe(" + MineTweakerAPI.convertStack(inputStack)
|
||||||
|
+ ", "
|
||||||
|
+ MineTweakerAPI.convertStack(output)
|
||||||
|
+ ");");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -203,6 +209,11 @@ public class MCFurnaceManager implements IFurnaceManager {
|
|||||||
@Override
|
@Override
|
||||||
public void apply() {
|
public void apply() {
|
||||||
FuelTweaker.INSTANCE.addFuelPattern(pattern);
|
FuelTweaker.INSTANCE.addFuelPattern(pattern);
|
||||||
|
MineTweakerAPI.info(
|
||||||
|
"GT_ModHandler.setFuelValue(" + MineTweakerAPI.convertStack(pattern.getPattern())
|
||||||
|
+ ", "
|
||||||
|
+ pattern.getValue()
|
||||||
|
+ ");");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ public class MCGame implements IGame {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Ported from ModTweaker.
|
* Ported from ModTweaker.
|
||||||
*
|
*
|
||||||
* @author Joshiejack
|
* @author Joshiejack
|
||||||
*/
|
*/
|
||||||
private static class SetTranslation implements IUndoableAction {
|
private static class SetTranslation implements IUndoableAction {
|
||||||
@@ -208,6 +208,7 @@ public class MCGame implements IGame {
|
|||||||
} else {
|
} else {
|
||||||
added = false;
|
added = false;
|
||||||
}
|
}
|
||||||
|
MineTweakerAPI.info(key + "=" + text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -271,6 +271,11 @@ public class MCOreDictEntry implements IOreDictEntry {
|
|||||||
@Override
|
@Override
|
||||||
public void apply() {
|
public void apply() {
|
||||||
OreDictionary.registerOre(id, item);
|
OreDictionary.registerOre(id, item);
|
||||||
|
MineTweakerAPI.info(
|
||||||
|
"OreDictionary.registerOre(\"" + OreDictionary.getOreName(id)
|
||||||
|
+ "\", "
|
||||||
|
+ MineTweakerAPI.convertStack(item)
|
||||||
|
+ ");");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -316,6 +316,17 @@ public final class MCRecipeManager implements IRecipeManager {
|
|||||||
toRemove = find();
|
toRemove = find();
|
||||||
|
|
||||||
removeRecipes(toRemove);
|
removeRecipes(toRemove);
|
||||||
|
|
||||||
|
for (Pair<IIngredient, Boolean> output : outputs) {
|
||||||
|
if (output.getKey().getInternal() instanceof String) MineTweakerAPI
|
||||||
|
.info("removeRecipeByOreOutputDelayed(\"" + ((String) output.getKey().getInternal()) + "\")");
|
||||||
|
else MineTweakerAPI.info(
|
||||||
|
"GT_ModHandler.removeRecipeByOutputDelayed(" + MineTweakerAPI.convertStack(output.getKey())
|
||||||
|
+ ", "
|
||||||
|
+ (output.getValue() ? "false" : "true")
|
||||||
|
+ ", false, true);");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -440,6 +451,14 @@ public final class MCRecipeManager implements IRecipeManager {
|
|||||||
toRemove = find();
|
toRemove = find();
|
||||||
MineTweakerAPI.logInfo("Removing " + toRemove.size() + " Shapeless recipes.");
|
MineTweakerAPI.logInfo("Removing " + toRemove.size() + " Shapeless recipes.");
|
||||||
super.removeRecipes(toRemove);
|
super.removeRecipes(toRemove);
|
||||||
|
|
||||||
|
if (ingredients == null || ingredients.length == 0)
|
||||||
|
MineTweakerAPI.info("removeRecipeShapeless(" + MineTweakerAPI.convertStackOrOre(output) + ");");
|
||||||
|
else MineTweakerAPI.info(
|
||||||
|
"removeRecipeShapeless(" + MineTweakerAPI.convertStackOrOre(output)
|
||||||
|
+ ", "
|
||||||
|
+ MineTweakerAPI.convertArrayInLine(ingredients)
|
||||||
|
+ ");");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -554,6 +573,21 @@ public final class MCRecipeManager implements IRecipeManager {
|
|||||||
|
|
||||||
MineTweakerAPI.logInfo(toRemove.size() + " removed");
|
MineTweakerAPI.logInfo(toRemove.size() + " removed");
|
||||||
super.removeRecipes(toRemove);
|
super.removeRecipes(toRemove);
|
||||||
|
|
||||||
|
if (ingredients == null || ingredients.length == 0)
|
||||||
|
MineTweakerAPI.info("removeRecipeShaped(" + MineTweakerAPI.convertStackOrOre(output) + ");");
|
||||||
|
else MineTweakerAPI.info(
|
||||||
|
"removeRecipeShaped(" + MineTweakerAPI.convertStackOrOre(output)
|
||||||
|
+ ", new Object[]{"
|
||||||
|
+ MineTweakerAPI.convertArrayInLine(ingredients[0])
|
||||||
|
+ "}"
|
||||||
|
+ (ingredients.length >= 2
|
||||||
|
? (", new Object[]{" + MineTweakerAPI.convertArrayInLine(ingredients[1]) + "}")
|
||||||
|
: ", new Object[0]")
|
||||||
|
+ (ingredients.length >= 3
|
||||||
|
? (", new Object[]{" + MineTweakerAPI.convertArrayInLine(ingredients[2]) + "}")
|
||||||
|
: ", new Object[0]")
|
||||||
|
+ ");");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -658,17 +692,50 @@ public final class MCRecipeManager implements IRecipeManager {
|
|||||||
|
|
||||||
private static class ActionAddShapedRecipe extends ActionBaseAddRecipe {
|
private static class ActionAddShapedRecipe extends ActionBaseAddRecipe {
|
||||||
|
|
||||||
|
IItemStack aOutput;
|
||||||
|
IIngredient[][] aIngredients;
|
||||||
|
boolean aMirrored;
|
||||||
|
|
||||||
public ActionAddShapedRecipe(IItemStack output, IIngredient[][] ingredients, IRecipeFunction function,
|
public ActionAddShapedRecipe(IItemStack output, IIngredient[][] ingredients, IRecipeFunction function,
|
||||||
IRecipeAction action, boolean mirrored) {
|
IRecipeAction action, boolean mirrored) {
|
||||||
super(new ShapedRecipe(output, ingredients, function, action, mirrored), output, true);
|
super(new ShapedRecipe(output, ingredients, function, action, mirrored), output, true);
|
||||||
|
aOutput = output;
|
||||||
|
aIngredients = ingredients;
|
||||||
|
aMirrored = mirrored;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void apply() {
|
||||||
|
super.apply();
|
||||||
|
MineTweakerAPI.info(
|
||||||
|
"addShapedRecipe(" + MineTweakerAPI.convertStack(aOutput)
|
||||||
|
+ ", new Object[] {"
|
||||||
|
+ MineTweakerAPI.convert2DArrayInLine(aIngredients)
|
||||||
|
+ "});");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class ActionAddShapelessRecipe extends ActionBaseAddRecipe {
|
private static class ActionAddShapelessRecipe extends ActionBaseAddRecipe {
|
||||||
|
|
||||||
|
IItemStack aOutput;
|
||||||
|
IIngredient[] aIngredients;
|
||||||
|
|
||||||
public ActionAddShapelessRecipe(IItemStack output, IIngredient[] ingredients, IRecipeFunction function,
|
public ActionAddShapelessRecipe(IItemStack output, IIngredient[] ingredients, IRecipeFunction function,
|
||||||
IRecipeAction action) {
|
IRecipeAction action) {
|
||||||
super(new ShapelessRecipe(output, ingredients, function, action), output, false);
|
super(new ShapelessRecipe(output, ingredients, function, action), output, false);
|
||||||
|
aOutput = output;
|
||||||
|
aIngredients = ingredients;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void apply() {
|
||||||
|
super.apply();
|
||||||
|
|
||||||
|
MineTweakerAPI.info(
|
||||||
|
"addShapelessCraftingRecipe(" + MineTweakerAPI.convertStack(aOutput)
|
||||||
|
+ ", new Object[] { "
|
||||||
|
+ MineTweakerAPI.convertArrayInLine(aIngredients)
|
||||||
|
+ " });");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -719,7 +786,7 @@ public final class MCRecipeManager implements IRecipeManager {
|
|||||||
recipes.removeIf(recipesToUndo::contains);
|
recipes.removeIf(recipesToUndo::contains);
|
||||||
}
|
}
|
||||||
int commonPoolParallelism = getCommonPoolParallelism();
|
int commonPoolParallelism = getCommonPoolParallelism();
|
||||||
if (commonPoolParallelism <= 1) {
|
if (true) {
|
||||||
// if thread == 1, then we have parallel overhead but doesn't have parallel speedup.
|
// if thread == 1, then we have parallel overhead but doesn't have parallel speedup.
|
||||||
// never do this
|
// never do this
|
||||||
recipesToRemove.forEach(ActionBaseRemoveRecipes::apply);
|
recipesToRemove.forEach(ActionBaseRemoveRecipes::apply);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package minetweaker.mods.ic2.crops;
|
package minetweaker.mods.ic2.crops;
|
||||||
|
|
||||||
import ic2.api.crops.CropCard;
|
import ic2.api.crops.CropCard;
|
||||||
import minetweaker.annotations.ModOnly;
|
|
||||||
import stanhebben.zenscript.annotations.ZenCaster;
|
import stanhebben.zenscript.annotations.ZenCaster;
|
||||||
import stanhebben.zenscript.annotations.ZenClass;
|
import stanhebben.zenscript.annotations.ZenClass;
|
||||||
import stanhebben.zenscript.annotations.ZenGetter;
|
import stanhebben.zenscript.annotations.ZenGetter;
|
||||||
@@ -9,12 +8,11 @@ import stanhebben.zenscript.annotations.ZenMethod;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Read-only data accessor for crops
|
* Read-only data accessor for crops
|
||||||
*
|
*
|
||||||
* @author ben
|
* @author ben
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ZenClass("mods.ic2.Crop")
|
@ZenClass("mods.ic2.Crop")
|
||||||
@ModOnly("IC2")
|
|
||||||
public class Crop {
|
public class Crop {
|
||||||
|
|
||||||
private CropCard cc;
|
private CropCard cc;
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
package minetweaker.mods.ic2.crops;
|
package minetweaker.mods.ic2.crops;
|
||||||
|
|
||||||
import minetweaker.annotations.ModOnly;
|
|
||||||
import minetweaker.api.item.IItemStack;
|
import minetweaker.api.item.IItemStack;
|
||||||
import stanhebben.zenscript.annotations.ZenClass;
|
import stanhebben.zenscript.annotations.ZenClass;
|
||||||
import stanhebben.zenscript.annotations.ZenGetter;
|
import stanhebben.zenscript.annotations.ZenGetter;
|
||||||
@@ -8,12 +7,11 @@ import stanhebben.zenscript.annotations.ZenSetter;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains all of the growth requirements for an IC2 crop in one easy place
|
* Contains all of the growth requirements for an IC2 crop in one easy place
|
||||||
*
|
*
|
||||||
* @author ben
|
* @author ben
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ZenClass("mods.ic2.GrowthRequirements")
|
@ZenClass("mods.ic2.GrowthRequirements")
|
||||||
@ModOnly("IC2")
|
|
||||||
public class GrowthRequirements {
|
public class GrowthRequirements {
|
||||||
|
|
||||||
private int minNutrients;
|
private int minNutrients;
|
||||||
@@ -27,7 +25,7 @@ public class GrowthRequirements {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the minimum amount of nutrients this plant needs to grow
|
* Get the minimum amount of nutrients this plant needs to grow
|
||||||
*
|
*
|
||||||
* @return The minimum amount of nutrients this plant needs
|
* @return The minimum amount of nutrients this plant needs
|
||||||
*/
|
*/
|
||||||
@ZenGetter("minNutrients")
|
@ZenGetter("minNutrients")
|
||||||
@@ -37,7 +35,7 @@ public class GrowthRequirements {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the minimum amount of nutrients this plant needs to grow
|
* Set the minimum amount of nutrients this plant needs to grow
|
||||||
*
|
*
|
||||||
* @param minNutrients The new minimum amount of nutrients this plant requires
|
* @param minNutrients The new minimum amount of nutrients this plant requires
|
||||||
*/
|
*/
|
||||||
@ZenSetter("minNutrients")
|
@ZenSetter("minNutrients")
|
||||||
@@ -47,7 +45,7 @@ public class GrowthRequirements {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the minimum amount of humidity this plant requires
|
* Get the minimum amount of humidity this plant requires
|
||||||
*
|
*
|
||||||
* @return The minimum amount of humidity this plant requires
|
* @return The minimum amount of humidity this plant requires
|
||||||
*/
|
*/
|
||||||
@ZenGetter("minHumidity")
|
@ZenGetter("minHumidity")
|
||||||
@@ -57,7 +55,7 @@ public class GrowthRequirements {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the minimum amount of humidity this plant requires
|
* Set the minimum amount of humidity this plant requires
|
||||||
*
|
*
|
||||||
* @param minHumidity The new minimum amount of humidity this plant requires
|
* @param minHumidity The new minimum amount of humidity this plant requires
|
||||||
*/
|
*/
|
||||||
@ZenSetter("minHumidity")
|
@ZenSetter("minHumidity")
|
||||||
@@ -67,7 +65,7 @@ public class GrowthRequirements {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the minimum air quality this plant requires
|
* Get the minimum air quality this plant requires
|
||||||
*
|
*
|
||||||
* @return The minimum air quality this plant requires
|
* @return The minimum air quality this plant requires
|
||||||
*/
|
*/
|
||||||
@ZenGetter("minAirQuality")
|
@ZenGetter("minAirQuality")
|
||||||
@@ -77,7 +75,7 @@ public class GrowthRequirements {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the minimum air quality this plant requires
|
* Set the minimum air quality this plant requires
|
||||||
*
|
*
|
||||||
* @param minAirQuality The new amount of air quality this plant requires
|
* @param minAirQuality The new amount of air quality this plant requires
|
||||||
*/
|
*/
|
||||||
@ZenSetter("minAirQuality")
|
@ZenSetter("minAirQuality")
|
||||||
@@ -87,7 +85,7 @@ public class GrowthRequirements {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the minimum amount of light this plant requires
|
* Get the minimum amount of light this plant requires
|
||||||
*
|
*
|
||||||
* @return The minimum amount of light this plant requires
|
* @return The minimum amount of light this plant requires
|
||||||
*/
|
*/
|
||||||
@ZenGetter("minLight")
|
@ZenGetter("minLight")
|
||||||
@@ -97,7 +95,7 @@ public class GrowthRequirements {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the minimum amount of light this plant requires
|
* Set the minimum amount of light this plant requires
|
||||||
*
|
*
|
||||||
* @param minLight The new minimum amount of light this plant requires
|
* @param minLight The new minimum amount of light this plant requires
|
||||||
*/
|
*/
|
||||||
@ZenSetter("minLight")
|
@ZenSetter("minLight")
|
||||||
@@ -107,7 +105,7 @@ public class GrowthRequirements {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the maximum amount of light this plant can have
|
* Get the maximum amount of light this plant can have
|
||||||
*
|
*
|
||||||
* @return The maximum amount of light this plant can have
|
* @return The maximum amount of light this plant can have
|
||||||
*/
|
*/
|
||||||
@ZenGetter("maxLight")
|
@ZenGetter("maxLight")
|
||||||
@@ -117,7 +115,7 @@ public class GrowthRequirements {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the maximum amount of light this plant can have
|
* Set the maximum amount of light this plant can have
|
||||||
*
|
*
|
||||||
* @param maxLight The new maximum amount of light thi plant can have
|
* @param maxLight The new maximum amount of light thi plant can have
|
||||||
*/
|
*/
|
||||||
@ZenSetter("maxLight")
|
@ZenSetter("maxLight")
|
||||||
@@ -127,7 +125,7 @@ public class GrowthRequirements {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the block that is required to be below this one
|
* Get the block that is required to be below this one
|
||||||
*
|
*
|
||||||
* @return The block required to be below this one
|
* @return The block required to be below this one
|
||||||
*/
|
*/
|
||||||
@ZenGetter("requiredBlock")
|
@ZenGetter("requiredBlock")
|
||||||
@@ -137,7 +135,7 @@ public class GrowthRequirements {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the block required to be below this one
|
* Set the block required to be below this one
|
||||||
*
|
*
|
||||||
* @param requiredBlock The new block required to be below this one
|
* @param requiredBlock The new block required to be below this one
|
||||||
*/
|
*/
|
||||||
@ZenSetter("requiredBlock")
|
@ZenSetter("requiredBlock")
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||||||
import ic2.api.crops.CropCard;
|
import ic2.api.crops.CropCard;
|
||||||
import ic2.api.crops.ICropTile;
|
import ic2.api.crops.ICropTile;
|
||||||
import minetweaker.MineTweakerAPI;
|
import minetweaker.MineTweakerAPI;
|
||||||
import minetweaker.annotations.ModOnly;
|
|
||||||
import minetweaker.api.item.IItemStack;
|
import minetweaker.api.item.IItemStack;
|
||||||
import minetweaker.api.minecraft.MineTweakerMC;
|
import minetweaker.api.minecraft.MineTweakerMC;
|
||||||
import stanhebben.zenscript.annotations.ZenClass;
|
import stanhebben.zenscript.annotations.ZenClass;
|
||||||
@@ -19,18 +18,17 @@ import stanhebben.zenscript.annotations.ZenSetter;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A synthetic crop, created in ZS
|
* A synthetic crop, created in ZS
|
||||||
*
|
*
|
||||||
* For your crop textures to be picked up, put them at owner + ":crops/crop" + name + "." + size where owner is the mod
|
* For your crop textures to be picked up, put them at owner + ":crops/crop" + name + "." + size where owner is the mod
|
||||||
* responsible for the crop name is the name of the crop size is the current size of the crop, starting at 0 for new
|
* responsible for the crop name is the name of the crop size is the current size of the crop, starting at 0 for new
|
||||||
* crops
|
* crops
|
||||||
*
|
*
|
||||||
* Localizations will be looked for at owner + ".crop." + name where each field has the value it has above
|
* Localizations will be looked for at owner + ".crop." + name where each field has the value it has above
|
||||||
*
|
*
|
||||||
* @author ben
|
* @author ben
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@ZenClass("mods.ic2.SyntheticCrop")
|
@ZenClass("mods.ic2.SyntheticCrop")
|
||||||
@ModOnly("IC2")
|
|
||||||
public class SyntheticCrop extends CropCard {
|
public class SyntheticCrop extends CropCard {
|
||||||
|
|
||||||
private String name;
|
private String name;
|
||||||
@@ -50,7 +48,7 @@ public class SyntheticCrop extends CropCard {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new synthetic crop
|
* Create a new synthetic crop
|
||||||
*
|
*
|
||||||
* @param cropName The name of this crop
|
* @param cropName The name of this crop
|
||||||
* @param cropOwner The mod creating this crop
|
* @param cropOwner The mod creating this crop
|
||||||
*/
|
*/
|
||||||
@@ -96,7 +94,7 @@ public class SyntheticCrop extends CropCard {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value of a particular stat for this crop
|
* Gets the value of a particular stat for this crop
|
||||||
*
|
*
|
||||||
* Stats: - 0: Chemistry (Industrial uses based on chemical plant components) - 1: Consumable (Food, potion
|
* Stats: - 0: Chemistry (Industrial uses based on chemical plant components) - 1: Consumable (Food, potion
|
||||||
* ingredients, stuff meant to be eaten or similarly used) - 2: Defensive (Plants with defense capabilities
|
* ingredients, stuff meant to be eaten or similarly used) - 2: Defensive (Plants with defense capabilities
|
||||||
* (damaging, explosive, chemical) or special abilities in general) - 3: Colorful (How
|
* (damaging, explosive, chemical) or special abilities in general) - 3: Colorful (How
|
||||||
@@ -188,7 +186,7 @@ public class SyntheticCrop extends CropCard {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the tier of this crop
|
* Sets the tier of this crop
|
||||||
*
|
*
|
||||||
* @param tier The new tier of this crop
|
* @param tier The new tier of this crop
|
||||||
*/
|
*/
|
||||||
@ZenSetter("tier")
|
@ZenSetter("tier")
|
||||||
@@ -198,7 +196,7 @@ public class SyntheticCrop extends CropCard {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets all of the stats for this crop
|
* Sets all of the stats for this crop
|
||||||
*
|
*
|
||||||
* @param stats The new stats to give to this crop
|
* @param stats The new stats to give to this crop
|
||||||
*/
|
*/
|
||||||
@ZenSetter("stats")
|
@ZenSetter("stats")
|
||||||
@@ -208,7 +206,7 @@ public class SyntheticCrop extends CropCard {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets an individual stat for this crop
|
* Sets an individual stat for this crop
|
||||||
*
|
*
|
||||||
* @param stat The stat to set a value for
|
* @param stat The stat to set a value for
|
||||||
* @param val The new value for this stat
|
* @param val The new value for this stat
|
||||||
*/
|
*/
|
||||||
@@ -223,7 +221,7 @@ public class SyntheticCrop extends CropCard {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the additional attributes for this crop
|
* Sets the additional attributes for this crop
|
||||||
*
|
*
|
||||||
* @param attributes Sets the attributes of this crop
|
* @param attributes Sets the attributes of this crop
|
||||||
*/
|
*/
|
||||||
@ZenSetter("attributes")
|
@ZenSetter("attributes")
|
||||||
@@ -233,7 +231,7 @@ public class SyntheticCrop extends CropCard {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the maximum size this crop goes to
|
* Sets the maximum size this crop goes to
|
||||||
*
|
*
|
||||||
* @param maxSize The new max size of this crop
|
* @param maxSize The new max size of this crop
|
||||||
*/
|
*/
|
||||||
@ZenSetter("maxSize")
|
@ZenSetter("maxSize")
|
||||||
@@ -243,7 +241,7 @@ public class SyntheticCrop extends CropCard {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the item this crop gives when harvested
|
* Sets the item this crop gives when harvested
|
||||||
*
|
*
|
||||||
* @param fruit The item to give from the crop
|
* @param fruit The item to give from the crop
|
||||||
*/
|
*/
|
||||||
@ZenSetter("fruit")
|
@ZenSetter("fruit")
|
||||||
@@ -253,7 +251,7 @@ public class SyntheticCrop extends CropCard {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the chance for this plant to yield its fruit
|
* Sets the chance for this plant to yield its fruit
|
||||||
*
|
*
|
||||||
* @param dropChance The new chance for this plant to yield fruit
|
* @param dropChance The new chance for this plant to yield fruit
|
||||||
*/
|
*/
|
||||||
@ZenSetter("dropChance")
|
@ZenSetter("dropChance")
|
||||||
@@ -263,7 +261,7 @@ public class SyntheticCrop extends CropCard {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current requirements for this plant to grow
|
* Get the current requirements for this plant to grow
|
||||||
*
|
*
|
||||||
* @return The current growth requirements for this plant
|
* @return The current growth requirements for this plant
|
||||||
*/
|
*/
|
||||||
public GrowthRequirements getReqs() {
|
public GrowthRequirements getReqs() {
|
||||||
@@ -272,7 +270,7 @@ public class SyntheticCrop extends CropCard {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the current growth requirements for this plant to grow
|
* Set the current growth requirements for this plant to grow
|
||||||
*
|
*
|
||||||
* @param reqs The new requirements for this plant to grow
|
* @param reqs The new requirements for this plant to grow
|
||||||
*/
|
*/
|
||||||
public void setReqs(GrowthRequirements reqs) {
|
public void setReqs(GrowthRequirements reqs) {
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack;
|
|||||||
import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
|
import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
|
||||||
import static minetweaker.api.minecraft.MineTweakerMC.getItemStacks;
|
import static minetweaker.api.minecraft.MineTweakerMC.getItemStacks;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import ic2.api.recipe.RecipeOutput;
|
import ic2.api.recipe.RecipeOutput;
|
||||||
import ic2.api.recipe.Recipes;
|
import ic2.api.recipe.Recipes;
|
||||||
import minetweaker.MineTweakerAPI;
|
import minetweaker.MineTweakerAPI;
|
||||||
@@ -18,7 +20,7 @@ import stanhebben.zenscript.annotations.ZenMethod;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides access to the IC2 compressor recipes. Recipes can be added but not removed, due to IC2 API restrictions.
|
* Provides access to the IC2 compressor recipes. Recipes can be added but not removed, due to IC2 API restrictions.
|
||||||
*
|
*
|
||||||
* @author Stan Hebben
|
* @author Stan Hebben
|
||||||
*/
|
*/
|
||||||
@ZenClass("mods.ic2.Compressor")
|
@ZenClass("mods.ic2.Compressor")
|
||||||
@@ -27,9 +29,9 @@ public class Compressor {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new recipe to the compressor.
|
* Adds a new recipe to the compressor.
|
||||||
*
|
*
|
||||||
* The recipe input can be any pattern, as long as the stack size is determined. The output can be any item stack.
|
* The recipe input can be any pattern, as long as the stack size is determined. The output can be any item stack.
|
||||||
*
|
*
|
||||||
* @param output recipe output
|
* @param output recipe output
|
||||||
* @param ingredient recipe input
|
* @param ingredient recipe input
|
||||||
*/
|
*/
|
||||||
@@ -44,14 +46,29 @@ public class Compressor {
|
|||||||
Recipes.compressor,
|
Recipes.compressor,
|
||||||
getItemStacks(output),
|
getItemStacks(output),
|
||||||
null,
|
null,
|
||||||
new IC2RecipeInput(ingredient)));
|
new IC2RecipeInput(ingredient)) {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void apply() {
|
||||||
|
super.apply();
|
||||||
|
|
||||||
|
MineTweakerAPI.logGTRecipe(
|
||||||
|
new ItemStack[] { new IC2RecipeInput(ingredient).getInputs().get(0) },
|
||||||
|
new ItemStack[] { getItemStack(output) },
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
300,
|
||||||
|
2,
|
||||||
|
"sCompressorRecipes");
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines the recipe output for the given input. Will return the output of a single item, even if the stack
|
* Determines the recipe output for the given input. Will return the output of a single item, even if the stack
|
||||||
* contains multiple items.
|
* contains multiple items.
|
||||||
*
|
*
|
||||||
* @param input recipe input
|
* @param input recipe input
|
||||||
* @return recipe output
|
* @return recipe output
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack;
|
|||||||
import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
|
import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
|
||||||
import static minetweaker.api.minecraft.MineTweakerMC.getItemStacks;
|
import static minetweaker.api.minecraft.MineTweakerMC.getItemStacks;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
import ic2.api.recipe.RecipeOutput;
|
import ic2.api.recipe.RecipeOutput;
|
||||||
import ic2.api.recipe.Recipes;
|
import ic2.api.recipe.Recipes;
|
||||||
import minetweaker.MineTweakerAPI;
|
import minetweaker.MineTweakerAPI;
|
||||||
@@ -23,7 +25,7 @@ import stanhebben.zenscript.annotations.ZenMethod;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides access to the IC2 Extractor recipes.
|
* Provides access to the IC2 Extractor recipes.
|
||||||
*
|
*
|
||||||
* @author Stan Hebben
|
* @author Stan Hebben
|
||||||
*/
|
*/
|
||||||
@ZenClass("mods.ic2.Extractor")
|
@ZenClass("mods.ic2.Extractor")
|
||||||
@@ -32,9 +34,9 @@ public class Extractor {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a new recipe to the extractor.
|
* Adds a new recipe to the extractor.
|
||||||
*
|
*
|
||||||
* The recipe input can be any pattern, as long as the stack size is determined. The output can be any item stack.
|
* The recipe input can be any pattern, as long as the stack size is determined. The output can be any item stack.
|
||||||
*
|
*
|
||||||
* @param output recipe output
|
* @param output recipe output
|
||||||
* @param ingredient recipe input
|
* @param ingredient recipe input
|
||||||
*/
|
*/
|
||||||
@@ -49,14 +51,29 @@ public class Extractor {
|
|||||||
Recipes.extractor,
|
Recipes.extractor,
|
||||||
getItemStacks(output),
|
getItemStacks(output),
|
||||||
null,
|
null,
|
||||||
new IC2RecipeInput(ingredient)));
|
new IC2RecipeInput(ingredient)) {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void apply() {
|
||||||
|
super.apply();
|
||||||
|
|
||||||
|
MineTweakerAPI.logGTRecipe(
|
||||||
|
new ItemStack[] { new IC2RecipeInput(ingredient).getInputs().get(0) },
|
||||||
|
new ItemStack[] { getItemStack(output) },
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
300,
|
||||||
|
2,
|
||||||
|
"sExtractorRecipes");
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines the recipe output for the given input. Will return the output of a single item, even if the stack
|
* Determines the recipe output for the given input. Will return the output of a single item, even if the stack
|
||||||
* contains multiple items.
|
* contains multiple items.
|
||||||
*
|
*
|
||||||
* @param input recipe input
|
* @param input recipe input
|
||||||
* @return recipe output
|
* @return recipe output
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ import stanhebben.zenscript.annotations.ZenMethod;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* MineTweaker NEI support.
|
* MineTweaker NEI support.
|
||||||
*
|
*
|
||||||
* Enables hiding NEI items as well as adding new item stacks. These item stacks can then show a custom message or
|
* Enables hiding NEI items as well as adding new item stacks. These item stacks can then show a custom message or
|
||||||
* contain NBT data. Can be used to show a custom message or lore with certain items, or to provide spawnable items with
|
* contain NBT data. Can be used to show a custom message or lore with certain items, or to provide spawnable items with
|
||||||
* specific NBT tags.
|
* specific NBT tags.
|
||||||
*
|
*
|
||||||
* @author Stan Hebben
|
* @author Stan Hebben
|
||||||
*/
|
*/
|
||||||
@ZenClass("mods.nei.NEI")
|
@ZenClass("mods.nei.NEI")
|
||||||
@@ -29,7 +29,7 @@ public class NEI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Hides a specific item in NEI. Will take into account metadata values, if any.
|
* Hides a specific item in NEI. Will take into account metadata values, if any.
|
||||||
*
|
*
|
||||||
* @param item item to be hidden
|
* @param item item to be hidden
|
||||||
*/
|
*/
|
||||||
@ZenMethod
|
@ZenMethod
|
||||||
@@ -39,7 +39,7 @@ public class NEI {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a NEI entry. The item stack can contain damage values and NBT tags.
|
* Adds a NEI entry. The item stack can contain damage values and NBT tags.
|
||||||
*
|
*
|
||||||
* @param stack item stack to be added
|
* @param stack item stack to be added
|
||||||
*/
|
*/
|
||||||
@ZenMethod
|
@ZenMethod
|
||||||
@@ -50,7 +50,7 @@ public class NEI {
|
|||||||
/**
|
/**
|
||||||
* Overrides a name in NEI. Note that this will not change the original display name, but it will change the way it
|
* Overrides a name in NEI. Note that this will not change the original display name, but it will change the way it
|
||||||
* is displayed in NEI.
|
* is displayed in NEI.
|
||||||
*
|
*
|
||||||
* @param item item
|
* @param item item
|
||||||
* @param name item name
|
* @param name item name
|
||||||
*/
|
*/
|
||||||
@@ -74,6 +74,7 @@ public class NEI {
|
|||||||
@Override
|
@Override
|
||||||
public void apply() {
|
public void apply() {
|
||||||
API.addItemListEntry(item);
|
API.addItemListEntry(item);
|
||||||
|
MineTweakerAPI.info("API.addItemListEntry(" + MineTweakerAPI.convertStack(item) + ");");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -113,6 +114,7 @@ public class NEI {
|
|||||||
@Override
|
@Override
|
||||||
public void apply() {
|
public void apply() {
|
||||||
API.hideItem(stack);
|
API.hideItem(stack);
|
||||||
|
MineTweakerAPI.info("API.hideItem(" + MineTweakerAPI.convertStack(stack) + ");");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -154,6 +156,7 @@ public class NEI {
|
|||||||
@Override
|
@Override
|
||||||
public void apply() {
|
public void apply() {
|
||||||
API.setOverrideName(item, name);
|
API.setOverrideName(item, name);
|
||||||
|
MineTweakerAPI.info("API.setOverrideName(" + MineTweakerAPI.convertStack(item) + ", \"" + name + "\");");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in new issue
Block a user