Compare commits

..
11 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
Raven Szewczyk ea3b258225 Don't minimize/relocate zenscript 2023-01-30 13:41:47 +00:00
85 changed files with 1052 additions and 504 deletions

No files matched your search

+403 -138
View File
@@ -1,4 +1,4 @@
//version: 1674988119
//version: 1682280358
/*
DO NOT CHANGE THIS FILE!
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.gtnewhorizons.retrofuturagradle.ObfuscationAttribute
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.CurseRelation
import com.modrinth.minotaur.dependencies.ModDependency
import com.modrinth.minotaur.dependencies.VersionDependency
import org.gradle.internal.logging.text.StyledTextOutput.Style
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.Paths
import java.util.concurrent.TimeUnit
import java.util.zip.ZipEntry
import java.util.zip.ZipOutputStream
buildscript {
repositories {
mavenLocal()
mavenCentral()
maven {
@@ -47,6 +48,8 @@ buildscript {
name 'Scala CI dependencies'
url 'https://repo1.maven.org/maven2/'
}
mavenLocal()
}
}
plugins {
@@ -55,25 +58,26 @@ plugins {
id 'eclipse'
id 'scala'
id 'maven-publish'
id 'org.jetbrains.kotlin.jvm' version '1.5.30' apply false
id 'org.jetbrains.kotlin.kapt' version '1.5.30' apply false
id 'com.google.devtools.ksp' version '1.5.30-1.0.0' 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 'com.github.johnrengelman.shadow' version '7.1.2' apply false
id 'com.palantir.git-version' version '0.13.0' apply false // 0.13.0 is the last jvm8 supporting version
id 'de.undercouch.download' version '5.3.0'
id 'org.jetbrains.kotlin.jvm' 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 'org.ajoberstar.grgit' version '4.1.1' // 4.1.1 is the last jvm8 supporting version, unused, available for addon.gradle
id 'com.github.johnrengelman.shadow' version '8.1.1' apply false
id 'com.palantir.git-version' version '3.0.0' apply false
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.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.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()
settingsupdated = verifyGitAttributes() || settingsupdated
if (settingsupdated)
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'
}
@@ -113,6 +117,7 @@ propertyDefaultIfUnset("modrinthRelations", "")
propertyDefaultIfUnset("curseForgeProjectId", "")
propertyDefaultIfUnset("curseForgeRelations", "")
propertyDefaultIfUnset("minimizeShadowedDependencies", true)
propertyDefaultIfUnset("relocateShadowedDependencies", true)
// Deprecated properties (kept for backwards compat)
propertyDefaultIfUnset("gradleTokenModId", "")
propertyDefaultIfUnset("gradleTokenModName", "")
@@ -121,7 +126,10 @@ propertyDefaultIfUnset("gradleTokenGroupName", "")
propertyDefaultIfUnset("enableModernJavaSyntax", 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) {
apply plugin: 'com.diffplug.spotless'
apply from: Blowdryer.file('spotless.gradle')
@@ -142,27 +150,80 @@ java {
} else {
languageVersion.set(projectJavaVersion)
}
vendor.set(JvmVendorSpec.ADOPTIUM)
vendor.set(JvmVendorSpec.AZUL)
}
if (!noPublishedSources) {
withSourcesJar()
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = "UTF-8"
}
tasks.withType(ScalaCompile).configureEach {
options.encoding = "UTF-8"
}
pluginManager.withPlugin('org.jetbrains.kotlin.jvm') {
// If Kotlin is enabled in the project
kotlin {
jvmToolchain(8)
}
// Kotlin hacks our source sets, so we hack Kotlin's tasks
def disabledKotlinTaskList = [
"kaptGenerateStubsMcLauncherKotlin",
"kaptGenerateStubsPatchedMcKotlin",
"kaptGenerateStubsInjectedTagsKotlin",
"compileMcLauncherKotlin",
"compilePatchedMcKotlin",
"compileInjectedTagsKotlin",
"kaptMcLauncherKotlin",
"kaptPatchedMcKotlin",
"kaptInjectedTagsKotlin",
"kspMcLauncherKotlin",
"kspPatchedMcKotlin",
"kspInjectedTagsKotlin",
]
tasks.configureEach { task ->
if (task.name in disabledKotlinTaskList) {
task.enabled = false
}
}
}
configurations {
create("runtimeOnlyNonPublishable") {
description = "Runtime only dependencies that are not published alongside the jar"
canBeConsumed = 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()) {
repositories {
mavenCentral {
mavenContent {
includeGroup("me.eigenraven.java8unsupported")
}
}
}
dependencies {
annotationProcessor '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
}
// 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 {
@@ -174,7 +235,7 @@ if (enableModernJavaSyntax.toBoolean()) {
javaCompiler.set(javaToolchains.compilerFor {
languageVersion.set(JavaLanguageVersion.of(17))
vendor.set(JvmVendorSpec.ADOPTIUM)
vendor.set(JvmVendorSpec.AZUL)
})
}
}
@@ -206,12 +267,14 @@ if (apiPackage) {
}
if (accessTransformersFile) {
String targetFile = "src/main/resources/META-INF/" + accessTransformersFile
if (!getFile(targetFile).exists()) {
throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile)
for (atFile in accessTransformersFile.split(",")) {
String targetFile = "src/main/resources/META-INF/" + atFile.trim()
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 {
boolean atsFound = false
for (File at : sourceSets.getByName("main").resources.files) {
@@ -309,7 +372,7 @@ if (identifiedVersion == versionOverride) {
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) {
archivesBaseName = customArchiveBaseName
} else {
@@ -339,12 +402,14 @@ minecraft {
injectMissingGenerics.set(true)
}
username = developmentEnvironmentUserName.toString()
lwjgl3Version = "3.3.2"
// Enable assertions in the current mod
extraRunJvmArguments.add("-ea:${modGroup}")
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
extraTweakClasses.add("org.spongepowered.asm.launch.MixinTweaker")
if (usesMixinDebug.toBoolean()) {
extraRunJvmArguments.addAll([
"-Dmixin.debug.countInjections=true",
@@ -373,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
@@ -392,7 +467,7 @@ if (file('addon.gradle').exists()) {
// Allow unsafe repos but warn
repositories.configureEach { repo ->
if (repo instanceof org.gradle.api.artifacts.repositories.UrlArtifactRepository) {
if (repo.getUrl().getScheme() == "http" && !repo.allowInsecureProtocol) {
if (repo.getUrl() != null && repo.getUrl().getScheme() == "http" && !repo.allowInsecureProtocol) {
logger.warn("Deprecated: Allowing insecure connections for repo '${repo.name}' - add 'allowInsecureProtocol = true'")
repo.allowInsecureProtocol = true
}
@@ -402,8 +477,9 @@ repositories.configureEach { repo ->
apply from: 'repositories.gradle'
configurations {
runtimeClasspath.extendsFrom(runtimeOnlyNonPublishable)
testRuntimeClasspath.extendsFrom(runtimeOnlyNonPublishable)
for (config in [compileClasspath, runtimeClasspath, testCompileClasspath, testRuntimeClasspath]) {
config.extendsFrom(runtimeOnlyNonPublishable)
if (usesShadowedDependencies.toBoolean()) {
config.extendsFrom(shadowImplementation)
// TODO: remove Compile after all uses are refactored to Implementation
@@ -448,12 +524,11 @@ repositories {
url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/"
allowInsecureProtocol = true
}
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
if (usesMixinDebug.toBoolean()) {
maven {
name = "Fabric Maven"
url = "https://maven.fabricmc.net/"
}
maven {
name 'sonatype'
url 'https://oss.sonatype.org/content/repositories/snapshots/'
content {
includeGroup "org.lwjgl"
}
}
if (includeWellKnownRepositories.toBoolean()) {
@@ -487,18 +562,46 @@ repositories {
}
}
def mixinProviderGroup = "io.github.legacymoddingmc"
def mixinProviderModule = "unimixins"
def mixinProviderVersion = "0.1.6"
def mixinProviderSpecNoClassifer = "${mixinProviderGroup}:${mixinProviderModule}:${mixinProviderVersion}"
def mixinProviderSpec = "${mixinProviderSpecNoClassifer}:dev"
dependencies {
if (usesMixins.toBoolean()) {
annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3')
annotationProcessor('com.google.guava:guava:24.1.1-jre')
annotationProcessor('com.google.code.gson:gson:2.8.6')
annotationProcessor('com.gtnewhorizon:gtnhmixins:2.1.10:processor')
annotationProcessor(mixinProviderSpec)
if (usesMixinDebug.toBoolean()) {
runtimeOnlyNonPublishable('org.jetbrains:intellij-fernflower:1.2.1.16')
}
}
if (usesMixins.toBoolean() || forceEnableMixins.toBoolean()) {
implementation('com.gtnewhorizon:gtnhmixins:2.1.10')
if (usesMixins.toBoolean()) {
implementation(mixinProviderSpec)
} else if (forceEnableMixins.toBoolean()) {
runtimeOnlyNonPublishable(mixinProviderSpec)
}
}
pluginManager.withPlugin('org.jetbrains.kotlin.kapt') {
if (usesMixins.toBoolean()) {
dependencies {
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")
}
}
@@ -542,9 +645,11 @@ if (usesMixins.toBoolean()) {
tasks.named("reobfJar", ReobfuscatedJar).configure {
extraSrgFiles.from(mixinSrg)
}
}
if (usesMixins.toBoolean()) {
tasks.named("processResources").configure {
dependsOn("generateAssets")
}
tasks.named("compileJava", JavaCompile).configure {
doFirst {
new File(mixinTmpDir).mkdirs()
@@ -558,6 +663,25 @@ if (usesMixins.toBoolean()) {
"-XDignore.symbol.file"
]
}
pluginManager.withPlugin('org.jetbrains.kotlin.kapt') {
kapt {
correctErrorTypes = true
javacOptions {
option("-AreobfSrgFile=${tasks.reobfJar.srg.get().asFile}")
option("-AoutSrgFile=$mixinSrg")
option("-AoutRefMapFile=$refMap")
}
}
tasks.configureEach { task ->
if (task.name == "kaptKotlin") {
task.doFirst {
new File(mixinTmpDir).mkdirs()
}
}
}
}
}
tasks.named("processResources", ProcessResources).configure {
@@ -576,9 +700,146 @@ tasks.named("processResources", ProcessResources).configure {
if (usesMixins.toBoolean()) {
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 manifestAttributes = [:]
if (!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) {
@@ -610,10 +871,6 @@ tasks.named("jar", Jar).configure {
}
if (usesShadowedDependencies.toBoolean()) {
tasks.register('relocateShadowJar', ConfigureShadowRelocation) {
target = tasks.shadowJar
prefix = modGroup + ".shadow"
}
tasks.named("shadowJar", ShadowJar).configure {
manifest {
attributes(getManifestAttributes())
@@ -628,7 +885,10 @@ if (usesShadowedDependencies.toBoolean()) {
project.configurations.shadeCompile
]
archiveClassifier.set('dev')
dependsOn(relocateShadowJar)
if (relocateShadowedDependencies.toBoolean()) {
relocationPrefix = modGroup + ".shadow"
enableRelocation = true
}
}
configurations.runtimeElements.outgoing.artifacts.clear()
configurations.apiElements.outgoing.artifacts.clear()
@@ -645,7 +905,7 @@ if (usesShadowedDependencies.toBoolean()) {
javaComponent.withVariantsFromConfiguration(configurations.shadowRuntimeElements) {
skip()
}
for (runTask in ["runClient", "runServer"]) {
for (runTask in ["runClient", "runServer", "runClient17", "runServer17"]) {
tasks.named(runTask).configure {
dependsOn("shadowJar")
}
@@ -654,16 +914,6 @@ if (usesShadowedDependencies.toBoolean()) {
ext.publishableDevJar = usesShadowedDependencies.toBoolean() ? tasks.shadowJar : tasks.jar
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) {
from(sourceSets.main.allSource) {
include modGroupPath + "/" + apiPackagePath + '/**'
@@ -693,9 +943,23 @@ idea {
module {
downloadJavadoc = true
downloadSources = true
inheritOutputDirs = true
}
project {
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 {
"1. Run Client"(Gradle) {
taskNames = ["runClient"]
@@ -703,6 +967,20 @@ idea {
"2. Run Server"(Gradle) {
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) {
taskNames = ["runObfClient"]
}
@@ -720,7 +998,7 @@ idea {
}
"Run Client (IJ Native)"(Application) {
mainClass = "GradleStart"
moduleName = project.name + ".main"
moduleName = project.name + ".ideVirtualMain"
afterEvaluate {
workingDirectory = tasks.runClient.workingDir.absolutePath
programParameters = tasks.runClient.calculateArgs(project).collect { '"' + it + '"' }.join(' ')
@@ -731,7 +1009,7 @@ idea {
}
"Run Server (IJ Native)"(Application) {
mainClass = "GradleStartServer"
moduleName = project.name + ".main"
moduleName = project.name + ".ideVirtualMain"
afterEvaluate {
workingDirectory = tasks.runServer.workingDir.absolutePath
programParameters = tasks.runServer.calculateArgs(project).collect { '"' + it + '"' }.join(' ')
@@ -743,11 +1021,57 @@ idea {
}
compiler.javac {
afterEvaluate {
javacAdditionalOptions = "-encoding utf8"
moduleJavacAdditionalOptions = [
(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>
"""
}
}
}
}
}
}
@@ -768,7 +1092,7 @@ publishing {
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
// Using the identified version, not project.version as it has the prepended 1.7.10
version = System.getenv("RELEASE_VERSION") ?: identifiedVersion
@@ -817,7 +1141,7 @@ if (modrinthProjectId.size() != 0 && System.getenv("MODRINTH_TOKEN") != null) {
}
}
if (usesMixins.toBoolean()) {
addModrinthDep("required", "project", "gtnhmixins")
addModrinthDep("required", "project", "unimixins")
}
tasks.modrinth.dependsOn(build)
tasks.publish.dependsOn(tasks.modrinth)
@@ -861,7 +1185,7 @@ if (curseForgeProjectId.size() != 0 && System.getenv("CURSEFORGE_TOKEN") != null
}
}
if (usesMixins.toBoolean()) {
addCurseForgeRelation("requiredDependency", "gtnhmixins")
addCurseForgeRelation("requiredDependency", "unimixins")
}
tasks.curseforge.dependsOn(build)
tasks.publish.dependsOn(tasks.curseforge)
@@ -895,10 +1219,21 @@ def addCurseForgeRelation(String type, String name) {
}
// Updating
def buildscriptGradleVersion = "8.1.1"
tasks.named('wrapper', Wrapper).configure {
gradleVersion = buildscriptGradleVersion
}
tasks.register('updateBuildScript') {
group = 'GTNH Buildscript'
description = 'Updates the build script to the latest version'
if (gradle.gradleVersion != buildscriptGradleVersion && !Boolean.getBoolean('DISABLE_BUILDSCRIPT_GRADLE_UPDATE')) {
dependsOn('wrapper')
}
doLast {
if (performBuildScriptUpdate()) return
@@ -911,6 +1246,9 @@ if (!project.getGradle().startParameter.isOffline() && !Boolean.getBoolean('DISA
performBuildScriptUpdate()
} else {
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")
}
}
}
@@ -1051,7 +1389,7 @@ static int replaceParams(File file, Map<String, String> params) {
return 0
}
// Dependency Deobfuscation
// Dependency Deobfuscation (Deprecated, use the new RFG API documented in dependencies.gradle)
def deobf(String sourceURL) {
try {
@@ -1093,11 +1431,7 @@ def deobfMaven(String repoURL, String mavenDep) {
}
def deobfCurse(String curseDep) {
try {
return deobfMaven("https://www.cursemaven.com/", "curse.maven:$curseDep")
} catch (Exception ignored) {
out.style(Style.Failure).println("Failed to get $curseDep from cursemaven.")
}
return dependencies.rfg.deobf("curse.maven:$curseDep")
}
// The method above is to be preferred. Use this method if the filename is not at the end of the URL.
@@ -1105,34 +1439,7 @@ def deobf(String sourceURL, String rawFileName) {
String bon2Version = "2.5.1"
String fileName = URLDecoder.decode(rawFileName, "UTF-8")
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 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 {
src sourceURL
@@ -1140,50 +1447,8 @@ def deobf(String sourceURL, String rawFileName) {
quiet true
overwrite false
}
exec {
commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch'
workingDir bon2Dir
standardOutput = new FileOutputStream("${deobfFile}.log")
}
return files(deobfFile)
return dependencies.rfg.deobf(files(obfFile))
}
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
def checkPropertyExists(String propertyName) {
+1 -1
View File
@@ -1,5 +1,5 @@
dependencies {
shadowImplementation("com.github.GTNewHorizons:ZenScript:1.0.0-GTNH")
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")
}
+5
View File
@@ -63,6 +63,11 @@ containsMixinsAndOrCoreModOnly = false
# If enabled, you may use 'shadowCompile' for dependencies. They will be integrated in your jar. It is your
# responsibility check the licence and request permission for distribution, if required.
usesShadowedDependencies = true
# If disabled, won't remove unused classes from shaded dependencies. Some libraries use reflection to access
# their own classes, making the minimization unreliable.
minimizeShadowedDependencies = false
# If disabled, won't rename the shadowed classes.
relocateShadowedDependencies = false
# Adds the GTNH maven, CurseMaven, IC2/Player maven, and some more well-known 1.7.10 repositories
includeWellKnownRepositories = true
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
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
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
+7
View File
@@ -1,4 +1,11 @@
// Add any additional repositories for your dependencies here
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.Modifier;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.function.Function;
import java.util.logging.Level;
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.ModOnly;
import minetweaker.api.client.IClient;
@@ -17,8 +27,13 @@ import minetweaker.api.compat.*;
import minetweaker.api.event.IEventManager;
import minetweaker.api.formatting.IFormatter;
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.oredict.IOreDict;
import minetweaker.api.oredict.IOreDictEntry;
import minetweaker.api.oredict.IngredientOreDict;
import minetweaker.api.recipes.IFurnaceManager;
import minetweaker.api.recipes.IRecipeManager;
import minetweaker.api.server.IServer;
@@ -38,18 +53,178 @@ import stanhebben.zenscript.type.natives.JavaMethod;
/**
* 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
* - 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
* official set of functions) - Register native classes using the GlobalRegistry - Register bracket handlers to resolve
* block/item/... references using the bracket syntax
*
*
* @author Stan Hebben
*/
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",
"Gray", "Light Gray", "Cyan", "Purple", "Blue", "Brown", "Green", "Red", "Black" };
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
* admins for further handling.
*
*
* @return
*/
public static final ILogger getLogger() {
@@ -149,7 +324,7 @@ public class MineTweakerAPI {
/**
* Applies this given action.
*
*
* @param action action object
*/
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.
*
*
* @param message command 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
* directly to players in-game.
*
*
* @param message info 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,
* the issue is not a large problem, and everything should run fine - besides perhaps a few things not entirely
* working as expected.
*
*
* @param message warning 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
* scripting system will still make a best-effort attempt at executing the rest of the scripts, but that might cause
* additional errors and issues.
*
*
* @param message error 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
* scripting system will still make a best-effort attempt at executing the rest of the scripts, but that might cause
* additional errors and issues.
*
*
* @param message error message
* @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
* accepts a List of classes and which stores its classes into that list.
*
*
* @param 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
* accepts a List of classes and which stores its classes into that list.
*
*
* @param registryClass
* @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
* loaded.
*
*
* @param className class name to be loaded
* @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
* loaded.
*
*
* @param className class name to be loaded
* @param description
* @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
* with either of these will be ignored.
*
*
* @param 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.
*
*
* @param name symbol name
* @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.
*
*
* @param remover recipe 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
* will be added last - it can thus not intercept values that are already handled by the system.
*
*
* @param handler bracket handler to be added
*/
public static void registerBracketHandler(IBracketHandler handler) {
@@ -356,7 +531,7 @@ public class MineTweakerAPI {
/**
* Creates a symbol that refers to a java method.
*
*
* @param cls class that contains the method
* @param name method name
* @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
* will act as a variable of which the value can be retrieved but not set.
*
*
* @param cls class that contains the getter method
* @param name name of the method
* @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.
* The field will act as a variable that can be retrieved but not set.
*
*
* @param cls class that contains the field
* @param name field name (must be public)
* @return corresponding symbol
@@ -401,7 +576,7 @@ public class MineTweakerAPI {
/**
* Loads a Java method from an existing class.
*
*
* @param cls method class
* @param name method name
* @param arguments argument types
@@ -4,6 +4,18 @@ import java.util.HashMap;
import java.util.List;
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.api.block.IBlock;
import minetweaker.api.block.IBlockDefinition;
@@ -27,18 +39,6 @@ import minetweaker.mc1710.player.MCPlayer;
import minetweaker.mc1710.world.MCBiome;
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.
*
@@ -1,5 +1,12 @@
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.MineTweakerImplementationAPI;
import minetweaker.api.event.PlayerCraftedEvent;
@@ -12,14 +19,6 @@ import minetweaker.mc1710.network.MineTweakerLoadScriptsPacket;
import minetweaker.mc1710.recipes.MCCraftingInventory;
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
@@ -7,15 +7,6 @@ package minetweaker.mc1710;
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.entity.*;
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.PlayerInteractEvent;
import stanhebben.zenscript.value.*;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
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
@@ -5,6 +5,8 @@
package minetweaker.mc1710;
import net.minecraft.item.Item;
import minetweaker.IPlatformFunctions;
import minetweaker.api.chat.IChatMessage;
import minetweaker.api.item.IItemDefinition;
@@ -12,8 +14,6 @@ import minetweaker.mc1710.chat.MCChatMessage;
import minetweaker.mc1710.item.MCItemDefinition;
import minetweaker.mc1710.network.MineTweakerLoadScriptsPacket;
import net.minecraft.item.Item;
/**
*
* @author Stan
@@ -8,6 +8,18 @@ package minetweaker.mc1710;
import java.io.File;
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.MineTweakerImplementationAPI;
import minetweaker.api.logger.FileLogger;
@@ -31,19 +43,6 @@ import minetweaker.runtime.providers.ScriptProviderCascade;
import minetweaker.runtime.providers.ScriptProviderCustom;
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.
*
@@ -5,12 +5,12 @@
package minetweaker.mc1710.actions;
import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI;
/**
*
* @author Jared
@@ -5,10 +5,10 @@
package minetweaker.mc1710.actions;
import minetweaker.IUndoableAction;
import net.minecraft.item.ItemStack;
import minetweaker.IUndoableAction;
/**
*
* @author Jared
@@ -5,10 +5,10 @@
package minetweaker.mc1710.actions;
import minetweaker.IUndoableAction;
import net.minecraft.item.ItemStack;
import minetweaker.IUndoableAction;
/**
*
* @author Jared
@@ -8,11 +8,11 @@ package minetweaker.mc1710.actions;
import java.io.ByteArrayInputStream;
import java.nio.charset.Charset;
import net.minecraft.util.StringTranslate;
import minetweaker.IUndoableAction;
import minetweaker.mc1710.util.MineTweakerHacks;
import net.minecraft.util.StringTranslate;
/**
*
* @author Stan
@@ -5,10 +5,10 @@
package minetweaker.mc1710.block;
import minetweaker.api.block.IBlockDefinition;
import net.minecraft.block.Block;
import minetweaker.api.block.IBlockDefinition;
/**
*
* @author Stan
@@ -8,6 +8,10 @@ package minetweaker.mc1710.block;
import java.util.Collections;
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.IBlock;
import minetweaker.api.block.IBlockDefinition;
@@ -15,10 +19,6 @@ import minetweaker.api.block.IBlockPattern;
import minetweaker.api.data.IData;
import minetweaker.api.minecraft.MineTweakerMC;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
/**
*
* @author Stan
@@ -8,6 +8,9 @@ package minetweaker.mc1710.block;
import java.util.Collections;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraftforge.oredict.OreDictionary;
import minetweaker.api.block.BlockPatternOr;
import minetweaker.api.block.IBlock;
import minetweaker.api.block.IBlockDefinition;
@@ -15,9 +18,6 @@ import minetweaker.api.block.IBlockPattern;
import minetweaker.api.data.IData;
import minetweaker.api.minecraft.MineTweakerMC;
import net.minecraft.block.Block;
import net.minecraftforge.oredict.OreDictionary;
/**
*
* @author Stan
@@ -8,13 +8,6 @@ package minetweaker.mc1710.block;
import java.util.Collections;
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.item.Item;
import net.minecraft.item.ItemStack;
@@ -23,6 +16,13 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
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
@@ -12,15 +12,14 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import net.minecraft.item.Item;
import net.minecraftforge.oredict.OreDictionary;
import minetweaker.IBracketHandler;
import minetweaker.MineTweakerAPI;
import minetweaker.annotations.BracketHandler;
import minetweaker.api.item.IItemStack;
import minetweaker.api.item.IngredientAny;
import net.minecraft.item.Item;
import net.minecraftforge.oredict.OreDictionary;
import stanhebben.zenscript.ZenTokener;
import stanhebben.zenscript.compiler.IEnvironmentGlobal;
import stanhebben.zenscript.expression.ExpressionCallStatic;
@@ -4,16 +4,15 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import minetweaker.IBracketHandler;
import minetweaker.annotations.BracketHandler;
import minetweaker.api.liquid.ILiquidStack;
import minetweaker.mc1710.liquid.MCLiquidStack;
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.expression.ExpressionCallStatic;
import stanhebben.zenscript.expression.ExpressionString;
@@ -5,11 +5,11 @@
package minetweaker.mc1710.chat;
import minetweaker.api.chat.IChatMessage;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IChatComponent;
import minetweaker.api.chat.IChatMessage;
/**
*
* @author Stan
@@ -5,13 +5,12 @@
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 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.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.DataByteArray;
import minetweaker.api.data.DataDouble;
@@ -26,19 +39,6 @@ import minetweaker.api.data.IData;
import minetweaker.api.data.IDataConverter;
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
@@ -7,12 +7,12 @@ package minetweaker.mc1710.data;
import java.util.Map;
import minetweaker.api.data.IData;
import minetweaker.api.data.IDataConverter;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import minetweaker.api.data.IData;
import minetweaker.api.data.IDataConverter;
/**
*
* @author Stan
@@ -7,10 +7,10 @@ package minetweaker.mc1710.entity;
import java.util.*;
import cpw.mods.fml.common.registry.EntityRegistry;
import minetweaker.api.entity.IEntityDefinition;
import minetweaker.api.item.*;
import stanhebben.zenscript.value.*;
import cpw.mods.fml.common.registry.EntityRegistry;
/**
*
@@ -5,10 +5,10 @@
package minetweaker.mc1710.formatting;
import minetweaker.api.formatting.IFormattedText;
import net.minecraft.util.EnumChatFormatting;
import minetweaker.api.formatting.IFormattedText;
/**
*
* @author Stan
@@ -7,10 +7,10 @@ package minetweaker.mc1710.formatting;
import java.util.Arrays;
import minetweaker.api.formatting.IFormattedText;
import net.minecraft.util.EnumChatFormatting;
import minetweaker.api.formatting.IFormattedText;
/**
*
* @author Stan
@@ -5,11 +5,11 @@
package minetweaker.mc1710.formatting;
import net.minecraft.util.EnumChatFormatting;
import minetweaker.api.formatting.IFormattedText;
import minetweaker.api.formatting.IFormatter;
import net.minecraft.util.EnumChatFormatting;
/**
*
* @author Stan
@@ -10,15 +10,14 @@ import java.util.ArrayList;
import java.util.HashMap;
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.ItemStack;
import cpw.mods.fml.common.IFuelHandler;
import cpw.mods.fml.common.registry.GameRegistry;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import minetweaker.api.minecraft.MineTweakerMC;
public class FuelTweaker {
@@ -13,6 +13,10 @@ import java.util.List;
import java.util.Map;
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.MineTweakerAPI;
import minetweaker.api.item.IIngredient;
@@ -22,11 +26,6 @@ import minetweaker.api.recipes.IFurnaceManager;
import minetweaker.api.recipes.IFurnaceRecipe;
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
*/
@@ -113,6 +112,7 @@ public class MCFurnaceManager implements IFurnaceManager {
public void apply() {
for (ItemStack item : items) {
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() {
for (ItemStack inputStack : input) {
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
public void apply() {
FuelTweaker.INSTANCE.addFuelPattern(pattern);
MineTweakerAPI.info(
"GT_ModHandler.setFuelValue(" + MineTweakerAPI.convertStack(pattern.getPattern())
+ ", "
+ pattern.getValue()
+ ");");
}
@Override
@@ -10,6 +10,17 @@ import java.util.List;
import java.util.Map;
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.MineTweakerAPI;
import minetweaker.api.block.IBlockDefinition;
@@ -26,18 +37,6 @@ import minetweaker.mc1710.liquid.MCLiquidDefinition;
import minetweaker.mc1710.util.MineTweakerHacks;
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
@@ -183,7 +182,7 @@ public class MCGame implements IGame {
/**
* Ported from ModTweaker.
*
*
* @author Joshiejack
*/
private static class SetTranslation implements IUndoableAction {
@@ -209,6 +208,7 @@ public class MCGame implements IGame {
} else {
added = false;
}
MineTweakerAPI.info(key + "=" + text);
}
@Override
@@ -8,16 +8,16 @@ package minetweaker.mc1710.item;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemDefinition;
import minetweaker.api.item.IItemStack;
import minetweaker.api.minecraft.MineTweakerMC;
import minetweaker.api.oredict.IOreDictEntry;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
/**
*
* @author Stan
@@ -12,6 +12,15 @@ import java.util.Collections;
import java.util.List;
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.api.block.IBlock;
import minetweaker.api.data.DataMap;
@@ -29,16 +38,6 @@ import minetweaker.mc1710.data.NBTConverter;
import minetweaker.mc1710.liquid.MCLiquidStack;
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
@@ -8,6 +8,10 @@ package minetweaker.mc1710.liquid;
import java.util.ArrayList;
import java.util.List;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
@@ -15,10 +19,6 @@ import minetweaker.api.liquid.ILiquidDefinition;
import minetweaker.api.liquid.ILiquidStack;
import minetweaker.api.minecraft.MineTweakerMC;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidStack;
/**
*
* @author Stan
@@ -8,6 +8,9 @@ package minetweaker.mc1710.liquid;
import java.util.Collections;
import java.util.List;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
import minetweaker.api.data.IData;
import minetweaker.api.item.*;
import minetweaker.api.liquid.ILiquidDefinition;
@@ -15,9 +18,6 @@ import minetweaker.api.liquid.ILiquidStack;
import minetweaker.api.player.IPlayer;
import minetweaker.mc1710.data.NBTConverter;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.FluidStack;
/**
* @author Stan
*/
@@ -3,11 +3,11 @@ package minetweaker.mc1710.mods;
import java.util.Iterator;
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.IMod;
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;
import minetweaker.api.mods.IMod;
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.StringSelection;
import minetweaker.mc1710.MineTweakerConfig;
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.mc1710.MineTweakerConfig;
/**
*
@@ -5,13 +5,13 @@
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.MineTweakerImplementationAPI;
import minetweaker.mc1710.MineTweakerConfig;
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.URISyntaxException;
import minetweaker.mc1710.MineTweakerConfig;
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.mc1710.MineTweakerConfig;
/**
*
@@ -10,12 +10,12 @@ import static minetweaker.api.minecraft.MineTweakerMC.getOreDict;
import java.util.ArrayList;
import java.util.List;
import net.minecraftforge.oredict.OreDictionary;
import minetweaker.api.minecraft.MineTweakerMC;
import minetweaker.api.oredict.IOreDict;
import minetweaker.api.oredict.IOreDictEntry;
import net.minecraftforge.oredict.OreDictionary;
/**
*
* @author Stan
@@ -12,6 +12,9 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.*;
@@ -22,9 +25,6 @@ import minetweaker.api.player.IPlayer;
import minetweaker.mc1710.util.MineTweakerHacks;
import minetweaker.util.ArrayUtil;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
/**
* @author Stan
*/
@@ -271,6 +271,11 @@ public class MCOreDictEntry implements IOreDictEntry {
@Override
public void apply() {
OreDictionary.registerOre(id, item);
MineTweakerAPI.info(
"OreDictionary.registerOre(\"" + OreDictionary.getOreName(id)
+ "\", "
+ MineTweakerAPI.convertStack(item)
+ ");");
}
@Override
@@ -1,15 +1,15 @@
package minetweaker.mc1710.player;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IChatComponent;
import minetweaker.MineTweakerAPI;
import minetweaker.api.chat.IChatMessage;
import minetweaker.api.data.IData;
import minetweaker.api.item.IItemStack;
import minetweaker.api.player.IPlayer;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IChatComponent;
/**
* @author Jared
*/
@@ -5,6 +5,11 @@
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.api.chat.IChatMessage;
import minetweaker.api.data.IData;
@@ -17,11 +22,6 @@ import minetweaker.mc1710.data.NBTConverter;
import minetweaker.mc1710.network.MineTweakerCopyClipboardPacket;
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
@@ -1,15 +1,15 @@
package minetweaker.mc1710.player;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IChatComponent;
import minetweaker.MineTweakerAPI;
import minetweaker.api.chat.IChatMessage;
import minetweaker.api.data.IData;
import minetweaker.api.item.IItemStack;
import minetweaker.api.player.IPlayer;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IChatComponent;
/**
*
* @author Jared
@@ -11,12 +11,6 @@ import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
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.inventory.Container;
import net.minecraft.inventory.IInventory;
@@ -25,6 +19,12 @@ import net.minecraft.inventory.Slot;
import net.minecraft.inventory.SlotCrafting;
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
@@ -9,6 +9,19 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.RecursiveAction;
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.MineTweakerAPI;
import minetweaker.MineTweakerImplementationAPI;
@@ -27,20 +40,6 @@ import minetweaker.mc1710.item.MCItemStack;
import minetweaker.mc1710.util.MineTweakerHacks;
import minetweaker.mc1710.util.ThreadSafeBitSet;
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;
/**
@@ -317,6 +316,17 @@ public final class MCRecipeManager implements IRecipeManager {
toRemove = find();
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
@@ -441,6 +451,14 @@ public final class MCRecipeManager implements IRecipeManager {
toRemove = find();
MineTweakerAPI.logInfo("Removing " + toRemove.size() + " Shapeless recipes.");
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
@@ -555,6 +573,21 @@ public final class MCRecipeManager implements IRecipeManager {
MineTweakerAPI.logInfo(toRemove.size() + " removed");
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
@@ -659,17 +692,50 @@ public final class MCRecipeManager implements IRecipeManager {
private static class ActionAddShapedRecipe extends ActionBaseAddRecipe {
IItemStack aOutput;
IIngredient[][] aIngredients;
boolean aMirrored;
public ActionAddShapedRecipe(IItemStack output, IIngredient[][] ingredients, IRecipeFunction function,
IRecipeAction action, boolean mirrored) {
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 {
IItemStack aOutput;
IIngredient[] aIngredients;
public ActionAddShapelessRecipe(IItemStack output, IIngredient[] ingredients, IRecipeFunction function,
IRecipeAction action) {
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);
}
int commonPoolParallelism = getCommonPoolParallelism();
if (commonPoolParallelism <= 1) {
if (true) {
// if thread == 1, then we have parallel overhead but doesn't have parallel speedup.
// never do this
recipesToRemove.forEach(ActionBaseRemoveRecipes::apply);
@@ -10,6 +10,13 @@ import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
import java.util.ArrayList;
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.IItemStack;
import minetweaker.api.minecraft.MineTweakerMC;
@@ -18,13 +25,6 @@ import minetweaker.api.recipes.ShapedRecipe;
import minetweaker.api.recipes.ShapelessRecipe;
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
@@ -7,13 +7,13 @@ package minetweaker.mc1710.recipes;
import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
import minetweaker.api.recipes.ShapedRecipe;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.world.World;
import minetweaker.api.recipes.ShapedRecipe;
/**
* TODO: NEI integration for this kind of recipes.
*
@@ -7,14 +7,14 @@ package minetweaker.mc1710.recipes;
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.item.ItemStack;
import net.minecraft.item.crafting.ShapedRecipes;
import net.minecraft.world.World;
import minetweaker.api.item.IItemStack;
import minetweaker.api.recipes.ShapedRecipe;
/**
*
* @author Stan
@@ -7,13 +7,13 @@ package minetweaker.mc1710.recipes;
import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
import minetweaker.api.recipes.ShapedRecipe;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.oredict.ShapedOreRecipe;
import minetweaker.api.recipes.ShapedRecipe;
/**
*
* @author Stan
@@ -7,13 +7,13 @@ package minetweaker.mc1710.recipes;
import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
import minetweaker.api.recipes.ShapelessRecipe;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.world.World;
import minetweaker.api.recipes.ShapelessRecipe;
/**
*
* @author Stan
@@ -9,13 +9,13 @@ import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
import java.util.Arrays;
import minetweaker.api.recipes.ShapelessRecipe;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraft.world.World;
import minetweaker.api.recipes.ShapelessRecipe;
/**
*
* @author Stan
@@ -7,13 +7,13 @@ package minetweaker.mc1710.recipes;
import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
import minetweaker.api.recipes.ShapelessRecipe;
import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import minetweaker.api.recipes.ShapelessRecipe;
/**
*
* @author Stan
@@ -8,6 +8,16 @@ package minetweaker.mc1710.server;
import java.util.Arrays;
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.MineTweakerAPI;
import minetweaker.api.minecraft.MineTweakerMC;
@@ -19,16 +29,6 @@ import minetweaker.api.server.ICommandValidator;
import minetweaker.mc1710.player.CommandBlockPlayer;
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
*/
@@ -14,15 +14,15 @@ import java.net.URI;
import java.util.logging.Level;
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.data.IData;
import minetweaker.api.item.IItemStack;
import minetweaker.api.player.IPlayer;
import net.minecraft.server.dedicated.DedicatedServer;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IChatComponent;
/**
*
* @author Stan
@@ -15,10 +15,6 @@ import java.util.Map;
import java.util.logging.Level;
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.player.EntityPlayer;
import net.minecraft.inventory.Container;
@@ -37,7 +33,11 @@ import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import com.google.common.collect.BiMap;
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
@@ -10,6 +10,9 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraftforge.common.ChestGenHooks;
import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient;
@@ -19,9 +22,6 @@ import minetweaker.api.vanilla.ILootRegistry;
import minetweaker.api.vanilla.LootEntry;
import minetweaker.mc1710.util.MineTweakerHacks;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraftforge.common.ChestGenHooks;
/**
*
* @author Stan
@@ -8,6 +8,9 @@ package minetweaker.mc1710.vanilla;
import java.util.ArrayList;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.util.WeightedRandom;
import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IIngredient;
@@ -17,9 +20,6 @@ import minetweaker.api.minecraft.MineTweakerMC;
import minetweaker.api.vanilla.ISeedRegistry;
import minetweaker.mc1710.util.MineTweakerHacks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.WeightedRandom;
/**
*
* @author Stan
@@ -5,10 +5,10 @@
package minetweaker.mc1710.world;
import minetweaker.api.world.IBiome;
import net.minecraft.world.biome.BiomeGenBase;
import minetweaker.api.world.IBiome;
/**
*
* @author Stan
@@ -5,12 +5,12 @@
package minetweaker.mc1710.world;
import net.minecraft.world.World;
import minetweaker.api.block.IBlock;
import minetweaker.api.minecraft.MineTweakerMC;
import minetweaker.api.world.IDimension;
import net.minecraft.world.World;
/**
*
* @author Stan
@@ -4,15 +4,15 @@ import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import ic2.api.item.IC2Items;
import minetweaker.IBracketHandler;
import minetweaker.MineTweakerAPI;
import minetweaker.annotations.BracketHandler;
import minetweaker.annotations.ModOnly;
import minetweaker.api.item.IItemStack;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import stanhebben.zenscript.ZenTokener;
import stanhebben.zenscript.compiler.IEnvironmentGlobal;
import stanhebben.zenscript.expression.ExpressionCallStatic;
@@ -24,7 +24,6 @@ import stanhebben.zenscript.symbols.IZenSymbol;
import stanhebben.zenscript.type.ZenType;
import stanhebben.zenscript.type.natives.IJavaMethod;
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;.
@@ -2,17 +2,16 @@ package minetweaker.mods.ic2;
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.MineTweakerAPI;
import minetweaker.annotations.ModOnly;
import minetweaker.api.item.IItemStack;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
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.
@@ -11,12 +11,11 @@ import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
import java.util.ArrayList;
import java.util.List;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import net.minecraft.item.ItemStack;
import ic2.api.recipe.IRecipeInput;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
/**
* Wrapper class for ITweakerItemStackPatterns to IC2 recipe inputs.
@@ -2,14 +2,13 @@ package minetweaker.mods.ic2;
import java.util.Arrays;
import minetweaker.MineTweakerAPI;
import minetweaker.OneWayAction;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import ic2.api.recipe.IMachineRecipeManager;
import ic2.api.recipe.IMachineRecipeManagerExt;
import minetweaker.MineTweakerAPI;
import minetweaker.OneWayAction;
/**
*
@@ -1,10 +1,10 @@
package minetweaker.mods.ic2.crops;
import ic2.api.crops.CropCard;
import stanhebben.zenscript.annotations.ZenCaster;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenGetter;
import stanhebben.zenscript.annotations.ZenMethod;
import ic2.api.crops.CropCard;
/**
* Read-only data accessor for crops
@@ -4,19 +4,18 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import net.minecraftforge.common.BiomeDictionary;
import ic2.api.crops.CropCard;
import ic2.api.crops.Crops;
import minetweaker.MineTweakerAPI;
import minetweaker.OneWayAction;
import minetweaker.annotations.ModOnly;
import minetweaker.api.item.IItemStack;
import minetweaker.api.minecraft.MineTweakerMC;
import net.minecraftforge.common.BiomeDictionary;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenGetter;
import stanhebben.zenscript.annotations.ZenMethod;
import ic2.api.crops.CropCard;
import ic2.api.crops.Crops;
@ZenClass("mods.ic2.CropsConfig")
@ModOnly("IC2")
@@ -1,21 +1,20 @@
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.item.ItemStack;
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.SideOnly;
import ic2.api.crops.CropCard;
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
@@ -3,18 +3,17 @@ package minetweaker.mods.ic2.expand;
import static minetweaker.api.minecraft.MineTweakerMC.getIItemStack;
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.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.ZenExpansion;
import stanhebben.zenscript.annotations.ZenGetter;
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.getItemStacks;
import ic2.api.recipe.RecipeOutput;
import ic2.api.recipe.Recipes;
import minetweaker.MineTweakerAPI;
import minetweaker.annotations.ModOnly;
import minetweaker.api.item.IIngredient;
@@ -18,8 +20,6 @@ import minetweaker.mods.ic2.MachineAddRecipeAction;
import stanhebben.zenscript.annotations.NotNull;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import ic2.api.recipe.RecipeOutput;
import ic2.api.recipe.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.getItemStacks;
import ic2.api.recipe.RecipeOutput;
import ic2.api.recipe.Recipes;
import minetweaker.MineTweakerAPI;
import minetweaker.annotations.ModOnly;
import minetweaker.api.item.IIngredient;
@@ -18,8 +20,6 @@ import minetweaker.mods.ic2.MachineAddRecipeAction;
import stanhebben.zenscript.annotations.NotNull;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import ic2.api.recipe.RecipeOutput;
import ic2.api.recipe.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 net.minecraftforge.fluids.FluidStack;
import ic2.api.recipe.RecipeInputFluidContainer;
import ic2.api.recipe.Recipes;
import minetweaker.MineTweakerAPI;
import minetweaker.OneWayAction;
import minetweaker.annotations.ModOnly;
@@ -14,13 +18,8 @@ import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import minetweaker.api.liquid.ILiquidStack;
import minetweaker.mods.ic2.IC2RecipeInput;
import net.minecraftforge.fluids.FluidStack;
import stanhebben.zenscript.annotations.ZenClass;
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.getItemStacks;
import net.minecraft.item.ItemStack;
import ic2.api.recipe.RecipeOutput;
import ic2.api.recipe.Recipes;
import minetweaker.MineTweakerAPI;
import minetweaker.annotations.ModOnly;
import minetweaker.api.item.IIngredient;
@@ -13,12 +17,10 @@ import minetweaker.mods.ic2.MachineAddRecipeAction;
import stanhebben.zenscript.annotations.NotNull;
import stanhebben.zenscript.annotations.ZenClass;
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.
*
*
* @author Stan Hebben
*/
@ZenClass("mods.ic2.Compressor")
@@ -27,9 +29,9 @@ public class 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.
*
*
* @param output recipe output
* @param ingredient recipe input
*/
@@ -44,14 +46,29 @@ public class Compressor {
Recipes.compressor,
getItemStacks(output),
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
* contains multiple items.
*
*
* @param input recipe input
* @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.getItemStacks;
import net.minecraft.item.ItemStack;
import ic2.api.recipe.RecipeOutput;
import ic2.api.recipe.Recipes;
import minetweaker.MineTweakerAPI;
import minetweaker.annotations.ModOnly;
import minetweaker.api.item.IIngredient;
@@ -18,12 +22,10 @@ import minetweaker.mods.ic2.MachineAddRecipeAction;
import stanhebben.zenscript.annotations.NotNull;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import ic2.api.recipe.RecipeOutput;
import ic2.api.recipe.Recipes;
/**
* Provides access to the IC2 Extractor recipes.
*
*
* @author Stan Hebben
*/
@ZenClass("mods.ic2.Extractor")
@@ -32,9 +34,9 @@ public class 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.
*
*
* @param output recipe output
* @param ingredient recipe input
*/
@@ -49,14 +51,29 @@ public class Extractor {
Recipes.extractor,
getItemStacks(output),
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
* contains multiple items.
*
*
* @param input recipe input
* @return recipe output
*/
@@ -5,16 +5,15 @@
package minetweaker.mods.ic2.machines;
import net.minecraftforge.fluids.FluidRegistry;
import ic2.api.recipe.Recipes;
import minetweaker.MineTweakerAPI;
import minetweaker.OneWayAction;
import minetweaker.annotations.ModOnly;
import minetweaker.api.liquid.ILiquidStack;
import net.minecraftforge.fluids.FluidRegistry;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import ic2.api.recipe.Recipes;
/**
* 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.getItemStacks;
import ic2.api.recipe.RecipeOutput;
import ic2.api.recipe.Recipes;
import minetweaker.MineTweakerAPI;
import minetweaker.annotations.ModOnly;
import minetweaker.api.item.IIngredient;
@@ -13,8 +15,6 @@ import minetweaker.mods.ic2.MachineAddRecipeAction;
import stanhebben.zenscript.annotations.NotNull;
import stanhebben.zenscript.annotations.ZenClass;
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.
@@ -5,18 +5,17 @@
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.annotations.ModOnly;
import minetweaker.api.item.IIngredient;
import minetweaker.mods.ic2.IC2RecipeInput;
import minetweaker.mods.ic2.MachineAddRecipeAction;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import stanhebben.zenscript.annotations.ZenClass;
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.getItemStacks;
import ic2.api.recipe.RecipeOutput;
import ic2.api.recipe.Recipes;
import minetweaker.MineTweakerAPI;
import minetweaker.annotations.ModOnly;
import minetweaker.api.item.IIngredient;
@@ -17,8 +19,6 @@ import minetweaker.mods.ic2.IC2RecipeInput;
import minetweaker.mods.ic2.MachineAddRecipeAction;
import stanhebben.zenscript.annotations.ZenClass;
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.getItemStacks;
import net.minecraft.nbt.NBTTagCompound;
import ic2.api.recipe.RecipeOutput;
import ic2.api.recipe.Recipes;
import minetweaker.MineTweakerAPI;
import minetweaker.annotations.ModOnly;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import minetweaker.mods.ic2.IC2RecipeInput;
import minetweaker.mods.ic2.MachineAddRecipeAction;
import net.minecraft.nbt.NBTTagCompound;
import stanhebben.zenscript.annotations.ZenClass;
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 ic2.api.recipe.Recipes;
import minetweaker.MineTweakerAPI;
import minetweaker.OneWayAction;
import minetweaker.annotations.ModOnly;
@@ -15,7 +16,6 @@ import minetweaker.api.item.IItemStack;
import minetweaker.mods.ic2.IC2RecipeInput;
import stanhebben.zenscript.annotations.ZenClass;
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 ic2.api.recipe.Recipes;
import minetweaker.MineTweakerAPI;
import minetweaker.OneWayAction;
import minetweaker.annotations.ModOnly;
import minetweaker.api.item.WeightedItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import ic2.api.recipe.Recipes;
/**
*
@@ -5,16 +5,15 @@
package minetweaker.mods.ic2.machines;
import net.minecraftforge.fluids.FluidRegistry;
import ic2.api.recipe.Recipes;
import minetweaker.MineTweakerAPI;
import minetweaker.OneWayAction;
import minetweaker.annotations.ModOnly;
import minetweaker.api.liquid.ILiquidStack;
import net.minecraftforge.fluids.FluidRegistry;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import ic2.api.recipe.Recipes;
/**
* 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.getItemStacks;
import net.minecraft.nbt.NBTTagCompound;
import ic2.api.recipe.RecipeOutput;
import ic2.api.recipe.Recipes;
import minetweaker.MineTweakerAPI;
import minetweaker.annotations.ModOnly;
import minetweaker.api.item.IIngredient;
import minetweaker.api.item.IItemStack;
import minetweaker.mods.ic2.IC2RecipeInput;
import minetweaker.mods.ic2.MachineAddRecipeAction;
import net.minecraft.nbt.NBTTagCompound;
import stanhebben.zenscript.annotations.ZenClass;
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.
+11 -9
View File
@@ -2,26 +2,25 @@ package minetweaker.mods.nei;
import static minetweaker.api.minecraft.MineTweakerMC.getItemStack;
import net.minecraft.item.ItemStack;
import codechicken.nei.api.API;
import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI;
import minetweaker.OneWayAction;
import minetweaker.annotations.ModOnly;
import minetweaker.api.item.IItemStack;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.NotNull;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
import codechicken.nei.api.API;
/**
* MineTweaker NEI support.
*
*
* 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
* specific NBT tags.
*
*
* @author Stan Hebben
*/
@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.
*
*
* @param item item to be hidden
*/
@ZenMethod
@@ -40,7 +39,7 @@ public class NEI {
/**
* Adds a NEI entry. The item stack can contain damage values and NBT tags.
*
*
* @param stack item stack to be added
*/
@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
* is displayed in NEI.
*
*
* @param item item
* @param name item name
*/
@@ -75,6 +74,7 @@ public class NEI {
@Override
public void apply() {
API.addItemListEntry(item);
MineTweakerAPI.info("API.addItemListEntry(" + MineTweakerAPI.convertStack(item) + ");");
}
@Override
@@ -114,6 +114,7 @@ public class NEI {
@Override
public void apply() {
API.hideItem(stack);
MineTweakerAPI.info("API.hideItem(" + MineTweakerAPI.convertStack(stack) + ");");
}
@Override
@@ -155,6 +156,7 @@ public class NEI {
@Override
public void apply() {
API.setOverrideName(item, name);
MineTweakerAPI.info("API.setOverrideName(" + MineTweakerAPI.convertStack(item) + ", \"" + name + "\");");
}
@Override