Compare commits

..
10 Commits
Author SHA1 Message Date
kuba6000 8fcb36d394 Fix shaped recipe 2023-05-07 20:33:59 +02:00
kuba6000 f9db90268e Forgot about quotes 2023-05-07 20:17:11 +02:00
kuba6000 e7cd5e602d Fix error stacks 2023-05-07 20:15:22 +02:00
kuba6000 65e1f469ae Force normal parsing 2023-05-07 20:07:19 +02:00
kuba6000 7fe4150afc magic 2023-04-30 23:06:42 +02:00
Martin Robertz 03ca9b2055 revert to Zen Script 1.0.0 2023-04-25 22:37:17 +02:00
Martin Robertz dff620805a update bs+sa 2023-04-25 22:23:41 +02:00
Martin Robertz bd80583381 update bs 2023-04-25 22:20:21 +02:00
Martin Robertz 1bb66c6402 update dependencies 2023-04-25 22:09:15 +02:00
Raven Szewczyk 4b21e3e833 [ci skip] upgraded build system 2023-01-31 09:52:04 +00:00
84 changed files with 984 additions and 501 deletions

No files matched your search

+340 -135
View File
@@ -1,4 +1,4 @@
//version: 1675084541 //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.
@@ -6,27 +6,28 @@
*/ */
import com.diffplug.blowdryer.Blowdryer
import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import com.gtnewhorizons.retrofuturagradle.ObfuscationAttribute
import com.gtnewhorizons.retrofuturagradle.mcp.ReobfuscatedJar import com.gtnewhorizons.retrofuturagradle.mcp.ReobfuscatedJar
import com.gtnewhorizons.retrofuturagradle.minecraft.RunMinecraftTask
import com.gtnewhorizons.retrofuturagradle.util.Distribution
import com.matthewprenger.cursegradle.CurseArtifact import com.matthewprenger.cursegradle.CurseArtifact
import com.matthewprenger.cursegradle.CurseRelation import com.matthewprenger.cursegradle.CurseRelation
import com.modrinth.minotaur.dependencies.ModDependency import com.modrinth.minotaur.dependencies.ModDependency
import com.modrinth.minotaur.dependencies.VersionDependency import com.modrinth.minotaur.dependencies.VersionDependency
import org.gradle.internal.logging.text.StyledTextOutput.Style import org.gradle.internal.logging.text.StyledTextOutput.Style
import org.gradle.internal.logging.text.StyledTextOutputFactory import org.gradle.internal.logging.text.StyledTextOutputFactory
import org.jetbrains.gradle.ext.* import org.gradle.internal.xml.XmlTransformer
import org.jetbrains.gradle.ext.Application
import org.jetbrains.gradle.ext.Gradle
import javax.inject.Inject
import java.nio.file.Files import java.nio.file.Files
import java.nio.file.Paths import java.nio.file.Paths
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
import java.util.zip.ZipEntry
import java.util.zip.ZipOutputStream
buildscript { buildscript {
repositories { repositories {
mavenLocal()
mavenCentral() mavenCentral()
maven { maven {
@@ -47,6 +48,8 @@ buildscript {
name 'Scala CI dependencies' name 'Scala CI dependencies'
url 'https://repo1.maven.org/maven2/' url 'https://repo1.maven.org/maven2/'
} }
mavenLocal()
} }
} }
plugins { plugins {
@@ -58,22 +61,23 @@ plugins {
id 'org.jetbrains.kotlin.jvm' version '1.8.0' apply false id 'org.jetbrains.kotlin.jvm' version '1.8.0' apply false
id 'org.jetbrains.kotlin.kapt' version '1.8.0' apply false id 'org.jetbrains.kotlin.kapt' version '1.8.0' apply false
id 'com.google.devtools.ksp' version '1.8.0-1.0.9' apply false id 'com.google.devtools.ksp' version '1.8.0-1.0.9' apply false
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 '7.1.2' apply false id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
id 'com.palantir.git-version' version '0.13.0' apply false // 0.13.0 is the last jvm8 supporting version id 'com.palantir.git-version' version '3.0.0' apply false
id 'de.undercouch.download' version '5.3.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.7.2' apply false 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.0.18' id 'com.gtnewhorizons.retrofuturagradle' version '1.3.2'
} }
boolean settingsupdated = verifySettingsGradle() boolean settingsupdated = verifySettingsGradle()
settingsupdated = verifyGitAttributes() || settingsupdated settingsupdated = verifyGitAttributes() || settingsupdated
if (settingsupdated) if (settingsupdated)
throw new GradleException("Settings has been updated, please re-run task.") throw new GradleException("Settings has been updated, please re-run task.")
if (project.file('.git/HEAD').isFile()) { // In submodules, .git is a file pointing to the real git dir
if (project.file('.git/HEAD').isFile() || project.file('.git').isFile()) {
apply plugin: 'com.palantir.git-version' apply plugin: 'com.palantir.git-version'
} }
@@ -122,7 +126,10 @@ propertyDefaultIfUnset("gradleTokenGroupName", "")
propertyDefaultIfUnset("enableModernJavaSyntax", false) // On by default for new projects only propertyDefaultIfUnset("enableModernJavaSyntax", false) // On by default for new projects only
propertyDefaultIfUnset("enableGenericInjection", false) // On by default for new projects only propertyDefaultIfUnset("enableGenericInjection", false) // On by default for new projects only
project.extensions.add(Blowdryer, "Blowdryer", Blowdryer) // Make blowdryer available in "apply from:" scripts // this is meant to be set using the user wide property file. by default we do nothing.
propertyDefaultIfUnset("ideaOverrideBuildType", "") // Can be nothing, "gradle" or "idea"
project.extensions.add(com.diffplug.blowdryer.Blowdryer, "Blowdryer", com.diffplug.blowdryer.Blowdryer) // Make blowdryer available in "apply from:" scripts
if (!disableSpotless) { if (!disableSpotless) {
apply plugin: 'com.diffplug.spotless' apply plugin: 'com.diffplug.spotless'
apply from: Blowdryer.file('spotless.gradle') apply from: Blowdryer.file('spotless.gradle')
@@ -143,13 +150,21 @@ java {
} else { } else {
languageVersion.set(projectJavaVersion) languageVersion.set(projectJavaVersion)
} }
vendor.set(JvmVendorSpec.ADOPTIUM) vendor.set(JvmVendorSpec.AZUL)
} }
if (!noPublishedSources) { if (!noPublishedSources) {
withSourcesJar() withSourcesJar()
} }
} }
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
}
tasks.withType(ScalaCompile).configureEach {
options.encoding = "UTF-8"
}
pluginManager.withPlugin('org.jetbrains.kotlin.jvm') { pluginManager.withPlugin('org.jetbrains.kotlin.jvm') {
// If Kotlin is enabled in the project // If Kotlin is enabled in the project
kotlin { kotlin {
@@ -183,14 +198,32 @@ configurations {
canBeConsumed = false canBeConsumed = false
canBeResolved = false canBeResolved = false
} }
create("devOnlyNonPublishable") {
description = "Runtime and compiletime dependencies that are not published alongside the jar (compileOnly + runtimeOnlyNonPublishable)"
canBeConsumed = false
canBeResolved = false
}
compileOnly.extendsFrom(devOnlyNonPublishable)
runtimeOnlyNonPublishable.extendsFrom(devOnlyNonPublishable)
} }
if (enableModernJavaSyntax.toBoolean()) { if (enableModernJavaSyntax.toBoolean()) {
repositories {
mavenCentral {
mavenContent {
includeGroup("me.eigenraven.java8unsupported")
}
}
}
dependencies { dependencies {
annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.0' annotationProcessor 'com.github.bsideup.jabel:jabel-javac-plugin:1.0.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
} }
// Allow using jdk.unsupported classes like sun.misc.Unsafe in the compiled code, working around JDK-8206937.
patchedMinecraft('me.eigenraven.java8unsupported:java-8-unsupported-shim:1.0.0')
} }
tasks.withType(JavaCompile).configureEach { tasks.withType(JavaCompile).configureEach {
@@ -202,7 +235,7 @@ if (enableModernJavaSyntax.toBoolean()) {
javaCompiler.set(javaToolchains.compilerFor { javaCompiler.set(javaToolchains.compilerFor {
languageVersion.set(JavaLanguageVersion.of(17)) languageVersion.set(JavaLanguageVersion.of(17))
vendor.set(JvmVendorSpec.ADOPTIUM) vendor.set(JvmVendorSpec.AZUL)
}) })
} }
} }
@@ -234,12 +267,14 @@ if (apiPackage) {
} }
if (accessTransformersFile) { if (accessTransformersFile) {
String targetFile = "src/main/resources/META-INF/" + accessTransformersFile for (atFile in accessTransformersFile.split(",")) {
if (!getFile(targetFile).exists()) { String targetFile = "src/main/resources/META-INF/" + atFile.trim()
throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile) if (!getFile(targetFile).exists()) {
throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile)
}
tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(targetFile)
tasks.srgifyBinpatchedJar.accessTransformerFiles.from(targetFile)
} }
tasks.deobfuscateMergedJarToSrg.accessTransformerFiles.from(targetFile)
tasks.srgifyBinpatchedJar.accessTransformerFiles.from(targetFile)
} else { } else {
boolean atsFound = false boolean atsFound = false
for (File at : sourceSets.getByName("main").resources.files) { for (File at : sourceSets.getByName("main").resources.files) {
@@ -337,7 +372,7 @@ if (identifiedVersion == versionOverride) {
out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7') out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7')
} }
group = modGroup group = "com.github.GTNewHorizons"
if (project.hasProperty("customArchiveBaseName") && customArchiveBaseName) { if (project.hasProperty("customArchiveBaseName") && customArchiveBaseName) {
archivesBaseName = customArchiveBaseName archivesBaseName = customArchiveBaseName
} else { } else {
@@ -367,12 +402,14 @@ minecraft {
injectMissingGenerics.set(true) injectMissingGenerics.set(true)
} }
username = developmentEnvironmentUserName.toString()
lwjgl3Version = "3.3.2"
// Enable assertions in the current mod // Enable assertions in the current mod
extraRunJvmArguments.add("-ea:${modGroup}") extraRunJvmArguments.add("-ea:${modGroup}")
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
extraTweakClasses.add("org.spongepowered.asm.launch.MixinTweaker")
if (usesMixinDebug.toBoolean()) { if (usesMixinDebug.toBoolean()) {
extraRunJvmArguments.addAll([ extraRunJvmArguments.addAll([
"-Dmixin.debug.countInjections=true", "-Dmixin.debug.countInjections=true",
@@ -401,6 +438,16 @@ configurations.configureEach {
} }
} }
} }
def obfuscationAttr = it.attributes.getAttribute(ObfuscationAttribute.OBFUSCATION_ATTRIBUTE)
if (obfuscationAttr != null && obfuscationAttr.name == ObfuscationAttribute.SRG) {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
// Remap CoFH core cursemaven dev jar to the obfuscated version for runObfClient/Server
if (details.requested.group == 'curse.maven' && details.requested.name.endsWith('-69162') && details.requested.version == '2388751') {
details.useVersion '2388750'
details.because 'Pick obfuscated jar'
}
}
}
} }
// Ensure tests have access to minecraft classes // Ensure tests have access to minecraft classes
@@ -430,8 +477,9 @@ repositories.configureEach { repo ->
apply from: 'repositories.gradle' apply from: 'repositories.gradle'
configurations { configurations {
runtimeClasspath.extendsFrom(runtimeOnlyNonPublishable)
testRuntimeClasspath.extendsFrom(runtimeOnlyNonPublishable)
for (config in [compileClasspath, runtimeClasspath, testCompileClasspath, testRuntimeClasspath]) { for (config in [compileClasspath, runtimeClasspath, testCompileClasspath, testRuntimeClasspath]) {
config.extendsFrom(runtimeOnlyNonPublishable)
if (usesShadowedDependencies.toBoolean()) { if (usesShadowedDependencies.toBoolean()) {
config.extendsFrom(shadowImplementation) config.extendsFrom(shadowImplementation)
// TODO: remove Compile after all uses are refactored to Implementation // TODO: remove Compile after all uses are refactored to Implementation
@@ -476,12 +524,11 @@ repositories {
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
allowInsecureProtocol = true allowInsecureProtocol = true
} }
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { maven {
if (usesMixinDebug.toBoolean()) { name 'sonatype'
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/'
name = "Fabric Maven" content {
url = "https://maven.fabricmc.net/" includeGroup "org.lwjgl"
}
} }
} }
if (includeWellKnownRepositories.toBoolean()) { if (includeWellKnownRepositories.toBoolean()) {
@@ -515,29 +562,49 @@ repositories {
} }
} }
def mixinProviderGroup = "io.github.legacymoddingmc"
def mixinProviderModule = "unimixins"
def mixinProviderVersion = "0.1.6"
def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}:${mixinProviderVersion}"
def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev"
dependencies { dependencies {
if (usesMixins.toBoolean()) { if (usesMixins.toBoolean()) {
annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3') annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3')
annotationProcessor('com.google.guava:guava:24.1.1-jre') annotationProcessor('com.google.guava:guava:24.1.1-jre')
annotationProcessor('com.google.code.gson:gson:2.8.6') annotationProcessor('com.google.code.gson:gson:2.8.6')
annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.10:processor') annotationProcessor(mixinProviderSpec)
if (usesMixinDebug.toBoolean()) { if (usesMixinDebug.toBoolean()) {
runtimeOnlyNonPublishable('org.jetbrains:intellij-fernflower:1.2.1.16') runtimeOnlyNonPublishable('org.jetbrains:intellij-fernflower:1.2.1.16')
} }
} }
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) { if (usesMixins.toBoolean()) {
implementation('com.gtnewhorizon:gtnhmixins:2.1.10') implementation(mixinProviderSpec)
} else if (forceEnableMixins.toBoolean()) {
runtimeOnlyNonPublishable(mixinProviderSpec)
} }
} }
pluginManager.withPlugin('org.jetbrains.kotlin.kapt') { pluginManager.withPlugin('org.jetbrains.kotlin.kapt') {
if (usesMixins.toBoolean()) { if (usesMixins.toBoolean()) {
dependencies { dependencies {
kapt('com.gtnewhorizon:gtnhmixins:2.1.10:processor') kapt(mixinProviderSpec)
} }
} }
} }
// Replace old mixin mods with unimixins
// https://docs.gradle.org/8.0.2/userguide/resolution_rules.html#sec:substitution_with_classifier
configurations.all {
resolutionStrategy.dependencySubstitution {
substitute module('com.gtnewhorizon:gtnhmixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Unimixins replaces other mixin mods")
substitute module('com.github.GTNewHorizons:Mixingasm') 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('io.github.legacymoddingmc:unimixins') using module(mixinProviderSpecNoClassifer) withClassifier("dev") because("Our previous unimixins upload was missing the dev classifier")
}
}
apply from: 'dependencies.gradle' apply from: 'dependencies.gradle'
def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json' def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json'
@@ -633,9 +700,146 @@ tasks.named("processResources", ProcessResources).configure {
if (usesMixins.toBoolean()) { if (usesMixins.toBoolean()) {
from refMap from refMap
dependsOn("compileJava", "compileScala")
} }
} }
ext.java17Toolchain = (JavaToolchainSpec spec) -> {
spec.languageVersion.set(JavaLanguageVersion.of(17))
spec.vendor.set(JvmVendorSpec.matching("jetbrains"))
}
ext.java17DependenciesCfg = configurations.create("java17Dependencies") {
extendsFrom(configurations.getByName("runtimeClasspath")) // Ensure consistent transitive dependency resolution
canBeConsumed = false
}
ext.java17PatchDependenciesCfg = configurations.create("java17PatchDependencies") {
canBeConsumed = false
}
dependencies {
def lwjgl3ifyVersion = '1.3.5'
def asmVersion = '9.4'
if (modId != 'lwjgl3ify') {
java17Dependencies("com.github.GTNewHorizons:lwjgl3ify:${lwjgl3ifyVersion}")
}
if (modId != 'hodgepodge') {
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}
}
ext.java17JvmArgs = [
// Java 9+ support
"--illegal-access=warn",
"-Djava.security.manager=allow",
"-Dfile.encoding=UTF-8",
"--add-opens", "java.base/jdk.internal.loader=ALL-UNNAMED",
"--add-opens", "java.base/java.net=ALL-UNNAMED",
"--add-opens", "java.base/java.nio=ALL-UNNAMED",
"--add-opens", "java.base/java.io=ALL-UNNAMED",
"--add-opens", "java.base/java.lang=ALL-UNNAMED",
"--add-opens", "java.base/java.lang.reflect=ALL-UNNAMED",
"--add-opens", "java.base/java.text=ALL-UNNAMED",
"--add-opens", "java.base/java.util=ALL-UNNAMED",
"--add-opens", "java.base/jdk.internal.reflect=ALL-UNNAMED",
"--add-opens", "java.base/sun.nio.ch=ALL-UNNAMED",
"--add-opens", "jdk.naming.dns/com.sun.jndi.dns=ALL-UNNAMED,java.naming",
"--add-opens", "java.desktop/sun.awt.image=ALL-UNNAMED",
"--add-modules", "jdk.dynalink",
"--add-opens", "jdk.dynalink/jdk.dynalink.beans=ALL-UNNAMED",
"--add-modules", "java.sql.rowset",
"--add-opens", "java.sql.rowset/javax.sql.rowset.serial=ALL-UNNAMED"
]
ext.hotswapJvmArgs = [
// DCEVM advanced hot reload
"-XX:+AllowEnhancedClassRedefinition",
"-XX:HotswapAgent=fatjar"
]
ext.setupHotswapAgentTask = tasks.register("setupHotswapAgent") {
group = "GTNH Buildscript"
description = "Installs a recent version of HotSwapAgent into the Java 17 JetBrains runtime directory"
def hsaUrl = 'https://github.com/HotswapProjects/HotswapAgent/releases/download/1.4.2-SNAPSHOT/hotswap-agent-1.4.2-SNAPSHOT.jar'
def targetFolderProvider = javaToolchains.launcherFor(java17Toolchain).map {it.metadata.installationPath.dir("lib/hotswap")}
def targetFilename = "hotswap-agent.jar"
onlyIf {
!targetFolderProvider.get().file(targetFilename).asFile.exists()
}
doLast {
def targetFolder = targetFolderProvider.get()
targetFolder.asFile.mkdirs()
download.run {
src hsaUrl
dest targetFolder.file(targetFilename).asFile
overwrite false
tempAndMove true
}
}
}
public abstract class RunHotswappableMinecraftTask extends RunMinecraftTask {
// IntelliJ doesn't seem to allow commandline arguments so we also support an env variable
private boolean enableHotswap = Boolean.valueOf(System.getenv("HOTSWAP"));
@Input
public boolean getEnableHotswap() { return enableHotswap }
@Option(option = "hotswap", description = "Enables HotSwapAgent for enhanced class reloading under a debugger")
public boolean setEnableHotswap(boolean enable) { enableHotswap = enable }
@Inject
public RunHotswappableMinecraftTask(Distribution side, String superTask, org.gradle.api.invocation.Gradle gradle) {
super(side, gradle)
this.lwjglVersion = 3
this.javaLauncher = project.javaToolchains.launcherFor(project.java17Toolchain)
this.extraJvmArgs.addAll(project.java17JvmArgs)
this.extraJvmArgs.addAll(project.provider(() -> enableHotswap ? project.hotswapJvmArgs : []))
this.classpath(project.java17PatchDependenciesCfg)
if (side == Distribution.CLIENT) {
this.classpath(project.minecraftTasks.lwjgl3Configuration)
}
// Use a raw provider instead of map to not create a dependency on the task
this.classpath(project.provider(() -> project.tasks.named(superTask, RunMinecraftTask).get().classpath))
this.classpath.filter { file ->
!file.path.contains("2.9.4-nightly-20150209") // Remove lwjgl2
}
this.classpath(project.java17DependenciesCfg)
}
}
def runClient17Task = tasks.register("runClient17", RunHotswappableMinecraftTask, Distribution.CLIENT, "runClient")
runClient17Task.configure {
setup(project)
group = "Modded Minecraft"
description = "Runs the modded client using Java 17, lwjgl3ify and Hodgepodge"
dependsOn(setupHotswapAgentTask, mcpTasks.launcherSources.classesTaskName, minecraftTasks.taskDownloadVanillaAssets, mcpTasks.taskPackagePatchedMc, 'jar')
mainClass = "GradleStart"
username = minecraft.username
userUUID = minecraft.userUUID
}
def runServer17Task = tasks.register("runServer17", RunHotswappableMinecraftTask, Distribution.DEDICATED_SERVER, "runServer")
runServer17Task.configure {
setup(project)
group = "Modded Minecraft"
description = "Runs the modded server using Java 17, lwjgl3ify and Hodgepodge"
dependsOn(setupHotswapAgentTask, mcpTasks.launcherSources.classesTaskName, minecraftTasks.taskDownloadVanillaAssets, mcpTasks.taskPackagePatchedMc, 'jar')
mainClass = "GradleStartServer"
extraArgs.add("nogui")
}
def getManifestAttributes() { def getManifestAttributes() {
def manifestAttributes = [:] def manifestAttributes = [:]
if (!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) { if (!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) {
@@ -667,11 +871,6 @@ tasks.named("jar", Jar).configure {
} }
if (usesShadowedDependencies.toBoolean()) { if (usesShadowedDependencies.toBoolean()) {
tasks.register('relocateShadowJar', ConfigureShadowRelocation) {
target = tasks.shadowJar
prefix = modGroup + ".shadow"
enabled = minimizeShadowedDependencies.toBoolean()
}
tasks.named("shadowJar", ShadowJar).configure { tasks.named("shadowJar", ShadowJar).configure {
manifest { manifest {
attributes(getManifestAttributes()) attributes(getManifestAttributes())
@@ -686,8 +885,9 @@ if (usesShadowedDependencies.toBoolean()) {
project.configurations.shadeCompile project.configurations.shadeCompile
] ]
archiveClassifier.set('dev') archiveClassifier.set('dev')
if (minimizeShadowedDependencies.toBoolean()) { if (relocateShadowedDependencies.toBoolean()) {
dependsOn(relocateShadowJar) relocationPrefix = modGroup + ".shadow"
enableRelocation = true
} }
} }
configurations.runtimeElements.outgoing.artifacts.clear() configurations.runtimeElements.outgoing.artifacts.clear()
@@ -705,7 +905,7 @@ if (usesShadowedDependencies.toBoolean()) {
javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements) { javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements) {
skip() skip()
} }
for (runTask in ["runClient", "runServer"]) { for (runTask in ["runClient", "runServer", "runClient17", "runServer17"]) {
tasks.named(runTask).configure { tasks.named(runTask).configure {
dependsOn("shadowJar") dependsOn("shadowJar")
} }
@@ -714,16 +914,6 @@ if (usesShadowedDependencies.toBoolean()) {
ext.publishableDevJar = usesShadowedDependencies.toBoolean() ? tasks.shadowJar : tasks.jar ext.publishableDevJar = usesShadowedDependencies.toBoolean() ? tasks.shadowJar : tasks.jar
ext.publishableObfJar = tasks.reobfJar ext.publishableObfJar = tasks.reobfJar
tasks.named('extractForgeUserdev', Copy).configure { efu ->
doLast {
// Fix CoFH-repackaged CCL not finding mappings
project.copy {
from(mcpTasks.userdevDir("conf"))
into(new File(project.buildDir, "unpacked/conf"))
}
}
}
tasks.register('apiJar', Jar) { tasks.register('apiJar', Jar) {
from(sourceSets.main.allSource) { from(sourceSets.main.allSource) {
include modGroupPath + "/" + apiPackagePath + '/**' include modGroupPath + "/" + apiPackagePath + '/**'
@@ -753,9 +943,23 @@ idea {
module { module {
downloadJavadoc = true downloadJavadoc = true
downloadSources = true downloadSources = true
inheritOutputDirs = true
} }
project { project {
settings { settings {
if (ideaOverrideBuildType != "") {
delegateActions {
if ("gradle".equalsIgnoreCase(ideaOverrideBuildType)) {
delegateBuildRunToGradle = true
testRunner = org.jetbrains.gradle.ext.ActionDelegationConfig.TestRunner.GRADLE
} else if ("idea".equalsIgnoreCase(ideaOverrideBuildType)) {
delegateBuildRunToGradle = false
testRunner = org.jetbrains.gradle.ext.ActionDelegationConfig.TestRunner.PLATFORM
} else {
throw GradleScriptException('Accepted value for ideaOverrideBuildType is one of gradle or idea.')
}
}
}
runConfigurations { runConfigurations {
"1. Run Client"(Gradle) { "1. Run Client"(Gradle) {
taskNames = ["runClient"] taskNames = ["runClient"]
@@ -763,6 +967,20 @@ idea {
"2. Run Server"(Gradle) { "2. Run Server"(Gradle) {
taskNames = ["runServer"] taskNames = ["runServer"]
} }
"1a. Run Client (Java 17)"(Gradle) {
taskNames = ["runClient17"]
}
"2a. Run Server (Java 17)"(Gradle) {
taskNames = ["runServer17"]
}
"1b. Run Client (Java 17, Hotswap)"(Gradle) {
taskNames = ["runClient17"]
envs = ["HOTSWAP": "true"]
}
"2b. Run Server (Java 17, Hotswap)"(Gradle) {
taskNames = ["runServer17"]
envs = ["HOTSWAP": "true"]
}
"3. Run Obfuscated Client"(Gradle) { "3. Run Obfuscated Client"(Gradle) {
taskNames = ["runObfClient"] taskNames = ["runObfClient"]
} }
@@ -780,7 +998,7 @@ idea {
} }
"Run Client (IJ Native)"(Application) { "Run Client (IJ Native)"(Application) {
mainClass = "GradleStart" mainClass = "GradleStart"
moduleName = project.name + ".main" moduleName = project.name + ".ideVirtualMain"
afterEvaluate { afterEvaluate {
workingDirectory = tasks.runClient.workingDir.absolutePath workingDirectory = tasks.runClient.workingDir.absolutePath
programParameters = tasks.runClient.calculateArgs(project).collect { '"' + it + '"' }.join(' ') programParameters = tasks.runClient.calculateArgs(project).collect { '"' + it + '"' }.join(' ')
@@ -791,7 +1009,7 @@ idea {
} }
"Run Server (IJ Native)"(Application) { "Run Server (IJ Native)"(Application) {
mainClass = "GradleStartServer" mainClass = "GradleStartServer"
moduleName = project.name + ".main" moduleName = project.name + ".ideVirtualMain"
afterEvaluate { afterEvaluate {
workingDirectory = tasks.runServer.workingDir.absolutePath workingDirectory = tasks.runServer.workingDir.absolutePath
programParameters = tasks.runServer.calculateArgs(project).collect { '"' + it + '"' }.join(' ') programParameters = tasks.runServer.calculateArgs(project).collect { '"' + it + '"' }.join(' ')
@@ -803,11 +1021,57 @@ idea {
} }
compiler.javac { compiler.javac {
afterEvaluate { afterEvaluate {
javacAdditionalOptions = "-encoding utf8"
moduleJavacAdditionalOptions = [ moduleJavacAdditionalOptions = [
(project.name + ".main"): tasks.compileJava.options.compilerArgs.collect { '"' + it + '"' }.join(' ') (project.name + ".main"): tasks.compileJava.options.compilerArgs.collect { '"' + it + '"' }.join(' ')
] ]
} }
} }
withIDEADir { File ideaDir ->
if (!ideaDir.path.contains(".idea")) {
// If an .ipr file exists, the project root directory is passed here instead of the .idea subdirectory
ideaDir = new File(ideaDir, ".idea")
}
if (ideaDir.isDirectory()) {
def miscFile = new File(ideaDir, "misc.xml")
if (miscFile.isFile()) {
boolean dirty = false
def miscTransformer = new XmlTransformer()
miscTransformer.addAction { root ->
Node rootNode = root.asNode()
def rootManager = rootNode
.component.find { it.@name == 'ProjectRootManager' }
if (!rootManager) {
rootManager = rootNode.appendNode('component', ['name': 'ProjectRootManager', 'version': '2'])
dirty = true
}
def output = rootManager.output
if (!output) {
output = rootManager.appendNode('output')
dirty = true
}
if (!output.@url) {
// Only modify the output url if it doesn't yet have one, or if the existing one is blank somehow.
// This is a sensible default for most setups
output.@url = 'file://$PROJECT_DIR$/build/ideaBuild'
dirty = true
}
}
def result = miscTransformer.transform(miscFile.text)
if (dirty) {
miscFile.write(result)
}
} else {
miscFile.text = """<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2">
<output url="file://\$PROJECT_DIR\$/out" />
</component>
</project>
"""
}
}
}
} }
} }
} }
@@ -828,7 +1092,7 @@ publishing {
artifact apiJar artifact apiJar
} }
groupId = System.getenv("ARTIFACT_GROUP_ID") ?: "com.github.GTNewHorizons" groupId = System.getenv("ARTIFACT_GROUP_ID") ?: project.group
artifactId = System.getenv("ARTIFACT_ID") ?: project.name artifactId = System.getenv("ARTIFACT_ID") ?: project.name
// Using the identified version, not project.version as it has the prepended 1.7.10 // Using the identified version, not project.version as it has the prepended 1.7.10
version = System.getenv("RELEASE_VERSION") ?: identifiedVersion version = System.getenv("RELEASE_VERSION") ?: identifiedVersion
@@ -877,7 +1141,7 @@ if (modrinthProjectId.size() != 0 && System.getenv("MODRINTH_TOKEN") != null) {
} }
} }
if (usesMixins.toBoolean()) { if (usesMixins.toBoolean()) {
addModrinthDep("required", "project", "gtnhmixins") addModrinthDep("required", "project", "unimixins")
} }
tasks.modrinth.dependsOn(build) tasks.modrinth.dependsOn(build)
tasks.publish.dependsOn(tasks.modrinth) tasks.publish.dependsOn(tasks.modrinth)
@@ -921,7 +1185,7 @@ if (curseForgeProjectId.size() != 0 && System.getenv("CURSEFORGE_TOKEN") != null
} }
} }
if (usesMixins.toBoolean()) { if (usesMixins.toBoolean()) {
addCurseForgeRelation("requiredDependency", "gtnhmixins") addCurseForgeRelation("requiredDependency", "unimixins")
} }
tasks.curseforge.dependsOn(build) tasks.curseforge.dependsOn(build)
tasks.publish.dependsOn(tasks.curseforge) tasks.publish.dependsOn(tasks.curseforge)
@@ -955,10 +1219,21 @@ def addCurseForgeRelation(String type, String name) {
} }
// Updating // Updating
def buildscriptGradleVersion = "8.1.1"
tasks.named('wrapper', Wrapper).configure {
gradleVersion = buildscriptGradleVersion
}
tasks.register('updateBuildScript') { tasks.register('updateBuildScript') {
group = 'GTNH Buildscript' group = 'GTNH Buildscript'
description = 'Updates the build script to the latest version' description = 'Updates the build script to the latest version'
if (gradle.gradleVersion != buildscriptGradleVersion && !Boolean.getBoolean('DISABLE_BUILDSCRIPT_GRADLE_UPDATE')) {
dependsOn('wrapper')
}
doLast { doLast {
if (performBuildScriptUpdate()) return if (performBuildScriptUpdate()) return
@@ -971,6 +1246,9 @@ if (!project.getGradle().startParameter.isOffline() && !Boolean.getBoolean('DISA
performBuildScriptUpdate() performBuildScriptUpdate()
} else { } else {
out.style(Style.SuccessHeader).println("Build script update available! Run 'gradle updateBuildScript'") out.style(Style.SuccessHeader).println("Build script update available! Run 'gradle updateBuildScript'")
if (gradle.gradleVersion != buildscriptGradleVersion) {
out.style(Style.SuccessHeader).println("updateBuildScript can update gradle from ${gradle.gradleVersion} to ${buildscriptGradleVersion}\n")
}
} }
} }
@@ -1111,7 +1389,7 @@ static int replaceParams(File file, Map<String, String> params) {
return 0 return 0
} }
// Dependency Deobfuscation // Dependency Deobfuscation (Deprecated, use the new RFG API documented in dependencies.gradle)
def deobf(String sourceURL) { def deobf(String sourceURL) {
try { try {
@@ -1153,11 +1431,7 @@ def deobfMaven(String repoURL, String mavenDep) {
} }
def deobfCurse(String curseDep) { def deobfCurse(String curseDep) {
try { return dependencies.rfg.deobf("curse.maven:$curseDep")
return deobfMaven("https://www.cursemaven.com/", "curse.maven:$curseDep")
} catch (Exception ignored) {
out.style(Style.Failure).println("Failed to get $curseDep from cursemaven.")
}
} }
// The method above is to be preferred. Use this method if the filename is not at the end of the URL. // The method above is to be preferred. Use this method if the filename is not at the end of the URL.
@@ -1165,34 +1439,7 @@ def deobf(String sourceURL, String rawFileName) {
String bon2Version = "2.5.1" String bon2Version = "2.5.1"
String fileName = URLDecoder.decode(rawFileName, "UTF-8") String fileName = URLDecoder.decode(rawFileName, "UTF-8")
String cacheDir = "$project.gradle.gradleUserHomeDir/caches" String cacheDir = "$project.gradle.gradleUserHomeDir/caches"
String bon2Dir = "$cacheDir/forge_gradle/deobf"
String bon2File = "$bon2Dir/BON2-${bon2Version}.jar"
String obfFile = "$cacheDir/modules-2/files-2.1/${fileName}.jar" String obfFile = "$cacheDir/modules-2/files-2.1/${fileName}.jar"
String deobfFile = "$cacheDir/modules-2/files-2.1/${fileName}-deobf.jar"
if (file(deobfFile).exists()) {
return files(deobfFile)
}
String mappingsVer
String remoteMappings = project.hasProperty('remoteMappings') ? project.remoteMappings : 'https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/'
if (remoteMappings) {
String id = "${forgeVersion.split("\\.")[3]}-$minecraftVersion"
String mappingsZIP = "$cacheDir/forge_gradle/maven_downloader/de/oceanlabs/mcp/mcp_snapshot_nodoc/$id/mcp_snapshot_nodoc-${id}.zip"
zipMappings(mappingsZIP, remoteMappings, bon2Dir)
mappingsVer = "snapshot_$id"
} else {
mappingsVer = "${channel}_$mappingsVersion"
}
download.run {
src "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/com/github/parker8283/BON2/$bon2Version-CUSTOM/BON2-$bon2Version-CUSTOM-all.jar"
dest bon2File
quiet true
overwrite false
}
download.run { download.run {
src sourceURL src sourceURL
@@ -1200,50 +1447,8 @@ def deobf(String sourceURL, String rawFileName) {
quiet true quiet true
overwrite false overwrite false
} }
return dependencies.rfg.deobf(files(obfFile))
exec {
commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch'
workingDir bon2Dir
standardOutput = new FileOutputStream("${deobfFile}.log")
}
return files(deobfFile)
} }
def zipMappings(String zipPath, String url, String bon2Dir) {
File zipFile = new File(zipPath)
if (zipFile.exists()) {
return
}
String fieldsCache = "$bon2Dir/data/fields.csv"
String methodsCache = "$bon2Dir/data/methods.csv"
download.run {
src "${url}fields.csv"
dest fieldsCache
quiet true
}
download.run {
src "${url}methods.csv"
dest methodsCache
quiet true
}
zipFile.getParentFile().mkdirs()
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile))
zos.putNextEntry(new ZipEntry("fields.csv"))
Files.copy(Paths.get(fieldsCache), zos)
zos.closeEntry()
zos.putNextEntry(new ZipEntry("methods.csv"))
Files.copy(Paths.get(methodsCache), zos)
zos.closeEntry()
zos.close()
}
// Helper methods // Helper methods
def checkPropertyExists(String propertyName) { def checkPropertyExists(String propertyName) {
+1 -1
View File
@@ -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("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev") implementation("net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev")
implementation("com.github.GTNewHorizons:NotEnoughItems:2.3.23-GTNH:dev") implementation("com.github.GTNewHorizons:NotEnoughItems:2.3.45-GTNH:dev")
} }
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000 networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
+7
View File
@@ -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"
}
} }
+197 -22
View File
@@ -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
@@ -4,6 +4,18 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.oredict.OreDictionary;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.api.block.IBlock; import minetweaker.api.block.IBlock;
import minetweaker.api.block.IBlockDefinition; import minetweaker.api.block.IBlockDefinition;
@@ -27,18 +39,6 @@ import minetweaker.mc1710.player.MCPlayer;
import minetweaker.mc1710.world.MCBiome; import minetweaker.mc1710.world.MCBiome;
import minetweaker.mc1710.world.MCDimension; import minetweaker.mc1710.world.MCDimension;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.oredict.OreDictionary;
/** /**
* MineTweaker - MineCraft API bridge. * MineTweaker - MineCraft API bridge.
* *
@@ -1,5 +1,12 @@
package minetweaker.mc1710; package minetweaker.mc1710;
import net.minecraft.entity.player.EntityPlayerMP;
import org.lwjgl.input.Keyboard;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI; import minetweaker.MineTweakerImplementationAPI;
import minetweaker.api.event.PlayerCraftedEvent; import minetweaker.api.event.PlayerCraftedEvent;
@@ -12,14 +19,6 @@ import minetweaker.mc1710.network.MineTweakerLoadScriptsPacket;
import minetweaker.mc1710.recipes.MCCraftingInventory; import minetweaker.mc1710.recipes.MCCraftingInventory;
import minetweaker.mc1710.recipes.MCRecipeManager; import minetweaker.mc1710.recipes.MCRecipeManager;
import net.minecraft.entity.player.EntityPlayerMP;
import org.lwjgl.input.Keyboard;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
/** /**
* *
* @author Stan * @author Stan
@@ -7,15 +7,6 @@ package minetweaker.mc1710;
import java.util.*; import java.util.*;
import minetweaker.*;
import minetweaker.api.entity.*;
import minetweaker.api.formatting.IFormattedText;
import minetweaker.api.item.IItemStack;
import minetweaker.api.minecraft.MineTweakerMC;
import minetweaker.api.tooltip.IngredientTooltips;
import minetweaker.mc1710.formatting.IMCFormattedString;
import minetweaker.mc1710.item.*;
import net.minecraft.client.multiplayer.GuiConnecting; import net.minecraft.client.multiplayer.GuiConnecting;
import net.minecraft.entity.*; import net.minecraft.entity.*;
import net.minecraft.entity.item.*; import net.minecraft.entity.item.*;
@@ -26,10 +17,18 @@ import net.minecraftforge.event.entity.living.*;
import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.event.entity.player.ItemTooltipEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import stanhebben.zenscript.value.*;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import minetweaker.*;
import minetweaker.api.entity.*;
import minetweaker.api.formatting.IFormattedText;
import minetweaker.api.item.IItemStack;
import minetweaker.api.minecraft.MineTweakerMC;
import minetweaker.api.tooltip.IngredientTooltips;
import minetweaker.mc1710.formatting.IMCFormattedString;
import minetweaker.mc1710.item.*;
import stanhebben.zenscript.value.*;
/** /**
* @author Stan * @author Stan
@@ -5,6 +5,8 @@
package minetweaker.mc1710; package minetweaker.mc1710;
import net.minecraft.item.Item;
import minetweaker.IPlatformFunctions; import minetweaker.IPlatformFunctions;
import minetweaker.api.chat.IChatMessage; import minetweaker.api.chat.IChatMessage;
import minetweaker.api.item.IItemDefinition; import minetweaker.api.item.IItemDefinition;
@@ -12,8 +14,6 @@ import minetweaker.mc1710.chat.MCChatMessage;
import minetweaker.mc1710.item.MCItemDefinition; import minetweaker.mc1710.item.MCItemDefinition;
import minetweaker.mc1710.network.MineTweakerLoadScriptsPacket; import minetweaker.mc1710.network.MineTweakerLoadScriptsPacket;
import net.minecraft.item.Item;
/** /**
* *
* @author Stan * @author Stan
@@ -8,6 +8,18 @@ package minetweaker.mc1710;
import java.io.File; import java.io.File;
import java.util.List; import java.util.List;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.*;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import cpw.mods.fml.relauncher.Side;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI; import minetweaker.MineTweakerImplementationAPI;
import minetweaker.api.logger.FileLogger; import minetweaker.api.logger.FileLogger;
@@ -31,19 +43,6 @@ import minetweaker.runtime.providers.ScriptProviderCascade;
import minetweaker.runtime.providers.ScriptProviderCustom; import minetweaker.runtime.providers.ScriptProviderCustom;
import minetweaker.runtime.providers.ScriptProviderDirectory; import minetweaker.runtime.providers.ScriptProviderDirectory;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.*;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import cpw.mods.fml.relauncher.Side;
/** /**
* Main mod class. Performs some general logic, initialization of the API and FML event handling. * Main mod class. Performs some general logic, initialization of the API and FML event handling.
* *
@@ -5,12 +5,12 @@
package minetweaker.mc1710.actions; package minetweaker.mc1710.actions;
import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI;
/** /**
* *
* @author Jared * @author Jared
@@ -5,10 +5,10 @@
package minetweaker.mc1710.actions; package minetweaker.mc1710.actions;
import minetweaker.IUndoableAction;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import minetweaker.IUndoableAction;
/** /**
* *
* @author Jared * @author Jared
@@ -5,10 +5,10 @@
package minetweaker.mc1710.actions; package minetweaker.mc1710.actions;
import minetweaker.IUndoableAction;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import minetweaker.IUndoableAction;
/** /**
* *
* @author Jared * @author Jared
@@ -8,11 +8,11 @@ package minetweaker.mc1710.actions;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.nio.charset.Charset; import java.nio.charset.Charset;
import net.minecraft.util.StringTranslate;
import minetweaker.IUndoableAction; import minetweaker.IUndoableAction;
import minetweaker.mc1710.util.MineTweakerHacks; import minetweaker.mc1710.util.MineTweakerHacks;
import net.minecraft.util.StringTranslate;
/** /**
* *
* @author Stan * @author Stan
@@ -5,10 +5,10 @@
package minetweaker.mc1710.block; package minetweaker.mc1710.block;
import minetweaker.api.block.IBlockDefinition;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import minetweaker.api.block.IBlockDefinition;
/** /**
* *
* @author Stan * @author Stan
@@ -8,6 +8,10 @@ package minetweaker.mc1710.block;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import minetweaker.api.block.BlockPatternOr; import minetweaker.api.block.BlockPatternOr;
import minetweaker.api.block.IBlock; import minetweaker.api.block.IBlock;
import minetweaker.api.block.IBlockDefinition; import minetweaker.api.block.IBlockDefinition;
@@ -15,10 +19,6 @@ import minetweaker.api.block.IBlockPattern;
import minetweaker.api.data.IData; import minetweaker.api.data.IData;
import minetweaker.api.minecraft.MineTweakerMC; import minetweaker.api.minecraft.MineTweakerMC;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
/** /**
* *
* @author Stan * @author Stan
@@ -8,6 +8,9 @@ package minetweaker.mc1710.block;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import net.minecraft.block.Block;
import net.minecraftforge.oredict.OreDictionary;
import minetweaker.api.block.BlockPatternOr; import minetweaker.api.block.BlockPatternOr;
import minetweaker.api.block.IBlock; import minetweaker.api.block.IBlock;
import minetweaker.api.block.IBlockDefinition; import minetweaker.api.block.IBlockDefinition;
@@ -15,9 +18,6 @@ import minetweaker.api.block.IBlockPattern;
import minetweaker.api.data.IData; import minetweaker.api.data.IData;
import minetweaker.api.minecraft.MineTweakerMC; import minetweaker.api.minecraft.MineTweakerMC;
import net.minecraft.block.Block;
import net.minecraftforge.oredict.OreDictionary;
/** /**
* *
* @author Stan * @author Stan
@@ -8,13 +8,6 @@ package minetweaker.mc1710.block;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import minetweaker.api.block.BlockPatternOr;
import minetweaker.api.block.IBlock;
import minetweaker.api.block.IBlockDefinition;
import minetweaker.api.block.IBlockPattern;
import minetweaker.api.data.IData;
import minetweaker.api.minecraft.MineTweakerMC;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@@ -23,6 +16,13 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import minetweaker.api.block.BlockPatternOr;
import minetweaker.api.block.IBlock;
import minetweaker.api.block.IBlockDefinition;
import minetweaker.api.block.IBlockPattern;
import minetweaker.api.data.IData;
import minetweaker.api.minecraft.MineTweakerMC;
/** /**
* *
* @author Stan * @author Stan
@@ -12,15 +12,14 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import net.minecraft.item.Item;
import net.minecraftforge.oredict.OreDictionary;
import minetweaker.IBracketHandler; import minetweaker.IBracketHandler;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.annotations.BracketHandler; import minetweaker.annotations.BracketHandler;
import minetweaker.api.item.IItemStack; import minetweaker.api.item.IItemStack;
import minetweaker.api.item.IngredientAny; import minetweaker.api.item.IngredientAny;
import net.minecraft.item.Item;
import net.minecraftforge.oredict.OreDictionary;
import stanhebben.zenscript.ZenTokener; import stanhebben.zenscript.ZenTokener;
import stanhebben.zenscript.compiler.IEnvironmentGlobal; import stanhebben.zenscript.compiler.IEnvironmentGlobal;
import stanhebben.zenscript.expression.ExpressionCallStatic; import stanhebben.zenscript.expression.ExpressionCallStatic;
@@ -4,16 +4,15 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import minetweaker.IBracketHandler; import minetweaker.IBracketHandler;
import minetweaker.annotations.BracketHandler; import minetweaker.annotations.BracketHandler;
import minetweaker.api.liquid.ILiquidStack; import minetweaker.api.liquid.ILiquidStack;
import minetweaker.mc1710.liquid.MCLiquidStack; import minetweaker.mc1710.liquid.MCLiquidStack;
import minetweaker.runtime.GlobalRegistry; import minetweaker.runtime.GlobalRegistry;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import stanhebben.zenscript.compiler.IEnvironmentGlobal; import stanhebben.zenscript.compiler.IEnvironmentGlobal;
import stanhebben.zenscript.expression.ExpressionCallStatic; import stanhebben.zenscript.expression.ExpressionCallStatic;
import stanhebben.zenscript.expression.ExpressionString; import stanhebben.zenscript.expression.ExpressionString;
@@ -5,11 +5,11 @@
package minetweaker.mc1710.chat; package minetweaker.mc1710.chat;
import minetweaker.api.chat.IChatMessage;
import net.minecraft.util.ChatComponentText; import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IChatComponent; import net.minecraft.util.IChatComponent;
import minetweaker.api.chat.IChatMessage;
/** /**
* *
* @author Stan * @author Stan
@@ -5,13 +5,12 @@
package minetweaker.mc1710.client; package minetweaker.mc1710.client;
import minetweaker.api.client.IClient;
import minetweaker.api.minecraft.MineTweakerMC;
import minetweaker.api.player.IPlayer;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.FMLClientHandler;
import minetweaker.api.client.IClient;
import minetweaker.api.minecraft.MineTweakerMC;
import minetweaker.api.player.IPlayer;
/** /**
* *
@@ -11,6 +11,19 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagByte;
import net.minecraft.nbt.NBTTagByteArray;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagDouble;
import net.minecraft.nbt.NBTTagFloat;
import net.minecraft.nbt.NBTTagInt;
import net.minecraft.nbt.NBTTagIntArray;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagLong;
import net.minecraft.nbt.NBTTagShort;
import net.minecraft.nbt.NBTTagString;
import minetweaker.api.data.DataByte; import minetweaker.api.data.DataByte;
import minetweaker.api.data.DataByteArray; import minetweaker.api.data.DataByteArray;
import minetweaker.api.data.DataDouble; import minetweaker.api.data.DataDouble;
@@ -26,19 +39,6 @@ import minetweaker.api.data.IData;
import minetweaker.api.data.IDataConverter; import minetweaker.api.data.IDataConverter;
import minetweaker.mc1710.util.MineTweakerHacks; import minetweaker.mc1710.util.MineTweakerHacks;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagByte;
import net.minecraft.nbt.NBTTagByteArray;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagDouble;
import net.minecraft.nbt.NBTTagFloat;
import net.minecraft.nbt.NBTTagInt;
import net.minecraft.nbt.NBTTagIntArray;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagLong;
import net.minecraft.nbt.NBTTagShort;
import net.minecraft.nbt.NBTTagString;
/** /**
* *
* @author Stan * @author Stan
@@ -7,12 +7,12 @@ package minetweaker.mc1710.data;
import java.util.Map; import java.util.Map;
import minetweaker.api.data.IData;
import minetweaker.api.data.IDataConverter;
import net.minecraft.nbt.NBTBase; import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import minetweaker.api.data.IData;
import minetweaker.api.data.IDataConverter;
/** /**
* *
* @author Stan * @author Stan
@@ -7,10 +7,10 @@ package minetweaker.mc1710.entity;
import java.util.*; import java.util.*;
import cpw.mods.fml.common.registry.EntityRegistry;
import minetweaker.api.entity.IEntityDefinition; import minetweaker.api.entity.IEntityDefinition;
import minetweaker.api.item.*; import minetweaker.api.item.*;
import stanhebben.zenscript.value.*; import stanhebben.zenscript.value.*;
import cpw.mods.fml.common.registry.EntityRegistry;
/** /**
* *
@@ -5,10 +5,10 @@
package minetweaker.mc1710.formatting; package minetweaker.mc1710.formatting;
import minetweaker.api.formatting.IFormattedText;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumChatFormatting;
import minetweaker.api.formatting.IFormattedText;
/** /**
* *
* @author Stan * @author Stan
@@ -7,10 +7,10 @@ package minetweaker.mc1710.formatting;
import java.util.Arrays; import java.util.Arrays;
import minetweaker.api.formatting.IFormattedText;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumChatFormatting;
import minetweaker.api.formatting.IFormattedText;
/** /**
* *
* @author Stan * @author Stan
@@ -5,11 +5,11 @@
package minetweaker.mc1710.formatting; package minetweaker.mc1710.formatting;
import net.minecraft.util.EnumChatFormatting;
import minetweaker.api.formatting.IFormattedText; import minetweaker.api.formatting.IFormattedText;
import minetweaker.api.formatting.IFormatter; import minetweaker.api.formatting.IFormatter;
import net.minecraft.util.EnumChatFormatting;
/** /**
* *
* @author Stan * @author Stan
@@ -10,15 +10,14 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import minetweaker.api.minecraft.MineTweakerMC;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import cpw.mods.fml.common.IFuelHandler; import cpw.mods.fml.common.IFuelHandler;
import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.GameRegistry;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import minetweaker.api.minecraft.MineTweakerMC;
public class FuelTweaker { public class FuelTweaker {
@@ -13,6 +13,10 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import cpw.mods.fml.common.registry.GameRegistry;
import minetweaker.IUndoableAction; import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient; import minetweaker.api.item.IIngredient;
@@ -22,11 +26,6 @@ import minetweaker.api.recipes.IFurnaceManager;
import minetweaker.api.recipes.IFurnaceRecipe; import minetweaker.api.recipes.IFurnaceRecipe;
import minetweaker.mc1710.item.MCItemStack; import minetweaker.mc1710.item.MCItemStack;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import cpw.mods.fml.common.registry.GameRegistry;
/** /**
* @author Stan * @author Stan
*/ */
@@ -113,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) + ");");
} }
} }
@@ -162,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)
+ ");");
} }
} }
@@ -204,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
@@ -10,6 +10,17 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.item.Item;
import net.minecraft.util.*;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import com.google.common.collect.*;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
import minetweaker.IUndoableAction; import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.api.block.IBlockDefinition; import minetweaker.api.block.IBlockDefinition;
@@ -26,18 +37,6 @@ import minetweaker.mc1710.liquid.MCLiquidDefinition;
import minetweaker.mc1710.util.MineTweakerHacks; import minetweaker.mc1710.util.MineTweakerHacks;
import minetweaker.mc1710.util.MineTweakerPlatformUtils; import minetweaker.mc1710.util.MineTweakerPlatformUtils;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.item.Item;
import net.minecraft.util.*;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import com.google.common.collect.*;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;
/** /**
* *
* @author Stan * @author Stan
@@ -183,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 {
@@ -209,6 +208,7 @@ public class MCGame implements IGame {
} else { } else {
added = false; added = false;
} }
MineTweakerAPI.info(key + "=" + text);
} }
@Override @Override
@@ -8,16 +8,16 @@ package minetweaker.mc1710.item;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemDefinition; import minetweaker.api.item.IItemDefinition;
import minetweaker.api.item.IItemStack; import minetweaker.api.item.IItemStack;
import minetweaker.api.minecraft.MineTweakerMC; import minetweaker.api.minecraft.MineTweakerMC;
import minetweaker.api.oredict.IOreDictEntry; import minetweaker.api.oredict.IOreDictEntry;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
/** /**
* *
* @author Stan * @author Stan
@@ -12,6 +12,15 @@ import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.relauncher.ReflectionHelper;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.api.block.IBlock; import minetweaker.api.block.IBlock;
import minetweaker.api.data.DataMap; import minetweaker.api.data.DataMap;
@@ -29,16 +38,6 @@ import minetweaker.mc1710.data.NBTConverter;
import minetweaker.mc1710.liquid.MCLiquidStack; import minetweaker.mc1710.liquid.MCLiquidStack;
import minetweaker.util.ArrayUtil; import minetweaker.util.ArrayUtil;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.oredict.OreDictionary;
import cpw.mods.fml.relauncher.ReflectionHelper;
/** /**
* *
* @author Stan * @author Stan
@@ -8,6 +8,10 @@ package minetweaker.mc1710.liquid;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import minetweaker.IUndoableAction; import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack; import minetweaker.api.item.IItemStack;
@@ -15,10 +19,6 @@ import minetweaker.api.liquid.ILiquidDefinition;
import minetweaker.api.liquid.ILiquidStack; import minetweaker.api.liquid.ILiquidStack;
import minetweaker.api.minecraft.MineTweakerMC; import minetweaker.api.minecraft.MineTweakerMC;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
/** /**
* *
* @author Stan * @author Stan
@@ -8,6 +8,9 @@ package minetweaker.mc1710.liquid;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
import minetweaker.api.data.IData; import minetweaker.api.data.IData;
import minetweaker.api.item.*; import minetweaker.api.item.*;
import minetweaker.api.liquid.ILiquidDefinition; import minetweaker.api.liquid.ILiquidDefinition;
@@ -15,9 +18,6 @@ import minetweaker.api.liquid.ILiquidStack;
import minetweaker.api.player.IPlayer; import minetweaker.api.player.IPlayer;
import minetweaker.mc1710.data.NBTConverter; import minetweaker.mc1710.data.NBTConverter;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
/** /**
* @author Stan * @author Stan
*/ */
@@ -3,11 +3,11 @@ package minetweaker.mc1710.mods;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
import minetweaker.api.mods.ILoadedMods; import minetweaker.api.mods.ILoadedMods;
import minetweaker.api.mods.IMod; import minetweaker.api.mods.IMod;
import stanhebben.zenscript.util.MappingIterator; import stanhebben.zenscript.util.MappingIterator;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.ModContainer;
/** /**
* *
@@ -5,8 +5,8 @@
package minetweaker.mc1710.mods; package minetweaker.mc1710.mods;
import minetweaker.api.mods.IMod;
import cpw.mods.fml.common.ModContainer; import cpw.mods.fml.common.ModContainer;
import minetweaker.api.mods.IMod;
/** /**
* *
@@ -10,10 +10,10 @@ import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection; import java.awt.datatransfer.StringSelection;
import minetweaker.mc1710.MineTweakerConfig;
import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import minetweaker.mc1710.MineTweakerConfig;
/** /**
* *
@@ -5,13 +5,13 @@
package minetweaker.mc1710.network; package minetweaker.mc1710.network;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI; import minetweaker.MineTweakerImplementationAPI;
import minetweaker.mc1710.MineTweakerConfig; import minetweaker.mc1710.MineTweakerConfig;
import minetweaker.runtime.providers.ScriptProviderMemory; import minetweaker.runtime.providers.ScriptProviderMemory;
import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
/** /**
* *
@@ -10,10 +10,10 @@ import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import minetweaker.mc1710.MineTweakerConfig;
import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
import cpw.mods.fml.common.network.simpleimpl.MessageContext; import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import minetweaker.mc1710.MineTweakerConfig;
/** /**
* *
@@ -10,12 +10,12 @@ import static minetweaker.api.minecraft.MineTweakerMC.getOreDict;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.minecraftforge.oredict.OreDictionary;
import minetweaker.api.minecraft.MineTweakerMC; import minetweaker.api.minecraft.MineTweakerMC;
import minetweaker.api.oredict.IOreDict; import minetweaker.api.oredict.IOreDict;
import minetweaker.api.oredict.IOreDictEntry; import minetweaker.api.oredict.IOreDictEntry;
import net.minecraftforge.oredict.OreDictionary;
/** /**
* *
* @author Stan * @author Stan
@@ -12,6 +12,9 @@ import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import minetweaker.IUndoableAction; import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.api.item.*; import minetweaker.api.item.*;
@@ -22,9 +25,6 @@ import minetweaker.api.player.IPlayer;
import minetweaker.mc1710.util.MineTweakerHacks; import minetweaker.mc1710.util.MineTweakerHacks;
import minetweaker.util.ArrayUtil; import minetweaker.util.ArrayUtil;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
/** /**
* @author Stan * @author Stan
*/ */
@@ -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
@@ -1,15 +1,15 @@
package minetweaker.mc1710.player; package minetweaker.mc1710.player;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IChatComponent;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.api.chat.IChatMessage; import minetweaker.api.chat.IChatMessage;
import minetweaker.api.data.IData; import minetweaker.api.data.IData;
import minetweaker.api.item.IItemStack; import minetweaker.api.item.IItemStack;
import minetweaker.api.player.IPlayer; import minetweaker.api.player.IPlayer;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IChatComponent;
/** /**
* @author Jared * @author Jared
*/ */
@@ -5,6 +5,11 @@
package minetweaker.mc1710.player; package minetweaker.mc1710.player;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IChatComponent;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.api.chat.IChatMessage; import minetweaker.api.chat.IChatMessage;
import minetweaker.api.data.IData; import minetweaker.api.data.IData;
@@ -17,11 +22,6 @@ import minetweaker.mc1710.data.NBTConverter;
import minetweaker.mc1710.network.MineTweakerCopyClipboardPacket; import minetweaker.mc1710.network.MineTweakerCopyClipboardPacket;
import minetweaker.mc1710.network.MineTweakerOpenBrowserPacket; import minetweaker.mc1710.network.MineTweakerOpenBrowserPacket;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IChatComponent;
/** /**
* *
* @author Stan * @author Stan
@@ -1,15 +1,15 @@
package minetweaker.mc1710.player; package minetweaker.mc1710.player;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IChatComponent;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.api.chat.IChatMessage; import minetweaker.api.chat.IChatMessage;
import minetweaker.api.data.IData; import minetweaker.api.data.IData;
import minetweaker.api.item.IItemStack; import minetweaker.api.item.IItemStack;
import minetweaker.api.player.IPlayer; import minetweaker.api.player.IPlayer;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IChatComponent;
/** /**
* *
* @author Jared * @author Jared
@@ -11,12 +11,6 @@ import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
import java.util.List; import java.util.List;
import minetweaker.api.item.IItemStack;
import minetweaker.api.player.IPlayer;
import minetweaker.api.recipes.ICraftingInventory;
import minetweaker.mc1710.player.MCPlayer;
import minetweaker.mc1710.util.MineTweakerHacks;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
@@ -25,6 +19,12 @@ import net.minecraft.inventory.Slot;
import net.minecraft.inventory.SlotCrafting; import net.minecraft.inventory.SlotCrafting;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import minetweaker.api.item.IItemStack;
import minetweaker.api.player.IPlayer;
import minetweaker.api.recipes.ICraftingInventory;
import minetweaker.mc1710.player.MCPlayer;
import minetweaker.mc1710.util.MineTweakerHacks;
/** /**
* *
* @author Stan * @author Stan
@@ -9,6 +9,19 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.RecursiveAction; import java.util.concurrent.RecursiveAction;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import org.apache.commons.lang3.tuple.Pair;
import minetweaker.IUndoableAction; import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI; import minetweaker.MineTweakerImplementationAPI;
@@ -27,20 +40,6 @@ import minetweaker.mc1710.item.MCItemStack;
import minetweaker.mc1710.util.MineTweakerHacks; import minetweaker.mc1710.util.MineTweakerHacks;
import minetweaker.mc1710.util.ThreadSafeBitSet; import minetweaker.mc1710.util.ThreadSafeBitSet;
import minetweaker.util.IEventHandler; import minetweaker.util.IEventHandler;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import org.apache.commons.lang3.tuple.Pair;
import stanhebben.zenscript.annotations.Optional; import stanhebben.zenscript.annotations.Optional;
/** /**
@@ -317,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
@@ -441,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
@@ -555,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
@@ -659,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)
+ " });");
} }
} }
@@ -720,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);
@@ -10,6 +10,13 @@ import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import minetweaker.api.item.IIngredient; import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack; import minetweaker.api.item.IItemStack;
import minetweaker.api.minecraft.MineTweakerMC; import minetweaker.api.minecraft.MineTweakerMC;
@@ -18,13 +25,6 @@ import minetweaker.api.recipes.ShapedRecipe;
import minetweaker.api.recipes.ShapelessRecipe; import minetweaker.api.recipes.ShapelessRecipe;
import minetweaker.api.recipes.UnknownRecipe; import minetweaker.api.recipes.UnknownRecipe;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
/** /**
* *
* @author Stan * @author Stan
@@ -7,13 +7,13 @@ package minetweaker.mc1710.recipes;
import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
import minetweaker.api.recipes.ShapedRecipe;
import net.minecraft.inventory.InventoryCrafting; import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.IRecipe;
import net.minecraft.world.World; import net.minecraft.world.World;
import minetweaker.api.recipes.ShapedRecipe;
/** /**
* TODO: NEI integration for this kind of recipes. * TODO: NEI integration for this kind of recipes.
* *
@@ -7,14 +7,14 @@ package minetweaker.mc1710.recipes;
import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
import minetweaker.api.item.IItemStack;
import minetweaker.api.recipes.ShapedRecipe;
import net.minecraft.inventory.InventoryCrafting; import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.ShapedRecipes; import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.world.World; import net.minecraft.world.World;
import minetweaker.api.item.IItemStack;
import minetweaker.api.recipes.ShapedRecipe;
/** /**
* *
* @author Stan * @author Stan
@@ -7,13 +7,13 @@ package minetweaker.mc1710.recipes;
import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
import minetweaker.api.recipes.ShapedRecipe;
import net.minecraft.inventory.InventoryCrafting; import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapedOreRecipe;
import minetweaker.api.recipes.ShapedRecipe;
/** /**
* *
* @author Stan * @author Stan
@@ -7,13 +7,13 @@ package minetweaker.mc1710.recipes;
import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
import minetweaker.api.recipes.ShapelessRecipe;
import net.minecraft.inventory.InventoryCrafting; import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.IRecipe;
import net.minecraft.world.World; import net.minecraft.world.World;
import minetweaker.api.recipes.ShapelessRecipe;
/** /**
* *
* @author Stan * @author Stan
@@ -9,13 +9,13 @@ import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
import java.util.Arrays; import java.util.Arrays;
import minetweaker.api.recipes.ShapelessRecipe;
import net.minecraft.inventory.InventoryCrafting; import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.ShapelessRecipes; import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraft.world.World; import net.minecraft.world.World;
import minetweaker.api.recipes.ShapelessRecipe;
/** /**
* *
* @author Stan * @author Stan
@@ -7,13 +7,13 @@ package minetweaker.mc1710.recipes;
import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
import minetweaker.api.recipes.ShapelessRecipe;
import net.minecraft.inventory.InventoryCrafting; import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.oredict.ShapelessOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe;
import minetweaker.api.recipes.ShapelessRecipe;
/** /**
* *
* @author Stan * @author Stan
@@ -8,6 +8,16 @@ package minetweaker.mc1710.server;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import net.minecraft.command.CommandHandler;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.server.CommandBlockLogic;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.rcon.RConConsoleSource;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.dedicated.DedicatedServer;
import net.minecraft.server.management.UserListOps;
import minetweaker.IUndoableAction; import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.api.minecraft.MineTweakerMC; import minetweaker.api.minecraft.MineTweakerMC;
@@ -19,16 +29,6 @@ import minetweaker.api.server.ICommandValidator;
import minetweaker.mc1710.player.CommandBlockPlayer; import minetweaker.mc1710.player.CommandBlockPlayer;
import minetweaker.mc1710.player.RconPlayer; import minetweaker.mc1710.player.RconPlayer;
import net.minecraft.command.CommandHandler;
import net.minecraft.command.ICommand;
import net.minecraft.command.ICommandSender;
import net.minecraft.command.server.CommandBlockLogic;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.rcon.RConConsoleSource;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.dedicated.DedicatedServer;
import net.minecraft.server.management.UserListOps;
/** /**
* @author Stan * @author Stan
*/ */
@@ -14,15 +14,15 @@ import java.net.URI;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import net.minecraft.server.dedicated.DedicatedServer;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IChatComponent;
import minetweaker.api.chat.IChatMessage; import minetweaker.api.chat.IChatMessage;
import minetweaker.api.data.IData; import minetweaker.api.data.IData;
import minetweaker.api.item.IItemStack; import minetweaker.api.item.IItemStack;
import minetweaker.api.player.IPlayer; import minetweaker.api.player.IPlayer;
import net.minecraft.server.dedicated.DedicatedServer;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IChatComponent;
/** /**
* *
* @author Stan * @author Stan
@@ -15,10 +15,6 @@ import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.WeightedItemStack;
import minetweaker.api.minecraft.MineTweakerMC;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
@@ -37,7 +33,11 @@ import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapedOreRecipe;
import com.google.common.collect.BiMap; import com.google.common.collect.BiMap;
import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.EntityRegistry;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.WeightedItemStack;
import minetweaker.api.minecraft.MineTweakerMC;
/** /**
* Common class for all runtime hacks (stuff requiring reflection). It is not unexpected to have it break with new * Common class for all runtime hacks (stuff requiring reflection). It is not unexpected to have it break with new
@@ -10,6 +10,9 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraftforge.common.ChestGenHooks;
import minetweaker.IUndoableAction; import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient; import minetweaker.api.item.IIngredient;
@@ -19,9 +22,6 @@ import minetweaker.api.vanilla.ILootRegistry;
import minetweaker.api.vanilla.LootEntry; import minetweaker.api.vanilla.LootEntry;
import minetweaker.mc1710.util.MineTweakerHacks; import minetweaker.mc1710.util.MineTweakerHacks;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraftforge.common.ChestGenHooks;
/** /**
* *
* @author Stan * @author Stan
@@ -8,6 +8,9 @@ package minetweaker.mc1710.vanilla;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.util.WeightedRandom;
import minetweaker.IUndoableAction; import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient; import minetweaker.api.item.IIngredient;
@@ -17,9 +20,6 @@ import minetweaker.api.minecraft.MineTweakerMC;
import minetweaker.api.vanilla.ISeedRegistry; import minetweaker.api.vanilla.ISeedRegistry;
import minetweaker.mc1710.util.MineTweakerHacks; import minetweaker.mc1710.util.MineTweakerHacks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.WeightedRandom;
/** /**
* *
* @author Stan * @author Stan
@@ -5,10 +5,10 @@
package minetweaker.mc1710.world; package minetweaker.mc1710.world;
import minetweaker.api.world.IBiome;
import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenBase;
import minetweaker.api.world.IBiome;
/** /**
* *
* @author Stan * @author Stan
@@ -5,12 +5,12 @@
package minetweaker.mc1710.world; package minetweaker.mc1710.world;
import net.minecraft.world.World;
import minetweaker.api.block.IBlock; import minetweaker.api.block.IBlock;
import minetweaker.api.minecraft.MineTweakerMC; import minetweaker.api.minecraft.MineTweakerMC;
import minetweaker.api.world.IDimension; import minetweaker.api.world.IDimension;
import net.minecraft.world.World;
/** /**
* *
* @author Stan * @author Stan
@@ -4,15 +4,15 @@ import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack;
import java.util.List; import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import ic2.api.item.IC2Items;
import minetweaker.IBracketHandler; import minetweaker.IBracketHandler;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.annotations.BracketHandler; import minetweaker.annotations.BracketHandler;
import minetweaker.annotations.ModOnly; import minetweaker.annotations.ModOnly;
import minetweaker.api.item.IItemStack; import minetweaker.api.item.IItemStack;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import stanhebben.zenscript.ZenTokener; import stanhebben.zenscript.ZenTokener;
import stanhebben.zenscript.compiler.IEnvironmentGlobal; import stanhebben.zenscript.compiler.IEnvironmentGlobal;
import stanhebben.zenscript.expression.ExpressionCallStatic; import stanhebben.zenscript.expression.ExpressionCallStatic;
@@ -24,7 +24,6 @@ import stanhebben.zenscript.symbols.IZenSymbol;
import stanhebben.zenscript.type.ZenType; import stanhebben.zenscript.type.ZenType;
import stanhebben.zenscript.type.natives.IJavaMethod; import stanhebben.zenscript.type.natives.IJavaMethod;
import stanhebben.zenscript.util.ZenPosition; import stanhebben.zenscript.util.ZenPosition;
import ic2.api.item.IC2Items;
/** /**
* Makes a ic2-item specific item syntax available in the form &lt;item-ic2:name[:meta]&gt;. * Makes a ic2-item specific item syntax available in the form &lt;item-ic2:name[:meta]&gt;.
@@ -2,17 +2,16 @@ package minetweaker.mods.ic2;
import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import ic2.api.tile.ExplosionWhitelist;
import minetweaker.IUndoableAction; import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.annotations.ModOnly; import minetweaker.annotations.ModOnly;
import minetweaker.api.item.IItemStack; import minetweaker.api.item.IItemStack;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenMethod;
import ic2.api.tile.ExplosionWhitelist;
/** /**
* Manages the explosion whitelist in IC2. Blocks on this whitelist will not resist an explosion but won't be destroyed. * Manages the explosion whitelist in IC2. Blocks on this whitelist will not resist an explosion but won't be destroyed.
@@ -11,12 +11,11 @@ import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import ic2.api.recipe.IRecipeInput; import ic2.api.recipe.IRecipeInput;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
/** /**
* Wrapper class for ITweakerItemStackPatterns to IC2 recipe inputs. * Wrapper class for ITweakerItemStackPatterns to IC2 recipe inputs.
@@ -2,14 +2,13 @@ package minetweaker.mods.ic2;
import java.util.Arrays; import java.util.Arrays;
import minetweaker.MineTweakerAPI;
import minetweaker.OneWayAction;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import ic2.api.recipe.IMachineRecipeManager; import ic2.api.recipe.IMachineRecipeManager;
import ic2.api.recipe.IMachineRecipeManagerExt; import ic2.api.recipe.IMachineRecipeManagerExt;
import minetweaker.MineTweakerAPI;
import minetweaker.OneWayAction;
/** /**
* *
@@ -1,10 +1,10 @@
package minetweaker.mods.ic2.crops; package minetweaker.mods.ic2.crops;
import ic2.api.crops.CropCard;
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;
import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenMethod;
import ic2.api.crops.CropCard;
/** /**
* Read-only data accessor for crops * Read-only data accessor for crops
@@ -4,19 +4,18 @@ import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import net.minecraftforge.common.BiomeDictionary;
import ic2.api.crops.CropCard;
import ic2.api.crops.Crops;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.OneWayAction; import minetweaker.OneWayAction;
import minetweaker.annotations.ModOnly; 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 net.minecraftforge.common.BiomeDictionary;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenGetter; import stanhebben.zenscript.annotations.ZenGetter;
import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenMethod;
import ic2.api.crops.CropCard;
import ic2.api.crops.Crops;
@ZenClass("mods.ic2.CropsConfig") @ZenClass("mods.ic2.CropsConfig")
@ModOnly("IC2") @ModOnly("IC2")
@@ -1,21 +1,20 @@
package minetweaker.mods.ic2.crops; package minetweaker.mods.ic2.crops;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import minetweaker.api.minecraft.MineTweakerMC;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenGetter;
import stanhebben.zenscript.annotations.ZenMethod;
import stanhebben.zenscript.annotations.ZenSetter;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; 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.api.item.IItemStack;
import minetweaker.api.minecraft.MineTweakerMC;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenGetter;
import stanhebben.zenscript.annotations.ZenMethod;
import stanhebben.zenscript.annotations.ZenSetter;
/** /**
* A synthetic crop, created in ZS * A synthetic crop, created in ZS
@@ -3,18 +3,17 @@ package minetweaker.mods.ic2.expand;
import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack; import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack;
import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
import minetweaker.annotations.ModOnly;
import minetweaker.api.item.IItemStack;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import ic2.api.item.ElectricItem;
import ic2.api.item.IElectricItem;
import minetweaker.annotations.ModOnly;
import minetweaker.api.item.IItemStack;
import stanhebben.zenscript.annotations.Optional; import stanhebben.zenscript.annotations.Optional;
import stanhebben.zenscript.annotations.ZenExpansion; import stanhebben.zenscript.annotations.ZenExpansion;
import stanhebben.zenscript.annotations.ZenGetter; import stanhebben.zenscript.annotations.ZenGetter;
import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenMethod;
import ic2.api.item.ElectricItem;
import ic2.api.item.IElectricItem;
/** /**
* *
@@ -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 ic2.api.recipe.RecipeOutput;
import ic2.api.recipe.Recipes;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.annotations.ModOnly; import minetweaker.annotations.ModOnly;
import minetweaker.api.item.IIngredient; import minetweaker.api.item.IIngredient;
@@ -18,8 +20,6 @@ import minetweaker.mods.ic2.MachineAddRecipeAction;
import stanhebben.zenscript.annotations.NotNull; import stanhebben.zenscript.annotations.NotNull;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenMethod;
import ic2.api.recipe.RecipeOutput;
import ic2.api.recipe.Recipes;
/** /**
* Provides access to the IC2 Blast Furnace recipes. * Provides access to the IC2 Blast Furnace recipes.
@@ -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 ic2.api.recipe.RecipeOutput;
import ic2.api.recipe.Recipes;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.annotations.ModOnly; import minetweaker.annotations.ModOnly;
import minetweaker.api.item.IIngredient; import minetweaker.api.item.IIngredient;
@@ -18,8 +20,6 @@ import minetweaker.mods.ic2.MachineAddRecipeAction;
import stanhebben.zenscript.annotations.NotNull; import stanhebben.zenscript.annotations.NotNull;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenMethod;
import ic2.api.recipe.RecipeOutput;
import ic2.api.recipe.Recipes;
/** /**
* Provides access to the IC2 Block Cutter recipes. * Provides access to the IC2 Block Cutter recipes.
@@ -7,6 +7,10 @@ package minetweaker.mods.ic2.machines;
import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
import net.minecraftforge.fluids.FluidStack;
import ic2.api.recipe.RecipeInputFluidContainer;
import ic2.api.recipe.Recipes;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.OneWayAction; import minetweaker.OneWayAction;
import minetweaker.annotations.ModOnly; import minetweaker.annotations.ModOnly;
@@ -14,13 +18,8 @@ import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack; import minetweaker.api.item.IItemStack;
import minetweaker.api.liquid.ILiquidStack; import minetweaker.api.liquid.ILiquidStack;
import minetweaker.mods.ic2.IC2RecipeInput; import minetweaker.mods.ic2.IC2RecipeInput;
import net.minecraftforge.fluids.FluidStack;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenMethod;
import ic2.api.recipe.RecipeInputFluidContainer;
import ic2.api.recipe.Recipes;
/** /**
* *
@@ -4,6 +4,10 @@ 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.Recipes;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.annotations.ModOnly; import minetweaker.annotations.ModOnly;
import minetweaker.api.item.IIngredient; import minetweaker.api.item.IIngredient;
@@ -13,12 +17,10 @@ import minetweaker.mods.ic2.MachineAddRecipeAction;
import stanhebben.zenscript.annotations.NotNull; import stanhebben.zenscript.annotations.NotNull;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenMethod;
import ic2.api.recipe.RecipeOutput;
import ic2.api.recipe.Recipes;
/** /**
* 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,10 @@ 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.Recipes;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.annotations.ModOnly; import minetweaker.annotations.ModOnly;
import minetweaker.api.item.IIngredient; import minetweaker.api.item.IIngredient;
@@ -18,12 +22,10 @@ import minetweaker.mods.ic2.MachineAddRecipeAction;
import stanhebben.zenscript.annotations.NotNull; import stanhebben.zenscript.annotations.NotNull;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenMethod;
import ic2.api.recipe.RecipeOutput;
import ic2.api.recipe.Recipes;
/** /**
* 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
*/ */
@@ -5,16 +5,15 @@
package minetweaker.mods.ic2.machines; package minetweaker.mods.ic2.machines;
import net.minecraftforge.fluids.FluidRegistry;
import ic2.api.recipe.Recipes;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.OneWayAction; import minetweaker.OneWayAction;
import minetweaker.annotations.ModOnly; import minetweaker.annotations.ModOnly;
import minetweaker.api.liquid.ILiquidStack; import minetweaker.api.liquid.ILiquidStack;
import net.minecraftforge.fluids.FluidRegistry;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenMethod;
import ic2.api.recipe.Recipes;
/** /**
* Add a fluid to the fluid heat generator * Add a fluid to the fluid heat generator
@@ -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 ic2.api.recipe.RecipeOutput;
import ic2.api.recipe.Recipes;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.annotations.ModOnly; import minetweaker.annotations.ModOnly;
import minetweaker.api.item.IIngredient; import minetweaker.api.item.IIngredient;
@@ -13,8 +15,6 @@ import minetweaker.mods.ic2.MachineAddRecipeAction;
import stanhebben.zenscript.annotations.NotNull; import stanhebben.zenscript.annotations.NotNull;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenMethod;
import ic2.api.recipe.RecipeOutput;
import ic2.api.recipe.Recipes;
/** /**
* Provides access to the IC2 macerator recipes. Recipes can be added but not removed, due to IC2 API restrictions. * Provides access to the IC2 macerator recipes. Recipes can be added but not removed, due to IC2 API restrictions.
@@ -5,18 +5,17 @@
package minetweaker.mods.ic2.machines; package minetweaker.mods.ic2.machines;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import ic2.api.recipe.Recipes;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.annotations.ModOnly; import minetweaker.annotations.ModOnly;
import minetweaker.api.item.IIngredient; import minetweaker.api.item.IIngredient;
import minetweaker.mods.ic2.IC2RecipeInput; import minetweaker.mods.ic2.IC2RecipeInput;
import minetweaker.mods.ic2.MachineAddRecipeAction; import minetweaker.mods.ic2.MachineAddRecipeAction;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenMethod;
import ic2.api.recipe.Recipes;
/** /**
* *
@@ -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 ic2.api.recipe.RecipeOutput;
import ic2.api.recipe.Recipes;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.annotations.ModOnly; import minetweaker.annotations.ModOnly;
import minetweaker.api.item.IIngredient; import minetweaker.api.item.IIngredient;
@@ -17,8 +19,6 @@ import minetweaker.mods.ic2.IC2RecipeInput;
import minetweaker.mods.ic2.MachineAddRecipeAction; import minetweaker.mods.ic2.MachineAddRecipeAction;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenMethod;
import ic2.api.recipe.RecipeOutput;
import ic2.api.recipe.Recipes;
/** /**
* *
@@ -4,19 +4,18 @@ import static minetweaker.api.minecraft.MineTweakerMC.getIItemStacks;
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.nbt.NBTTagCompound;
import ic2.api.recipe.RecipeOutput;
import ic2.api.recipe.Recipes;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.annotations.ModOnly; import minetweaker.annotations.ModOnly;
import minetweaker.api.item.IIngredient; import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack; import minetweaker.api.item.IItemStack;
import minetweaker.mods.ic2.IC2RecipeInput; import minetweaker.mods.ic2.IC2RecipeInput;
import minetweaker.mods.ic2.MachineAddRecipeAction; import minetweaker.mods.ic2.MachineAddRecipeAction;
import net.minecraft.nbt.NBTTagCompound;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenMethod;
import ic2.api.recipe.RecipeOutput;
import ic2.api.recipe.Recipes;
/** /**
* *
@@ -7,6 +7,7 @@ package minetweaker.mods.ic2.machines;
import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
import ic2.api.recipe.Recipes;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.OneWayAction; import minetweaker.OneWayAction;
import minetweaker.annotations.ModOnly; import minetweaker.annotations.ModOnly;
@@ -15,7 +16,6 @@ import minetweaker.api.item.IItemStack;
import minetweaker.mods.ic2.IC2RecipeInput; import minetweaker.mods.ic2.IC2RecipeInput;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenMethod;
import ic2.api.recipe.Recipes;
/** /**
* *
@@ -7,13 +7,13 @@ package minetweaker.mods.ic2.machines;
import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
import ic2.api.recipe.Recipes;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.OneWayAction; import minetweaker.OneWayAction;
import minetweaker.annotations.ModOnly; import minetweaker.annotations.ModOnly;
import minetweaker.api.item.WeightedItemStack; import minetweaker.api.item.WeightedItemStack;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenMethod;
import ic2.api.recipe.Recipes;
/** /**
* *
@@ -5,16 +5,15 @@
package minetweaker.mods.ic2.machines; package minetweaker.mods.ic2.machines;
import net.minecraftforge.fluids.FluidRegistry;
import ic2.api.recipe.Recipes;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.OneWayAction; import minetweaker.OneWayAction;
import minetweaker.annotations.ModOnly; import minetweaker.annotations.ModOnly;
import minetweaker.api.liquid.ILiquidStack; import minetweaker.api.liquid.ILiquidStack;
import net.minecraftforge.fluids.FluidRegistry;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenMethod;
import ic2.api.recipe.Recipes;
/** /**
* Add a fluid to the semi-fluid generator * Add a fluid to the semi-fluid generator
@@ -4,19 +4,18 @@ import static minetweaker.api.minecraft.MineTweakerMC.getIItemStacks;
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.nbt.NBTTagCompound;
import ic2.api.recipe.RecipeOutput;
import ic2.api.recipe.Recipes;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.annotations.ModOnly; import minetweaker.annotations.ModOnly;
import minetweaker.api.item.IIngredient; import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack; import minetweaker.api.item.IItemStack;
import minetweaker.mods.ic2.IC2RecipeInput; import minetweaker.mods.ic2.IC2RecipeInput;
import minetweaker.mods.ic2.MachineAddRecipeAction; import minetweaker.mods.ic2.MachineAddRecipeAction;
import net.minecraft.nbt.NBTTagCompound;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenMethod;
import ic2.api.recipe.RecipeOutput;
import ic2.api.recipe.Recipes;
/** /**
* 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.
+11 -9
View File
@@ -2,26 +2,25 @@ package minetweaker.mods.nei;
import static minetweaker.api.minecraft.MineTweakerMC.getItemStack; import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
import net.minecraft.item.ItemStack;
import codechicken.nei.api.API;
import minetweaker.IUndoableAction; import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI; import minetweaker.MineTweakerAPI;
import minetweaker.OneWayAction; import minetweaker.OneWayAction;
import minetweaker.annotations.ModOnly; import minetweaker.annotations.ModOnly;
import minetweaker.api.item.IItemStack; import minetweaker.api.item.IItemStack;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.NotNull; import stanhebben.zenscript.annotations.NotNull;
import stanhebben.zenscript.annotations.ZenClass; import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod; import stanhebben.zenscript.annotations.ZenMethod;
import codechicken.nei.api.API;
/** /**
* 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")
@@ -30,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
@@ -40,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
@@ -51,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
*/ */
@@ -75,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
@@ -114,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
@@ -155,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