diff --git a/.gitignore b/.gitignore index 5e19125..4cdb876 100644 --- a/.gitignore +++ b/.gitignore @@ -1,26 +1,45 @@ -#eclipse -.project -.classpath -.metadata -org.* +# eclipse bin *.launch +.settings +.metadata +.classpath +.project +eclipse -#idea -*.iml +# idea +out *.ipr *.iws +*.iml .idea -out -#gradle +# gradle build .gradle +modules libs #runtime run -classes +run_server +run_data #mac .DS_Store + +#Custom code to inject the the dev environment +custom +test-results + +#licnse_checker +# Not in git because it contains names + emails. +license_checker/agreed.txt +license_checker/unused_code.txt +license_checker/out/** + +# Files from Forge MDK +forge*changelog.txt + +# For some annoying reason the tests creates a log file in "/logs/latest.txt" +logs diff --git a/.gitmodules b/.gitmodules index 3602e61..fd83d87 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,4 @@ [submodule "BuildCraft"] path = BuildCraft - url = https://github.com/BuildCraft/BuildCraft.git + url = https://github.com/CalenXwX/BuildCraft.git + branch = 8.0.x-1.18.2 diff --git a/BuildCraft b/BuildCraft index 656b0a0..fccc1d4 160000 --- a/BuildCraft +++ b/BuildCraft @@ -1 +1 @@ -Subproject commit 656b0a00a04bf61ebd9f39f6c3e44eac2818b1ec +Subproject commit fccc1d4530c575f850c52ed23b4df3700f7e1a14 diff --git a/build.gradle b/build.gradle index 95cf589..d212458 100755 --- a/build.gradle +++ b/build.gradle @@ -1,31 +1,30 @@ -// DON'T TOUCH THE BUILDSCRIPT[] BLOCK -// its special, and it is only there to make ForgeGradle work correctly. - buildscript { repositories { + // These repositories are only for Gradle plugins, put any other repositories in the repository core further below + maven { url = 'https://maven.minecraftforge.net' } +// maven { url = 'https://maven.parchmentmc.org' } mavenCentral() - maven { - name = "forge" - url = "http://files.minecraftforge.net/maven" - } - maven { - name = "sonatype" - url = "https://oss.sonatype.org/content/repositories/snapshots/" - } - maven { - url "https://plugins.gradle.org/m2/" - } } dependencies { - classpath "net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT" - classpath "org.ajoberstar:grgit:2.2.1" + classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true + // Mixin + //classpath group: 'org.spongepowered', name: 'mixingradle', version: '0.7-SNAPSHOT' + classpath 'org.spongepowered:mixingradle:0.7.+' } } - -apply plugin: "net.minecraftforge.gradle.forge" // adds the forge dependency -apply plugin: "maven" // for uploading to a maven repo -apply plugin: 'maven-publish' // for uploading to a maven repo -apply plugin: "org.ajoberstar.grgit" +// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. +plugins { + id 'eclipse' + id 'maven-publish' +// id 'net.minecraftforge.gradle' version '5.+' +// id 'org.parchmentmc.librarian.forgegradle' version '1.+' +} +apply plugin: 'net.minecraftforge.gradle' +// +////apply plugin: 'org.parchmentmc.librarian.forgegradle' version '1.+' +// +// Mixin +apply plugin: 'org.spongepowered.mixin' ext.configFile = file "build.properties" configFile.withReader { @@ -43,265 +42,438 @@ version = config.compat_version group = "com.mod-buildcraft-compat" archivesBaseName = "buildcraft" // the name that all artifacts will use as a base. artifacts names follow this pattern: [baseName]-[appendix]-[version]-[classifier].[extension] -ext { - compatModInfo = new groovy.json.JsonSlurper().parse(file("resources/mcmod.info")) - mainModInfo = new groovy.json.JsonSlurper().parse(file("BuildCraft/buildcraft_resources/mcmod.info")) -} - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - -repositories { - maven { name="JEI"; url="http://dvs1.progwml6.com/files/maven" } - maven { name="TOP"; url="http://maven.tterrag.com/" } - maven { name="hwyla"; url="http://tehnut.info/maven" } - // The One probe depends on the RF API -- we don't use it ourselves, nor will we ever add compat for it... - maven { name="cofh"; url="http://maven.covers1624.net" } - maven { name="forestry"; url = "http://maven.ic2.player.to/" } - maven { name "CraftTweaker"; url "http://maven.blamejared.com/" } -} - -dependencies { - // JEI Stuff - // Versions from http://minecraft.curseforge.com/projects/just-enough-items-jei/files - compileOnly "mezz.jei:jei_${config.mc_version}:${config.jei_version}:api" - runtime "mezz.jei:jei_${config.mc_version}:${config.jei_version}" +// Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. +java.toolchain.languageVersion = JavaLanguageVersion.of(17) - // The One Probe Stuff - compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${config.top_version}:api" - runtime "mcjty.theoneprobe:TheOneProbe-1.12:${config.top_version}" - // The One Probe depends on the RF api for some odd reason... we never intend to add support for RF ourselves though. +println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" +minecraft { + // The mappings can be changed at any time and must be in the following format. + // Channel: Version: + // official MCVersion Official field/method names from Mojang mapping files + // parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official + // + // You must be aware of the Mojang license when using the 'official' or 'parchment' mappings. + // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md + // + // Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge + // Additional setup is needed to use their mappings: https://github.com/ParchmentMC/Parchment/wiki/Getting-Started + // + // Use non-default mappings at your own risk. They may not always work. + // Simply re-run your setup task after changing the mappings to update your workspace. + + mappings channel: 'official', version: '1.18.2' +// mappings channel: 'parchment', version: '2022.08.07-1.18.2' + +// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') +// accessTransformer = file('buildcraft_resources/META-INF/accesstransformer.cfg') + accessTransformer = file('BuildCraft/buildcraft_resources/META-INF/accesstransformer.cfg') + // Currently, this location cannot be changed from the default. + + // Default run configurations. + // These can be tweaked, removed, or duplicated as needed. + runs { + client { + workingDirectory project.file('run') + + // Recommended logging data for a userdev environment + // The markers can be added/remove as needed separated by commas. + // "SCAN": For mods scan. + // "REGISTRIES": For firing of registry events. + // "REGISTRYDUMP": For getting the contents of all registries. + property 'forge.logging.markers', 'REGISTRIES' + + // Recommended logging level for the console + // You can set various levels here. + // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels + property 'forge.logging.console.level', 'debug' + + // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. + property 'forge.enabledGameTestNamespaces', 'buildcraftcore,buildcraftenergy,buildcraftfactory,buildcraftlib' + + // Mixin + arg "-mixin.config=mixins.buildcraft.json" + + mods { + buildcraftcore { + source sourceSets.main + } + } + } - // HWYLA - compileOnly "mcp.mobius.waila:Hwyla:${config.hwyla_version}:api" - runtime "mcp.mobius.waila:Hwyla:${config.hwyla_version}" + server { + workingDirectory project.file('run_server') - // Forestry - deobfCompile "net.sengir.forestry:forestry_${config.mc_version}:${config.forestry_version}" + property 'forge.logging.markers', 'REGISTRIES' - deobfCompile "net.industrial-craft:industrialcraft-2:${config.ic2_version}" + property 'forge.logging.console.level', 'debug' - // CraftTweaker - deobfCompile "CraftTweaker2:CraftTweaker2-API:${config.crafttweaker_version}" - deobfCompile "CraftTweaker2:CraftTweaker2-MC1120-Main:1.12-${config.crafttweaker_version}" -} + // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. + property 'forge.enabledGameTestNamespaces', 'buildcraftcore' -minecraft { - version = config.mc_version + "-" + config.forge_version - runDir = "run" - - // the mappings can be changed at any time, and must be in the following format. - // snapshot_YYYYMMDD snapshot are built nightly. - // stable_# stables are built at the discretion of the MCP team. - // Use non-default mappings at your own risk. they may not allways work. - // simply re-run your setup task after changing the mappings to update your workspace. - mappings = config.mappings_version - - useDepAts = true - - def separate = Boolean.getBoolean("build_compat_only") - if (separate) { - project.version = config.compat_version - } else { - project.version = config.mod_version; - } + // Mixin + arg "-mixin.config=mixins.buildcraft.json" - def addVersionDetails = !Boolean.getBoolean("release") - - // Git versioning stuffs - if (grgit != null) { - def repo = grgit.open(dir: project.rootDir) - replace "\${git_commit_hash}", repo.head().id - replace "\${git_commit_msg}", repo.head().fullMessage.replace("\"", "\\\\\\\"").split("\n")[0] - replace "\${git_commit_author}", repo.head().author.name - replace "\${git_branch}", repo.branch.current().getName() - if (addVersionDetails) { - project.version += "-" + repo.head().id.toString().substring(0, 12) + mods { + buildcraftcore { + source sourceSets.main + } + } } - } else { - if (addVersionDetails) { - project.version += "-SNAPSHOT" + + // This run config launches GameTestServer and runs all registered gametests, then exits. + // By default, the server will crash when no gametests are provided. + // The gametest system is also enabled by default for other run configs under the /test command. + gameTestServer { + workingDirectory project.file('run') + + // Recommended logging data for a userdev environment + // The markers can be added/remove as needed separated by commas. + // "SCAN": For mods scan. + // "REGISTRIES": For firing of registry events. + // "REGISTRYDUMP": For getting the contents of all registries. + property 'forge.logging.markers', 'REGISTRIES' + + // Recommended logging level for the console + // You can set various levels here. + // Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels + property 'forge.logging.console.level', 'debug' + + // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. + property 'forge.enabledGameTestNamespaces', 'buildcraftcore' + + mods { + buildcraftcore { + source sourceSets.main + } + } } - } - // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. + data { + workingDirectory project.file('run_data') - // replacing stuff in the source - replace "\$version", project.version - replace "\${mcversion}", version - // Replace @Mod.acceptedMinecraftVersions specially as it has to be a valid version in a dev environment :/ - replace "(gradle_replace_mcversion,)", "[" + version + "]" - replace "(gradle_replace_forgeversion,)", "[" + config.forge_version + ",)" - replace "\$bc_version", config.mod_version + property 'forge.logging.markers', 'REGISTRIES' - useDepAts = true -} + property 'forge.logging.console.level', 'debug' -compileJava { - options.compilerArgs << "-Xmaxerrs" << "2000" - options.compilerArgs << "-Xmaxwarns" << "2" - options.compilerArgs << "-Xlint:all" - options.compilerArgs << "-Xdiags:verbose" - options.compilerArgs << "-encoding" << "UTF-8" -} +// property 'forge.enabledGameTestNamespaces', 'buildcraftcore,buildcraftenergy,buildcraftfactory,buildcraftlib' -javadoc { - options.setUse(true) - options.addStringsOption("Xmaxerrs").setValue(["2000"]) - options.addStringsOption("Xmaxwarns").setValue(["2000"]) - options.addStringsOption("Xdoclint:all") - options.setEncoding("UTF-8") -} + // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. +// args '--mod', 'buildcraftcore', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') + args '--mod', 'buildcraftcore', '--all', '--output', file('BuildCraft/buildcraft_resources_generated/'), + '--existing', file('BuildCraft/buildcraft_resources/') -task setupSubProjects(dependsOn: "BuildCraft:sub_projects:expression:generateSources") { - // Just an inter-dependency task + mods { + buildcraftcore { + source sourceSets.main + } + } + } + } } -eclipseClasspath.dependsOn setupSubProjects -ideaModule.dependsOn setupSubProjects -compileApiJava.dependsOn setupSubProjects - -// configure the source folders +// Include resources generated by data generators. sourceSets { - api { + main { java { + srcDir "common" srcDir "BuildCraft/BuildCraftAPI/api" srcDir "BuildCraft/common" srcDir "BuildCraft/sub_projects/expression/src/main/java" srcDir "BuildCraft/sub_projects/expression/src/autogen/java" } resources { + srcDir "resources" + srcDir "mod_info" srcDir "BuildCraft/buildcraft_resources" + srcDir 'BuildCraft/buildcraft_resources_generated' + srcDir "BuildCraft/BuildCraft-Localization" srcDir "BuildCraft/BuildCraftGuide/guide_resources" + exclude "**/.md" // exclude readme from localization repo exclude "pack.png" // exclude from the guide repo - exclude "pack.mcmeta" // exclude from the guide repo + exclude '.cache' + exclude "pack.mcmeta_" + // Calen: we should not exclude the pack.mcmeta file in buildcraft_resources, or all the resources will be lost +// exclude "pack.mcmeta" // exclude from the guide repo } } - main { + api { java { - srcDir "common" + srcDir "BuildCraft/BuildCraftAPI/api" + srcDir "BuildCraft/common" + srcDir "BuildCraft/sub_projects/expression/src/main/java" + srcDir "BuildCraft/sub_projects/expression/src/autogen/java" } resources { - srcDir "resources" + srcDir "BuildCraft/buildcraft_resources" + srcDir "BuildCraft/BuildCraftGuide/guide_resources" + exclude "pack.png" // exclude from the guide repo + // exclude "pack.mcmeta" // exclude from the guide repo + } + } + test { + java { + srcDir "BuildCraft/src/test/java" + srcDir "BuildCraft/sub_projects/expression/src/test/java" } } } -// Obfuscated Jar location -ext.jarFile = zipTree(jar.archivePath) -processResources { - // replace stuff in mcmod.info, nothing else - from(sourceSets.main.resources.srcDirs) { - include 'mcmod.info' +//task setupSubProjects(dependsOn: "sub_projects:expression:generateSources") { +// // Just an inter-dependency task +//} - // replace version and mcversion - // ${version} and ${mcversion} are the exact strings being replaced - expand 'version': project.version, 'mcversion': project.minecraft.version, 'modid': config.modid - } - - // copy everything else, that's not the mcmod.info - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' - exclude 'pack.mcmeta' - exclude 'pack.png' - } -} - -def createAllModInfo() { - return new File("$projectDir/build/processing/compat-all/mcmod.info") +compileJava { + options.compilerArgs << "-Xmaxerrs" << "2000" + options.compilerArgs << "-Xmaxwarns" << "2" + options.compilerArgs << "-Xlint:all" + options.compilerArgs << "-Xdiags:verbose" + options.compilerArgs << "-encoding" << "UTF-8" } -task writeAllModInfo() { - outputs.upToDateWhen { false } - doLast { - File temp = createAllModInfo() - temp.parentFile.mkdirs() - if (temp.exists()) - temp.delete() - temp.createNewFile() - def elements = []; - for (int i = 0; i < mainModInfo.size(); i++) { - elements += mainModInfo[i]; - } - elements += compatModInfo[0]; - String prettyPrinted = groovy.json.JsonOutput.prettyPrint(groovy.json.JsonOutput.toJson(elements)) - prettyPrinted = prettyPrinted.replace("\$version", project.version) - prettyPrinted = prettyPrinted.replace("\${mcversion}", project.minecraft.version) - temp.write(prettyPrinted) - return temp - } +javadoc { + options.setUse(true) + options.addStringsOption("Xmaxerrs").setValue(["2000"]) + options.addStringsOption("Xmaxwarns").setValue(["2000"]) + options.addStringsOption("Xdoclint:all") + options.setEncoding("UTF-8") } def unzippedSourceJar = new File("$projectDir/build/processing/tasks/unzipped_src_jar/unzip") -def libsDir = new File(System.getenv("LIBS_DIR") ?: "build/libs/", project.version) +def libsDir = new File(System.getenv("LIBS_DIR") ?: "$projectDir/build/libs/", version) def modulesDir = new File(libsDir, "modules") - -// forge (or gradle?) creates a special sourceJar which has been processed -// This task unzips that created jar, so that partial source jars can be created. -task unzipSourceJar(type: Copy, dependsOn: sourceJar) { - from (zipTree(sourceJar.archivePath)) { - include "**" - } - into unzippedSourceJar +def modulesDirSrc = new File(modulesDir, "src") + +//// forge (or gradle?) creates a special sourceJar which has been processed +//// This task unzips that created jar, so that partial source jars can be created. +//task unzipSourceJar(type: Copy, dependsOn: sourceJar) { +// from (zipTree(sourceJar.archivePath)) { +// include "**" +// } +// into unzippedSourceJar +//} + +// add api classes to javadoc +javadoc { + source += sourceSets.api.allSource } -task compatJar(type: Jar, dependsOn:reobfJar) { - destinationDir = modulesDir - appendix = "compat" - version = project.version - - from(project.ext.jarFile) { - includes.addAll("**") - } +// add a javadoc jar +task javadocJar(type: Jar, dependsOn: javadoc) { + destinationDir = libsDir + appendix = "main" + classifier = 'javadoc' + from '$projectDir/build/docs/javadoc' } -task allJar(type: Jar, dependsOn: [reobfJar, writeAllModInfo]) { +// because the normal output has been made to be obfuscated +task deobfJar(type: Jar) { destinationDir = libsDir - appendix = "all" - version = project.version + appendix = "main" + from sourceSets.main.output + from sourceSets.api.output + classifier = 'dev' +} + +//task apiSrcJar(type: Jar, dependsOn: [build, unzipSourceJar]) { +// destinationDir = modulesDirSrc +// appendix = "api" +// classifier = 'sources' +// from sourceSets.api.allSource +//} +// specify artifacts to be uploaded +//artifacts { +// // the default jar is already here by default +// archives sourceJar +// archives javadocJar +// +// // Modules +// archives apiJar +// archives libJar +// archives coreJar +// archives buildersJar +// archives energyJar +// archives factoryJar +// archives siliconJar +// archives transportJar +// archives roboticsJar +// archives mainJar +//} + +//eclipseClasspath.dependsOn setupSubProjects +//ideaModule.dependsOn setupSubProjects +//compileJava.dependsOn setupSubProjects + +//runClient.jvmArgs += "-Dbuildcraft.dev=true" +//runData.jvmArgs += "-Dbuildcraft.dev=true" +//runServer.jvmArgs += "-Dbuildcraft.dev=true" + +//// Add API dir to the IDEA module +//idea.module.sourceDirs += sourceSets.api.java.srcDirs - from(createAllModInfo().parentFile) - from(project.ext.jarFile) { - includes.addAll("**") - exclude("mcmod.info") +repositories { + // Put repositories for dependencies here + // ForgeGradle automatically adds the Forge maven and Maven Central for you + + // If you have mod jar dependencies in ./libs, you can declare them as a repository like so: + flatDir { + dir 'libs' + } + + maven { + name 'prog' + url 'https://dvs1.progwml6.com/files/maven' + content { + includeGroup 'mezz.jei' + } + } + maven { + name 'CurseMaven' + url 'https://www.cursemaven.com' + content { + includeGroup 'curse.maven' + } + } + // JEI + maven { + // location of the maven that hosts JEI files before January 2023 + name = "Progwml6's maven" + url = "https://dvs1.progwml6.com/files/maven/" + } + maven { + // location of the maven that hosts JEI files since January 2023 + name = "Jared's maven" + url = "https://maven.blamejared.com/" + } + maven { + // location of a maven mirror for JEI files, as a fallback + name = "ModMaven" + url = "https://modmaven.dev" + } + // crafttweaker + maven { + url = 'https://maven.blamejared.com' + name = 'BlameJared Maven' + } + // TOP + maven { + url "https://maven.k-4u.nl/" + content { + includeGroup "mcjty" + } } } -task allSrcJar(type: Jar, dependsOn:[reobfJar, writeAllModInfo, unzipSourceJar]) { - destinationDir = libsDir - appendix = "all" - classifier = "sources" +//processResources { +// // replace stuff in mcmod.info, nothing else +// from(sourceSets.main.resources.srcDirs) { +//// include 'mcmod.info' +// include 'mods.toml' +// +// // replace version and mcversion +// // ${version} and ${mcversion} are the exact strings being replaced +//// expand 'version': project.version, 'mcversion': project.minecraft.version, 'modid': config.modid +// expand 'version': project.version, 'mcversion': config.mc_version, 'modid': config.modid +// } +// +// // copy everything else, that's not the mcmod.info +// from(sourceSets.main.resources.srcDirs) { +// exclude 'mods.toml' +// exclude 'pack.mcmeta' +// exclude 'pack.png' +// } +//} + +// Mixin +mixin { + add sourceSets.main, "refmap.buildcraft.json" + config 'mixins.buildcraft.json' + mixin.env.remapRefMap = true + debug = true + debug.verbose = true + debug.export = true +} + +dependencies { + // Specify the version of Minecraft to use. If this is any group other than 'net.minecraft', it is assumed + // that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied. + // The userdev artifact is a special name and will get all sorts of transformations applied to it. + +// minecraft 'net.minecraftforge:forge:1.18.2-40.1.0' + minecraft 'net.minecraftforge:forge:1.18.2-40.2.14' + + // Examples using mod jars from ./libs + + // JEI + compileOnly fg.deobf("mezz.jei:jei-" + config.mc_version + ":" + config.jei_version + ":api") + runtimeOnly fg.deobf("mezz.jei:jei-" + config.mc_version + ":" + config.jei_version) + + // Jade + implementation fg.deobf("curse.maven:jade-324717:" + config.jade_id) + + // CraftTweaker + implementation(fg.deobf("com.blamejared.crafttweaker:CraftTweaker-forge-" + config.mc_version + ":" + config.crafttweaker_version)) - from(createAllModInfo().parentFile) - from(unzippedSourceJar) { - includes.add("**") - exclude("mcmod.info") + // The One Probe + implementation(fg.deobf("curse.maven:the-one-probe-245211:3965688")) + + // Testing + testImplementation "junit:junit:4.12" + testImplementation 'org.hamcrest:hamcrest:2.2' +// compileOnly "junit:junit:4.12" + + // Mixin + annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' + // For more info... + // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html + // http://www.gradle.org/docs/current/userguide/dependency_management.html +} + +// Example for how to get properties into the manifest for reading at runtime. +jar { + manifest { + attributes([ + "Specification-Title" : "BuildCraft", + "Specification-Vendor" : "BuildCraft Team", + "Specification-Version" : project.version, + "Implementation-Title" : project.name, + "Implementation-Version" : project.jar.archiveVersion, + "Implementation-Vendor" : "BuildCraft Team", + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), + "MixinConfigs" : "mixins.buildcraft.json" + ]) } + include '**/**/**/libs/*' } -build.dependsOn compatJar, allJar, allSrcJar +// Example configuration to allow publishing using the maven-publish plugin +// This is the preferred method to reobfuscate your jar file +jar.finalizedBy('reobfJar') +// However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing +// publish.dependsOn('reobfJar') publishing { + publications { + mavenJava(MavenPublication) { + artifact jar + } + } repositories { maven { - url System.getenv("MAVEN_DIR") ?: "$projectDir/build/maven" + url "file://${project.projectDir}/mcmodsrepo" } } - publications { - pub_allJar(MavenPublication) { - groupId "com.mod-buildcraft" - artifactId "buildcraft-all" - version project.version +} - artifact allJar - } - pub_apiSrcJar(MavenPublication) { - groupId "com.mod-buildcraft" - artifactId "buildcraft-all" - version project.version +tasks.withType(JavaCompile).configureEach { + options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation +} - artifact allSrcJar - } - } +jar.enabled = true + +// enable Jar-in-Jar +jarJar.enable() + +tasks.named('jarJar') { + // ... } diff --git a/build.properties b/build.properties index 66c247b..0ac75ba 100644 --- a/build.properties +++ b/build.properties @@ -1,8 +1,19 @@ -compat_version=7.99.15 -jei_version=4.8.5.138 -top_version=1.12-1.4.19-11 -hwyla_version=1.8.22-B37_1.12 +mc_version=1.18.2 + +#compat_version=7.99.15 +compat_version=7.99.24.9 + +#jei_version=4.8.5.138 +jei_version=9.7.1.255 +#top_version=1.12-1.4.19-11 +top_version=1.18-5.1.2 +#hwyla_version=1.8.22-B37_1.12 + +jade_api_id=3803228 +jade_id=3803226 + forestry_version=5.7.0.236 -crafttweaker_version=4.1.9.491 +#crafttweaker_version=4.1.9.491 +crafttweaker_version=9.1.211 ic2_version=2.8.221-ex112 diff --git a/common/buildcraft/compat/BCCompat.java b/common/buildcraft/compat/BCCompat.java index 72fdbaa..9668a92 100644 --- a/common/buildcraft/compat/BCCompat.java +++ b/common/buildcraft/compat/BCCompat.java @@ -1,53 +1,45 @@ -/* - * Copyright (c) 2020 SpaceToad and the BuildCraft team - * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not - * distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/ - */ - package buildcraft.compat; -import java.util.HashMap; -import java.util.Map; - -import net.minecraftforge.common.config.Property; -import net.minecraftforge.fml.common.Mod; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.fml.common.network.NetworkRegistry; - import buildcraft.api.core.BCLog; - import buildcraft.compat.module.crafttweaker.CompatModuleCraftTweaker; -import buildcraft.compat.module.forestry.CompatModuleForestry; import buildcraft.compat.module.ic2.CompatModuleIndustrialCraft2; import buildcraft.compat.module.theoneprobe.CompatModuleTheOneProbe; -import buildcraft.compat.network.CompatGui; -import buildcraft.core.BCCoreConfig; - -//@formatter:off -@Mod( - modid = BCCompat.MODID, - name = "BuildCraft Compat", - version = BCCompat.VERSION, - updateJSON = "https://mod-buildcraft.com/version/versions-compat.json", - acceptedMinecraftVersions = "(gradle_replace_mcversion,)", - dependencies = BCCompat.DEPENDENCIES -) -//@formatter:on -public class BCCompat { +import buildcraft.core.BCCore; +import buildcraft.lib.config.ConfigCategory; +import buildcraft.lib.config.EnumRestartRequirement; +import buildcraft.lib.registry.RegistryConfig; +import buildcraft.lib.registry.TagManager; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; +import net.minecraftforge.fml.event.lifecycle.FMLConstructModEvent; +import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent; +import java.util.HashMap; +import java.util.Map; +import java.util.function.Consumer; + +//@Mod( +// modid = "buildcraftcompat", +// name = "BuildCraft Compat", +// version = "7.99.24.8", +// updateJSON = "https://mod-buildcraft.com/version/versions-compat.json", +// acceptedMinecraftVersions = "[1.12.2]", +// dependencies = "required-after:forge@[14.23.0.2544,);required-after:buildcraftcore@[7.99.24.8,);after:buildcrafttransport;after:buildcraftbuilders;after:buildcraftsilicon;after:theoneprobe;after:forestry;after:crafttweaker;after:ic2" +//) +@Mod(BCCompat.MODID) +@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) +public class BCCompat { static final String DEPENDENCIES = "required-after:forge@(gradle_replace_forgeversion,)"// - + ";required-after:buildcraftcore@[$bc_version,)"// - + ";after:buildcrafttransport"// - + ";after:buildcraftbuilders"// - + ";after:buildcraftsilicon"// - + ";after:theoneprobe"// - + ";after:forestry"// - + ";after:crafttweaker"// - + ";after:ic2"// - ; - + + ";required-after:buildcraftcore@[$bc_version,)"// + + ";after:buildcrafttransport"// + + ";after:buildcraftbuilders"// + + ";after:buildcraftsilicon"// + + ";after:theoneprobe"// + + ";after:forestry"// + + ";after:crafttweaker"// + + ";after:ic2"// + ; public static final String MODID = "buildcraftcompat"; public static final String VERSION = "$version"; public static final String GIT_BRANCH = "${git_branch}"; @@ -55,17 +47,27 @@ public class BCCompat { public static final String GIT_COMMIT_MSG = "${git_commit_msg}"; public static final String GIT_COMMIT_AUTHOR = "${git_commit_author}"; - @Mod.Instance(MODID) + // @Instance(MOD_ID) public static BCCompat instance; - private static final Map modules = new HashMap<>(); + private static final Map> moduleConfigs = new HashMap<>(); - private static void offerAndPreInitModule(final CompatModuleBase module) { + public BCCompat() { + instance = this; + } + + private static void offerAndPreInitModule(CompatModuleBase module) { String cModId = module.compatModId(); if (module.canLoad()) { - Property prop = BCCoreConfig.config.get("modules", cModId, true); - if (prop.getBoolean(true)) { + String _modules = "modules"; + ConfigCategory prop = BCCompatConfig.config + .define(_modules, + "", + EnumRestartRequirement.NONE, + cModId, true); + if (prop.get()) { modules.put(cModId, module); + moduleConfigs.put(cModId, prop); BCLog.logger.info("[compat] + " + cModId); module.preInit(); } else { @@ -76,9 +78,13 @@ private static void offerAndPreInitModule(final CompatModuleBase module) { } } - @Mod.EventHandler - public static void preInit(final FMLPreInitializationEvent evt) { + @SubscribeEvent + public static void preInit(FMLConstructModEvent evt) { + // Calen + RegistryConfig.useOtherModConfigFor(MODID, BCCore.MODID); + BCCompatConfig.preInit(); + // init BCLog.logger.info(""); BCLog.logger.info("Starting BuildCraftCompat " + VERSION); BCLog.logger.info("Copyright (c) the BuildCraft team, 2011-2017"); @@ -94,54 +100,70 @@ public static void preInit(final FMLPreInitializationEvent evt) { BCLog.logger.info("[compat] Module list:"); // List of all modules - offerAndPreInitModule(new CompatModuleForestry()); + // TODO Calen Forestry? +// offerAndPreInitModule(new CompatModuleForestry()); offerAndPreInitModule(new CompatModuleTheOneProbe()); offerAndPreInitModule(new CompatModuleCraftTweaker()); offerAndPreInitModule(new CompatModuleIndustrialCraft2()); // End of module list - } - - @Mod.EventHandler - public static void init(final FMLInitializationEvent evt) { - NetworkRegistry.INSTANCE.registerGuiHandler(instance, CompatGui.guiHandlerProxy); - // compatChannelHandler = new ChannelHandler(); - // MinecraftForge.EVENT_BUS.register(this); + // Calen + BCCompatProxy.getProxy().fmlPreInit(); + } - // compatChannelHandler.registerPacketType(PacketGenomeFilterChange.class); - // compatChannelHandler.registerPacketType(PacketTypeFilterChange.class); - // compatChannelHandler.registerPacketType(PacketRequestFilterSet.class); + /** This is called after config loaded. */ + private static void loadModules() { + modules.entrySet().forEach(entry -> + { + String cModId = entry.getKey(); + CompatModuleBase module = entry.getValue(); + if (moduleConfigs.get(cModId).get()) { + BCLog.logger.info("[compat] + " + cModId); + module.preInit(); + } else { + BCLog.logger.info("[compat] x " + cModId + " (It has been disabled in the config)"); + } + }); + } - for (final CompatModuleBase m : modules.values()) { + @SubscribeEvent + public static void init(FMLCommonSetupEvent evt) { + loadModules(); + // TODO Calen compat GUI??? +// NetworkRegistry.INSTANCE.registerGuiHandler(instance, CompatGui.guiHandlerProxy); + for (CompatModuleBase m : modules.values()) { m.init(); } } - @Mod.EventHandler - public static void postInit(final FMLPostInitializationEvent evt) { - for (final CompatModuleBase m : modules.values()) { + @SubscribeEvent + public static void postInit(FMLLoadCompleteEvent evt) { + for (CompatModuleBase m : modules.values()) { m.postInit(); } + + BCCompatConfig.saveConfigs(); } - // @Mod.EventHandler - // public void missingMapping(FMLMissingMappingsEvent event) { - // CompatModuleForestry.missingMapping(event); - // } - - // @SubscribeEvent - // @SideOnly(Side.CLIENT) - // public void handleTextureRemap(TextureStitchEvent.Pre event) { - // if (event.map.getTextureType() == 1) { - // TextureManager.getInstance().initIcons(event.map); - // } - // } - - // public static boolean isLoaded(String module) { - // return moduleNames.contains(module); - // } - - // public static boolean hasModule(final String module) { - // return BuildCraftCompat.moduleNames.contains(module); - // } + private static final TagManager tagManager = new TagManager(); + + static { + startBatch(); + + endBatch(TagManager.prependTags("buildcraftcompat:", TagManager.EnumTagType.REGISTRY_NAME) + .andThen(TagManager.setTab("buildcraft.main")) + ); + } + + private static TagManager.TagEntry registerTag(String id) { + return tagManager.registerTag(id); + } + + private static void startBatch() { + tagManager.startBatch(); + } + + private static void endBatch(Consumer consumer) { + tagManager.endBatch(consumer); + } } diff --git a/common/buildcraft/compat/BCCompatConfig.java b/common/buildcraft/compat/BCCompatConfig.java new file mode 100644 index 0000000..8ce5d63 --- /dev/null +++ b/common/buildcraft/compat/BCCompatConfig.java @@ -0,0 +1,56 @@ +package buildcraft.compat; + +import buildcraft.api.BCModules; +import buildcraft.lib.config.BCConfig; +import buildcraft.lib.config.ConfigCategory; +import buildcraft.lib.config.Configuration; +import buildcraft.lib.config.EnumRestartRequirement; + +public class BCCompatConfig { + public static Configuration config; + + // Calen: remove the json file + public static boolean coloredPipesVisible; + public static boolean facadesVisible; + private static ConfigCategory propColoredPipesVisible; + private static ConfigCategory propFacadesVisible; + + public static void preInit() { + // Start config + BCModules module = BCModules.COMPAT; + config = new Configuration(module); + createProps(); + reloadConfig(); +// BCCoreConfig.addReloadListener(BCEnergyConfig::reloadConfig); + BCConfig.registerReloadListener(module, BCCompatConfig::reloadConfig); + } + + public static void createProps() { + EnumRestartRequirement world = EnumRestartRequirement.WORLD; + + propColoredPipesVisible = config + .define("client", + "Should all colored pipes be visible in JEI/REI?", + world, + "colored_pipes_visible", false); + + propFacadesVisible = config + .define("client", + "Should all facades be visible in JEI/REI?", + world, + "facades_visible", false); + } + + public static void reloadConfig() { + coloredPipesVisible = propColoredPipesVisible.get(); + facadesVisible = propFacadesVisible.get(); + + saveConfigs(); + } + + public static void saveConfigs() { + if (config.hasChanged()) { + config.save(); + } + } +} diff --git a/common/buildcraft/compat/BCCompatProxy.java b/common/buildcraft/compat/BCCompatProxy.java new file mode 100644 index 0000000..1e79f0d --- /dev/null +++ b/common/buildcraft/compat/BCCompatProxy.java @@ -0,0 +1,41 @@ +package buildcraft.compat; + +import net.minecraftforge.fml.loading.FMLLoader; + +public abstract class BCCompatProxy { + private static BCCompatProxy proxy = null; + + public static BCCompatProxy getProxy() { + if (proxy == null) { + switch (FMLLoader.getDist()) { + case CLIENT: + proxy = new ClientProxy(); + break; + case DEDICATED_SERVER: + proxy = new ServerProxy(); + break; + } + } + return proxy; + } + + public void fmlPreInit() { + } + + public void fmlInit() { + } + + public void fmlPostInit() { + } + + public static class ServerProxy extends BCCompatProxy { + + } + + public static class ClientProxy extends BCCompatProxy { + @Override + public void fmlPreInit() { + super.fmlPreInit(); + } + } +} diff --git a/common/buildcraft/compat/CompatModuleBase.java b/common/buildcraft/compat/CompatModuleBase.java index 483f782..233b729 100644 --- a/common/buildcraft/compat/CompatModuleBase.java +++ b/common/buildcraft/compat/CompatModuleBase.java @@ -1,10 +1,11 @@ package buildcraft.compat; -import net.minecraftforge.fml.common.Loader; +import net.minecraftforge.fml.ModList; public abstract class CompatModuleBase { public boolean canLoad() { - return Loader.isModLoaded(this.compatModId()); +// return Loader.isModLoaded(this.compatModId()); + return ModList.get().isLoaded(this.compatModId()); } public abstract String compatModId(); diff --git a/common/buildcraft/compat/CompatUtils.java b/common/buildcraft/compat/CompatUtils.java index 876fd34..b3550b5 100644 --- a/common/buildcraft/compat/CompatUtils.java +++ b/common/buildcraft/compat/CompatUtils.java @@ -1,29 +1,29 @@ package buildcraft.compat; -import java.util.List; - +import buildcraft.compat.network.IGuiCreator; +import buildcraft.lib.misc.StackUtil; +import buildcraft.lib.tile.item.ItemHandlerSimple; import com.google.common.collect.Lists; - -import net.minecraft.item.ItemStack; - +import net.minecraft.world.item.ItemStack; import net.minecraftforge.common.capabilities.Capability; +import net.minecraftforge.common.capabilities.CapabilityManager; +import net.minecraftforge.common.capabilities.CapabilityToken; +import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.common.Mod; -import buildcraft.api.core.CapabilitiesHelper; - -import buildcraft.lib.tile.item.ItemHandlerSimple; - -import buildcraft.compat.network.IGuiCreator; +import java.util.List; +@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD, modid = BCCompat.MODID) public class CompatUtils { + public static final Capability CAP_GUI_CREATOR = CapabilityManager.get(new CapabilityToken<>() { + }); - public static final Capability CAP_GUI_CREATOR = - CapabilitiesHelper.registerCapability(IGuiCreator.class); - - private CompatUtils() {} + private CompatUtils() { + } public static List compactInventory(ItemHandlerSimple inventory) { List stacks = Lists.newArrayList(); - for (int slot = 0; slot < inventory.getSlots(); slot++) { ItemStack stack = inventory.getStackInSlot(slot); if (stack.isEmpty()) { @@ -32,7 +32,8 @@ public static List compactInventory(ItemHandlerSimple inventory) { boolean handled = false; for (ItemStack existing : stacks) { - if (existing.isItemEqual(stack)) { +// if (existing.isItemEqual(stack)) + if (StackUtil.isSameItemSameDamage(existing, stack)) { existing.grow(stack.getCount()); handled = true; break; @@ -45,4 +46,10 @@ public static List compactInventory(ItemHandlerSimple inventory) { return stacks; } + + // Calen + @SubscribeEvent + public static void registerCapability(RegisterCapabilitiesEvent event) { + event.register(IGuiCreator.class); + } } diff --git a/common/buildcraft/compat/module/crafttweaker/AssemblyTable.java b/common/buildcraft/compat/module/crafttweaker/AssemblyTable.java index a06e22c..37cbc3f 100644 --- a/common/buildcraft/compat/module/crafttweaker/AssemblyTable.java +++ b/common/buildcraft/compat/module/crafttweaker/AssemblyTable.java @@ -1,105 +1,186 @@ package buildcraft.compat.module.crafttweaker; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.ImmutableSet.Builder; - -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.Ingredient; -import net.minecraft.util.ResourceLocation; - import buildcraft.api.mj.MjAPI; -import buildcraft.api.recipes.AssemblyRecipeBasic; +import buildcraft.api.recipes.IAssemblyRecipe; import buildcraft.api.recipes.IngredientStack; - -import buildcraft.lib.recipe.AssemblyRecipeRegistry; - -import crafttweaker.CraftTweakerAPI; -import crafttweaker.IAction; -import crafttweaker.annotations.ModOnly; -import crafttweaker.api.item.IIngredient; -import crafttweaker.api.item.IItemStack; -import crafttweaker.api.minecraft.CraftTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; - -@ZenClass("mods.buildcraft.AssemblyTable") -@ModOnly("buildcraftsilicon") -public class AssemblyTable { +import buildcraft.lib.recipe.assembly.AssemblyRecipe; +import buildcraft.lib.recipe.assembly.AssemblyRecipeBasic; +import buildcraft.lib.recipe.assembly.IFacadeAssemblyRecipes; +import buildcraft.silicon.recipe.FacadeAssemblyRecipes; +import com.blamejared.crafttweaker.api.CraftTweakerAPI; +import com.blamejared.crafttweaker.api.action.recipe.ActionAddRecipe; +import com.blamejared.crafttweaker.api.action.recipe.ActionRemoveRecipeByName; +import com.blamejared.crafttweaker.api.annotation.ZenRegister; +import com.blamejared.crafttweaker.api.ingredient.IIngredient; +import com.blamejared.crafttweaker.api.item.IItemStack; +import com.blamejared.crafttweaker.api.recipe.handler.IRecipeHandler; +import com.blamejared.crafttweaker.api.recipe.manager.base.IRecipeManager; +import com.blamejared.crafttweaker.api.util.ItemStackUtil; +import com.blamejared.crafttweaker.api.util.StringUtil; +import com.google.common.collect.ImmutableSet; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.item.crafting.RecipeType; +import org.openzen.zencode.java.ZenCodeGlobals; +import org.openzen.zencode.java.ZenCodeType; + +import java.util.stream.Collectors; + +//@ZenClass("mods.buildcraft.AssemblyTable") +//@ModOnly("buildcraftsilicon") +@ZenRegister +@ZenCodeType.Name("mods.buildcraft.AssemblyTable") +@IRecipeHandler.For(IAssemblyRecipe.class) +//public class AssemblyTable +public enum AssemblyTable implements IRecipeManager, IRecipeHandler { + @ZenCodeGlobals.Global("assemblyTable") + INSTANCE; private static int ids; - @ZenMethod - public static void addRecipe(IItemStack output, int power, IIngredient[] ingredients) { - addRecipe0("auto_" + ids++, output, power, ingredients); - } - - @ZenMethod - public static void addRecipe(String name, IItemStack output, int power, IIngredient[] ingredients) { +// // @ZenMethod +// @ZenCodeType.Method +// // public static void addRecipe(IItemStack output, int power, IIngredient[] ingredients) +// public void addRecipe(IItemStack output, int power, IIngredient[] ingredients) { +// addRecipe0("auto_" + ids++, output, power, ingredients); +// } + + // @ZenMethod + @ZenCodeType.Method +// public static void addRecipe(String name, IItemStack output, int power, IIngredient[] ingredients) + public void addRecipe(String name, IItemStack output, int power, IIngredient[] ingredients) { addRecipe0("custom/" + name, output, power, ingredients); } - private static void addRecipe0(String name, IItemStack output, int power, IIngredient[] ingredients) { - CraftTweakerAPI.apply(new AddRecipeAction(name, output, power, ingredients)); + // @ZenMethod + @ZenCodeType.Method +// public static void addRecipe(String name, IItemStack output, int power, IIngredient[] ingredients) + public void enableFacadeAssembly() { + enableFacadeAssembly0(); } - @ZenMethod - public static void removeByName(String name) { - CraftTweakerAPI.apply(new RemoveRecipeByNameAction(new ResourceLocation(name))); + // private static void addRecipe0(String name, IItemStack output, int power, IIngredient[] ingredients) + private void addRecipe0(String name, IItemStack output, int power, IIngredient[] ingredients) { +// CraftTweakerAPI.apply(new AddRecipeAction(name, output, power, ingredients)); + CraftTweakerAPI.apply(AddRecipeAction.create(this, name, output, power, ingredients)); } - // ###################### - // ### Action classes ### - // ###################### + // private static void addRecipe0(String name, IItemStack output, int power, IIngredient[] ingredients) + private void enableFacadeAssembly0() { +// CraftTweakerAPI.apply(new AddRecipeAction(name, output, power, ingredients)); + CraftTweakerAPI.apply(AddRecipeAction.createFacadeRecipe(this)); + } - private static class AddRecipeAction implements IAction { + // @ZenMethod + @ZenCodeType.Method + @Override + // public static void removeByName(String name) + public void removeByName(String name) { +// CraftTweakerAPI.apply(new RemoveRecipeByNameAction(new ResourceLocation(name))); + CraftTweakerAPI.apply(new RemoveRecipeByNameAction(this, new ResourceLocation(name))); + } - private final ItemStack output; - private final ResourceLocation name; - private final long requiredMj; - private final ImmutableSet requiredStacks; + @Override + public RecipeType getRecipeType() { + return IAssemblyRecipe.TYPE; + } - public AddRecipeAction(String name, IItemStack output, int power, IIngredient[] ingredients) { - this.output = CraftTweakerMC.getItemStack(output); + @Override + public String dumpToCommandString(final IRecipeManager manager, IAssemblyRecipe recipe) { + if (recipe instanceof IFacadeAssemblyRecipes) { + return String.format( + "assemblyTable.enableFacadeAssembly();" + ); + } else { + return String.format( + "assemblyTable.addRecipe(%s, %s, %s, %s);", + StringUtil.quoteAndEscape(recipe.getId()), + ItemStackUtil.getCommandString(recipe.getOutputPreviews().stream().toList().get(0)), + recipe.getRequiredMicroJoules(), + recipe.getRequiredIngredientStacks().stream() + .map(i -> IIngredient.fromIngredient(i.ingredient)) + .map(IIngredient::getCommandString) + .collect(Collectors.joining(", ", "[", "]")) + ); + } + } - Builder stacks = ImmutableSet.builder(); - for (int i = 0; i < ingredients.length; i++) { - IIngredient ctIng = ingredients[i]; - Ingredient ingredient = CraftTweakerMC.getIngredient(ctIng); - stacks.add(new IngredientStack(ingredient, Math.max(1, ctIng.getAmount()))); - } - requiredStacks = stacks.build(); + // private static class RemoveRecipeByNameAction implements IAction + private static class RemoveRecipeByNameAction extends ActionRemoveRecipeByName { + private final ResourceLocation name; - this.requiredMj = power * MjAPI.MJ; - this.name = new ResourceLocation("crafttweaker", name); + // RemoveRecipeByNameAction(ResourceLocation name) + RemoveRecipeByNameAction(IRecipeManager manager, ResourceLocation name) { + super(manager); + this.name = name; } - @Override public void apply() { - AssemblyRecipeRegistry.REGISTRY.put(name, - new AssemblyRecipeBasic(name, requiredMj, requiredStacks, output)); +// AssemblyRecipeRegistry.REGISTRY.remove(this.name); + getManager().removeByName(this.name.toString()); } - @Override public String describe() { - return "Adding assembly table recipe for " + output; + return "Removing assembly table recipe " + this.name; } } - private static class RemoveRecipeByNameAction implements IAction { - private final ResourceLocation name; + // private static class AddRecipeAction implements IAction + private static class AddRecipeAction extends ActionAddRecipe { +// private final ItemStack output; +// private final ResourceLocation name; +// private final long requiredMj; +// private final ImmutableSet requiredStacks; + + // public AddRecipeAction(IRecipeManager manager, String name, IItemStack output, int power, IIngredient[] ingredients) + private AddRecipeAction(IRecipeManager manager, AssemblyRecipe recipe) { + super(manager, recipe); +// this.output = CraftTweakerMC.getItemStack(output); +// ImmutableSet.Builder stacks = ImmutableSet.builder(); +// +// for (int i = 0; i < ingredients.length; ++i) { +// IIngredient ctIng = ingredients[i]; +// Ingredient ingredient = CraftTweakerMC.getIngredient(ctIng); +// stacks.add(new IngredientStack(ingredient, Math.max(1, ctIng.getAmount()))); +// } +// +// this.requiredStacks = stacks.build(); +// this.requiredMj = (long) power * MjAPI.MJ; +// this.name = new ResourceLocation("crafttweaker", name); + } - RemoveRecipeByNameAction(ResourceLocation name) { - this.name = name; + public static AddRecipeAction create(IRecipeManager manager, String name, IItemStack output, int power, IIngredient[] ingredients) { +// ItemStack output = CraftTweakerMC.getItemStack(output); + ItemStack _output = output.getImmutableInternal(); + ImmutableSet.Builder stacks = ImmutableSet.builder(); + + for (int i = 0; i < ingredients.length; ++i) { + IIngredient ctIng = ingredients[i]; +// Ingredient ingredient = CraftTweakerMC.getIngredient(ctIng); + Ingredient ingredient = ctIng.asVanillaIngredient(); +// stacks.add(new IngredientStack(ingredient, Math.max(1, ctIng.getAmount()))); + stacks.add(new IngredientStack(ingredient, Math.max(1, ctIng.asIIngredientWithAmount().getAmount()))); + } + + ImmutableSet requiredStacks = stacks.build(); + long requiredMj = (long) power * MjAPI.MJ; + ResourceLocation _name = new ResourceLocation("crafttweaker", name); + AssemblyRecipeBasic recipe = new AssemblyRecipeBasic(_name, requiredMj, requiredStacks, _output); + return new AddRecipeAction(manager, recipe); } - @Override - public void apply() { - AssemblyRecipeRegistry.REGISTRY.remove(name); + public static AddRecipeAction createFacadeRecipe(IRecipeManager manager) { + return new AddRecipeAction(manager, FacadeAssemblyRecipes.INSTANCE); } - @Override +// public void apply() { +// AssemblyRecipeRegistry.REGISTRY.put(this.name, new AssemblyRecipeBasic(this.name, this.requiredMj, this.requiredStacks, this.output)); +// } + public String describe() { - return "Removing assembly table recipe " + name; +// return "Adding assembly table recipe for " + this.output; + return "Adding assembly table recipe for " + this.recipe.getOutputPreviews().stream().toList().get(0); } } } diff --git a/common/buildcraft/compat/module/crafttweaker/CombustionEngine.java b/common/buildcraft/compat/module/crafttweaker/CombustionEngine.java index f1cb66a..30ecb90 100644 --- a/common/buildcraft/compat/module/crafttweaker/CombustionEngine.java +++ b/common/buildcraft/compat/module/crafttweaker/CombustionEngine.java @@ -1,153 +1,198 @@ package buildcraft.compat.module.crafttweaker; -import net.minecraftforge.fluids.FluidStack; - -import buildcraft.api.fuels.BuildcraftFuelRegistry; +import buildcraft.api.fuels.IFluidCoolant; +import buildcraft.api.fuels.IFuel; +import buildcraft.api.fuels.IFuelManager; import buildcraft.api.mj.MjAPI; +import buildcraft.lib.recipe.fuel.FuelRegistry; +import com.blamejared.crafttweaker.api.CraftTweakerAPI; +import com.blamejared.crafttweaker.api.action.recipe.ActionAddRecipe; +import com.blamejared.crafttweaker.api.annotation.ZenRegister; +import com.blamejared.crafttweaker.api.fluid.IFluidStack; +import com.blamejared.crafttweaker.api.recipe.handler.IRecipeHandler; +import com.blamejared.crafttweaker.api.recipe.manager.base.IRecipeManager; +import com.blamejared.crafttweaker.api.util.StringUtil; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.level.material.EmptyFluid; +import net.minecraftforge.fluids.FluidStack; +import org.openzen.zencode.java.ZenCodeGlobals; +import org.openzen.zencode.java.ZenCodeType; -import buildcraft.lib.engine.TileEngineBase_BC8; - -import crafttweaker.CraftTweakerAPI; -import crafttweaker.IAction; -import crafttweaker.annotations.ModOnly; -import crafttweaker.api.liquid.ILiquidStack; -import crafttweaker.api.minecraft.CraftTweakerMC; -import stanhebben.zenscript.annotations.ZenClass; -import stanhebben.zenscript.annotations.ZenMethod; +//@ZenClass("mods.buildcraft.CombustionEngine") +//@ModOnly("buildcraftenergy") +@ZenRegister +@ZenCodeType.Name("mods.buildcraft.CombustionEngine") +@IRecipeHandler.For(IFuel.class) +//public class CombustionEngine +public enum CombustionEngine implements IRecipeManager, IRecipeHandler { + @ZenCodeGlobals.Global("combustionEngine") + INSTANCE; -@ZenClass("mods.buildcraft.CombustionEngine") -@ModOnly("buildcraftenergy") -public class CombustionEngine { + private static final double MAX_POWER = 100000.0; - private static final double MAX_POWER - = (TileEngineBase_BC8.MAX_HEAT - TileEngineBase_BC8.MIN_HEAT) / TileEngineBase_BC8.HEAT_PER_MJ; + // @ZenMethod + @ZenCodeType.Method + public void addCleanFuel(String name, IFluidStack liquid, double powerPerTick, int timePerBucket) { + addCleanFuel0("custom/" + name, liquid, powerPerTick, timePerBucket); + } - @ZenMethod - public static void addCleanFuel(ILiquidStack liquid, double powerPerTick, int timePerBucket) { - FluidStack fluid = CraftTweakerMC.getLiquidStack(liquid); - if (fluid == null) { - throw new IllegalArgumentException("Fluid was null!"); - } - if (BuildcraftFuelRegistry.fuel.getFuel(fluid) != null) { + // @ZenMethod + // @ZenCodeType.Method + // public static void addCleanFuel(ILiquidStack liquid, double powerPerTick, int timePerBucket) + private void addCleanFuel0(String name, IFluidStack liquid, double powerPerTick, int timePerBucket) { +// FluidStack fluid = CraftTweakerMC.getLiquidStack(liquid); + FluidStack fluid = liquid.getImmutableInternal(); +// if (fluid == null) + if (fluid.getFluid() == null || fluid.getFluid() instanceof EmptyFluid) { + throw new IllegalArgumentException("Fluid was null or empty!"); + } +// else if (BuildcraftFuelRegistry.fuel.getFuel(fluid) != null) + else if (getAllRecipes().stream().anyMatch(r -> r.getFluid().equals(fluid))) { throw new IllegalArgumentException("The fluid " + fluid + " is already registered as a fuel!"); } - if (BuildcraftFuelRegistry.coolant.getCoolant(fluid) != null) { - throw new IllegalArgumentException( - "The fluid " + fluid - + " is already registered as a coolant - so it won't work very well if you add it as a fuel too!" - ); - } - if (powerPerTick <= 0) { +// else if (BuildcraftFuelRegistry.coolant.getCoolant(fluid) != null) + else if (Coolant.INSTANCE.getAllRecipes().stream().anyMatch(r -> r instanceof IFluidCoolant fluidCoolant && fluidCoolant.getFluid().equals(fluid))) { + throw new IllegalArgumentException("The fluid " + fluid + " is already registered as a coolant - so it won't work very well if you add it as a fuel too!"); + } else if (powerPerTick <= 0.0) { throw new IllegalArgumentException("Power was less than or equal to 0!"); + } else if (powerPerTick > 100000.0) { + throw new IllegalArgumentException("Maximum power is 100000.0, as any values above this would instantly bring the engine to overheat."); + } else { + long mj = (long) ((double) MjAPI.MJ * powerPerTick); +// CraftTweakerAPI.apply(new AddCleanFuel(fluid, mj, timePerBucket)); + CraftTweakerAPI.apply(AddCleanFuel.create(this, name, fluid, mj, timePerBucket)); } - if (powerPerTick > MAX_POWER) { - throw new IllegalArgumentException( - "Maximum power is " + MAX_POWER - + ", as any values above this would instantly bring the engine to overheat." - ); - } - long mj = (long) (MjAPI.MJ * powerPerTick); - CraftTweakerAPI.apply(new AddCleanFuel(fluid, mj, timePerBucket)); } - @ZenMethod - public static void addDirtyFuel(ILiquidStack lFuel, double powerPerTick, int timePerBucket, ILiquidStack lResidue) { - FluidStack fuel = CraftTweakerMC.getLiquidStack(lFuel); - FluidStack residue = CraftTweakerMC.getLiquidStack(lResidue); - if (fuel.getFluid() == null) { - throw new IllegalArgumentException("Fuel fluid was null!"); - } - if (residue.getFluid() == null) { - throw new IllegalArgumentException("Residue fluid was null!"); - } - if (BuildcraftFuelRegistry.fuel.getFuel(fuel) != null) { + // @ZenMethod + @ZenCodeType.Method + public void addDirtyFuel(String name, IFluidStack lFuel, double powerPerTick, int timePerBucket, IFluidStack lResidue) { + addDirtyFuel0("custom/" + name, lFuel, powerPerTick, timePerBucket, lResidue); + } + + // @ZenMethod + // @ZenCodeType.Method + // public static void addDirtyFuel(ILiquidStack lFuel, double powerPerTick, int timePerBucket, ILiquidStack lResidue) + private void addDirtyFuel0(String name, IFluidStack lFuel, double powerPerTick, int timePerBucket, IFluidStack lResidue) { +// FluidStack fuel = CraftTweakerMC.getLiquidStack(lFuel); + FluidStack fuel = lFuel.getImmutableInternal(); +// FluidStack residue = CraftTweakerMC.getLiquidStack(lResidue); + FluidStack residue = lResidue.getImmutableInternal(); +// if (fuel.getFluid() == null) + if (fuel.getFluid() == null || fuel.getFluid() instanceof EmptyFluid) { +// throw new IllegalArgumentException("Fuel fluid was null!"); + throw new IllegalArgumentException("Fuel fluid was null or empty!"); + } +// else if (residue.getFluid() == null) + else if (residue.getFluid() == null || residue.getFluid() instanceof EmptyFluid) { +// throw new IllegalArgumentException("Residue fluid was null!"); + throw new IllegalArgumentException("Residue fluid was null or empty!"); + } +// else if (BuildcraftFuelRegistry.fuel.getFuel(fuel) != null) + else if (getAllRecipes().stream().anyMatch(r -> r.getFluid().equals(fuel))) { throw new IllegalArgumentException("The fluid " + fuel + " is already registered as a fuel!"); } - if (BuildcraftFuelRegistry.coolant.getCoolant(fuel) != null) { - throw new IllegalArgumentException( - "The fluid " + fuel - + " is already registered as a coolant - so it won't work very well if you add it as a fuel too!" - ); - } - if (powerPerTick <= 0) { +// else if (BuildcraftFuelRegistry.coolant.getCoolant(fuel) != null) + else if (Coolant.INSTANCE.getAllRecipes().stream().anyMatch(r -> r instanceof IFluidCoolant fluidCoolant && fluidCoolant.getFluid().equals(fuel))) { + throw new IllegalArgumentException("The fluid " + fuel + " is already registered as a coolant - so it won't work very well if you add it as a fuel too!"); + } else if (powerPerTick <= 0.0) { throw new IllegalArgumentException("Power was less than or equal to 0!"); + } else if (powerPerTick > 100000.0) { + throw new IllegalArgumentException("Maximum power is 100000.0, as any values above this would instantly bring the engine to overheat."); + } else { + long mj = (long) ((double) MjAPI.MJ * powerPerTick); +// CraftTweakerAPI.apply(new AddDirtyFuel(fuel, mj, timePerBucket, residue)); + CraftTweakerAPI.apply(AddDirtyFuel.create(this, name, fuel, mj, timePerBucket, residue)); } - if (powerPerTick > MAX_POWER) { - throw new IllegalArgumentException( - "Maximum power is " + MAX_POWER - + ", as any values above this would instantly bring the engine to overheat." - ); - } - long mj = (long) (MjAPI.MJ * powerPerTick); - CraftTweakerAPI.apply(new AddDirtyFuel(fuel, mj, timePerBucket, residue)); } - // @ZenMethod - // public static void addLiquidCoolant(FluidStack coolant) { - // - // } - // - // @ZenMethod - // public static void addSolidCoolant(ItemStack stack, FluidStack coolant) { - // - // } - - // ###################### - // ### Action classes ### - // ###################### + @Override + public RecipeType getRecipeType() { + return IFuel.TYPE; + } - static final class AddCleanFuel implements IAction { + @Override + public String dumpToCommandString(final IRecipeManager manager, IFuel recipe) { + if (recipe instanceof IFuelManager.IDirtyFuel dirtyFuel) { + return String.format( + "combustionEngine.addDirtyFuel(%s, %s, %s, %s, %s);", + StringUtil.quoteAndEscape(recipe.getId()), + StringUtil.quoteAndEscape(recipe.getFluid().getFluid().getRegistryName()), + recipe.getPowerPerCycle(), + recipe.getTotalBurningTime(), + StringUtil.quoteAndEscape(dirtyFuel.getResidue().getFluid().getRegistryName()) + ); + } else { + return String.format( + "combustionEngine.addCleanFuel(%s, %s, %s, %s);", + StringUtil.quoteAndEscape(recipe.getId()), + StringUtil.quoteAndEscape(recipe.getFluid().getFluid().getRegistryName()), + recipe.getPowerPerCycle(), + recipe.getTotalBurningTime() + ); + } + } - private final FluidStack fluid; - private final long powerPerTick; - private final int totalBurningTime; + // static final class AddDirtyFuel implements IAction + static final class AddDirtyFuel extends ActionAddRecipe { +// private final FluidStack fuel; +// private final FluidStack residue; +// private final long powerPerTick; +// private final int totalBurningTime; - public AddCleanFuel(FluidStack fluid, long powerPerCycle, int totalBurningTime) { - this.fluid = fluid; - this.powerPerTick = powerPerCycle; - this.totalBurningTime = totalBurningTime; + // public AddDirtyFuel(FluidStack fuel, long powerPerCycle, int totalBurningTime, FluidStack residue) + private AddDirtyFuel(IRecipeManager manager, IFuel recipe) { + super(manager, recipe); +// this.fuel = fuel; +// this.powerPerTick = powerPerCycle; +// this.totalBurningTime = totalBurningTime; +// this.residue = residue; } - @Override - public void apply() { - BuildcraftFuelRegistry.fuel.addFuel(fluid, powerPerTick, totalBurningTime); + // Calen + public static AddDirtyFuel create(IRecipeManager manager, String name, FluidStack fuel, long powerPerCycle, int totalBurningTime, FluidStack residue) { + ResourceLocation _name = new ResourceLocation("crafttweaker", name); + return new AddDirtyFuel(manager, new FuelRegistry.DirtyFuel(_name, fuel, powerPerCycle, totalBurningTime, residue)); } - @Override +// public void apply() { +// BuildcraftFuelRegistry.fuel.addDirtyFuel(this.fuel, this.powerPerTick, this.totalBurningTime, this.residue); +// } + public String describe() { - return "Adding combustion engine fuel " + fluid; +// return "Adding combustion engine fuel " + this.fuel; + return "Adding combustion engine fuel " + this.recipe.getFluid(); } } - static final class AddDirtyFuel implements IAction { - - private final FluidStack fuel, residue; - private final long powerPerTick; - private final int totalBurningTime; + // static final class AddCleanFuel implements IAction + static final class AddCleanFuel extends ActionAddRecipe { +// private final FluidStack fluid; +// private final long powerPerTick; +// private final int totalBurningTime; - public AddDirtyFuel(FluidStack fuel, long powerPerCycle, int totalBurningTime, FluidStack residue) { - this.fuel = fuel; - this.powerPerTick = powerPerCycle; - this.totalBurningTime = totalBurningTime; - this.residue = residue; + // public AddCleanFuel(FluidStack fluid, long powerPerCycle, int totalBurningTime) + public AddCleanFuel(IRecipeManager manager, IFuel recipe) { + super(manager, recipe); +// this.fluid = fluid; +// this.powerPerTick = powerPerCycle; +// this.totalBurningTime = totalBurningTime; } - @Override - public void apply() { - BuildcraftFuelRegistry.fuel.addDirtyFuel(fuel, powerPerTick, totalBurningTime, residue); + // Calen + public static AddCleanFuel create(IRecipeManager manager, String name, FluidStack fluid, long powerPerCycle, int totalBurningTime) { + ResourceLocation _name = new ResourceLocation("crafttweaker", name); + return new AddCleanFuel(manager, new FuelRegistry.Fuel(_name, fluid, powerPerCycle, totalBurningTime)); } - @Override +// public void apply() { +// BuildcraftFuelRegistry.fuel.addFuel(this.fluid, this.powerPerTick, this.totalBurningTime); +// } + public String describe() { - return "Adding combustion engine fuel " + fuel; +// return "Adding combustion engine fuel " + this.fluid; + return "Adding combustion engine fuel " + this.recipe.getFluid(); } } - - // static final class AddLiquidCoolant implements IAction { - // - // } - // - // static final class AddSolidCoolant implements IAction { - // - // } } diff --git a/common/buildcraft/compat/module/crafttweaker/CompatModuleCraftTweaker.java b/common/buildcraft/compat/module/crafttweaker/CompatModuleCraftTweaker.java index 7e93009..1f43709 100644 --- a/common/buildcraft/compat/module/crafttweaker/CompatModuleCraftTweaker.java +++ b/common/buildcraft/compat/module/crafttweaker/CompatModuleCraftTweaker.java @@ -2,17 +2,17 @@ import buildcraft.compat.CompatModuleBase; -import crafttweaker.CraftTweakerAPI; - public class CompatModuleCraftTweaker extends CompatModuleBase { - @Override + public CompatModuleCraftTweaker() { + } + public String compatModId() { return "crafttweaker"; } - @Override public void preInit() { - CraftTweakerAPI.registerClass(AssemblyTable.class); - CraftTweakerAPI.registerClass(CombustionEngine.class); +// CraftTweakerAPI.registerClass(AssemblyTable.class); +// CraftTweakerAPI.getRegistry()..registerClass(AssemblyTable.class); +// CraftTweakerAPI.registerClass(CombustionEngine.class); } } diff --git a/common/buildcraft/compat/module/crafttweaker/Coolant.java b/common/buildcraft/compat/module/crafttweaker/Coolant.java new file mode 100644 index 0000000..397f3a6 --- /dev/null +++ b/common/buildcraft/compat/module/crafttweaker/Coolant.java @@ -0,0 +1,129 @@ +package buildcraft.compat.module.crafttweaker; + +import buildcraft.api.fuels.ICoolant; +import buildcraft.api.fuels.IFluidCoolant; +import buildcraft.api.fuels.ISolidCoolant; +import buildcraft.lib.recipe.coolant.CoolantRegistry; +import com.blamejared.crafttweaker.api.CraftTweakerAPI; +import com.blamejared.crafttweaker.api.action.recipe.ActionAddRecipe; +import com.blamejared.crafttweaker.api.annotation.ZenRegister; +import com.blamejared.crafttweaker.api.fluid.IFluidStack; +import com.blamejared.crafttweaker.api.item.IItemStack; +import com.blamejared.crafttweaker.api.recipe.handler.IRecipeHandler; +import com.blamejared.crafttweaker.api.recipe.manager.base.IRecipeManager; +import com.blamejared.crafttweaker.api.util.ItemStackUtil; +import com.blamejared.crafttweaker.api.util.StringUtil; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraft.world.level.material.EmptyFluid; +import net.minecraftforge.fluids.FluidStack; +import org.openzen.zencode.java.ZenCodeGlobals; +import org.openzen.zencode.java.ZenCodeType; + +@ZenRegister +@ZenCodeType.Name("mods.buildcraft.Coolant") +@IRecipeHandler.For(ICoolant.class) +public enum Coolant implements IRecipeManager, IRecipeHandler { + @ZenCodeGlobals.Global("coolant") + INSTANCE; + + @ZenCodeType.Method + public void addFluidCoolant(String name, IFluidStack liquid, float degreesCoolingPerMB) { + addFluidCoolant0("custom/" + name, liquid, degreesCoolingPerMB); + } + + private void addFluidCoolant0(String name, IFluidStack liquid, float degreesCoolingPerMB) { + FluidStack fluid = liquid.getImmutableInternal(); + if (fluid == null) { + throw new IllegalArgumentException("Fluid was null!"); + } else if (getAllRecipes().stream().anyMatch(r -> r instanceof IFluidCoolant fluidCoolant && fluidCoolant.getFluid().equals(fluid))) { + throw new IllegalArgumentException("The fluid " + fluid + " is already registered as a coolant!"); + } else if (CombustionEngine.INSTANCE.getAllRecipes().stream().anyMatch(r -> r.getFluid().equals(fluid))) { + throw new IllegalArgumentException("The fluid " + fluid + " is already registered as a fuel - so it won't work very well if you add it as a coolant too!"); + } else if (degreesCoolingPerMB <= 0.0) { + throw new IllegalArgumentException("Degrees cooling per MB was less than or equal to 0!"); + } else { + CraftTweakerAPI.apply(AddFluidCoolant.create(this, name, fluid, degreesCoolingPerMB)); + } + } + + // @ZenMethod + @ZenCodeType.Method + public void addSolidCoolant(String name, IItemStack item, IFluidStack lFuel, float multiplier) { + addSolidCoolant0("custom/" + name, item, lFuel, multiplier); + } + + private void addSolidCoolant0(String name, IItemStack itemIn, IFluidStack fluidIn, float multiplier) { + ItemStack item = itemIn.getImmutableInternal(); + FluidStack fluid = fluidIn.getImmutableInternal(); + if (item.getItem() == Items.AIR) { + throw new IllegalArgumentException("Coolant item was air!"); + } else if (fluid.getFluid() == null || fluid.getFluid() instanceof EmptyFluid) { + throw new IllegalArgumentException("Fluid was null or empty!"); + } else if (getAllRecipes().stream().anyMatch(r -> r instanceof ISolidCoolant solidCoolant && solidCoolant.getSolid().equals(item))) { + throw new IllegalArgumentException("The item " + item + " is already registered as a coolant!"); + } else if (multiplier <= 0.0) { + throw new IllegalArgumentException("Multiplier was less than or equal to 0!"); + } else { + CraftTweakerAPI.apply(AddSolidCoolant.create(this, name, item, fluid, multiplier)); + } + } + + @Override + public RecipeType getRecipeType() { + return ICoolant.TYPE; + } + + @Override + public String dumpToCommandString(final IRecipeManager manager, ICoolant recipe) { + if (recipe instanceof IFluidCoolant fluidCoolant) { + return String.format( + "coolant.addFluidCoolant(%s, %s, %s);", + StringUtil.quoteAndEscape(recipe.getId()), + StringUtil.quoteAndEscape(recipe.getFluid().getFluid().getRegistryName()), + fluidCoolant.getDegreesCoolingPerMB() + ); + } else if (recipe instanceof ISolidCoolant solidCoolant) { + return String.format( + "coolant.addSolidCoolant(%s, %s, %s, %s);", + StringUtil.quoteAndEscape(recipe.getId()), + ItemStackUtil.getCommandString(solidCoolant.getSolid()), + StringUtil.quoteAndEscape(recipe.getFluid().getFluid().getRegistryName()), + solidCoolant.getMultiplier() + ); + } + return "This is not a fluid coolant or a solid coolant. What happened?"; + } + + static final class AddFluidCoolant extends ActionAddRecipe { + private AddFluidCoolant(IRecipeManager manager, IFluidCoolant recipe) { + super(manager, recipe); + } + + public static AddFluidCoolant create(IRecipeManager manager, String name, FluidStack fluid, float degreesCoolingPerMB) { + ResourceLocation _name = new ResourceLocation("crafttweaker", name); + return new AddFluidCoolant(manager, new CoolantRegistry.FluidCoolant(_name, fluid, degreesCoolingPerMB)); + } + + public String describe() { + return "Adding combustion engine coolant " + this.recipe.getFluid(); + } + } + + static final class AddSolidCoolant extends ActionAddRecipe { + public AddSolidCoolant(IRecipeManager manager, ISolidCoolant recipe) { + super(manager, recipe); + } + + public static AddSolidCoolant create(IRecipeManager manager, String name, ItemStack item, FluidStack fluid, float multiplier) { + ResourceLocation _name = new ResourceLocation("crafttweaker", name); + return new AddSolidCoolant(manager, new CoolantRegistry.SolidCoolant(_name, item, fluid, multiplier)); + } + + public String describe() { + return "Adding combustion engine coolant " + ((ISolidCoolant) this.recipe).getSolid(); + } + } +} diff --git a/common/buildcraft/compat/module/forestry/CompatModuleForestry.java b/common/buildcraft/compat/module/forestry/CompatModuleForestry.java deleted file mode 100644 index 622aca4..0000000 --- a/common/buildcraft/compat/module/forestry/CompatModuleForestry.java +++ /dev/null @@ -1,39 +0,0 @@ -package buildcraft.compat.module.forestry; - -import buildcraft.api.BCModules; -import buildcraft.api.core.BCLog; -import buildcraft.api.lists.ListRegistry; - -import buildcraft.compat.CompatModuleBase; -import buildcraft.compat.module.forestry.list.ListMatchGenome; -import buildcraft.compat.module.forestry.pipe.ForestryPipes; - -public class CompatModuleForestry extends CompatModuleBase { - @Override - public String compatModId() { - return "forestry"; - } - - @Override - public void preInit() { - ListRegistry.registerHandler(new ListMatchGenome()); - if (canLoadPropolisPipe()) { - ForestryPipes.preInit(); - } - } - - private static boolean canLoadPropolisPipe() { - if (!BCModules.TRANSPORT.isLoaded()) { - return false; - } - try { - // Ensure that forestry is up-to-date - Class.forName("forestry.sorting.tiles.IFilterContainer"); - return true; - } catch (ClassNotFoundException ignored) { - BCLog.logger.warn( - "[compat.forestry] IFilterContainer not found -- forestry must be updated to add the propolis pipe!"); - return false; - } - } -} diff --git a/common/buildcraft/compat/module/forestry/list/ListMatchGenome.java b/common/buildcraft/compat/module/forestry/list/ListMatchGenome.java deleted file mode 100644 index 7b9e247..0000000 --- a/common/buildcraft/compat/module/forestry/list/ListMatchGenome.java +++ /dev/null @@ -1,93 +0,0 @@ -package buildcraft.compat.module.forestry.list; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.NonNullList; - -import buildcraft.api.lists.ListMatchHandler; - -import forestry.api.genetics.AlleleManager; -import forestry.api.genetics.IAlleleSpecies; -import forestry.api.genetics.IIndividual; -import forestry.api.genetics.ISpeciesRoot; - -public class ListMatchGenome extends ListMatchHandler { - - @Override - public boolean matches(Type type, ItemStack compare, ItemStack target, boolean precise) { - IIndividual infoCompare = AlleleManager.alleleRegistry.getIndividual(compare); - IIndividual infoTarget = AlleleManager.alleleRegistry.getIndividual(target); - if (infoCompare == null || infoTarget == null) { - return false; - } - switch (type) { - case MATERIAL: { - return matchesMaterial(compare, target, infoCompare, infoTarget, precise); - } - case TYPE: { - return matchesType(compare, target, infoCompare, infoTarget, precise); - } - case CLASS: { - return matchesMaterial(compare, target, infoCompare, infoTarget, precise) - && matchesType(compare, target, infoCompare, infoTarget, precise); - } - default: { - throw new IllegalArgumentException("Unknown type " + type); - } - } - } - - private static boolean matchesMaterial(ItemStack compare, ItemStack target, IIndividual infoCompare, - IIndividual infoTarget, boolean precise) { - // Ensures that both individuals have the same species - // If precise is true then also ensure that the secondary species is the same - IAlleleSpecies speciesCompare = infoCompare.getGenome().getPrimary(); - IAlleleSpecies speciesTarget = infoTarget.getGenome().getPrimary(); - if (speciesCompare != speciesTarget) { - return false; - } - if (precise) { - IAlleleSpecies inactiveCompare = infoCompare.getGenome().getSecondary(); - IAlleleSpecies inactiveTarget = infoTarget.getGenome().getSecondary(); - if (inactiveCompare != inactiveTarget) { - return false; - } - } - return true; - } - - private static boolean matchesType(ItemStack compare, ItemStack target, IIndividual infoCompare, - IIndividual infoTarget, boolean precise) { - ISpeciesRoot speciesRootCompare = infoCompare.getGenome().getSpeciesRoot(); - ISpeciesRoot speciesRootTarget = infoTarget.getGenome().getSpeciesRoot(); - if (speciesRootCompare != speciesRootTarget) { - return false; - } - // Ensure that both fully match (both princesses or both drones etc) - if (speciesRootCompare.getType(compare) != speciesRootTarget.getType(target)) { - return false; - } - return true; - } - - @Override - public boolean isValidSource(Type type, @Nonnull ItemStack stack) { - return AlleleManager.alleleRegistry.getIndividual(stack) != null; - } - - @Override - @Nullable - public NonNullList getClientExamples(Type type, @Nonnull ItemStack stack) { - IIndividual individual = AlleleManager.alleleRegistry.getIndividual(stack); - if (individual == null) { - return null; - } - - NonNullList list = NonNullList.create(); - boolean isType = type != Type.MATERIAL; - boolean isMaterial = type != Type.TYPE; - return list; - } -} diff --git a/common/buildcraft/compat/module/forestry/pipe/ContainerPropolisPipe.java b/common/buildcraft/compat/module/forestry/pipe/ContainerPropolisPipe.java deleted file mode 100644 index 1460eff..0000000 --- a/common/buildcraft/compat/module/forestry/pipe/ContainerPropolisPipe.java +++ /dev/null @@ -1,22 +0,0 @@ -package buildcraft.compat.module.forestry.pipe; - -import net.minecraft.entity.player.EntityPlayer; - -import forestry.sorting.gui.ContainerGeneticFilter; - -public class ContainerPropolisPipe extends ContainerGeneticFilter { - - public final PipeBehaviourPropolis pipeBehaviour; - - public ContainerPropolisPipe(PipeBehaviourPropolis behaviour, EntityPlayer player) { - super(behaviour, player.inventory); - this.pipeBehaviour = behaviour; - behaviour.pipe.getHolder().onPlayerOpen(player); - } - - @Override - public void onContainerClosed(EntityPlayer player) { - super.onContainerClosed(player); - pipeBehaviour.pipe.getHolder().onPlayerClose(player); - } -} diff --git a/common/buildcraft/compat/module/forestry/pipe/ForestryPipes.java b/common/buildcraft/compat/module/forestry/pipe/ForestryPipes.java deleted file mode 100644 index cab9d26..0000000 --- a/common/buildcraft/compat/module/forestry/pipe/ForestryPipes.java +++ /dev/null @@ -1,86 +0,0 @@ -package buildcraft.compat.module.forestry.pipe; - -import net.minecraft.init.Items; -import net.minecraft.item.EnumDyeColor; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.ResourceLocation; - -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.RegistryEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.common.registry.ForgeRegistries; -import net.minecraftforge.oredict.ShapedOreRecipe; - -import buildcraft.api.transport.pipe.PipeApi; -import buildcraft.api.transport.pipe.PipeDefinition; -import buildcraft.api.transport.pipe.PipeDefinition.PipeDefinitionBuilder; - -import buildcraft.lib.misc.ColourUtil; -import buildcraft.lib.registry.CreativeTabManager; - -public class ForestryPipes { - - public static Item pipeItemPropolis; - public static PipeDefinition pipeDefinitionPropolis; - - public static void preInit() { - MinecraftForge.EVENT_BUS.register(ForestryPipes.class); - - String[] textureSuffixes = new String[8]; - textureSuffixes[0] = ""; - textureSuffixes[7] = "_itemstack"; - for (EnumFacing face : EnumFacing.VALUES) { - textureSuffixes[face.ordinal() + 1] = "_" + face.getName(); - } - - pipeDefinitionPropolis = new PipeDefinitionBuilder()// - .id("forestry_propolis")// Note: id() automatically sets the namespace to "buildcraftcompat" - .texPrefix("propolis")// - .texSuffixes(textureSuffixes)// - .logic(PipeBehaviourPropolis::new, PipeBehaviourPropolis::new)// - .flowItem()// - .define(); - - PipeApi.pipeRegistry.createUnnamedItemForPipe(pipeDefinitionPropolis, item -> { - pipeItemPropolis = item; - item.setRegistryName("pipe_item_propolis"); - item.setUnlocalizedName("buildcraftPipe.pipeitemspropolis"); - item.setCreativeTab(CreativeTabManager.getTab("buildcraft.pipes")); - }); - } - - @SubscribeEvent - public static void registerRecipes(RegistryEvent.Register event) { - Item propolis = ForgeRegistries.ITEMS.getValue(new ResourceLocation("forestry:propolis")); - if (propolis != null && propolis != Items.AIR) { - addPipeRecipe(pipeItemPropolis, propolis, Items.DIAMOND); - } - } - - private static void addPipeRecipe(Item pipe, Object surround) { - addPipeRecipe(pipe, surround, surround); - } - - private static void addPipeRecipe(Item pipe, Object left, Object right) { - // Copied directly from BCTransportRecipes - if (pipe == null) { - return; - } - ItemStack result = new ItemStack(pipe, 8); - IRecipe recipe = new ShapedOreRecipe(pipe.getRegistryName(), result, "lgr", 'l', left, 'r', right, 'g', - "blockGlassColorless"); - recipe.setRegistryName(new ResourceLocation(pipe.getRegistryName() + "_colorless")); - ForgeRegistries.RECIPES.register(recipe); - - for (EnumDyeColor colour : EnumDyeColor.values()) { - ItemStack resultStack = new ItemStack(pipe, 8, colour.getMetadata() + 1); - IRecipe colorRecipe = new ShapedOreRecipe(pipe.getRegistryName(), resultStack, "lgr", 'l', left, 'r', right, - 'g', "blockGlass" + ColourUtil.getName(colour)); - colorRecipe.setRegistryName(new ResourceLocation(pipe.getRegistryName() + "_" + colour)); - ForgeRegistries.RECIPES.register(colorRecipe); - } - } -} diff --git a/common/buildcraft/compat/module/forestry/pipe/PipeBehaviourPropolis.java b/common/buildcraft/compat/module/forestry/pipe/PipeBehaviourPropolis.java deleted file mode 100644 index def558a..0000000 --- a/common/buildcraft/compat/module/forestry/pipe/PipeBehaviourPropolis.java +++ /dev/null @@ -1,196 +0,0 @@ -package buildcraft.compat.module.forestry.pipe; - -import java.io.IOException; - -import javax.annotation.Nonnull; -import javax.annotation.Nullable; - -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.PacketBuffer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.RayTraceResult; -import net.minecraft.world.World; -import net.minecraft.world.WorldServer; - -import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import buildcraft.api.core.EnumPipePart; -import buildcraft.api.transport.pipe.IPipe; -import buildcraft.api.transport.pipe.PipeBehaviour; -import buildcraft.api.transport.pipe.PipeEventHandler; -import buildcraft.api.transport.pipe.PipeEventItem; - -import buildcraft.lib.cap.CapabilityHelper; - -import buildcraft.compat.CompatUtils; -import buildcraft.compat.network.CompatGui; -import buildcraft.compat.network.IGuiCreator; - -import forestry.api.genetics.AlleleManager; -import forestry.api.genetics.GeneticCapabilities; -import forestry.api.genetics.IFilterLogic; -import forestry.api.genetics.IFilterLogic.INetworkHandler; -import forestry.sorting.DefaultFilterRuleType; -import forestry.sorting.gui.ContainerGeneticFilter; -import forestry.sorting.gui.GuiGeneticFilter; -import forestry.sorting.tiles.IFilterContainer; - -public class PipeBehaviourPropolis extends PipeBehaviour implements IFilterContainer, INetworkHandler, IGuiCreator { - - private final CapabilityHelper caps = new CapabilityHelper(); - private final IFilterLogic filter = AlleleManager.filterRegistry.createLogic(this, this); - - { - caps.addCapabilityInstance(GeneticCapabilities.FILTER_LOGIC, filter, EnumPipePart.VALUES); - caps.addCapabilityInstance(CompatUtils.CAP_GUI_CREATOR, this, EnumPipePart.CENTER); - } - - public PipeBehaviourPropolis(IPipe pipe) { - super(pipe); - } - - public PipeBehaviourPropolis(IPipe pipe, NBTTagCompound nbt) { - super(pipe, nbt); - filter.readFromNBT(nbt.getCompoundTag("filter")); - } - - @Override - public NBTTagCompound writeToNbt() { - NBTTagCompound nbt = super.writeToNbt(); - nbt.setTag("filter", filter.writeToNBT(new NBTTagCompound())); - return nbt; - } - - @Override - public void readPayload(PacketBuffer buffer, Side side, MessageContext ctx) throws IOException { - super.readPayload(buffer, side, ctx); - if (side == Side.CLIENT) { - filter.readGuiData(buffer); - } - } - - @Override - public void writePayload(PacketBuffer buffer, Side side) { - super.writePayload(buffer, side); - if (side == Side.SERVER) { - // FIXME: Inefficient to be sending gui updates all the time - // but fixing this requires proper fixes throughout the net code :/ - filter.writeGuiData(buffer); - } - } - - @Override - public T getCapability(@Nonnull Capability capability, EnumFacing facing) { - T value = caps.getCapability(capability, facing); - if (value != null) { - return value; - } - return super.getCapability(capability, facing); - } - - @Override - public int getTextureIndex(EnumFacing face) { - return face == null ? 0 : face.ordinal() + 1; - } - - @Override - public boolean onPipeActivate(EntityPlayer player, RayTraceResult trace, float hitX, float hitY, float hitZ, - EnumPipePart part) { - if (!getWorldObj().isRemote) { - // TODO: Properly abstract this in to make GUI's a bit more sane! - CompatGui.FORESTRY_PROPOLIS_PIPE.openGui(player, pipe.getHolder().getPipePos()); - // sendUpdatePacket(ImmutableList.of()); - } - return true; - } - - @PipeEventHandler - public void sideCheck(PipeEventItem.SideCheck event) { - ItemStack stack = event.stack; - for (EnumFacing face : EnumFacing.VALUES) { - if (!filter.isValid(stack, face)) { - event.disallow(face); - } else if (filter.getRule(face) == DefaultFilterRuleType.ANYTHING) { - event.decreasePriority(face); - } - } - } - - // IFilterContainer - - @Override - public BlockPos getCoordinates() { - return pipe.getHolder().getPipePos(); - } - - @Override - public World getWorldObj() { - return pipe.getHolder().getPipeWorld(); - } - - @Override - public String getUnlocalizedTitle() { - return ForestryPipes.pipeItemPropolis.getUnlocalizedName() + ".name"; - } - - @Override - @Nullable - public IInventory getBuffer() { - return null; - } - - @Override - public TileEntity getTileEntity() { - return pipe.getHolder().getPipeTile(); - } - - @Override - public IFilterLogic getLogic() { - return filter; - } - - // INetworkHandler - - @Override - public void sendToPlayers(IFilterLogic logic, WorldServer server, EntityPlayer currentPlayer) { - for (EntityPlayer player : server.playerEntities) { - if (player != currentPlayer && player.openContainer instanceof ContainerGeneticFilter) { - ContainerGeneticFilter currentContainer = (ContainerGeneticFilter) currentPlayer.openContainer; - ContainerGeneticFilter otherContainer = (ContainerGeneticFilter) player.openContainer; - if (otherContainer.hasSameTile(currentContainer)) { - otherContainer.setGuiNeedsUpdate(true); - } - } - } - } - - // IGuiCreator - - @Override - public Enum getGuiType() { - return CompatGui.FORESTRY_PROPOLIS_PIPE; - } - - @Override - @Nullable - public Container getServerGuiElement(int data, EntityPlayer player) { - return new ContainerPropolisPipe(this, player); - } - - @Override - @Nullable - @SideOnly(Side.CLIENT) - public GuiContainer getClientGuiElement(int data, EntityPlayer player) { - return new GuiGeneticFilter(this, player.inventory); - } -} diff --git a/common/buildcraft/compat/module/ic2/CompatModuleIndustrialCraft2.java b/common/buildcraft/compat/module/ic2/CompatModuleIndustrialCraft2.java index 01c782d..bd441c6 100644 --- a/common/buildcraft/compat/module/ic2/CompatModuleIndustrialCraft2.java +++ b/common/buildcraft/compat/module/ic2/CompatModuleIndustrialCraft2.java @@ -1,37 +1,32 @@ -/* - * Copyright (c) 2020 SpaceToad and the BuildCraft team - * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not - * distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/ - */ - package buildcraft.compat.module.ic2; -import net.minecraft.item.Item; - import buildcraft.compat.CompatModuleBase; - import buildcraft.lib.misc.StackMatchingPredicate; import buildcraft.lib.misc.StackNbtMatcher; import buildcraft.lib.misc.StackUtil; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.Item; +import net.minecraftforge.registries.ForgeRegistries; public class CompatModuleIndustrialCraft2 extends CompatModuleBase { - @Override + public CompatModuleIndustrialCraft2() { + } + public String compatModId() { return "ic2"; } - @Override public void preInit() { - registerCableMatchingPredicate(); + this.registerCableMatchingPredicate(); } private void registerCableMatchingPredicate() { - // Distinguish cables by type and insulation - // https://github.com/BuildCraft/BuildCraft/issues/4553 - Item cable = Item.getByNameOrId("ic2:cable"); +// Item cable = Item.func_111206_d("ic2:cable"); + Item cable = ForgeRegistries.ITEMS.getValue(new ResourceLocation("ic2:cable")); if (cable != null) { - StackMatchingPredicate predicate = new StackNbtMatcher("insulation", "type"); + StackMatchingPredicate predicate = new StackNbtMatcher(new String[] { "insulation", "type" }); StackUtil.registerMatchingPredicate(cable, predicate); } + } } diff --git a/common/buildcraft/compat/module/jei/BCPluginJEI.java b/common/buildcraft/compat/module/jei/BCPluginJEI.java index f31d176..c7ef598 100644 --- a/common/buildcraft/compat/module/jei/BCPluginJEI.java +++ b/common/buildcraft/compat/module/jei/BCPluginJEI.java @@ -1,150 +1,241 @@ package buildcraft.compat.module.jei; -import java.util.Arrays; -import java.util.List; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; - -import net.minecraft.item.ItemStack; - -import net.minecraftforge.fml.common.Loader; - -import buildcraft.api.BCBlocks; import buildcraft.api.BCModules; import buildcraft.api.core.BCLog; import buildcraft.api.enums.EnumEngineType; import buildcraft.api.fuels.IFuel; -import buildcraft.api.recipes.AssemblyRecipeBasic; -import buildcraft.api.recipes.BuildcraftRecipeRegistry; +import buildcraft.api.recipes.IProgrammingRecipe; import buildcraft.api.recipes.IRefineryRecipeManager; - -import buildcraft.lib.fluid.FuelRegistry; -import buildcraft.lib.recipe.AssemblyRecipeRegistry; - +import buildcraft.api.recipes.IntegrationRecipe; +import buildcraft.compat.BCCompatConfig; import buildcraft.compat.module.jei.energy.combustionengine.CategoryCombustionEngine; -import buildcraft.compat.module.jei.energy.combustionengine.HandlerCombustionEngine; import buildcraft.compat.module.jei.factory.CategoryCoolable; import buildcraft.compat.module.jei.factory.CategoryDistiller; import buildcraft.compat.module.jei.factory.CategoryHeatable; -import buildcraft.compat.module.jei.factory.HandlerCoolable; -import buildcraft.compat.module.jei.factory.HandlerDistiller; -import buildcraft.compat.module.jei.factory.HandlerHeatable; -import buildcraft.compat.module.jei.recipe.GuiHandlerBuildCraft; +import buildcraft.compat.module.jei.gui.GuiHandlerBuildCraft; import buildcraft.compat.module.jei.silicon.CategoryAssemblyTable; -import buildcraft.compat.module.jei.silicon.WrapperAssemblyTable; +import buildcraft.compat.module.jei.silicon.CategoryIntegrationTable; +import buildcraft.compat.module.jei.silicon.CategoryProgrammingTable; import buildcraft.compat.module.jei.transferhandlers.AdvancedCraftingItemsTransferHandler; import buildcraft.compat.module.jei.transferhandlers.AutoCraftItemsTransferHandler; import buildcraft.core.BCCoreBlocks; +import buildcraft.factory.BCFactoryBlocks; +import buildcraft.lib.gui.GuiBC8; +import buildcraft.lib.recipe.assembly.AssemblyRecipe; +import buildcraft.lib.recipe.assembly.AssemblyRecipeRegistry; +import buildcraft.lib.recipe.fuel.FuelRegistry; +import buildcraft.lib.recipe.programming.ProgrammingRecipeManager; +import buildcraft.silicon.BCSiliconBlocks; +import buildcraft.silicon.BCSiliconItems; import buildcraft.silicon.container.ContainerAssemblyTable; - -import mezz.jei.api.IGuiHelper; +import buildcraft.silicon.container.ContainerIntegrationTable; +import buildcraft.silicon.container.ContainerProgrammingTable_Neptune; +import buildcraft.transport.pipe.PipeRegistry; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; import mezz.jei.api.IModPlugin; -import mezz.jei.api.IModRegistry; -import mezz.jei.api.JEIPlugin; -import mezz.jei.api.recipe.IRecipeCategoryRegistration; -import mezz.jei.api.recipe.VanillaRecipeCategoryUid; +import mezz.jei.api.JeiPlugin; +import mezz.jei.api.constants.RecipeTypes; +import mezz.jei.api.constants.VanillaTypes; +import mezz.jei.api.helpers.IGuiHelper; +import mezz.jei.api.recipe.category.IRecipeCategory; +import mezz.jei.api.registration.*; +import mezz.jei.api.runtime.IJeiRuntime; +import net.minecraft.client.Minecraft; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.item.Item; +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.fml.ModList; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; -@JEIPlugin +@JeiPlugin public class BCPluginJEI implements IModPlugin { - // public static boolean disableFacadeJEI; - public static IModRegistry registry; + // public static IModRegistry registry; + public static IRecipeRegistration registryRecipe; + public static IGuiHandlerRegistration registryGui; + public static IRecipeTransferRegistration registryRecipeTransfer; + public static IRecipeCatalystRegistration registryRecipeCatalyst; + public static IJeiRuntime jeiRuntime; + + private static final ResourceLocation UID = new ResourceLocation("buildcraft:jei_plugin"); @Override - public void register(IModRegistry registry) { - BCPluginJEI.registry = registry; - registry.addAdvancedGuiHandlers(new GuiHandlerBuildCraft()); -// boolean transport = BCModules.TRANSPORT.isLoaded(); + public ResourceLocation getPluginUid() { + return UID; + } + + + @Override + public void registerGuiHandlers(IGuiHandlerRegistration registry) { + BCPluginJEI.registryGui = registry; + registry.addGenericGuiContainerHandler(GuiBC8.class, new GuiHandlerBuildCraft()); + + } + + // Calen: IRecipeWrapper combined into IRecipeCategory + @Override + public void registerRecipes(IRecipeRegistration registry) { + BCPluginJEI.registryRecipe = registry; boolean factory = BCModules.FACTORY.isLoaded(); boolean energy = BCModules.ENERGY.isLoaded(); boolean silicon = BCModules.SILICON.isLoaded(); -// boolean robotics = BCModules.ROBOTICS.isLoaded(); - if (factory) { - registry.handleRecipes(IRefineryRecipeManager.ICoolableRecipe.class, new HandlerCoolable(), CategoryCoolable.UID); - registry.handleRecipes(IRefineryRecipeManager.IDistillationRecipe.class, new HandlerDistiller(), CategoryDistiller.UID); - registry.handleRecipes(IRefineryRecipeManager.IHeatableRecipe.class, new HandlerHeatable(), CategoryHeatable.UID); - - registry.addRecipes(ImmutableList.copyOf(BuildcraftRecipeRegistry.refineryRecipes.getCoolableRegistry().getAllRecipes()), CategoryCoolable.UID); - registry.addRecipes(ImmutableList.copyOf(BuildcraftRecipeRegistry.refineryRecipes.getDistillationRegistry().getAllRecipes()), CategoryDistiller.UID); - registry.addRecipes(ImmutableList.copyOf(BuildcraftRecipeRegistry.refineryRecipes.getHeatableRegistry().getAllRecipes()), CategoryHeatable.UID); - if (BCBlocks.Factory.DISTILLER != null) { - registry.addRecipeCatalyst(new ItemStack(BCBlocks.Factory.DISTILLER), CategoryDistiller.UID); - } - if (BCBlocks.Factory.HEAT_EXCHANGE != null) { - registry.addRecipeCatalyst(new ItemStack(BCBlocks.Factory.HEAT_EXCHANGE), CategoryCoolable.UID); - registry.addRecipeCatalyst(new ItemStack(BCBlocks.Factory.HEAT_EXCHANGE), CategoryHeatable.UID); - } +// registry.handleRecipes(IRefineryRecipeManager.ICoolableRecipe.class, new HandlerCoolable(), "buildcraft:category_coolable"); +// registry.handleRecipes(IRefineryRecipeManager.IDistillationRecipe.class, new HandlerDistiller(), "buildcraft:category_distiller"); +// registry.handleRecipes(IRefineryRecipeManager.IHeatableRecipe.class, new HandlerHeatable(), "buildcraft:category_heatable"); +// registry.addRecipes(ImmutableList.copyOf(BuildcraftRecipeRegistry.refineryRecipes.getCoolableRegistry().getAllRecipes()), new ResourceLocation("buildcraft:category_coolable")); + registry.addRecipes(CategoryCoolable.RECIPE_TYPE, ImmutableList.copyOf(Minecraft.getInstance().level.getRecipeManager().getAllRecipesFor(IRefineryRecipeManager.ICoolableRecipe.TYPE))); +// registry.addRecipes(ImmutableList.copyOf(BuildcraftRecipeRegistry.refineryRecipes.getDistillationRegistry().getAllRecipes()), new ResourceLocation("buildcraft:category_distiller")); + registry.addRecipes(CategoryDistiller.RECIPE_TYPE, ImmutableList.copyOf(Minecraft.getInstance().level.getRecipeManager().getAllRecipesFor(IRefineryRecipeManager.IDistillationRecipe.TYPE))); +// registry.addRecipes(ImmutableList.copyOf(BuildcraftRecipeRegistry.refineryRecipes.getHeatableRegistry().getAllRecipes()), new ResourceLocation("buildcraft:category_heatable")); + registry.addRecipes(CategoryHeatable.RECIPE_TYPE, ImmutableList.copyOf(Minecraft.getInstance().level.getRecipeManager().getAllRecipesFor(IRefineryRecipeManager.IHeatableRecipe.TYPE))); } + if (energy) { - registry.handleRecipes(IFuel.class, new HandlerCombustionEngine(), CategoryCombustionEngine.UID); - registry.addRecipes(ImmutableList.copyOf(FuelRegistry.INSTANCE.getFuels()), CategoryCombustionEngine.UID); - if (BCCoreBlocks.engine != null){ - if (BCCoreBlocks.engine.isRegistered(EnumEngineType.STONE)) { - registry.addRecipeCatalyst(BCCoreBlocks.engine.getStack(EnumEngineType.STONE), VanillaRecipeCategoryUid.FUEL); - } - if (BCCoreBlocks.engine.isRegistered(EnumEngineType.IRON)) { - registry.addRecipeCatalyst(BCCoreBlocks.engine.getStack(EnumEngineType.IRON), CategoryCombustionEngine.UID); - } - } +// registry.handleRecipes(IFuel.class, new HandlerCombustionEngine(), "buildcraft-compat:engine.combustion"); +// registry.addRecipes(ImmutableList.copyOf(FuelRegistry.INSTANCE.getFuels()), new ResourceLocation("buildcraft-compat:engine.combustion")); + registry.addRecipes(CategoryCombustionEngine.RECIPE_TYPE, ImmutableList.copyOf(Minecraft.getInstance().level.getRecipeManager().getAllRecipesFor(IFuel.TYPE))); } - if (silicon) { - registry.handleRecipes(AssemblyRecipeBasic.class, WrapperAssemblyTable::new, CategoryAssemblyTable.UID); -// registry.handleRecipes(IntegrationRecipe.class, new HandlerIntegrationTable(), CategoryIntegrationTable.UID); - registry.addRecipes(ImmutableList.copyOf(AssemblyRecipeRegistry.REGISTRY.values()), CategoryAssemblyTable.UID); -// registry.addRecipes(ImmutableList.copyOf(IntegrationRecipeRegistry.INSTANCE.getAllRecipes()), CategoryIntegrationTable.UID); - if (BCBlocks.Silicon.ASSEMBLY_TABLE != null) { - registry.addRecipeCatalyst(new ItemStack(BCBlocks.Silicon.ASSEMBLY_TABLE), CategoryAssemblyTable.UID); - } - if (BCBlocks.Silicon.ADVANCED_CRAFTING_TABLE != null) { - registry.addRecipeCatalyst(new ItemStack(BCBlocks.Silicon.ADVANCED_CRAFTING_TABLE), VanillaRecipeCategoryUid.CRAFTING); - } + if (silicon) { +// registry.handleRecipes(AssemblyRecipeBasic.class, WrapperAssemblyTable::new, "buildcraft-compat:silicon.assembly"); +// registry.addRecipes(ImmutableList.copyOf(AssemblyRecipeRegistry.REGISTRY.values()), new ResourceLocation("buildcraft-compat:silicon.assembly")); + registry.addRecipes(CategoryAssemblyTable.RECIPE_TYPE, ImmutableList.copyOf(Minecraft.getInstance().level.getRecipeManager().getAllRecipesFor(AssemblyRecipe.TYPE))); + registry.addRecipes(CategoryIntegrationTable.RECIPE_TYPE, ImmutableList.copyOf(Minecraft.getInstance().level.getRecipeManager().getAllRecipesFor(IntegrationRecipe.TYPE))); + registry.addRecipes(CategoryProgrammingTable.RECIPE_TYPE, ImmutableList.copyOf(Minecraft.getInstance().level.getRecipeManager().getAllRecipesFor(IProgrammingRecipe.TYPE))); } + } - registry.getRecipeTransferRegistry().addRecipeTransferHandler(new AutoCraftItemsTransferHandler(), VanillaRecipeCategoryUid.CRAFTING); - registry.getRecipeTransferRegistry().addRecipeTransferHandler(new AdvancedCraftingItemsTransferHandler(), VanillaRecipeCategoryUid.CRAFTING); - // registry.getRecipeTransferRegistry().addRecipeTransferHandler(new AssemblyTableTransferHandler(), CategoryAssemblyTable.UID); - registry.getRecipeTransferRegistry().addRecipeTransferHandler(ContainerAssemblyTable.class, CategoryAssemblyTable.UID, - 36, 12, 0, 36); + @Override + public void registerRecipeTransferHandlers(IRecipeTransferRegistration registry) { + BCPluginJEI.registryRecipeTransfer = registry; + +// registry.addRecipeTransferHandler(new AutoCraftItemsTransferHandler(), "minecraft.crafting"); + registry.addRecipeTransferHandler(new AutoCraftItemsTransferHandler(), RecipeTypes.CRAFTING); +// registry.addRecipeTransferHandler(new AdvancedCraftingItemsTransferHandler(), "minecraft.crafting"); + registry.addRecipeTransferHandler(new AdvancedCraftingItemsTransferHandler(), RecipeTypes.CRAFTING); +// registry.addRecipeTransferHandler(ContainerAssemblyTable.class, "buildcraft-compat:silicon.assembly", 36, 12, 0, 36); + registry.addRecipeTransferHandler(ContainerAssemblyTable.class, CategoryAssemblyTable.RECIPE_TYPE, 36, 12, 0, 36); + registry.addRecipeTransferHandler(ContainerIntegrationTable.class, CategoryIntegrationTable.RECIPE_TYPE, 36, 11, 0, 36); + registry.addRecipeTransferHandler(ContainerProgrammingTable_Neptune.class, CategoryProgrammingTable.RECIPE_TYPE, 36, 26, 0, 36); } @Override public void registerCategories(IRecipeCategoryRegistration registry) { -// boolean transport = Loader.isModLoaded(BCModules.TRANSPORT.getModId()); - boolean factory = Loader.isModLoaded(BCModules.FACTORY.getModId()); - boolean energy = Loader.isModLoaded(BCModules.ENERGY.getModId()); - boolean silicon = Loader.isModLoaded(BCModules.SILICON.getModId()); -// boolean robotics = Loader.isModLoaded(BCModules.ROBOTICS.getModId()); - +// boolean factory = Loader.isModLoaded(BCModules.FACTORY.getModId()); + boolean factory = ModList.get().isLoaded(BCModules.FACTORY.getModId()); +// boolean energy = Loader.isModLoaded(BCModules.ENERGY.getModId()); + boolean energy = ModList.get().isLoaded(BCModules.ENERGY.getModId()); +// boolean silicon = Loader.isModLoaded(BCModules.SILICON.getModId()); + boolean silicon = ModList.get().isLoaded(BCModules.SILICON.getModId()); List lst = Lists.newArrayList(); IGuiHelper helper = registry.getJeiHelpers().getGuiHelper(); - -// jeiRegistry.addAdvancedGuiHandlers(new LedgerGuiHandler()); -// if (transport) { -// lst.add("transport"); -// loadTransport(jeiRegistry); -// } if (factory) { lst.add("factory"); - registry.addRecipeCategories(new CategoryHeatable(helper)); - registry.addRecipeCategories(new CategoryDistiller(helper)); - registry.addRecipeCategories(new CategoryCoolable(helper)); + registry.addRecipeCategories(new IRecipeCategory[] { new CategoryHeatable(helper) }); + registry.addRecipeCategories(new IRecipeCategory[] { new CategoryDistiller(helper) }); + registry.addRecipeCategories(new IRecipeCategory[] { new CategoryCoolable(helper) }); } + if (energy) { lst.add("energy"); - registry.addRecipeCategories(new CategoryCombustionEngine(helper)); +// registry.addRecipeCategories(new IRecipeCategory[]{new CategoryCombustionEngine(helper)}); + registry.addRecipeCategories(new IRecipeCategory[] { new CategoryCombustionEngine(helper, FuelRegistry.INSTANCE.getFuels(Minecraft.getInstance().level)) }); } + if (silicon) { lst.add("silicon"); - registry.addRecipeCategories(new CategoryAssemblyTable(helper)); -// registry.addRecipeCategories(new CategoryIntegrationTable(helper)); +// registry.addRecipeCategories(new IRecipeCategory[]{new CategoryAssemblyTable(helper)}); + registry.addRecipeCategories(new IRecipeCategory[] { new CategoryAssemblyTable(helper, AssemblyRecipeRegistry.getAll(Minecraft.getInstance().level)) }); + registry.addRecipeCategories(new IRecipeCategory[] { new CategoryIntegrationTable(helper) }); + registry.addRecipeCategories(new IRecipeCategory[] { new CategoryProgrammingTable(helper, ProgrammingRecipeManager.INSTANCE.getRecipes(Minecraft.getInstance().level)) }); } BCLog.logger.info("Loaded JEI mods: " + Arrays.toString(lst.toArray())); } -// private static void loadTransport(IModRegistry jeiRegistry) { -// jeiRegistry.addAdvancedGuiHandlers(new GateGuiHandler()); -// } + @Override + public void registerRecipeCatalysts(IRecipeCatalystRegistration registry) { + BCPluginJEI.registryRecipeCatalyst = registry; + + boolean factory = BCModules.FACTORY.isLoaded(); + boolean energy = BCModules.ENERGY.isLoaded(); + boolean silicon = BCModules.SILICON.isLoaded(); + if (factory) { + if (BCFactoryBlocks.distiller != null) { +// registry.addRecipeCatalyst(new ItemStack(BCFactoryBlocks.distiller.get()), new String[]{"buildcraft:category_distiller"}); + registry.addRecipeCatalyst(new ItemStack(BCFactoryBlocks.distiller.get()), CategoryDistiller.RECIPE_TYPE); + } + + if (BCFactoryBlocks.heatExchange != null) { +// registry.addRecipeCatalyst(new ItemStack(BCFactoryBlocks.heatExchange.get()), new String[]{"buildcraft:category_coolable"}); + registry.addRecipeCatalyst(new ItemStack(BCFactoryBlocks.heatExchange.get()), CategoryCoolable.RECIPE_TYPE); +// registry.addRecipeCatalyst(new ItemStack(BCFactoryBlocks.heatExchange.get()), new String[]{"buildcraft:category_heatable"}); + registry.addRecipeCatalyst(new ItemStack(BCFactoryBlocks.heatExchange.get()), CategoryHeatable.RECIPE_TYPE); + } + + if (BCFactoryBlocks.autoWorkbenchItems != null) { + registry.addRecipeCatalyst(new ItemStack(BCFactoryBlocks.autoWorkbenchItems.get()), RecipeTypes.CRAFTING); + } + } + + if (energy) { +// if (BCCoreBlocks.engine != null) + if (!BCCoreBlocks.engineBlockMap.isEmpty()) { +// if (BCCoreBlocks.engine.isRegistered(EnumEngineType.STONE)) + if (BCCoreBlocks.engineBlockMap.containsKey(EnumEngineType.STONE)) { +// registry.addRecipeCatalyst(BCCoreBlocks.engine.getStack(EnumEngineType.STONE), new String[]{"minecraft.fuel"}); + registry.addRecipeCatalyst(new ItemStack(BCCoreBlocks.engineBlockMap.get(EnumEngineType.STONE).get()), RecipeTypes.FUELING); + } + +// if (BCCoreBlocks.engine.isRegistered(EnumEngineType.IRON)) + if (BCCoreBlocks.engineBlockMap.containsKey(EnumEngineType.IRON)) { +//// registry.addRecipeCatalyst(BCCoreBlocks.engine.getStack(EnumEngineType.IRON), new String[]{"buildcraft-compat:engine.combustion"}); +// registry.addRecipeCatalyst(new ItemStack(BCCoreBlocks.engineBlockMap.get(EnumEngineType.IRON).get()), new String[]{"buildcraft-compat:engine.combustion"}); + registry.addRecipeCatalyst(new ItemStack(BCCoreBlocks.engineBlockMap.get(EnumEngineType.IRON).get()), CategoryCombustionEngine.RECIPE_TYPE); + } + } + } + + if (silicon) { + if (BCSiliconBlocks.assemblyTable != null) { +// registry.addRecipeCatalyst(new ItemStack(BCSiliconBlocks.assemblyTable.get()), new String[]{"buildcraft-compat:silicon.assembly"}); + registry.addRecipeCatalyst(new ItemStack(BCSiliconBlocks.assemblyTable.get()), CategoryAssemblyTable.RECIPE_TYPE); + registry.addRecipeCatalyst(new ItemStack(BCSiliconBlocks.integrationTable.get()), CategoryIntegrationTable.RECIPE_TYPE); + registry.addRecipeCatalyst(new ItemStack(BCSiliconBlocks.programmingTable.get()), CategoryProgrammingTable.RECIPE_TYPE); + } + + if (BCSiliconBlocks.advancedCraftingTable != null) { +// registry.addRecipeCatalyst(new ItemStack(BCSiliconBlocks.advancedCraftingTable.get()), new String[]{"minecraft.crafting"}); + registry.addRecipeCatalyst(new ItemStack(BCSiliconBlocks.advancedCraftingTable.get()), RecipeTypes.CRAFTING); + } + } + } + + @Override + public void onRuntimeAvailable(IJeiRuntime jeiRuntime) { + BCPluginJEI.jeiRuntime = jeiRuntime; + + if (!BCCompatConfig.coloredPipesVisible) { + List itemsToRemove = new ArrayList<>(); + Arrays.stream(DyeColor.values()).forEach( + color -> PipeRegistry.INSTANCE.getAllRegisteredPipes().forEach( + def -> itemsToRemove.add(new ItemStack((Item) PipeRegistry.INSTANCE.getItemForPipe(def, color))) + ) + ); + jeiRuntime.getIngredientManager().removeIngredientsAtRuntime(VanillaTypes.ITEM_STACK, itemsToRemove); + } + + if (!BCCompatConfig.facadesVisible) { + jeiRuntime.getIngredientManager().removeIngredientsAtRuntime( + VanillaTypes.ITEM_STACK, + jeiRuntime.getIngredientManager().getAllIngredients(VanillaTypes.ITEM_STACK).stream() + .filter(stack -> stack.getItem() == BCSiliconItems.plugFacade.get()).toList() + ); + } + } } diff --git a/common/buildcraft/compat/module/jei/energy/combustionengine/CategoryCombustionEngine.java b/common/buildcraft/compat/module/jei/energy/combustionengine/CategoryCombustionEngine.java index 323ec89..cae0189 100644 --- a/common/buildcraft/compat/module/jei/energy/combustionengine/CategoryCombustionEngine.java +++ b/common/buildcraft/compat/module/jei/energy/combustionengine/CategoryCombustionEngine.java @@ -1,40 +1,93 @@ package buildcraft.compat.module.jei.energy.combustionengine; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fluids.FluidStack; import buildcraft.api.BCModules; -import mezz.jei.api.IGuiHelper; -import mezz.jei.api.gui.IDrawable; -import mezz.jei.api.gui.IGuiFluidStackGroup; -import mezz.jei.api.gui.IRecipeLayout; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.BlankRecipeCategory; +import buildcraft.api.fuels.IFuel; +import buildcraft.api.fuels.IFuelManager; +import buildcraft.api.mj.MjAPI; +import buildcraft.energy.BCEnergyBlocks; +import com.google.common.collect.Lists; +import com.mojang.blaze3d.platform.InputConstants; +import com.mojang.blaze3d.vertex.PoseStack; +import mezz.jei.api.constants.VanillaTypes; +import mezz.jei.api.forge.ForgeTypes; +import mezz.jei.api.gui.builder.IRecipeLayoutBuilder; +import mezz.jei.api.gui.drawable.IDrawable; +import mezz.jei.api.gui.drawable.IDrawableAnimated; +import mezz.jei.api.gui.drawable.IDrawableStatic; +import mezz.jei.api.gui.ingredient.IRecipeSlotsView; +import mezz.jei.api.helpers.IGuiHelper; +import mezz.jei.api.recipe.IFocusGroup; +import mezz.jei.api.recipe.RecipeIngredientRole; +import mezz.jei.api.recipe.RecipeType; +import mezz.jei.api.recipe.category.IRecipeCategory; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Font; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.fluids.FluidStack; -public class CategoryCombustionEngine extends BlankRecipeCategory { - public static final String UID = "buildcraft-compat:engine.combustion"; +import java.awt.*; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +//public class CategoryCombustionEngine extends BlankRecipeCategory +public class CategoryCombustionEngine implements IRecipeCategory { + // Calen + public static final RecipeType RECIPE_TYPE = + RecipeType.create(BCModules.ENERGY.getModId(), "engine_combustion", IFuel.class); + // public static final ResourceLocation UID = new ResourceLocation("buildcraft-compat:engine.combustion"); + public static final ResourceLocation UID = new ResourceLocation(BCModules.ENERGY.getModId(), "engine_combustion"); + public static final ResourceLocation FURNACE = new ResourceLocation("minecraft", "textures/gui/container/furnace.png"); private final IDrawable background; -// private WrapperCombustionEngine wrapper = null; - public CategoryCombustionEngine(IGuiHelper guiHelper) { - super(); - this.background = guiHelper.createDrawable( - new ResourceLocation("minecraft", "textures/gui/container/furnace.png"), - 55, 38, 18, 32, 0, 0, 0, 80); + private final IDrawable icon; + + @OnlyIn(Dist.CLIENT) + private Font font = Minecraft.getInstance().font; + private final Map burnTimeDrabableMap = new HashMap<>(); + + public CategoryCombustionEngine(IGuiHelper guiHelper, Collection fuels) { + // Calen: 80->100 +// this.background = guiHelper.createDrawable(new ResourceLocation("minecraft", "textures/gui/container/furnace.png"), 55, 38, 18, 32, 0, 0, 0, 80); +// this.background = guiHelper.drawableBuilder(FURNACE, 55, 38, 18, 32).addPadding(0, 0, 0, 80).build(); + this.background = guiHelper.drawableBuilder(FURNACE, 55, 38, 18, 32).addPadding(0, 0, 0, 120).build(); + // Calen: from 1.12.2 what is this doing??? guiHelper.createDrawable(new ResourceLocation(BCModules.ENERGY.getModId(), ""), 0, 0, 16, 16); + + this.icon = guiHelper.createDrawableIngredient(VanillaTypes.ITEM_STACK, new ItemStack(BCEnergyBlocks.engineIron.get())); + +// ResourceLocation furnaceBackgroundLocation = new ResourceLocation("minecraft", "textures/gui/container/furnace.png"); + IDrawableStatic flameDrawable = guiHelper.createDrawable(FURNACE, 176, 0, 14, 14); +// this.flame = guiHelper.createAnimatedDrawable(flameDrawable, fuel.getTotalBurningTime() / 10, IDrawableAnimated.StartDirection.TOP, true); + for (IFuel fuel : fuels) { + if (!burnTimeDrabableMap.containsKey(fuel.getTotalBurningTime())) { + burnTimeDrabableMap.put(fuel.getTotalBurningTime(), guiHelper.createAnimatedDrawable(flameDrawable, fuel.getTotalBurningTime() / 10, IDrawableAnimated.StartDirection.TOP, true)); + } + } } @Override - public String getUid() { + public ResourceLocation getUid() { return UID; } @Override - public String getTitle() { - return "Combustion Engine Fuels"; + public Class getRecipeClass() { + return IFuel.class; } @Override + public Component getTitle() { +// return new TextComponent("Combustion Engine Fuels"); + return new TranslatableComponent("buildcraft.jei.title.combustion_engine_fuels"); + } + public String getModName() { return BCModules.ENERGY.name(); } @@ -45,27 +98,66 @@ public IDrawable getBackground() { } @Override - public void setRecipe(IRecipeLayout recipeLayout, WrapperCombustionEngine recipeWrapper, IIngredients ingredients) { -// WrapperCombustionEngine wrapper = (WrapperCombustionEngine) recipeWrapper; - IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks(); + public IDrawable getIcon() { + return this.icon; + } - guiFluidStacks.init(0, true, 1, 15, 16, 16, 1000, false, null); - guiFluidStacks.set(0, ingredients.getInputs(FluidStack.class).get(0)); + // Calen + private int lastBurnTime = -1; - if (recipeWrapper instanceof WrapperCombustionEngine.Dirty) { -// WrapperCombustionEngine.Dirty dirty = (WrapperCombustionEngine.Dirty)recipeWrapper; + @Override + public void draw(IFuel fuel, IRecipeSlotsView recipeSlotsView, PoseStack stack, double mouseX, double mouseY) { +// this.flame.draw(stack, 2, 0); + this.burnTimeDrabableMap.get(fuel.getTotalBurningTime()).draw(stack, 2, 0); +// GlStateManager.func_179094_E(); + stack.pushPose(); + // Calen: 8->6 +// GlStateManager.func_179109_b(24.0F, 8.0F, 0.0F); +// stack.translate(24.0F, 8.0F, 0.0F); + stack.translate(24.0F, 6.0F, 0.0F); +// this.font.draw(stack, "Burns for " + fuel.getTotalBurningTime() / 20 + "s", 0, 0, Color.darkGray.getRGB()); + this.font.draw(stack, new TranslatableComponent("buildcraft.jei.title.combustion_engine_fuels.burn_time", fuel.getTotalBurningTime() / 20).getString(), 0, 0, Color.darkGray.getRGB()); +// this.font.draw(stack, " at " + MjAPI.formatMj(fuel.getPowerPerCycle()) + " MJ/t", 0, font.lineHeight, Color.darkGray.getRGB()); + this.font.draw(stack, new TranslatableComponent("buildcraft.jei.title.combustion_engine_fuels.burn_speed", MjAPI.formatMj(fuel.getPowerPerCycle())).getString(), 0, font.lineHeight, Color.darkGray.getRGB()); +// GlStateManager.func_179109_b(0.0F, (float)(minecraft.field_71466_p.field_78288_b * 2), 0.0F); + stack.translate(0.0F, (float) (font.lineHeight * 2), 0.0F); +// GlStateManager.func_179139_a(0.7, 0.7, 1.0); + stack.scale(0.7F, 0.7F, 1.0F); +// this.font.draw(stack, " total " + MjAPI.formatMj(fuel.getPowerPerCycle() * (long) fuel.getTotalBurningTime()) + " MJ", 1, 2, Color.gray.getRGB()); + this.font.draw(stack, new TranslatableComponent("buildcraft.jei.title.combustion_engine_fuels.burn_total", MjAPI.formatMj(fuel.getPowerPerCycle() * (long) fuel.getTotalBurningTime())).getString(), 1, 2, Color.gray.getRGB()); +// GlStateManager.func_179121_F(); + stack.popPose(); + } - guiFluidStacks.init(1, false, 95, 15, 16, 16, 1000, false, null); - guiFluidStacks.set(1, ingredients.getOutputs(FluidStack.class).get(0)); + @Override + // public void setRecipe(IRecipeLayout recipeLayout, WrapperCombustionEngine recipeWrapper, IIngredients ingredients) + public void setRecipe(IRecipeLayoutBuilder builder, IFuel fuel, IFocusGroup focuses) { +// IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks(); +// guiFluidStacks.init(0, true, 1, 15, 16, 16, 1000, false, (IDrawable) null); +// guiFluidStacks.set(0, (List) ingredients.getInputs(FluidStack.class).get(0)); + builder + .addSlot(RecipeIngredientRole.INPUT, 1, 15) + .setFluidRenderer(1000, false, 16, 16) + .addIngredient(ForgeTypes.FLUID_STACK, new FluidStack(fuel.getFluid(), 1000)); + if (fuel instanceof IFuelManager.IDirtyFuel dirtyFuel) { + // Calen: move right 20 to not covered the text +// guiFluidStacks.init(1, false, 95, 15, 16, 16, 1000, false, (IDrawable) null); +// guiFluidStacks.set(1, (List) ingredients.getOutputs(FluidStack.class).get(0)); + builder +// .addSlot(RecipeIngredientRole.OUTPUT, 95, 15) + .addSlot(RecipeIngredientRole.OUTPUT, 115, 15) + .setFluidRenderer(1000, false, 16, 16) + .addIngredient(ForgeTypes.FLUID_STACK, dirtyFuel.getResidue()); } } -// -// @Override -// public void drawExtras(Minecraft minecraft) { -// super.drawExtras(minecraft); -// -// if (this.wrapper != null) { -// this.wrapper.flame.draw(minecraft, 2, 0); -// } -// } + + @Override + public List getTooltipStrings(IFuel recipe, IRecipeSlotsView recipeSlotsView, double mouseX, double mouseY) { + return Lists.newArrayList(); + } + + @Override + public boolean handleInput(IFuel recipe, double mouseX, double mouseY, InputConstants.Key input) { + return false; + } } diff --git a/common/buildcraft/compat/module/jei/energy/combustionengine/HandlerCombustionEngine.java b/common/buildcraft/compat/module/jei/energy/combustionengine/HandlerCombustionEngine.java deleted file mode 100644 index 7a4a0f0..0000000 --- a/common/buildcraft/compat/module/jei/energy/combustionengine/HandlerCombustionEngine.java +++ /dev/null @@ -1,19 +0,0 @@ -package buildcraft.compat.module.jei.energy.combustionengine; - -import buildcraft.api.fuels.IFuel; -import buildcraft.api.fuels.IFuelManager.IDirtyFuel; - -import buildcraft.compat.module.jei.BCPluginJEI; - -import mezz.jei.api.recipe.IRecipeWrapper; -import mezz.jei.api.recipe.IRecipeWrapperFactory; - -public class HandlerCombustionEngine implements IRecipeWrapperFactory { - @Override - public IRecipeWrapper getRecipeWrapper(IFuel recipe) { - if (recipe instanceof IDirtyFuel) { - return new WrapperCombustionEngine.Dirty(BCPluginJEI.registry.getJeiHelpers().getGuiHelper(), (IDirtyFuel) recipe); - } - return new WrapperCombustionEngine(BCPluginJEI.registry.getJeiHelpers().getGuiHelper(), recipe); - } -} diff --git a/common/buildcraft/compat/module/jei/energy/combustionengine/WrapperCombustionEngine.java b/common/buildcraft/compat/module/jei/energy/combustionengine/WrapperCombustionEngine.java deleted file mode 100644 index d50d9f0..0000000 --- a/common/buildcraft/compat/module/jei/energy/combustionengine/WrapperCombustionEngine.java +++ /dev/null @@ -1,110 +0,0 @@ -package buildcraft.compat.module.jei.energy.combustionengine; - -import java.awt.Color; -import java.util.List; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import buildcraft.api.fuels.IFuel; -import buildcraft.api.fuels.IFuelManager.IDirtyFuel; -import buildcraft.api.mj.MjAPI; -import mezz.jei.api.IGuiHelper; -import mezz.jei.api.gui.IDrawableAnimated; -import mezz.jei.api.gui.IDrawableStatic; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.IRecipeWrapper; - -public class WrapperCombustionEngine implements IRecipeWrapper { - private final IFuel fuel; - private final ImmutableList in; - private final IDrawableAnimated flame; - - WrapperCombustionEngine(IGuiHelper guiHelper, IFuel fuel) { - this.fuel = fuel; - in = ImmutableList.of(new FluidStack(fuel.getFluid(), Fluid.BUCKET_VOLUME)); - - ResourceLocation furnaceBackgroundLocation = new ResourceLocation("minecraft", "textures/gui/container/furnace.png"); - IDrawableStatic flameDrawable = guiHelper.createDrawable(furnaceBackgroundLocation, 176, 0, 14, 14); - this.flame = guiHelper.createAnimatedDrawable(flameDrawable, fuel.getTotalBurningTime() / 10, IDrawableAnimated.StartDirection.TOP, true); - } - -// @Override -// public List getInputs() { -// return Collections.emptyList(); -// } -// -// @Override -// public List getOutputs() { -// return Collections.emptyList(); -// } -// -// @Override -// public List getFluidInputs() { -// return in; -// } -// -// @Override -// public List getFluidOutputs() { -// return null; -// } -// -// @Override -// public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight) {} - - @Override - public void getIngredients(IIngredients ingredients) { - ingredients.setInputs(FluidStack.class, this.in); - } - - @Override - @SideOnly(Side.CLIENT) - public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) { - this.flame.draw(minecraft, 2, 0); - - GlStateManager.pushMatrix(); - GlStateManager.translate(24, 8, 0); - // GlStateManager.scale(.7, .7, 1.0); - minecraft.fontRenderer.drawString("Burns for " + (fuel.getTotalBurningTime() / 20) + "s", 0, 0, Color.darkGray.getRGB()); - minecraft.fontRenderer.drawString(" at " + MjAPI.formatMj(fuel.getPowerPerCycle()) + " MJ/t", 0, minecraft.fontRenderer.FONT_HEIGHT, Color.darkGray.getRGB()); - GlStateManager.translate(0, minecraft.fontRenderer.FONT_HEIGHT * 2, 0); - GlStateManager.scale(.7, .7, 1.0); - minecraft.fontRenderer.drawString(" total " + MjAPI.formatMj(fuel.getPowerPerCycle() * fuel.getTotalBurningTime()) + " MJ", 1, 2, Color.gray.getRGB()); - GlStateManager.popMatrix(); - } - -// @Override -// public void drawAnimations(Minecraft minecraft, int recipeWidth, int recipeHeight) { -// flame.draw(minecraft, 2, 0); -// } - - @Override - public List getTooltipStrings(int mouseX, int mouseY) { - return Lists.newArrayList(); - } - - @Override - public boolean handleClick(Minecraft minecraft, int mouseX, int mouseY, int mouseButton) { - return false; - } - - public static class Dirty extends WrapperCombustionEngine { - final IDirtyFuel dirty; - - Dirty(IGuiHelper guiHelper, IDirtyFuel fuel) { - super(guiHelper, fuel); - this.dirty = fuel; - } - - @Override - public void getIngredients(IIngredients ingredients) { - super.getIngredients(ingredients); - ingredients.setOutput(FluidStack.class, this.dirty.getResidue()); - } - } -} diff --git a/common/buildcraft/compat/module/jei/energy/combustionengine/package-info.java b/common/buildcraft/compat/module/jei/energy/combustionengine/package-info.java index 1cad84d..3d25469 100644 --- a/common/buildcraft/compat/module/jei/energy/combustionengine/package-info.java +++ b/common/buildcraft/compat/module/jei/energy/combustionengine/package-info.java @@ -2,5 +2,6 @@ @MethodsReturnNonnullByDefault package buildcraft.compat.module.jei.energy.combustionengine; -import javax.annotation.ParametersAreNonnullByDefault; -import mcp.MethodsReturnNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/common/buildcraft/compat/module/jei/factory/CategoryCoolable.java b/common/buildcraft/compat/module/jei/factory/CategoryCoolable.java index 426d952..7f09e18 100644 --- a/common/buildcraft/compat/module/jei/factory/CategoryCoolable.java +++ b/common/buildcraft/compat/module/jei/factory/CategoryCoolable.java @@ -1,64 +1,138 @@ package buildcraft.compat.module.jei.factory; -import net.minecraft.client.Minecraft; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fluids.FluidStack; import buildcraft.api.BCModules; -import mezz.jei.api.IGuiHelper; -import mezz.jei.api.gui.IDrawable; -import mezz.jei.api.gui.IGuiFluidStackGroup; -import mezz.jei.api.gui.IRecipeLayout; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.BlankRecipeCategory; - -public class CategoryCoolable extends BlankRecipeCategory { - public static final String UID = "buildcraft:category_coolable"; +import buildcraft.api.recipes.IRefineryRecipeManager; +import buildcraft.factory.BCFactoryBlocks; +import buildcraft.lib.misc.StackUtil; +import com.google.common.collect.Lists; +import com.mojang.blaze3d.platform.InputConstants; +import com.mojang.blaze3d.vertex.PoseStack; +import mezz.jei.api.constants.VanillaTypes; +import mezz.jei.api.forge.ForgeTypes; +import mezz.jei.api.gui.builder.IRecipeLayoutBuilder; +import mezz.jei.api.gui.drawable.IDrawable; +import mezz.jei.api.gui.drawable.IDrawableAnimated; +import mezz.jei.api.gui.drawable.IDrawableStatic; +import mezz.jei.api.gui.ingredient.IRecipeSlotsView; +import mezz.jei.api.helpers.IGuiHelper; +import mezz.jei.api.recipe.IFocusGroup; +import mezz.jei.api.recipe.RecipeIngredientRole; +import mezz.jei.api.recipe.RecipeType; +import mezz.jei.api.recipe.category.IRecipeCategory; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; + +import java.util.List; + +//public class CategoryCoolable extends BlankRecipeCategory +public class CategoryCoolable implements IRecipeCategory { + // Calen + public static final RecipeType RECIPE_TYPE = + RecipeType.create(BCModules.FACTORY.getModId(), "category_coolable", IRefineryRecipeManager.ICoolableRecipe.class); + public static final ResourceLocation UID = new ResourceLocation(BCModules.FACTORY.getModId(), "category_coolable"); public static final ResourceLocation heatExchangerBackground = new ResourceLocation("buildcraftfactory:textures/gui/heat_exchanger.png"); + private final IDrawable background; + private final IDrawable slot; + + private final IDrawable icon; + + private final IDrawableAnimated animatedCooling; + private final IDrawableAnimated animatedHeating; + + public CategoryCoolable(IGuiHelper guiHelper) { + // Calen: top padding add 2 to be same height as heatable +// this.background = helper.createDrawable(heatExchangerBackground, 61, 38, 54, 17, 0, 0, 18, 80); +// this.background = guiHelper.drawableBuilder(heatExchangerBackground, 61, 38, 54, 17).addPadding(0, 0, 18, 80).build(); + this.background = guiHelper.drawableBuilder(heatExchangerBackground, 61, 38, 54, 17).addPadding(2, 0, 18, 80).build(); + this.slot = guiHelper.createDrawable(heatExchangerBackground, 7, 22, 18, 18); - private final IDrawable background, slot; + this.icon = guiHelper.createDrawableIngredient(VanillaTypes.ITEM_STACK, new ItemStack(BCFactoryBlocks.heatExchange.get())); - public CategoryCoolable(IGuiHelper helper) { - this.background = helper.createDrawable(heatExchangerBackground, 61, 38, 54, 17, 0, 0, 18, 80); - this.slot = helper.createDrawable(heatExchangerBackground, 7, 22, 18, 18); + IDrawableStatic overComplete = guiHelper.createDrawable(CategoryCoolable.heatExchangerBackground, 52, 171, 54, 17); + this.animatedCooling = guiHelper.createAnimatedDrawable(overComplete, 40, IDrawableAnimated.StartDirection.LEFT, false); + overComplete = guiHelper.createDrawable(CategoryCoolable.heatExchangerBackground, 52, 188, 54, 17); + this.animatedHeating = guiHelper.createAnimatedDrawable(overComplete, 40, IDrawableAnimated.StartDirection.RIGHT, false); } @Override - public String getUid() { + public ResourceLocation getUid() { return UID; } @Override - public String getTitle() { - return "Coolable Fluids"; + public Class getRecipeClass() { + return IRefineryRecipeManager.ICoolableRecipe.class; } @Override + public RecipeType getRecipeType() { + return RECIPE_TYPE; + } + + public Component getTitle() { +// return new TextComponent("Coolable Fluids"); + return new TranslatableComponent("buildcraft.jei.title.coolable_fluids"); + } + public String getModName() { return BCModules.FACTORY.name(); } - @Override public IDrawable getBackground() { return this.background; } @Override - public void drawExtras(Minecraft minecraft) { - slot.draw(minecraft, 0, 0); - slot.draw(minecraft, 72, 0); + public IDrawable getIcon() { + return this.icon; } -// -// @Override -// public void drawAnimations(Minecraft minecraft) {} @Override - public void setRecipe(IRecipeLayout recipeLayout, WrapperCoolable recipeWrapper, IIngredients ingredients) { - IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks(); +// public void drawExtras(Minecraft minecraft) + public void draw(IRefineryRecipeManager.ICoolableRecipe recipe, IRecipeSlotsView recipeSlotsView, PoseStack stack, double mouseX, double mouseY) { + // Calen: y+1 to be at the same height as tubes of background + // in 1.18.2 additionally +1 +// this.slot.draw(stack, 0, 0); + this.slot.draw(stack, 0, 1); +// this.slot.draw(stack, 72, 0); + this.slot.draw(stack, 72, 1); + + // Calen: top padding add 2 to be same height as heatable +// this.animatedCooling.draw(stack, 18, 0); + this.animatedCooling.draw(stack, 18, 2); +// this.animatedHeating.draw(stack, 18, 0); + this.animatedHeating.draw(stack, 18, 2); + } - guiFluidStacks.init(0, true, 1, 1, 16, 16, 10, false, null); - guiFluidStacks.set(0, ingredients.getInputs(FluidStack.class).get(0)); + @Override +// public void setRecipe(IRecipeLayout recipeLayout, WrapperCoolable recipeWrapper, IIngredients ingredients) + public void setRecipe(IRecipeLayoutBuilder builder, IRefineryRecipeManager.ICoolableRecipe recipe, IFocusGroup focuses) { +// IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks(); +// guiFluidStacks.init(0, true, 1, 1, 16, 16, 10, false, (IDrawable) null); +// guiFluidStacks.set(0, (List) ingredients.getInputs(FluidStack.class).get(0)); + builder +// .addSlot(RecipeIngredientRole.INPUT, 1, 1) + .addSlot(RecipeIngredientRole.INPUT, 1, 2) + .setFluidRenderer(10, false, 16, 16) + .addIngredient(ForgeTypes.FLUID_STACK, recipe.in()); +// guiFluidStacks.init(1, false, 73, 1, 16, 16, 10, false, (IDrawable) null); +// guiFluidStacks.set(1, (List) ingredients.getOutputs(FluidStack.class).get(0)); + builder +// .addSlot(RecipeIngredientRole.OUTPUT, 73, 1) + .addSlot(RecipeIngredientRole.OUTPUT, 73, 2) + .setFluidRenderer(10, false, 16, 16) + .addIngredient(ForgeTypes.FLUID_STACK, recipe.out() == null ? StackUtil.EMPTY_FLUID : recipe.out()); + } - guiFluidStacks.init(1, false, 73, 1, 16, 16, 10, false, null); - guiFluidStacks.set(1, ingredients.getOutputs(FluidStack.class).get(0)); + @Override + public List getTooltipStrings(IRefineryRecipeManager.ICoolableRecipe recipe, IRecipeSlotsView recipeSlotsView, double mouseX, double mouseY) { + return Lists.newArrayList(); + } + + @Override + public boolean handleInput(IRefineryRecipeManager.ICoolableRecipe recipe, double mouseX, double mouseY, InputConstants.Key input) { + return false; } } diff --git a/common/buildcraft/compat/module/jei/factory/CategoryDistiller.java b/common/buildcraft/compat/module/jei/factory/CategoryDistiller.java index 64f4501..b46cd66 100644 --- a/common/buildcraft/compat/module/jei/factory/CategoryDistiller.java +++ b/common/buildcraft/compat/module/jei/factory/CategoryDistiller.java @@ -1,70 +1,144 @@ package buildcraft.compat.module.jei.factory; -import net.minecraft.client.Minecraft; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fluids.FluidStack; import buildcraft.api.BCModules; -import mezz.jei.api.IGuiHelper; -import mezz.jei.api.gui.IDrawable; -import mezz.jei.api.gui.IGuiFluidStackGroup; -import mezz.jei.api.gui.IRecipeLayout; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.BlankRecipeCategory; - -public class CategoryDistiller extends BlankRecipeCategory { - public static final String UID = "buildcraft:category_distiller"; +import buildcraft.api.mj.MjAPI; +import buildcraft.api.recipes.IRefineryRecipeManager; +import buildcraft.factory.BCFactoryBlocks; +import com.google.common.collect.Lists; +import com.mojang.blaze3d.platform.InputConstants; +import com.mojang.blaze3d.vertex.PoseStack; +import mezz.jei.api.constants.VanillaTypes; +import mezz.jei.api.forge.ForgeTypes; +import mezz.jei.api.gui.builder.IRecipeLayoutBuilder; +import mezz.jei.api.gui.drawable.IDrawable; +import mezz.jei.api.gui.drawable.IDrawableAnimated; +import mezz.jei.api.gui.drawable.IDrawableStatic; +import mezz.jei.api.gui.ingredient.IRecipeSlotsView; +import mezz.jei.api.helpers.IGuiHelper; +import mezz.jei.api.recipe.IFocusGroup; +import mezz.jei.api.recipe.RecipeIngredientRole; +import mezz.jei.api.recipe.RecipeType; +import mezz.jei.api.recipe.category.IRecipeCategory; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Font; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +import java.awt.*; +import java.util.List; + +//public class CategoryDistiller extends BlankRecipeCategory +public class CategoryDistiller implements IRecipeCategory { + // Calen + public static final RecipeType RECIPE_TYPE = + RecipeType.create(BCModules.FACTORY.getModId(), "category_distiller", IRefineryRecipeManager.IDistillationRecipe.class); + public static final ResourceLocation UID = new ResourceLocation(BCModules.FACTORY.getModId(), "category_distiller"); public static final ResourceLocation distillerBackground = new ResourceLocation("buildcraftfactory:textures/gui/distiller.png"); + private final IDrawable background; + private final IDrawable slot; + private final IDrawable fakeBackground; + + private final IDrawable icon; + + private final IDrawableAnimated animated; - private final IDrawable background, slot, fakeBackground; + @OnlyIn(Dist.CLIENT) + private Font font = Minecraft.getInstance().font; - public CategoryDistiller(IGuiHelper helper) { - this.fakeBackground = helper.createBlankDrawable(76, 65); - this.background = helper.createDrawable(distillerBackground, 61, 12, 36, 57); - this.slot = helper.createDrawable(distillerBackground, 7, 34, 18, 18); + public CategoryDistiller(IGuiHelper guiHelper) { +// this.fakeBackground = guiHelper.createBlankDrawable(76, 65); + this.fakeBackground = guiHelper.createBlankDrawable(90, 65); + this.background = guiHelper.createDrawable(distillerBackground, 61, 12, 36, 57); + this.slot = guiHelper.createDrawable(distillerBackground, 7, 34, 18, 18); + + this.icon = guiHelper.createDrawableIngredient(VanillaTypes.ITEM_STACK, new ItemStack(BCFactoryBlocks.distiller.get())); + + IDrawableStatic overComplete = guiHelper.createDrawable(CategoryDistiller.distillerBackground, 212, 0, 36, 57); + this.animated = guiHelper.createAnimatedDrawable(overComplete, 40, IDrawableAnimated.StartDirection.LEFT, false); } @Override - public String getUid() { + public ResourceLocation getUid() { return UID; } @Override - public String getTitle() { - return "Distillable Fluids"; + public Class getRecipeClass() { + return IRefineryRecipeManager.IDistillationRecipe.class; + } + + @Override + public RecipeType getRecipeType() { + return RECIPE_TYPE; } @Override + public Component getTitle() { +// return new TextComponent("Distillable Fluids"); + return new TranslatableComponent("buildcraft.jei.title.distillable_fluids"); + } + public String getModName() { return BCModules.FACTORY.name(); } @Override public IDrawable getBackground() { - return fakeBackground; + return this.fakeBackground; } @Override - public void drawExtras(Minecraft minecraft) { - this.background.draw(minecraft, 20, 4); - this.slot.draw(minecraft, 0, 25); // -20, 21); - this.slot.draw(minecraft, 56, 0); // 36, -4); - this.slot.draw(minecraft, 56, 45); // 36, 41); + public IDrawable getIcon() { + return this.icon; } -// @Override -// public void drawAnimations(Minecraft minecraft) {} - @Override - public void setRecipe(IRecipeLayout recipeLayout, WrapperDistiller recipeWrapper, IIngredients ingredients) { - IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks(); +// public void drawExtras(Minecraft minecraft) + public void draw(IRefineryRecipeManager.IDistillationRecipe recipe, IRecipeSlotsView recipeSlotsView, PoseStack stack, double mouseX, double mouseY) { + this.background.draw(stack, 20, 4); + this.slot.draw(stack, 0, 25); + this.slot.draw(stack, 56, 0); + this.slot.draw(stack, 56, 45); + + this.animated.draw(stack, 20, 4); + this.font.draw(stack, MjAPI.formatMj(recipe.powerRequired()) + " MJ", 58, 28, Color.CYAN.getRGB()); + } - guiFluidStacks.init(0, true, /*-19, 22*/ 1, 26, 16, 16, 10, false, null); - guiFluidStacks.set(0, ingredients.getInputs(FluidStack.class).get(0)); + @Override +// public void setRecipe(IRecipeLayout recipeLayout, WrapperDistiller recipeWrapper, IIngredients ingredients) + public void setRecipe(IRecipeLayoutBuilder builder, IRefineryRecipeManager.IDistillationRecipe recipe, IFocusGroup focuses) { +// IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks(); +// guiFluidStacks.init(0, true, 1, 26, 16, 16, 10, false, (IDrawable) null); +// guiFluidStacks.set(0, (List) ingredients.getInputs(FluidStack.class).get(0)); + builder + .addSlot(RecipeIngredientRole.INPUT, 1, 26) + .setFluidRenderer(10, false, 16, 16) + .addIngredient(ForgeTypes.FLUID_STACK, recipe.in()); +// guiFluidStacks.init(1, false, 57, 1, 16, 16, 10, false, (IDrawable) null); +// guiFluidStacks.set(1, (List) ingredients.getOutputs(FluidStack.class).get(0)); + builder + .addSlot(RecipeIngredientRole.OUTPUT, 57, 1) + .setFluidRenderer(10, false, 16, 16) + .addIngredient(ForgeTypes.FLUID_STACK, recipe.outGas()); +// guiFluidStacks.init(2, false, 57, 46, 16, 16, 10, false, (IDrawable) null); +// guiFluidStacks.set(2, (List) ingredients.getOutputs(FluidStack.class).get(1)); + builder + .addSlot(RecipeIngredientRole.OUTPUT, 57, 46) + .setFluidRenderer(10, false, 16, 16) + .addIngredient(ForgeTypes.FLUID_STACK, recipe.outLiquid()); + } - guiFluidStacks.init(1, false, /*37, -3*/ 57, 1, 16, 16, 10, false, null); - guiFluidStacks.set(1, ingredients.getOutputs(FluidStack.class).get(0)); + @Override + public List getTooltipStrings(IRefineryRecipeManager.IDistillationRecipe recipe, IRecipeSlotsView recipeSlotsView, double mouseX, double mouseY) { + return Lists.newArrayList(); + } - guiFluidStacks.init(2, false, /*37, 42*/ 57, 46, 16, 16, 10, false, null); - guiFluidStacks.set(2, ingredients.getOutputs(FluidStack.class).get(1)); + @Override + public boolean handleInput(IRefineryRecipeManager.IDistillationRecipe recipe, double mouseX, double mouseY, InputConstants.Key input) { + return false; } } diff --git a/common/buildcraft/compat/module/jei/factory/CategoryHeatable.java b/common/buildcraft/compat/module/jei/factory/CategoryHeatable.java index 75300fb..0d3062f 100644 --- a/common/buildcraft/compat/module/jei/factory/CategoryHeatable.java +++ b/common/buildcraft/compat/module/jei/factory/CategoryHeatable.java @@ -1,39 +1,82 @@ package buildcraft.compat.module.jei.factory; -import net.minecraft.client.Minecraft; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fluids.FluidStack; import buildcraft.api.BCModules; -import mezz.jei.api.IGuiHelper; -import mezz.jei.api.gui.IDrawable; -import mezz.jei.api.gui.IGuiFluidStackGroup; -import mezz.jei.api.gui.IRecipeLayout; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.BlankRecipeCategory; - -public class CategoryHeatable extends BlankRecipeCategory { - public static final String UID = "buildcraft:category_heatable"; +import buildcraft.api.recipes.IRefineryRecipeManager; +import buildcraft.factory.BCFactoryBlocks; +import buildcraft.lib.misc.StackUtil; +import com.google.common.collect.Lists; +import com.mojang.blaze3d.platform.InputConstants; +import com.mojang.blaze3d.vertex.PoseStack; +import mezz.jei.api.constants.VanillaTypes; +import mezz.jei.api.forge.ForgeTypes; +import mezz.jei.api.gui.builder.IRecipeLayoutBuilder; +import mezz.jei.api.gui.drawable.IDrawable; +import mezz.jei.api.gui.drawable.IDrawableAnimated; +import mezz.jei.api.gui.drawable.IDrawableStatic; +import mezz.jei.api.gui.ingredient.IRecipeSlotsView; +import mezz.jei.api.helpers.IGuiHelper; +import mezz.jei.api.recipe.IFocusGroup; +import mezz.jei.api.recipe.RecipeIngredientRole; +import mezz.jei.api.recipe.RecipeType; +import mezz.jei.api.recipe.category.IRecipeCategory; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +import java.util.List; + +//public class CategoryHeatable extends BlankRecipeCategory +public class CategoryHeatable implements IRecipeCategory { + // Calen + public static final RecipeType RECIPE_TYPE = + RecipeType.create(BCModules.FACTORY.getModId(), "category_heatable", IRefineryRecipeManager.IHeatableRecipe.class); + public static final ResourceLocation UID = new ResourceLocation(BCModules.FACTORY.getModId(), "category_heatable"); public static final ResourceLocation energyHeaterBackground = new ResourceLocation("buildcraftfactory:textures/gui/energy_heater.png"); + private final IDrawable background; + private final IDrawable slotIn; + private final IDrawable slotOut; + + private final IDrawable icon; + + private final IDrawableAnimated animated; - private final IDrawable background, slotIn, slotOut; - public CategoryHeatable(IGuiHelper helper) { - this.background = helper.createDrawable(energyHeaterBackground, 176, 19, 54, 19, 0, 0, 18, 80); - this.slotIn = helper.createDrawable(energyHeaterBackground, 7, 22, 18, 18, 0, 0, 0, 0); - this.slotOut = helper.createDrawable(energyHeaterBackground, 7, 22, 18, 18, 0, 0, 72, 0); + public CategoryHeatable(IGuiHelper guiHelper) { +// this.background = helper.createDrawable(energyHeaterBackground, 176, 19, 54, 19, 0, 0, 18, 80); + this.background = guiHelper.drawableBuilder(energyHeaterBackground, 176, 19, 54, 19).addPadding(0, 0, 18, 80).build(); + // Calen: top+1 to be at the same height as tubes of background +// this.slotIn = helper.createDrawable(energyHeaterBackground, 7, 22, 18, 18, 0, 0, 0, 0); +// this.slotIn = guiHelper.drawableBuilder(energyHeaterBackground, 7, 22, 18, 18).addPadding(0, 0, 0, 0).build(); + this.slotIn = guiHelper.drawableBuilder(energyHeaterBackground, 7, 22, 18, 18).addPadding(1, 0, 0, 0).build(); +// this.slotOut = helper.createDrawable(energyHeaterBackground, 7, 22, 18, 18, 0, 0, 72, 0); +// this.slotOut = guiHelper.drawableBuilder(energyHeaterBackground, 7, 22, 18, 18).addPadding(0, 0, 72, 0).build(); + this.slotOut = guiHelper.drawableBuilder(energyHeaterBackground, 7, 22, 18, 18).addPadding(1, 0, 72, 0).build(); + + this.icon = guiHelper.createDrawableIngredient(VanillaTypes.ITEM_STACK, new ItemStack(BCFactoryBlocks.heatExchange.get())); + + IDrawableStatic overComplete = guiHelper.createDrawable(CategoryHeatable.energyHeaterBackground, 176, 152, 54, 19); + this.animated = guiHelper.createAnimatedDrawable(overComplete, 40, IDrawableAnimated.StartDirection.LEFT, false); } @Override - public String getUid() { + public ResourceLocation getUid() { return UID; } @Override - public String getTitle() { - return "Heatable Fluids"; + public Class getRecipeClass() { + return IRefineryRecipeManager.IHeatableRecipe.class; } @Override + public Component getTitle() { +// return new TextComponent("Heatable Fluids"); + return new TranslatableComponent("buildcraft.jei.title.heatable_fluids"); + } + public String getModName() { return BCModules.FACTORY.name(); } @@ -44,22 +87,47 @@ public IDrawable getBackground() { } @Override - public void drawExtras(Minecraft minecraft) { - slotIn.draw(minecraft); - slotOut.draw(minecraft); + public IDrawable getIcon() { + return this.icon; } -// @Override -// public void drawAnimations(Minecraft minecraft) {} + @OnlyIn(Dist.CLIENT) + @Override +// public void drawExtras(Minecraft minecraft) + public void draw(IRefineryRecipeManager.IHeatableRecipe recipe, IRecipeSlotsView recipeSlotsView, PoseStack stack, double mouseX, double mouseY) { + this.slotIn.draw(stack); + this.slotOut.draw(stack); + + this.animated.draw(stack, 18, 0); + } @Override - public void setRecipe(IRecipeLayout recipeLayout, WrapperHeatable recipeWrapper, IIngredients ingredients) { - IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks(); +// public void setRecipe(IRecipeLayout recipeLayout, WrapperHeatable recipeWrapper, IIngredients ingredients) + public void setRecipe(IRecipeLayoutBuilder builder, IRefineryRecipeManager.IHeatableRecipe recipe, IFocusGroup focuses) { +// IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks(); +// guiFluidStacks.init(0, true, 1, 1, 16, 16, 10, false, (IDrawable) null); +// guiFluidStacks.set(0, (List) ingredients.getInputs(FluidStack.class).get(0)); + builder +// .addSlot(RecipeIngredientRole.INPUT, 1, 1) + .addSlot(RecipeIngredientRole.INPUT, 1, 2) + .setFluidRenderer(10, false, 16, 16) + .addIngredient(ForgeTypes.FLUID_STACK, recipe.in()); +// guiFluidStacks.init(1, false, 73, 1, 16, 16, 10, false, (IDrawable) null); +// guiFluidStacks.set(1, (List) ingredients.getOutputs(FluidStack.class).get(0)); + builder +// .addSlot(RecipeIngredientRole.OUTPUT, 73, 1) + .addSlot(RecipeIngredientRole.OUTPUT, 73, 2) + .setFluidRenderer(10, false, 16, 16) + .addIngredient(ForgeTypes.FLUID_STACK, recipe.out() == null ? StackUtil.EMPTY_FLUID : recipe.out()); + } - guiFluidStacks.init(0, true, 1, 1, 16, 16, 10, false, null); - guiFluidStacks.set(0, ingredients.getInputs(FluidStack.class).get(0)); + @Override + public List getTooltipStrings(IRefineryRecipeManager.IHeatableRecipe recipe, IRecipeSlotsView recipeSlotsView, double mouseX, double mouseY) { + return Lists.newArrayList(); + } - guiFluidStacks.init(1, false, 73, 1, 16, 16, 10, false, null); - guiFluidStacks.set(1, ingredients.getOutputs(FluidStack.class).get(0)); + @Override + public boolean handleInput(IRefineryRecipeManager.IHeatableRecipe recipe, double mouseX, double mouseY, InputConstants.Key input) { + return false; } } diff --git a/common/buildcraft/compat/module/jei/factory/HandlerCoolable.java b/common/buildcraft/compat/module/jei/factory/HandlerCoolable.java deleted file mode 100644 index a2fa129..0000000 --- a/common/buildcraft/compat/module/jei/factory/HandlerCoolable.java +++ /dev/null @@ -1,15 +0,0 @@ -package buildcraft.compat.module.jei.factory; - -import buildcraft.api.recipes.IRefineryRecipeManager; - -import buildcraft.compat.module.jei.BCPluginJEI; - -import mezz.jei.api.recipe.IRecipeWrapper; -import mezz.jei.api.recipe.IRecipeWrapperFactory; - -public class HandlerCoolable implements IRecipeWrapperFactory { - @Override - public IRecipeWrapper getRecipeWrapper(IRefineryRecipeManager.ICoolableRecipe recipe) { - return new WrapperCoolable(BCPluginJEI.registry.getJeiHelpers().getGuiHelper(), recipe); - } -} diff --git a/common/buildcraft/compat/module/jei/factory/HandlerDistiller.java b/common/buildcraft/compat/module/jei/factory/HandlerDistiller.java deleted file mode 100644 index a510139..0000000 --- a/common/buildcraft/compat/module/jei/factory/HandlerDistiller.java +++ /dev/null @@ -1,15 +0,0 @@ -package buildcraft.compat.module.jei.factory; - -import buildcraft.api.recipes.IRefineryRecipeManager; - -import buildcraft.compat.module.jei.BCPluginJEI; - -import mezz.jei.api.recipe.IRecipeWrapper; -import mezz.jei.api.recipe.IRecipeWrapperFactory; - -public class HandlerDistiller implements IRecipeWrapperFactory { - @Override - public IRecipeWrapper getRecipeWrapper(IRefineryRecipeManager.IDistillationRecipe recipe) { - return new WrapperDistiller(BCPluginJEI.registry.getJeiHelpers().getGuiHelper(), recipe); - } -} diff --git a/common/buildcraft/compat/module/jei/factory/HandlerHeatable.java b/common/buildcraft/compat/module/jei/factory/HandlerHeatable.java deleted file mode 100644 index 0fbb251..0000000 --- a/common/buildcraft/compat/module/jei/factory/HandlerHeatable.java +++ /dev/null @@ -1,15 +0,0 @@ -package buildcraft.compat.module.jei.factory; - -import buildcraft.api.recipes.IRefineryRecipeManager; - -import buildcraft.compat.module.jei.BCPluginJEI; - -import mezz.jei.api.recipe.IRecipeWrapper; -import mezz.jei.api.recipe.IRecipeWrapperFactory; - -public class HandlerHeatable implements IRecipeWrapperFactory { - @Override - public IRecipeWrapper getRecipeWrapper(IRefineryRecipeManager.IHeatableRecipe recipe) { - return new WrapperHeatable(BCPluginJEI.registry.getJeiHelpers().getGuiHelper(), recipe); - } -} diff --git a/common/buildcraft/compat/module/jei/factory/WrapperCoolable.java b/common/buildcraft/compat/module/jei/factory/WrapperCoolable.java deleted file mode 100644 index 518ae0d..0000000 --- a/common/buildcraft/compat/module/jei/factory/WrapperCoolable.java +++ /dev/null @@ -1,86 +0,0 @@ -package buildcraft.compat.module.jei.factory; - -import java.util.List; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; -import net.minecraft.client.Minecraft; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import buildcraft.api.recipes.IRefineryRecipeManager; -import mezz.jei.api.IGuiHelper; -import mezz.jei.api.gui.IDrawableAnimated; -import mezz.jei.api.gui.IDrawableStatic; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.IRecipeWrapper; - -public class WrapperCoolable implements IRecipeWrapper { - private final IRefineryRecipeManager.ICoolableRecipe recipe; - private final ImmutableList in, out; - private final IDrawableAnimated animatedCooling, animatedHeating; - - WrapperCoolable(IGuiHelper guiHelper, IRefineryRecipeManager.ICoolableRecipe recipe) { - this.recipe = recipe; - this.in = ImmutableList.of(recipe.in()); - //noinspection ConstantConditions - this.out = (recipe.out() != null) ? ImmutableList.of(recipe.out()) : ImmutableList.of(); - - IDrawableStatic overComplete = guiHelper.createDrawable(CategoryCoolable.heatExchangerBackground, 52, 171, 54, 17); - this.animatedCooling = guiHelper.createAnimatedDrawable(overComplete, /*recipe.ticks() * 20*/ 40, IDrawableAnimated.StartDirection.LEFT, false); - overComplete = guiHelper.createDrawable(CategoryCoolable.heatExchangerBackground, 52, 188, 54, 17); - this.animatedHeating = guiHelper.createAnimatedDrawable(overComplete, /*recipe.ticks() * 20*/ 40, IDrawableAnimated.StartDirection.RIGHT, false); - } - -// @Override -// public List getInputs() { -// return Collections.emptyList(); -// } -// -// @Override -// public List getOutputs() { -// return Collections.emptyList(); -// } -// -// @Override -// public List getFluidInputs() { -// return in; -// } -// -// @Override -// public List getFluidOutputs() { -// return out; -// } -// -// @Override -// public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight) {} - - @Override - public void getIngredients(IIngredients ingredients) { - ingredients.setInputs(FluidStack.class, this.in); - ingredients.setOutputs(FluidStack.class, this.out); - } - - @Override - @SideOnly(Side.CLIENT) - public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) { - this.animatedCooling.draw(minecraft, 18, 0); - this.animatedHeating.draw(minecraft, 18, 0); - // minecraft.fontRenderer.drawString("Takes " + (recipe.ticks() / 20.0) + "s", 93, 0, Color.gray.getRGB()); - } - -// @Override -// public void drawAnimations(Minecraft minecraft, int recipeWidth, int recipeHeight) { -// animatedCooling.draw(minecraft, 18, 0); -// animatedHeating.draw(minecraft, 18, 0); -// } - - @Override - public List getTooltipStrings(int mouseX, int mouseY) { - return Lists.newArrayList(); - } - - @Override - public boolean handleClick(Minecraft minecraft, int mouseX, int mouseY, int mouseButton) { - return false; - } -} diff --git a/common/buildcraft/compat/module/jei/factory/WrapperDistiller.java b/common/buildcraft/compat/module/jei/factory/WrapperDistiller.java deleted file mode 100644 index 0c4b316..0000000 --- a/common/buildcraft/compat/module/jei/factory/WrapperDistiller.java +++ /dev/null @@ -1,84 +0,0 @@ -package buildcraft.compat.module.jei.factory; - -import java.awt.Color; -import java.util.List; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; -import net.minecraft.client.Minecraft; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import buildcraft.api.mj.MjAPI; -import buildcraft.api.recipes.IRefineryRecipeManager; -import mezz.jei.api.IGuiHelper; -import mezz.jei.api.gui.IDrawableAnimated; -import mezz.jei.api.gui.IDrawableStatic; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.IRecipeWrapper; - -public class WrapperDistiller implements IRecipeWrapper { - public final IRefineryRecipeManager.IDistillationRecipe recipe; - private final ImmutableList in, out; - private final IDrawableAnimated animated; - - WrapperDistiller(IGuiHelper guiHelper, IRefineryRecipeManager.IDistillationRecipe recipe) { - this.recipe = recipe; - this.in = ImmutableList.of(recipe.in()); - this.out = ImmutableList.of(recipe.outGas(), recipe.outLiquid()); - - IDrawableStatic overComplete = guiHelper.createDrawable(CategoryDistiller.distillerBackground, 212, 0, 36, 57); - this.animated = guiHelper.createAnimatedDrawable(overComplete, /*recipe.ticks() * 20*/ 40, IDrawableAnimated.StartDirection.LEFT, false); - } - -// @Override -// public List getInputs() { -// return Collections.emptyList(); -// } -// -// @Override -// public List getOutputs() { -// return Collections.emptyList(); -// } -// -// @Override -// public List getFluidInputs() { -// return in; -// } -// -// @Override -// public List getFluidOutputs() { -// return out; -// } -// -// @Override -// public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight) {} - - - @Override - public void getIngredients(IIngredients ingredients) { - ingredients.setInputs(FluidStack.class, this.in); - ingredients.setOutputs(FluidStack.class, this.out); - } - - @Override - @SideOnly(Side.CLIENT) - public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) { - this.animated.draw(minecraft, 20, 4); - minecraft.fontRenderer.drawString(MjAPI.formatMj(recipe.powerRequired()) + " MJ", 58, 28, Color.CYAN.getRGB()); - } - -// @Override -// public void drawAnimations(Minecraft minecraft, int recipeWidth, int recipeHeight) { -// animated.draw(minecraft, 0, 0); -// } - - @Override - public List getTooltipStrings(int mouseX, int mouseY) { - return Lists.newArrayList(); - } - - @Override - public boolean handleClick(Minecraft minecraft, int mouseX, int mouseY, int mouseButton) { - return false; - } -} diff --git a/common/buildcraft/compat/module/jei/factory/WrapperHeatable.java b/common/buildcraft/compat/module/jei/factory/WrapperHeatable.java deleted file mode 100644 index 593aed0..0000000 --- a/common/buildcraft/compat/module/jei/factory/WrapperHeatable.java +++ /dev/null @@ -1,84 +0,0 @@ -package buildcraft.compat.module.jei.factory; - -import java.util.List; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; -import net.minecraft.client.Minecraft; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import buildcraft.api.recipes.IRefineryRecipeManager; -import mezz.jei.api.IGuiHelper; -import mezz.jei.api.gui.IDrawableAnimated; -import mezz.jei.api.gui.IDrawableStatic; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.IRecipeWrapper; - -public class WrapperHeatable implements IRecipeWrapper { - private final IRefineryRecipeManager.IHeatableRecipe heatable; - private final ImmutableList in, out; - private final IDrawableAnimated animated; - - public WrapperHeatable(IGuiHelper guiHelper, IRefineryRecipeManager.IHeatableRecipe recipe) { - this.heatable = recipe; - this.in = ImmutableList.of(recipe.in()); - //noinspection ConstantConditions - this.out = (recipe.out() != null) ? ImmutableList.of(recipe.out()) : ImmutableList.of(); - - IDrawableStatic overComplete = guiHelper.createDrawable(CategoryHeatable.energyHeaterBackground, 176, 152, 54, 19); - animated = guiHelper.createAnimatedDrawable(overComplete, /*recipe.ticks() * 20*/ 40, IDrawableAnimated.StartDirection.LEFT, false); - } - -// @Override -// public List getInputs() { -// return Collections.emptyList(); -// } -// -// @Override -// public List getOutputs() { -// return Collections.emptyList(); -// } -// -// @Override -// public List getFluidInputs() { -// return in; -// } -// -// @Override -// public List getFluidOutputs() { -// return out; -// } -// -// @Override -// public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight) {} - - @Override - public void getIngredients(IIngredients ingredients) { - ingredients.setInputs(FluidStack.class, this.in); - ingredients.setOutputs(FluidStack.class, this.out); - } - - @Override - @SideOnly(Side.CLIENT) - public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) { - this.animated.draw(minecraft, 18, 0); -// minecraft.fontRenderer.drawString("Takes " + (heatable.ticks() / 20.0) + "s", 93, 0, Color.gray.getRGB()); -// int rftick = Math.abs(heatable.heatFrom() - heatable.heatTo()) * BuildCraftFactory.rfPerHeatPerMB * heatable.in().amount; -// minecraft.fontRenderer.drawString(" at " + rftick + "RF/t", 93, 11, Color.gray.getRGB()); - } - -// @Override -// public void drawAnimations(Minecraft minecraft, int recipeWidth, int recipeHeight) { -// animated.draw(minecraft, 18, 0); -// } - - @Override - public List getTooltipStrings(int mouseX, int mouseY) { - return Lists.newArrayList(); - } - - @Override - public boolean handleClick(Minecraft minecraft, int mouseX, int mouseY, int mouseButton) { - return false; - } -} diff --git a/common/buildcraft/compat/module/jei/factory/package-info.java b/common/buildcraft/compat/module/jei/factory/package-info.java index 04b20ee..3153dd2 100644 --- a/common/buildcraft/compat/module/jei/factory/package-info.java +++ b/common/buildcraft/compat/module/jei/factory/package-info.java @@ -2,5 +2,6 @@ @MethodsReturnNonnullByDefault package buildcraft.compat.module.jei.factory; -import javax.annotation.ParametersAreNonnullByDefault; -import mcp.MethodsReturnNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/common/buildcraft/compat/module/jei/gui/GuiHandlerBuildCraft.java b/common/buildcraft/compat/module/jei/gui/GuiHandlerBuildCraft.java new file mode 100644 index 0000000..8cf0f13 --- /dev/null +++ b/common/buildcraft/compat/module/jei/gui/GuiHandlerBuildCraft.java @@ -0,0 +1,48 @@ +package buildcraft.compat.module.jei.gui; + +import buildcraft.lib.gui.GuiBC8; +import buildcraft.lib.gui.IGuiElement; +import buildcraft.lib.gui.pos.GuiRectangle; +import mezz.jei.api.gui.handlers.IGuiContainerHandler; +import net.minecraft.client.renderer.Rect2i; +import net.minecraft.util.Mth; +import org.jetbrains.annotations.NotNull; + +import java.util.ArrayList; +import java.util.List; + +public class GuiHandlerBuildCraft implements IGuiContainerHandler> { + @NotNull + @Override + public List getGuiExtraAreas(GuiBC8 guiDirty) { + List list = new ArrayList<>(); + + for (IGuiElement element : guiDirty.mainGui.shownElements) { + GuiRectangle rect = element.asImmutable(); + int x = (int) rect.x; + int y = (int) rect.y; +// int endX = MathHelper.ceil(rect.getEndX()); + int endX = Mth.ceil(rect.getEndX()); +// int endY = MathHelper.ceil(rect.getEndY()); + int endY = Mth.ceil(rect.getEndY()); + int width = endX - x; + int height = endY - y; + list.add(new Rect2i(x, y, width, height)); + } + + return list; + } + + +// @Nullable +// @Override +// public Object getIngredientUnderMouse(GuiBC8 screen, double mouseX, double mouseY) { +// return screen.getIngredientUnderMouse(mouseX, mouseY); +// } + +// @NotNull +// @Override +// public Collection getGuiClickableAreas(GuiBC8 screen, double mouseX, double mouseY) { +// return Collections.emptyList(); +// } +} diff --git a/common/buildcraft/compat/module/jei/recipe/GateGuiHandler.java b/common/buildcraft/compat/module/jei/recipe/GateGuiHandler.java deleted file mode 100644 index bb27224..0000000 --- a/common/buildcraft/compat/module/jei/recipe/GateGuiHandler.java +++ /dev/null @@ -1,37 +0,0 @@ -package buildcraft.compat.module.jei.recipe; -//package buildcraft.compat.module.jei; -// -//import java.awt.Rectangle; -//import java.util.ArrayList; -//import java.util.List; -// -//import buildcraft.transport.gui.GuiGateInterface; -// -//import mezz.jei.api.gui.IAdvancedGuiHandler; -// -//public class GateGuiHandler implements IAdvancedGuiHandler { -// @Override -// public Class getGuiContainerClass() { -// return GuiGateInterface.class; -// } -// -// @Override -// public List getGuiExtraAreas(GuiGateInterface gate) { -// List rectangles = new ArrayList<>(); -// int guiLeft = (gate.width - gate.xSize()) / 2; -// int guiTop = (gate.height - gate.ySize()) / 2; -// -// // Actions -// int actionStartX = guiLeft + gate.xSize(); -// int actionStartY = guiTop + 6; -// -// if (gate.actionRows > 1) { -// int endRow = gate.actionRows * 18; -// rectangles.add(new Rectangle(actionStartX, actionStartY, 6 * 18, endRow)); -// rectangles.add(new Rectangle(actionStartX, actionStartY + endRow, gate.lastActionRowSize, 18)); -// } else if (gate.actionRows == 1) { -// rectangles.add(new Rectangle(actionStartX, actionStartY, gate.lastActionRowSize, 18)); -// } -// return rectangles; -// } -//} diff --git a/common/buildcraft/compat/module/jei/recipe/GuiHandlerBuildCraft.java b/common/buildcraft/compat/module/jei/recipe/GuiHandlerBuildCraft.java deleted file mode 100644 index f6a434d..0000000 --- a/common/buildcraft/compat/module/jei/recipe/GuiHandlerBuildCraft.java +++ /dev/null @@ -1,51 +0,0 @@ -package buildcraft.compat.module.jei.recipe; - -import java.awt.Rectangle; -import java.util.ArrayList; -import java.util.List; - -import javax.annotation.Nullable; - -import net.minecraft.util.math.MathHelper; - -import buildcraft.lib.gui.GuiBC8; -import buildcraft.lib.gui.IGuiElement; -import buildcraft.lib.gui.pos.GuiRectangle; - -import mezz.jei.api.gui.IAdvancedGuiHandler; - -public class GuiHandlerBuildCraft implements IAdvancedGuiHandler { - - @Override - public Class getGuiContainerClass() { - return GuiBC8.class; - } - - @Override - @Nullable - public List getGuiExtraAreas(GuiBC8 guiDirty) { - GuiBC8 gui = guiDirty; - // Get the rectangles of everything that is *outside* the main gui area - List list = new ArrayList<>(); - for (IGuiElement element : gui.mainGui.shownElements) { - // Ignore children: all ledger style elements are top level - GuiRectangle rect = element.asImmutable(); -// if (!gui.rootElement.contains(rect)) { - // Round down x and y - int x = (int) rect.x; - int y = (int) rect.y; - // Round up width and height - int endX = MathHelper.ceil(rect.getEndX()); - int endY = MathHelper.ceil(rect.getEndY()); - int width = endX - x; - int height = endY - y; - list.add(new Rectangle(x, y, width, height)); -// } - } - if (list.isEmpty()) { - // Cheapen JEI checks a tiny bit. Possibly. - return null; - } - return list; - } -} diff --git a/common/buildcraft/compat/module/jei/recipe/HandlerFlexibleRecipe.java b/common/buildcraft/compat/module/jei/recipe/HandlerFlexibleRecipe.java deleted file mode 100644 index 1454d01..0000000 --- a/common/buildcraft/compat/module/jei/recipe/HandlerFlexibleRecipe.java +++ /dev/null @@ -1,15 +0,0 @@ -package buildcraft.compat.module.jei.recipe; -//package buildcraft.compat.module.jei.recipe; -// -//import buildcraft.api.recipes.IFlexibleRecipe; -// -//import javax.annotation.Nonnull; -//import mezz.jei.api.recipe.IRecipeHandler; -// -//public abstract class HandlerFlexibleRecipe implements IRecipeHandler { -// @Nonnull -// @Override -// public Class getRecipeClass() { -// return IFlexibleRecipe.class; -// } -//} diff --git a/common/buildcraft/compat/module/jei/recipe/LedgerGuiHandler.java b/common/buildcraft/compat/module/jei/recipe/LedgerGuiHandler.java deleted file mode 100644 index 7624e92..0000000 --- a/common/buildcraft/compat/module/jei/recipe/LedgerGuiHandler.java +++ /dev/null @@ -1,35 +0,0 @@ -package buildcraft.compat.module.jei.recipe; -//package buildcraft.compat.module.jei; -// -//import java.awt.Rectangle; -//import java.util.ArrayList; -//import java.util.List; -// -//import buildcraft.core.lib.gui.GuiBuildCraft; -//import buildcraft.core.lib.gui.Ledger; -// -//import mezz.jei.api.gui.IAdvancedGuiHandler; -// -//public class LedgerGuiHandler implements IAdvancedGuiHandler { -// @Override -// public Class getGuiContainerClass() { -// return GuiBuildCraft.class; -// } -// -// @Override -// public List getGuiExtraAreas(GuiBuildCraft gui) { -// List rectangles = new ArrayList<>(); -// int guiLeft = (gui.width - gui.xSize()) / 2; -// int guiTop = (gui.height - gui.ySize()) / 2; -// -// int yPos = 8; -// for (Ledger l : gui.ledgerManager.getAll()) { -// if (l.isVisible()) { -// rectangles.add(new Rectangle(guiLeft + gui.xSize(), guiTop + yPos, l.getWidth(), l.getHeight())); -// yPos += l.getHeight(); -// } -// } -// -// return rectangles; -// } -//} diff --git a/common/buildcraft/compat/module/jei/silicon/CategoryAssemblyTable.java b/common/buildcraft/compat/module/jei/silicon/CategoryAssemblyTable.java index 701b365..952e4f1 100644 --- a/common/buildcraft/compat/module/jei/silicon/CategoryAssemblyTable.java +++ b/common/buildcraft/compat/module/jei/silicon/CategoryAssemblyTable.java @@ -1,68 +1,151 @@ package buildcraft.compat.module.jei.silicon; +import buildcraft.api.BCModules; +import buildcraft.api.mj.MjAPI; +import buildcraft.api.recipes.IAssemblyRecipe; +import buildcraft.api.recipes.IngredientStack; +import buildcraft.silicon.BCSiliconBlocks; +import com.google.common.collect.Lists; +import com.mojang.blaze3d.vertex.PoseStack; +import mezz.jei.api.constants.VanillaTypes; +import mezz.jei.api.gui.builder.IRecipeLayoutBuilder; +import mezz.jei.api.gui.drawable.IDrawable; +import mezz.jei.api.gui.drawable.IDrawableAnimated; +import mezz.jei.api.gui.drawable.IDrawableStatic; +import mezz.jei.api.gui.ingredient.IRecipeSlotsView; +import mezz.jei.api.helpers.IGuiHelper; +import mezz.jei.api.recipe.IFocusGroup; +import mezz.jei.api.recipe.RecipeIngredientRole; +import mezz.jei.api.recipe.RecipeType; +import mezz.jei.api.recipe.category.IRecipeCategory; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Font; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +import java.awt.*; import java.util.List; +import java.util.*; + +public class CategoryAssemblyTable implements IRecipeCategory { + // Calen + public static final RecipeType RECIPE_TYPE = + RecipeType.create(BCModules.SILICON.getModId(), "assembly", IAssemblyRecipe.class); + // public static final ResourceLocation UID = new ResourceLocation("buildcraft-compat:silicon.assembly"); + public static final ResourceLocation UID = new ResourceLocation(BCModules.SILICON.getModId(), "assembly"); + protected final ResourceLocation backgroundLocation = new ResourceLocation("buildcraftsilicon", "textures/gui/assembly_table.png"); + private final IDrawable background; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; + private final IDrawable icon; -import buildcraft.api.BCModules; + private final Map progressBarMap = new HashMap<>(); + private final Map> inputsMap = new HashMap<>(); + private final Map outputsMap = new HashMap<>(); -import mezz.jei.api.IGuiHelper; -import mezz.jei.api.gui.IDrawable; -import mezz.jei.api.gui.IGuiItemStackGroup; -import mezz.jei.api.gui.IRecipeLayout; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.IRecipeCategory; + @OnlyIn(Dist.CLIENT) + private Font font = Minecraft.getInstance().font; -public class CategoryAssemblyTable implements IRecipeCategory { - public static final String UID = "buildcraft-compat:silicon.assembly"; + // public CategoryAssemblyTable(IGuiHelper guiHelper, AssemblyRecipeBasic recipe) + public CategoryAssemblyTable(IGuiHelper guiHelper, Collection recipes) { +// this.background = guiHelper.createDrawable(this.backgroundLocation, 5, 34, 166, 76, 10, 0, 0, 0); + this.background = guiHelper.drawableBuilder(this.backgroundLocation, 5, 34, 166, 76).addPadding(10, 0, 0, 0).build(); - protected final ResourceLocation backgroundLocation; - private final IDrawable background; + this.icon = guiHelper.createDrawableIngredient(VanillaTypes.ITEM_STACK, new ItemStack(BCSiliconBlocks.assemblyTable.get())); + + ResourceLocation backgroundLocation = new ResourceLocation("buildcraftsilicon", "textures/gui/assembly_table.png"); +// IDrawableStatic progressDrawable = guiHelper.createDrawable(backgroundLocation, 176, 48, 4, 71, 10, 0, 0, 0); + IDrawableStatic progressDrawable = guiHelper.drawableBuilder(backgroundLocation, 176, 48, 4, 71).addPadding(10, 0, 0, 0).build(); + + for (IAssemblyRecipe recipe : recipes) { + List _inputs = Lists.newArrayList(); + + for (IngredientStack in : recipe.getInputsFor(ItemStack.EMPTY)) { + List inner = new ArrayList(); + + for (ItemStack matching : in.ingredient.getItems()) { + matching = matching.copy(); + matching.setCount(in.count); + inner.add(matching); + } + + _inputs.add(Ingredient.of(inner.stream())); + } - public CategoryAssemblyTable(IGuiHelper guiHelper) { - this.backgroundLocation = new ResourceLocation("buildcraftsilicon", "textures/gui/assembly_table.png"); - this.background = guiHelper.createDrawable(backgroundLocation, 5, 34, 166, 76, 10, 0, 0, 0); + this.inputsMap.put(recipe, _inputs); + this.outputsMap.put(recipe, Ingredient.of(recipe.getOutputPreviews().stream())); + + long mj = recipe.getRequiredMicroJoulesFor(ItemStack.EMPTY); +// this.progressBar = guiHelper.createAnimatedDrawable(progressDrawable, (int) Math.max(10L, mj / MjAPI.MJ / 50L), IDrawableAnimated.StartDirection.BOTTOM, false); + progressBarMap.put(recipe, guiHelper.createAnimatedDrawable(progressDrawable, (int) Math.max(10L, mj / MjAPI.MJ / 50L), IDrawableAnimated.StartDirection.BOTTOM, false)); + } } @Override - public String getUid() { + public ResourceLocation getUid() { return UID; } @Override - public String getTitle() { - return "Assembly Table"; + public Class getRecipeClass() { + return IAssemblyRecipe.class; } @Override + public Component getTitle() { +// return new TextComponent("Assembly Table"); + return new TranslatableComponent("tile.assemblyTableBlock.name"); + } + public String getModName() { return BCModules.SILICON.name(); } @Override public IDrawable getBackground() { - return background; + return this.background; } @Override - public void setRecipe(IRecipeLayout recipeLayout, WrapperAssemblyTable recipeWrapper, IIngredients ingredients) { - IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks(); - - List> inputs = ingredients.getInputs(ItemStack.class); - for (int i = 0; i < inputs.size(); i++) { - guiItemStacks.init(i, true, 2 + (i % 3) * 18, 11 + (i / 3) * 18); - - guiItemStacks.set(i, inputs.get(i)); -// Object o = recipeWrapper.getInputs().get(i); -// if (o instanceof ItemStack) { -// guiItemStacks.set(i, (ItemStack) o); -// } else if (o instanceof List) { -// guiItemStacks.set(i, (List) o); -// } + public IDrawable getIcon() { + return this.icon; + } + + @OnlyIn(Dist.CLIENT) + @Override + public void draw(IAssemblyRecipe recipe, IRecipeSlotsView recipeSlotsView, PoseStack stack, double mouseX, double mouseY) { +// this.progressBar.draw(stack, 81, 2); + this.progressBarMap.get(recipe).draw(stack, 81, 2); + long mj = recipe.getRequiredMicroJoulesFor(ItemStack.EMPTY); + this.font.draw(stack, MjAPI.formatMj(mj) + " MJ", 4, 0, Color.gray.getRGB()); + } + + @Override +// public void setRecipe(IRecipeLayout recipeLayout, WrapperAssemblyTable recipeWrapper, IIngredients ingredients) + public void setRecipe(IRecipeLayoutBuilder builder, IAssemblyRecipe recipe, IFocusGroup focuses) { +// IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks(); + + // Calen: the looks moved x-1 y-1 off the slot in 1.18.2 with the position used in 1.12.2 +// for (int i = 0; i < inputs.size(); ++i) + List inputs = inputsMap.get(recipe); + for (int i = 0; i < inputs.size(); ++i) { +// guiItemStacks.init(i, true, 2 + i % 3 * 18, 11 + i / 3 * 18); +// guiItemStacks.set(i, (List) inputs.get(i)); + builder +// .addSlot(RecipeIngredientRole.INPUT, 2 + i % 3 * 18, 11 + i / 3 * 18) + .addSlot(RecipeIngredientRole.INPUT, 3 + i % 3 * 18, 12 + i / 3 * 18) + .addIngredients(inputs.get(i)); } - guiItemStacks.init(12, false, 110, 11); - guiItemStacks.set(12, ingredients.getOutputs(ItemStack.class).get(0)); +// guiItemStacks.init(12, false, 110, 11); +// guiItemStacks.set(12, (List) ingredients.getOutputs(ItemStack.class).get(0)); + builder +// .addSlot(RecipeIngredientRole.OUTPUT, 110, 11) + .addSlot(RecipeIngredientRole.OUTPUT, 111, 12) + .addIngredients(this.outputsMap.get(recipe)); } } diff --git a/common/buildcraft/compat/module/jei/silicon/CategoryIntegrationTable.java b/common/buildcraft/compat/module/jei/silicon/CategoryIntegrationTable.java index ffe1d16..709fc13 100644 --- a/common/buildcraft/compat/module/jei/silicon/CategoryIntegrationTable.java +++ b/common/buildcraft/compat/module/jei/silicon/CategoryIntegrationTable.java @@ -1,77 +1,132 @@ package buildcraft.compat.module.jei.silicon; -import java.util.List; +import buildcraft.api.BCModules; +import buildcraft.api.mj.MjAPI; +import buildcraft.api.recipes.IngredientStack; +import buildcraft.api.recipes.IntegrationRecipe; +import buildcraft.silicon.BCSiliconBlocks; +import com.mojang.blaze3d.vertex.PoseStack; +import mezz.jei.api.constants.VanillaTypes; +import mezz.jei.api.gui.builder.IRecipeLayoutBuilder; +import mezz.jei.api.gui.drawable.IDrawable; +import mezz.jei.api.gui.drawable.IDrawableAnimated; +import mezz.jei.api.gui.drawable.IDrawableStatic; +import mezz.jei.api.gui.ingredient.IRecipeSlotsView; +import mezz.jei.api.helpers.IGuiHelper; +import mezz.jei.api.recipe.IFocusGroup; +import mezz.jei.api.recipe.RecipeIngredientRole; +import mezz.jei.api.recipe.RecipeType; +import mezz.jei.api.recipe.category.IRecipeCategory; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Font; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; +import java.awt.*; +import java.util.List; -import buildcraft.api.BCModules; +// public class CategoryIntegrationTable implements IRecipeCategory +public class CategoryIntegrationTable implements IRecipeCategory { + // Calen + public static final RecipeType RECIPE_TYPE = + RecipeType.create(BCModules.SILICON.getModId(), "integration", IntegrationRecipe.class); + // public static final ResourceLocation UID = new ResourceLocation("buildcraft-compat:silicon.integration"); + public static final ResourceLocation UID = new ResourceLocation(BCModules.SILICON.getModId(), "integration"); + protected final ResourceLocation backgroundLocation = new ResourceLocation("buildcraftsilicon", "textures/gui/integration_table.png"); + private final IDrawable background; -import mezz.jei.api.IGuiHelper; -import mezz.jei.api.gui.IDrawable; -import mezz.jei.api.gui.IGuiItemStackGroup; -import mezz.jei.api.gui.IRecipeLayout; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.IRecipeCategory; + private final IDrawable icon; -public class CategoryIntegrationTable implements IRecipeCategory { - public static final String UID = "buildcraft-compat:silicon.integration"; + private final IDrawableAnimated progressBar; - protected final ResourceLocation backgroundLocation; - private final IDrawable background; - private WrapperIntegrationTable wrapper = null; + @OnlyIn(Dist.CLIENT) + private Font font = Minecraft.getInstance().font; public CategoryIntegrationTable(IGuiHelper guiHelper) { - backgroundLocation = new ResourceLocation("buildcraftsilicon", "textures/gui/integration_table.png"); - background = guiHelper.createDrawable(backgroundLocation, 17, 22, 153, 71, 0, 0, 9, 0); +// this.background = guiHelper.createDrawable(this.backgroundLocation, 17, 22, 153, 71, 0, 0, 9, 0); + this.background = guiHelper.drawableBuilder(this.backgroundLocation, 17, 21, 153, 72).addPadding(0, 0, 9, 0).build(); + + this.icon = guiHelper.createDrawableIngredient(VanillaTypes.ITEM_STACK, new ItemStack(BCSiliconBlocks.integrationTable.get())); + +// IDrawableStatic progressDrawable = guiHelper.createDrawable(backgroundLocation, 176, 17, 4, 69, 0, 0, 0, 0); + IDrawableStatic progressDrawable = guiHelper.drawableBuilder(this.backgroundLocation, 176, 0, 4, 70).addPadding(0, 0, 0, 0).build(); + this.progressBar = guiHelper.createAnimatedDrawable(progressDrawable, 720, IDrawableAnimated.StartDirection.BOTTOM, false); } @Override - public String getUid() { + public ResourceLocation getUid() { return UID; } @Override - public String getTitle() { - return "Integration Table"; + public Class getRecipeClass() { + return IntegrationRecipe.class; + } + + public Component getTitle() { +// return new TextComponent("Integration Table"); + return new TranslatableComponent("tile.integrationTableBlock.name"); } - @Override public String getModName() { return BCModules.SILICON.name(); } - @Override public IDrawable getBackground() { - return background; + return this.background; } @Override - public void setRecipe(IRecipeLayout recipeLayout, WrapperIntegrationTable recipeWrapper, IIngredients ingredients) { - IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks(); + public IDrawable getIcon() { + return this.icon; + } - List> inputs = ingredients.getInputs(ItemStack.class); - int inventoryIndex = 0; + @OnlyIn(Dist.CLIENT) + @Override + public void draw(IntegrationRecipe recipe, IRecipeSlotsView recipeSlotsView, PoseStack stack, double mouseX, double mouseY) { + progressBar.draw(stack, 156, 1); + this.font.draw(stack, MjAPI.formatMj(recipe.getRequiredMicroJoules()) + " MJ", 80, 52, Color.gray.getRGB()); + } + + @Override + // public void setRecipe(IRecipeLayout recipeLayout, WrapperIntegrationTable recipeWrapper, IIngredients ingredients) + public void setRecipe(IRecipeLayoutBuilder builder, IntegrationRecipe recipe, IFocusGroup focuses) { +// IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks(); +// List> inputs = ingredients.getInputs(ItemStack.class); +// int inventoryIndex = 0; + + List surroundings = recipe.getRequirements(); + int surroundingsIndexCounter = 0; for (int y = 0; y < 3; ++y) { for (int x = 0; x < 3; ++x) { - int slotIndex = ((x == 1) && (y == 1)) ? 0 : (x + y * 3 + 1); - if (inputs.size() > slotIndex) { - guiItemStacks.init(inventoryIndex, true, 19 + x * 25, 24 + y * 25); - guiItemStacks.set(inventoryIndex, inputs.get(slotIndex)); - inventoryIndex++; +// int slotIndex = x == 1 && y == 1 ? 0 : x + y * 3 + 1; +// if (inputs.size() > slotIndex) { +// guiItemStacks.init(inventoryIndex, true, 11 + x * 25, 3 + y * 25); +// guiItemStacks.set(inventoryIndex, inputs.get(slotIndex)); +// inventoryIndex++; +// } + if (x == 1 && y == 1) { + builder + .addSlot(RecipeIngredientRole.INPUT, 11 + x * 25, 3 + y * 25) + .addIngredients(recipe.getCenterStack().ingredient); + } else if (surroundingsIndexCounter < surroundings.size()) { + builder + .addSlot(RecipeIngredientRole.INPUT, 11 + x * 25, 3 + y * 25) + .addIngredients(surroundings.get(surroundingsIndexCounter).ingredient); + surroundingsIndexCounter++; } - // this.addSlotToContainer(new SlotBase(x == 1 && y == 1 ? tile.invTarget : tile.invToIntegrate, indexes[x + y * 3], 19 + x * 25, 24 + y * 25)); } } -// for (int i = 0; i < wrapper.getInputs().size(); i++) { -// int x = ContainerIntegrationTable.SLOT_X[i] - 9; -// int y = ContainerIntegrationTable.SLOT_Y[i] - 23; -// guiItemStacks.init(i, true, x, y); -// guiItemStacks.set(i, (List) wrapper.getInputs().get(i)); -// } - - guiItemStacks.init(inventoryIndex, false, 129, 26); - guiItemStacks.set(inventoryIndex, ingredients.getOutputs(ItemStack.class).get(0)); +// guiItemStacks.init(inventoryIndex, false, 129, 26); +// guiItemStacks.set(inventoryIndex, (List) ingredients.getOutputs(ItemStack.class).get(0)); + builder + .addSlot(RecipeIngredientRole.OUTPUT, 130, 28) + .addIngredients(Ingredient.of(recipe.getExampleOutput())); } } diff --git a/common/buildcraft/compat/module/jei/silicon/CategoryProgrammingTable.java b/common/buildcraft/compat/module/jei/silicon/CategoryProgrammingTable.java new file mode 100644 index 0000000..5543e3e --- /dev/null +++ b/common/buildcraft/compat/module/jei/silicon/CategoryProgrammingTable.java @@ -0,0 +1,114 @@ +package buildcraft.compat.module.jei.silicon; + +import buildcraft.api.BCModules; +import buildcraft.api.mj.MjAPI; +import buildcraft.api.recipes.IProgrammingRecipe; +import buildcraft.silicon.BCSiliconBlocks; +import com.mojang.blaze3d.vertex.PoseStack; +import mezz.jei.api.constants.VanillaTypes; +import mezz.jei.api.gui.builder.IRecipeLayoutBuilder; +import mezz.jei.api.gui.drawable.IDrawable; +import mezz.jei.api.gui.drawable.IDrawableAnimated; +import mezz.jei.api.gui.drawable.IDrawableStatic; +import mezz.jei.api.gui.ingredient.IRecipeSlotsView; +import mezz.jei.api.helpers.IGuiHelper; +import mezz.jei.api.recipe.IFocusGroup; +import mezz.jei.api.recipe.RecipeIngredientRole; +import mezz.jei.api.recipe.RecipeType; +import mezz.jei.api.recipe.category.IRecipeCategory; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Font; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +import java.awt.*; +import java.util.Collection; +import java.util.HashMap; +import java.util.Map; + +public class CategoryProgrammingTable implements IRecipeCategory { + public static final RecipeType RECIPE_TYPE = + RecipeType.create(BCModules.SILICON.getModId(), "programming", IProgrammingRecipe.class); + public static final ResourceLocation UID = new ResourceLocation(BCModules.SILICON.getModId(), "programming"); + protected final ResourceLocation backgroundLocation = new ResourceLocation("buildcraftsilicon", "textures/gui/programming_table.png"); + private final IDrawable background; + private final IDrawable inputSlot; + private final IDrawable outputSlot; + private final IDrawable arrow; + private final IDrawable progressBarBackground; + private final IDrawableAnimated defaultProgressBar; + private final Map progressBarMap = new HashMap<>(); + private final IDrawable icon; + @OnlyIn(Dist.CLIENT) + private Font font = Minecraft.getInstance().font; + + public CategoryProgrammingTable(IGuiHelper guiHelper, Collection recipes) { + this.background = guiHelper.createBlankDrawable(72, 72); + this.inputSlot = guiHelper.drawableBuilder(this.backgroundLocation, 7, 35, 18, 18).build(); + this.outputSlot = guiHelper.drawableBuilder(this.backgroundLocation, 7, 89, 18, 18).build(); + this.arrow = guiHelper.drawableBuilder(this.backgroundLocation, 28, 40, 11, 8).build(); + this.progressBarBackground = guiHelper.drawableBuilder(this.backgroundLocation, 163, 35, 6, 72).build(); + + this.icon = guiHelper.createDrawableIngredient(VanillaTypes.ITEM_STACK, new ItemStack(BCSiliconBlocks.programmingTable.get())); + + IDrawableStatic progressDrawable = guiHelper.drawableBuilder(this.backgroundLocation, 176, 18, 4, 70).addPadding(0, 0, 0, 0).build(); + this.defaultProgressBar = guiHelper.createAnimatedDrawable(progressDrawable, 720, IDrawableAnimated.StartDirection.BOTTOM, false); + for (IProgrammingRecipe recipe : recipes) { + long mj = recipe.getEnergyCost(); + progressBarMap.put(mj, guiHelper.createAnimatedDrawable(progressDrawable, (int) Math.max(10L, mj / MjAPI.MJ / 50L), IDrawableAnimated.StartDirection.BOTTOM, false)); + } + } + + @Override + public Component getTitle() { + return new TranslatableComponent("tile.programmingTableBlock.name"); + } + + @Override + public IDrawable getBackground() { + return background; + } + + @Override + public IDrawable getIcon() { + return this.icon; + } + + @Override + public ResourceLocation getUid() { + return UID; + } + + @Override + public Class getRecipeClass() { + return IProgrammingRecipe.class; + } + + @OnlyIn(Dist.CLIENT) + @Override + public void draw(IProgrammingRecipe recipe, IRecipeSlotsView recipeSlotsView, PoseStack stack, double mouseX, double mouseY) { + this.inputSlot.draw(stack, 2, 27); + this.arrow.draw(stack, 2 + 18 + 5, 27 + 5); + this.outputSlot.draw(stack, 2 + 18 + 5 + 11 + 5, 27); + this.progressBarBackground.draw(stack, 66, 0); + this.progressBarMap.getOrDefault(recipe.getEnergyCost(), this.defaultProgressBar).draw(stack, 67, 1); + long mj = recipe.getEnergyCost(); + this.font.draw(stack, MjAPI.formatMj(mj) + " MJ", 10, 30 + 5 + 8 + 10, Color.gray.getRGB()); + } + + @Override + public void setRecipe(IRecipeLayoutBuilder builder, IProgrammingRecipe recipe, IFocusGroup focuses) { + builder + .addSlot(RecipeIngredientRole.INPUT, 2 + 1, 27 + 1) + .addIngredients(recipe.getInput().ingredient); + + builder + .addSlot(RecipeIngredientRole.OUTPUT, 2 + 18 + 5 + 11 + 5 + 1, 27 + 1) + .addIngredients(Ingredient.of(recipe.getOutput())); + } +} diff --git a/common/buildcraft/compat/module/jei/silicon/HandlerIntegrationTable.java b/common/buildcraft/compat/module/jei/silicon/HandlerIntegrationTable.java deleted file mode 100644 index dfefe11..0000000 --- a/common/buildcraft/compat/module/jei/silicon/HandlerIntegrationTable.java +++ /dev/null @@ -1,38 +0,0 @@ -package buildcraft.compat.module.jei.silicon; - -import buildcraft.api.recipes.IntegrationRecipe; - -import buildcraft.compat.module.jei.BCPluginJEI; - -import mezz.jei.api.recipe.IRecipeWrapper; -import mezz.jei.api.recipe.IRecipeWrapperFactory; - -public class HandlerIntegrationTable implements IRecipeWrapperFactory { - @Override - public IRecipeWrapper getRecipeWrapper(IntegrationRecipe recipe) { - return new WrapperIntegrationTable(BCPluginJEI.registry.getJeiHelpers().getGuiHelper(), recipe); - } - - // -// @Nonnull -// @Override -// public Class getRecipeClass() { -// return IIntegrationRecipe.class; -// } -// -// @Override -// public String getRecipeCategoryUid() { -// return CategoryIntegrationTable.UID; -// } -// -// @Nonnull -// @Override -// public IRecipeWrapper getRecipeWrapper(@Nonnull IIntegrationRecipe recipe) { -// return new WrapperIntegrationTable(BCPluginJEI.registry.getJeiHelpers().getGuiHelper(), recipe); -// } -// -// @Override -// public boolean isRecipeValid(@Nonnull IIntegrationRecipe recipe) { -// return true; -// } -} diff --git a/common/buildcraft/compat/module/jei/silicon/Utils.java b/common/buildcraft/compat/module/jei/silicon/Utils.java index 197c28d..b7fb4fa 100644 --- a/common/buildcraft/compat/module/jei/silicon/Utils.java +++ b/common/buildcraft/compat/module/jei/silicon/Utils.java @@ -1,15 +1,19 @@ package buildcraft.compat.module.jei.silicon; -import java.util.List; -import com.google.common.collect.Lists; -import net.minecraft.item.ItemStack; import buildcraft.api.recipes.StackDefinition; +import com.google.common.collect.Lists; +import net.minecraft.world.item.ItemStack; + +import java.util.List; public final class Utils { + public Utils() { + } + public static List getItemStacks(StackDefinition definition) { List list = Lists.newArrayList(); - if (definition.filter != null) { + for (ItemStack stack : definition.filter.getExamples()) { ItemStack sizedStack = stack.copy(); sizedStack.setCount(definition.count); diff --git a/common/buildcraft/compat/module/jei/silicon/WrapperAssemblyTable.java b/common/buildcraft/compat/module/jei/silicon/WrapperAssemblyTable.java deleted file mode 100644 index 0015916..0000000 --- a/common/buildcraft/compat/module/jei/silicon/WrapperAssemblyTable.java +++ /dev/null @@ -1,83 +0,0 @@ -package buildcraft.compat.module.jei.silicon; - -import java.awt.Color; -import java.util.ArrayList; -import java.util.List; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; - -import net.minecraft.client.Minecraft; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; - -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; - -import buildcraft.api.mj.MjAPI; -import buildcraft.api.recipes.AssemblyRecipeBasic; -import buildcraft.api.recipes.IngredientStack; - -import buildcraft.compat.module.jei.BCPluginJEI; - -import mezz.jei.api.IGuiHelper; -import mezz.jei.api.gui.IDrawableAnimated; -import mezz.jei.api.gui.IDrawableStatic; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.IRecipeWrapper; - -public class WrapperAssemblyTable implements IRecipeWrapper { - private final AssemblyRecipeBasic recipe; - private final IDrawableAnimated progressBar; - private final List> inputs; - private final List outputs; - - public WrapperAssemblyTable(AssemblyRecipeBasic recipe) { - this.recipe = recipe; - List> _inputs = Lists.newArrayList(); - for (IngredientStack in : recipe.getInputsFor(ItemStack.EMPTY)) { - List inner = new ArrayList<>(); - for (ItemStack matching : in.ingredient.getMatchingStacks()) { - matching = matching.copy(); - matching.setCount(in.count); - inner.add(matching); - } - _inputs.add(inner); - } - this.inputs = ImmutableList.copyOf(_inputs); - this.outputs = ImmutableList.copyOf(recipe.getOutputPreviews()); - - IGuiHelper guiHelper = BCPluginJEI.registry.getJeiHelpers().getGuiHelper(); - - ResourceLocation backgroundLocation = - new ResourceLocation("buildcraftsilicon", "textures/gui/assembly_table.png"); - IDrawableStatic progressDrawable = guiHelper.createDrawable(backgroundLocation, 176, 48, 4, 71, 10, 0, 0, 0); - long mj = this.recipe.getRequiredMicroJoulesFor(ItemStack.EMPTY); - progressBar = guiHelper.createAnimatedDrawable(progressDrawable, (int) Math.max(10, mj / MjAPI.MJ / 50), - IDrawableAnimated.StartDirection.BOTTOM, false); - } - - @Override - public void getIngredients(IIngredients ingredients) { - ingredients.setInputLists(ItemStack.class, this.inputs); - ingredients.setOutputs(ItemStack.class, this.outputs); - } - - @Override - @SideOnly(Side.CLIENT) - public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) { - this.progressBar.draw(minecraft, 81, 2); - long mj = this.recipe.getRequiredMicroJoulesFor(ItemStack.EMPTY); - minecraft.fontRenderer.drawString(MjAPI.formatMj(mj) + " MJ", 4, 0, Color.gray.getRGB()); - } - - @Override - public List getTooltipStrings(int mouseX, int mouseY) { - return Lists.newArrayList(); - } - - @Override - public boolean handleClick(Minecraft minecraft, int mouseX, int mouseY, int mouseButton) { - return false; - } -} diff --git a/common/buildcraft/compat/module/jei/silicon/WrapperIntegrationTable.java b/common/buildcraft/compat/module/jei/silicon/WrapperIntegrationTable.java deleted file mode 100644 index abe1a52..0000000 --- a/common/buildcraft/compat/module/jei/silicon/WrapperIntegrationTable.java +++ /dev/null @@ -1,93 +0,0 @@ -package buildcraft.compat.module.jei.silicon; - -import java.awt.Color; -import java.util.List; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.Lists; -import net.minecraft.client.Minecraft; -import net.minecraft.init.Blocks; -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; -import buildcraft.api.mj.MjAPI; -import buildcraft.api.recipes.IntegrationRecipe; -import buildcraft.api.recipes.StackDefinition; -import mezz.jei.api.IGuiHelper; -import mezz.jei.api.gui.IDrawableAnimated; -import mezz.jei.api.gui.IDrawableStatic; -import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.IRecipeWrapper; - -public class WrapperIntegrationTable implements IRecipeWrapper { - private final IntegrationRecipe recipe; - private final IDrawableAnimated progressBar; - private final List inputs, outputs; - - public WrapperIntegrationTable(IGuiHelper guiHelper, IntegrationRecipe recipe) { - this.recipe = recipe; - - List inputs = Lists.newArrayList(); -// inputs.addAll(Utils.getItemStacks(recipe.target)); -// for (StackDefinition definition : recipe.toIntegrate) { -// inputs.addAll(Utils.getItemStacks(definition)); -// } - this.inputs = ImmutableList.copyOf(inputs); - this.outputs = ImmutableList.of(new ItemStack(Blocks.COBBLESTONE)); - - ResourceLocation backgroundLocation = new ResourceLocation("buildcraftsilicon", "textures/gui/integration_table.png"); - IDrawableStatic progressDrawable = guiHelper.createDrawable(backgroundLocation, 176, 17, 4, 69, 0, 0, 0, 0); - this.progressBar = guiHelper.createAnimatedDrawable(progressDrawable, (int) (/*recipe.requiredMicroJoules / */ 720), IDrawableAnimated.StartDirection.BOTTOM, false); - } - -// @Override -// public List getInputs() { -// return inputs; -// } -// -// @Override -// public List getOutputs() { -// return outputs; -// } -// -// @Override -// public List getFluidInputs() { -// return null; -// } -// -// @Override -// public List getFluidOutputs() { -// return null; -// } -// -// @Override -// public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight) {} - - @Override - public void getIngredients(IIngredients ingredients) { - ingredients.setInputs(ItemStack.class, this.inputs); - ingredients.setOutputs(ItemStack.class, this.outputs); - } - - @Override - @SideOnly(Side.CLIENT) - public void drawInfo(Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY) { - this.progressBar.draw(minecraft, 156, 1); - minecraft.fontRenderer.drawString(MjAPI.formatMj(/*this.recipe.requiredMicroJoules*/0) + " MJ", 80, 52, Color.gray.getRGB()); - } -// -// @Override -// public void drawAnimations(Minecraft minecraft, int recipeWidth, int recipeHeight) { -// progressBar.draw(minecraft, 156, 1); -// } - - @Override - public List getTooltipStrings(int mouseX, int mouseY) { - return Lists.newArrayList(); - } - - @Override - public boolean handleClick(Minecraft minecraft, int mouseX, int mouseY, int mouseButton) { - return false; - } -} diff --git a/common/buildcraft/compat/module/jei/silicon/package-info.java b/common/buildcraft/compat/module/jei/silicon/package-info.java index fce7fb1..f747716 100644 --- a/common/buildcraft/compat/module/jei/silicon/package-info.java +++ b/common/buildcraft/compat/module/jei/silicon/package-info.java @@ -2,5 +2,6 @@ @MethodsReturnNonnullByDefault package buildcraft.compat.module.jei.silicon; -import javax.annotation.ParametersAreNonnullByDefault; -import mcp.MethodsReturnNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/common/buildcraft/compat/module/jei/transferhandlers/AdvancedCraftingItemsTransferHandler.java b/common/buildcraft/compat/module/jei/transferhandlers/AdvancedCraftingItemsTransferHandler.java index 02282e5..b9f1615 100644 --- a/common/buildcraft/compat/module/jei/transferhandlers/AdvancedCraftingItemsTransferHandler.java +++ b/common/buildcraft/compat/module/jei/transferhandlers/AdvancedCraftingItemsTransferHandler.java @@ -1,34 +1,41 @@ package buildcraft.compat.module.jei.transferhandlers; -import javax.annotation.Nullable; -import net.minecraft.entity.player.EntityPlayer; import buildcraft.silicon.container.ContainerAdvancedCraftingTable; -import mezz.jei.api.gui.IRecipeLayout; +import mezz.jei.api.gui.ingredient.IRecipeSlotsView; import mezz.jei.api.recipe.transfer.IRecipeTransferError; import mezz.jei.api.recipe.transfer.IRecipeTransferHandler; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.crafting.CraftingRecipe; + +import javax.annotation.Nullable; + +public class AdvancedCraftingItemsTransferHandler implements IRecipeTransferHandler { + public AdvancedCraftingItemsTransferHandler() { + } -public class AdvancedCraftingItemsTransferHandler implements IRecipeTransferHandler { @Override public Class getContainerClass() { return ContainerAdvancedCraftingTable.class; } - @Nullable @Override - public IRecipeTransferError transferRecipe(ContainerAdvancedCraftingTable container, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer) { - if (doTransfer) { -// Map> inputs = recipeLayout.getItemStacks().getGuiIngredients(); -// -// for (int slot = 0; slot < 9; slot++) { -// IGuiIngredient ingredient = inputs.getOrDefault(slot + 1, null); -// ItemStack stack = (ingredient == null) ? ItemStack.EMPTY : ingredient.getDisplayedIngredient(); -// -// container.sendSetPhantomSlot(container.tile.invBlueprint, slot, (stack == null) ? ItemStack.EMPTY : stack); -// } + public Class getRecipeClass() { + return CraftingRecipe.class; + } - AutoCraftItemsTransferHandler.transferRecipe( - itemStacks -> container.sendSetPhantomSlots(container.tile.invBlueprint, itemStacks), - recipeLayout); + @Override + @Nullable +// public IRecipeTransferError transferRecipe(ContainerAdvancedCraftingTable container, IRecipeLayout recipeLayout, Player player, boolean maxTransfer, boolean doTransfer) + public IRecipeTransferError transferRecipe(ContainerAdvancedCraftingTable container, CraftingRecipe recipe, IRecipeSlotsView recipeSlots, Player player, boolean maxTransfer, boolean doTransfer) { + if (doTransfer) { + AutoCraftItemsTransferHandler.transferRecipe((itemStacks) -> + { + container.sendSetPhantomSlots(container.tile.invBlueprint, itemStacks); + }, +// recipeLayout + recipe, + recipeSlots + ); } return null; diff --git a/common/buildcraft/compat/module/jei/transferhandlers/AssemblyTableTransferHandler.java b/common/buildcraft/compat/module/jei/transferhandlers/AssemblyTableTransferHandler.java index e0ce8ee..58f4260 100644 --- a/common/buildcraft/compat/module/jei/transferhandlers/AssemblyTableTransferHandler.java +++ b/common/buildcraft/compat/module/jei/transferhandlers/AssemblyTableTransferHandler.java @@ -1,23 +1,32 @@ package buildcraft.compat.module.jei.transferhandlers; -import javax.annotation.Nullable; -import net.minecraft.entity.player.EntityPlayer; +import buildcraft.lib.recipe.assembly.AssemblyRecipe; +import buildcraft.silicon.container.ContainerAdvancedCraftingTable; import buildcraft.silicon.container.ContainerAssemblyTable; -import mezz.jei.api.gui.IRecipeLayout; +import mezz.jei.api.gui.ingredient.IRecipeSlotsView; import mezz.jei.api.recipe.transfer.IRecipeTransferError; import mezz.jei.api.recipe.transfer.IRecipeTransferHandler; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.crafting.CraftingRecipe; + +import javax.annotation.Nullable; + +// Calen: never used in 1.12.2? +public class AssemblyTableTransferHandler implements IRecipeTransferHandler { -public class AssemblyTableTransferHandler implements IRecipeTransferHandler { @Override public Class getContainerClass() { return ContainerAssemblyTable.class; } - @Nullable @Override - public IRecipeTransferError transferRecipe(ContainerAssemblyTable container, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer) { - + public Class getRecipeClass() { + return AssemblyRecipe.class; + } + @Nullable +// public IRecipeTransferError transferRecipe(ContainerAssemblyTable container, IRecipeLayout recipeLayout, Player player, boolean maxTransfer, boolean doTransfer) + public IRecipeTransferError transferRecipe(ContainerAdvancedCraftingTable container, CraftingRecipe recipe, IRecipeSlotsView recipeSlots, Player player, boolean maxTransfer, boolean doTransfer) { return null; } } diff --git a/common/buildcraft/compat/module/jei/transferhandlers/AutoCraftItemsTransferHandler.java b/common/buildcraft/compat/module/jei/transferhandlers/AutoCraftItemsTransferHandler.java index 5ab756e..c4c473d 100644 --- a/common/buildcraft/compat/module/jei/transferhandlers/AutoCraftItemsTransferHandler.java +++ b/common/buildcraft/compat/module/jei/transferhandlers/AutoCraftItemsTransferHandler.java @@ -1,53 +1,64 @@ package buildcraft.compat.module.jei.transferhandlers; -import java.util.List; -import java.util.Map; -import java.util.function.Consumer; -import javax.annotation.Nullable; -import com.google.common.collect.Lists; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; import buildcraft.factory.container.ContainerAutoCraftItems; -import mezz.jei.api.gui.IGuiIngredient; -import mezz.jei.api.gui.IRecipeLayout; +import com.google.common.collect.Lists; +import mezz.jei.api.gui.ingredient.IRecipeSlotView; +import mezz.jei.api.gui.ingredient.IRecipeSlotsView; import mezz.jei.api.recipe.transfer.IRecipeTransferError; import mezz.jei.api.recipe.transfer.IRecipeTransferHandler; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.CraftingRecipe; + +import javax.annotation.Nullable; +import java.util.List; +import java.util.function.Consumer; + +public class AutoCraftItemsTransferHandler implements IRecipeTransferHandler { + public AutoCraftItemsTransferHandler() { + } -public class AutoCraftItemsTransferHandler implements IRecipeTransferHandler { @Override public Class getContainerClass() { return ContainerAutoCraftItems.class; } - @Nullable @Override - public IRecipeTransferError transferRecipe(ContainerAutoCraftItems container, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer) { + public Class getRecipeClass() { + return CraftingRecipe.class; + } + + @Override + @Nullable +// public IRecipeTransferError transferRecipe(ContainerAutoCraftItems container, IRecipeLayout recipeLayout, Player player, boolean maxTransfer, boolean doTransfer) + public IRecipeTransferError transferRecipe(ContainerAutoCraftItems container, CraftingRecipe recipe, IRecipeSlotsView recipeSlots, Player player, boolean maxTransfer, boolean doTransfer) { if (doTransfer) { -// Map> inputs = recipeLayout.getItemStacks().getGuiIngredients(); -// -// for (int slot = 0; slot < 9; slot++) { -// IGuiIngredient ingredient = inputs.getOrDefault(slot + 1, null); -// ItemStack stack = (ingredient == null) ? ItemStack.EMPTY : ingredient.getDisplayedIngredient(); -// -// container.sendSetPhantomSlot(container.tile.invBlueprint, slot, (stack == null) ? ItemStack.EMPTY : stack); -// } - - AutoCraftItemsTransferHandler.transferRecipe( - itemStacks -> container.sendSetPhantomSlots(container.tile.invBlueprint, itemStacks), - recipeLayout); + transferRecipe((itemStacks) -> + { + container.sendSetPhantomSlots((container.tile).invBlueprint, itemStacks); + }, +// recipeLayout + recipe, + recipeSlots + ); } return null; } - static void transferRecipe(Consumer> callback, IRecipeLayout recipeLayout) { - Map> inputs = recipeLayout.getItemStacks().getGuiIngredients(); + // static void transferRecipe(Consumer> callback, IRecipeLayout recipeLayout) + static void transferRecipe(Consumer> callback, CraftingRecipe recipe, IRecipeSlotsView recipeLayout) { +// Map> inputs = recipeLayout.getItemStacks().getGuiIngredients(); + List inputs = recipeLayout.getSlotViews(); List stacks = Lists.newArrayList(); - for (int slot = 0; slot < 9; slot++) { - IGuiIngredient ingredient = inputs.getOrDefault(slot + 1, null); - ItemStack stack = (ingredient == null) ? ItemStack.EMPTY : ingredient.getDisplayedIngredient(); - stacks.add((stack == null) ? ItemStack.EMPTY : stack); + + for (int slot = 0; slot < 9; ++slot) { +// IGuiIngredient ingredient = (IGuiIngredient) inputs.getOrDefault(slot + 1, (Object) null); + IRecipeSlotView ingredient = inputs.get(slot + 1); +// ItemStack stack = ingredient == null ? ItemStack.EMPTY : (ItemStack) ingredient.getDisplayedIngredient(); + ItemStack stack = ingredient == null ? ItemStack.EMPTY : (ItemStack) ingredient.getDisplayedIngredient().get().getIngredient(); + stacks.add(stack == null ? ItemStack.EMPTY : stack); } callback.accept(stacks); diff --git a/common/buildcraft/compat/module/jei/transferhandlers/package-info.java b/common/buildcraft/compat/module/jei/transferhandlers/package-info.java index 546f6b9..107bd58 100644 --- a/common/buildcraft/compat/module/jei/transferhandlers/package-info.java +++ b/common/buildcraft/compat/module/jei/transferhandlers/package-info.java @@ -2,5 +2,6 @@ @MethodsReturnNonnullByDefault package buildcraft.compat.module.jei.transferhandlers; -import javax.annotation.ParametersAreNonnullByDefault; -import mcp.MethodsReturnNonnullByDefault; +import net.minecraft.MethodsReturnNonnullByDefault; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/common/buildcraft/compat/module/theoneprobe/BCPluginTOP.java b/common/buildcraft/compat/module/theoneprobe/BCPluginTOP.java index 947e923..1aefed5 100644 --- a/common/buildcraft/compat/module/theoneprobe/BCPluginTOP.java +++ b/common/buildcraft/compat/module/theoneprobe/BCPluginTOP.java @@ -1,48 +1,37 @@ package buildcraft.compat.module.theoneprobe; -import static buildcraft.compat.module.theoneprobe.BCPluginTOP.TOP_MOD_ID; - -import java.util.List; - -import com.google.common.base.Function; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.world.World; - -import net.minecraftforge.fml.common.Loader; -import net.minecraftforge.fml.common.Optional; -import net.minecraftforge.fml.common.event.FMLInterModComms; - import buildcraft.api.BCModules; import buildcraft.api.mj.ILaserTarget; import buildcraft.api.mj.MjAPI; - -import buildcraft.lib.tile.craft.IAutoCraft; - import buildcraft.compat.CompatUtils; +import buildcraft.lib.tile.craft.IAssemblyCraft; +import buildcraft.lib.tile.craft.IAutoCraft; +import com.google.common.base.Function; +import mcjty.theoneprobe.api.*; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.state.BlockState; -import mcjty.theoneprobe.api.ElementAlignment; -import mcjty.theoneprobe.api.IBlockDisplayOverride; -import mcjty.theoneprobe.api.IProbeHitData; -import mcjty.theoneprobe.api.IProbeInfo; -import mcjty.theoneprobe.api.IProbeInfoProvider; -import mcjty.theoneprobe.api.ITheOneProbe; -import mcjty.theoneprobe.api.ProbeMode; +import java.util.List; -@Optional.InterfaceList({ - @Optional.Interface(modid = TOP_MOD_ID, iface = "mcjty.theoneprobe.api.IBlockDisplayOverride"), - @Optional.Interface(modid = TOP_MOD_ID, iface = "mcjty.theoneprobe.api.IProbeInfoProvider") -}) -public class BCPluginTOP implements Function, IBlockDisplayOverride, IProbeInfoProvider { +//@InterfaceList({@Interface( +// modid = "theoneprobe", +// iface = "mcjty.theoneprobe.api.IBlockDisplayOverride" +//), @Interface( +// modid = "theoneprobe", +// iface = "mcjty.theoneprobe.api.IProbeInfoProvider" +//)}) +//public class BCPluginTOP implements Function, IBlockDisplayOverride, IProbeInfoProvider +public enum BCPluginTOP implements Function, IBlockDisplayOverride, IProbeInfoProvider { + INSTANCE; static final String TOP_MOD_ID = "theoneprobe"; @Override - @Optional.Method(modid = TOP_MOD_ID) + // @Method(modid = "theoneprobe") public Void apply(ITheOneProbe top) { top.registerBlockDisplayOverride(this); top.registerProvider(this); @@ -50,23 +39,27 @@ public Void apply(ITheOneProbe top) { } @Override - @Optional.Method(modid = TOP_MOD_ID) - public boolean overrideStandardInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data) { + // @Method(modid = "theoneprobe") + // public boolean overrideStandardInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data) + public boolean overrideStandardInfo(ProbeMode mode, IProbeInfo probeInfo, Player player, Level world, BlockState blockState, IProbeHitData data) { return false; } @Override - @Optional.Method(modid = TOP_MOD_ID) - public String getID() { - return "buildcraftcompat.top"; + // @Method(modid = "theoneprobe") + // public String getID() + public ResourceLocation getID() { +// return "buildcraftcompat.top"; + return new ResourceLocation("buildcraftcompat.top"); } @Override - @Optional.Method(modid = TOP_MOD_ID) - public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data) { + // @Method(modid = "theoneprobe") +// public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer player, World world, IBlockState blockState, IProbeHitData data) + public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, Player player, Level world, BlockState blockState, IProbeHitData data) { ResourceLocation blockRegistryName = blockState.getBlock().getRegistryName(); - if ((blockRegistryName != null) && (BCModules.isBcMod(blockRegistryName.getResourceDomain()))) { - TileEntity entity = world.getTileEntity(data.getPos()); + if (blockRegistryName != null && BCModules.isBcMod(blockRegistryName.getNamespace())) { + BlockEntity entity = world.getBlockEntity(data.getPos()); if (entity instanceof IAutoCraft) { this.addAutoCraftInfo(probeInfo, (IAutoCraft) entity); } @@ -74,36 +67,48 @@ public void addProbeInfo(ProbeMode mode, IProbeInfo probeInfo, EntityPlayer play if (entity instanceof ILaserTarget) { this.addLaserTargetInfo(probeInfo, (ILaserTarget) entity); } + + if (entity instanceof IAssemblyCraft) { + this.addAssemblyInfo(probeInfo, (IAssemblyCraft) entity); + } } } - @Optional.Method(modid = TOP_MOD_ID) + // @Method(modid = "theoneprobe") private void addAutoCraftInfo(IProbeInfo probeInfo, IAutoCraft crafter) { if (!crafter.getCurrentRecipeOutput().isEmpty()) { IProbeInfo mainInfo = probeInfo.vertical(); - mainInfo - .horizontal(mainInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER)) - .text("Making: ") - .item(crafter.getCurrentRecipeOutput()); - IProbeInfo info = mainInfo - .horizontal(mainInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER)) - .text("From: "); +// mainInfo.horizontal(mainInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER)).text("Making: ").item(crafter.getCurrentRecipeOutput()); + mainInfo.horizontal(mainInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER)).text(new TranslatableComponent("buildcraft.waila.crafting")).item(crafter.getCurrentRecipeOutput()); +// IProbeInfo info = mainInfo.horizontal(mainInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER)).text("From: "); + IProbeInfo info = mainInfo.horizontal(mainInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER)).text(new TranslatableComponent("buildcraft.waila.crafting_from")); List stacks = CompatUtils.compactInventory(crafter.getInvBlueprint()); - for (ItemStack stack : stacks) + for (ItemStack stack : stacks) { info.item(stack); + } + } else { + IProbeInfo mainInfo = probeInfo.vertical(); + mainInfo.horizontal(mainInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER)).text(new TranslatableComponent("buildcraft.waila.no_recipe")); } } - @Optional.Method(modid = TOP_MOD_ID) + // @Method(modid = "theoneprobe") private void addLaserTargetInfo(IProbeInfo probeInfo, ILaserTarget laserTarget) { long power = laserTarget.getRequiredLaserPower(); - if (power > 0) { - probeInfo.horizontal() - .text(TextFormatting.WHITE + "Waiting from laser: ") - .text(TextFormatting.AQUA + MjAPI.formatMj(power)) - .text(TextFormatting.AQUA + "MJ"); + if (power > 0L) { +// probeInfo.horizontal().text(TextFormatting.WHITE + "Waiting from laser: ").text(TextFormatting.AQUA + MjAPI.formatMj(power)).text(TextFormatting.AQUA + "MJ"); + probeInfo.horizontal().text(new TranslatableComponent("buildcraft.waila.waiting_for_laser", MjAPI.formatMj(power))); } } -} + private void addAssemblyInfo(IProbeInfo probeInfo, IAssemblyCraft assembly) { + ItemStack result = assembly.getAssemblyResult(); + if (!result.isEmpty()) { + probeInfo.horizontal().text(new TranslatableComponent("buildcraft.waila.crafting")).item(result); + } else { + IProbeInfo mainInfo = probeInfo.vertical(); + mainInfo.horizontal(mainInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER)).text(new TranslatableComponent("buildcraft.waila.no_recipe")); + } + } +} diff --git a/common/buildcraft/compat/module/theoneprobe/CompatModuleTheOneProbe.java b/common/buildcraft/compat/module/theoneprobe/CompatModuleTheOneProbe.java index 964bc69..a6210ba 100644 --- a/common/buildcraft/compat/module/theoneprobe/CompatModuleTheOneProbe.java +++ b/common/buildcraft/compat/module/theoneprobe/CompatModuleTheOneProbe.java @@ -1,19 +1,18 @@ package buildcraft.compat.module.theoneprobe; -import net.minecraftforge.fml.common.event.FMLInterModComms; - import buildcraft.compat.CompatModuleBase; +import net.minecraftforge.fml.InterModComms; public class CompatModuleTheOneProbe extends CompatModuleBase { + public CompatModuleTheOneProbe() { + } - @Override public String compatModId() { return "theoneprobe"; } - @Override public void preInit() { - FMLInterModComms.sendFunctionMessage(compatModId(), "getTheOneProbe", - "buildcraft.compat.module.theoneprobe.BCPluginTOP"); +// FMLInterModComms.sendFunctionMessage(this.compatModId(), "getTheOneProbe", "buildcraft.compat.module.theoneprobe.BCPluginTOP"); + InterModComms.sendTo(this.compatModId(), "getTheOneProbe", () -> BCPluginTOP.INSTANCE); } } diff --git a/common/buildcraft/compat/module/waila/AssemblyCraftDataProvider.java b/common/buildcraft/compat/module/waila/AssemblyCraftDataProvider.java new file mode 100644 index 0000000..8aa2a95 --- /dev/null +++ b/common/buildcraft/compat/module/waila/AssemblyCraftDataProvider.java @@ -0,0 +1,53 @@ +package buildcraft.compat.module.waila; + +import buildcraft.lib.tile.craft.IAssemblyCraft; +import mcp.mobius.waila.api.BlockAccessor; +import mcp.mobius.waila.api.ITooltip; +import mcp.mobius.waila.api.config.IPluginConfig; +import mcp.mobius.waila.impl.ui.ItemStackElement; +import mcp.mobius.waila.impl.ui.SpacerElement; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.Tag; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.phys.Vec2; + +public class AssemblyCraftDataProvider { + static class BodyProvider extends BaseWailaDataProvider.BodyProvider { + @Override + public void getWailaBody(ITooltip currentTip, BlockAccessor accessor, IPluginConfig iPluginConfig) { + BlockEntity tile = accessor.getBlockEntity(); + if (tile instanceof IAssemblyCraft) { +// CompoundTag nbt = accessor.getNBTData(); + CompoundTag nbt = accessor.getServerData(); + if (nbt.contains("recipe_result", Tag.TAG_COMPOUND)) { + ItemStack recipe_result = ItemStack.of(nbt.getCompound("recipe_result")); + if (!recipe_result.isEmpty()) { + currentTip.add(new TranslatableComponent("buildcraft.waila.crafting")); + currentTip.append(ItemStackElement.of(recipe_result)); + // Calen: an empty line because the item icon is 2 lines height + // if ItemStackElement.of(result, 0.5F), the count text of the stack will not scale + currentTip.add(new SpacerElement(new Vec2(0, 5))); + return; + } + } + currentTip.add(new TranslatableComponent("buildcraft.waila.no_recipe")); + } +// else { +// currentTip.add(new TextComponent(ChatFormatting.RED + "{wrong tile entity}")); +// } + } + } + + static class NBTProvider extends BaseWailaDataProvider.NBTProvider { + @Override + public void getNBTData(CompoundTag nbt, ServerPlayer player, Level world, BlockEntity tile, boolean showDetails) { + if (tile instanceof IAssemblyCraft assembly) { + nbt.put("recipe_result", assembly.getAssemblyResult().serializeNBT()); + } + } + } +} diff --git a/common/buildcraft/compat/module/waila/AutoCraftDataProvider.java b/common/buildcraft/compat/module/waila/AutoCraftDataProvider.java index df1f7c4..adb365e 100644 --- a/common/buildcraft/compat/module/waila/AutoCraftDataProvider.java +++ b/common/buildcraft/compat/module/waila/AutoCraftDataProvider.java @@ -1,83 +1,77 @@ package buildcraft.compat.module.waila; -import static buildcraft.compat.module.waila.HWYLAPlugin.WAILA_MOD_ID; - -import java.util.List; - -import javax.annotation.Nonnull; - -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.world.World; - -import net.minecraftforge.common.util.Constants; -import net.minecraftforge.fml.common.Optional; - +import buildcraft.compat.CompatUtils; import buildcraft.lib.tile.craft.IAutoCraft; +import mcp.mobius.waila.api.BlockAccessor; +import mcp.mobius.waila.api.ITooltip; +import mcp.mobius.waila.api.config.IPluginConfig; +import mcp.mobius.waila.impl.ui.ItemStackElement; +import mcp.mobius.waila.impl.ui.SpacerElement; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.Tag; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.phys.Vec2; -import buildcraft.compat.CompatUtils; +import java.util.List; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.SpecialChars; +public class AutoCraftDataProvider { -class AutoCraftDataProvider extends BaseWailaDataProvider { - @Nonnull - @Override - @Optional.Method(modid = WAILA_MOD_ID) - public List getWailaBody(ItemStack itemStack, List currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config) { - TileEntity tile = accessor.getTileEntity(); - if (tile instanceof IAutoCraft) { - NBTTagCompound nbt = accessor.getNBTData(); - if (nbt.hasKey("recipe_result", Constants.NBT.TAG_COMPOUND)) { - ItemStack result = new ItemStack(nbt.getCompoundTag("recipe_result")); - currentTip.add(TextFormatting.WHITE + "Making: " + SpecialChars.WailaSplitter + HWYLAPlugin.getItemStackString(result)); + static class BodyProvider extends BaseWailaDataProvider.BodyProvider { + @Override + public void getWailaBody(ITooltip currentTip, BlockAccessor accessor, IPluginConfig iPluginConfig) { + BlockEntity tile = accessor.getBlockEntity(); + if (tile instanceof IAutoCraft) { + CompoundTag nbt = accessor.getServerData(); + if (nbt.contains("recipe_result", Tag.TAG_COMPOUND)) { + // Calen: add -> create new line / append -> append at the last line + ItemStack result = ItemStack.of(nbt.getCompound("recipe_result")); + currentTip.add(new TranslatableComponent("buildcraft.waila.crafting")); + currentTip.append(ItemStackElement.of(result)); + // Calen: an empty line, because the item icon is 2 lines height + // if ItemStackElement.of(result, 0.5F), the count text of the stack will not scale + currentTip.add(new SpacerElement(new Vec2(0, 5))); + if (nbt.contains("recipe_inputs", Tag.TAG_LIST)) { + ListTag list = nbt.getList("recipe_inputs", Tag.TAG_COMPOUND); + currentTip.add(new TranslatableComponent("buildcraft.waila.crafting_from")); - if (nbt.hasKey("recipe_inputs", Constants.NBT.TAG_LIST)) { - NBTTagList list = nbt.getTagList("recipe_inputs", Constants.NBT.TAG_COMPOUND); - StringBuilder inputs = new StringBuilder(TextFormatting.WHITE + "From: " + SpecialChars.WailaSplitter); - for (int index = 0; index < list.tagCount(); index++) { - NBTTagCompound compound = NBTTagCompound.class.cast(list.get(index)); - inputs.append(HWYLAPlugin.getItemStackString(new ItemStack(compound))); + for (int index = 0; index < list.size(); ++index) { + CompoundTag compound = list.getCompound(index); + currentTip.append(ItemStackElement.of(ItemStack.of(compound))); + } + currentTip.add(new SpacerElement(new Vec2(0, 5))); } - currentTip.add(inputs.toString()); + } else { + currentTip.add(new TranslatableComponent("buildcraft.waila.no_recipe")); } - } else { - currentTip.add(TextFormatting.GRAY + "No recipe"); } - } else { - currentTip.add(TextFormatting.RED + "{wrong tile entity}"); +// else { +// currentTip.add(new TextComponent(ChatFormatting.RED + "{wrong tile entity}")); +// } } - return currentTip; } - @Nonnull - @Override - @Optional.Method(modid = WAILA_MOD_ID) - public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) { - NBTTagCompound nbt = super.getNBTData(player, te, tag, world, pos); + static class NBTProvider extends BaseWailaDataProvider.NBTProvider { + @Override + public void getNBTData(CompoundTag nbt, ServerPlayer player, Level world, BlockEntity tile, boolean showDetails) { + if (tile instanceof IAutoCraft auto) { + ItemStack output = auto.getCurrentRecipeOutput(); + if (!output.isEmpty()) { + nbt.put("recipe_result", output.serializeNBT()); + List stacks = CompatUtils.compactInventory(auto.getInvBlueprint()); + ListTag list = new ListTag(); - TileEntity tile = world.getTileEntity(pos); - if (tile instanceof IAutoCraft) { - IAutoCraft auto = IAutoCraft.class.cast(tile); - ItemStack output = auto.getCurrentRecipeOutput(); - if (!output.isEmpty()) { - nbt.setTag("recipe_result", output.serializeNBT()); + for (int index = 0; index < stacks.size(); ++index) { + list.add((stacks.get(index)).serializeNBT()); + } - List stacks = CompatUtils.compactInventory(auto.getInvBlueprint()); - NBTTagList list = new NBTTagList(); - for (int index = 0; index < stacks.size(); index++) { - list.appendTag(stacks.get(index).serializeNBT()); + nbt.put("recipe_inputs", list); } - nbt.setTag("recipe_inputs", list); } } - - return nbt; } } diff --git a/common/buildcraft/compat/module/waila/BaseWailaDataProvider.java b/common/buildcraft/compat/module/waila/BaseWailaDataProvider.java index 630b8af..b109da3 100644 --- a/common/buildcraft/compat/module/waila/BaseWailaDataProvider.java +++ b/common/buildcraft/compat/module/waila/BaseWailaDataProvider.java @@ -1,57 +1,49 @@ package buildcraft.compat.module.waila; -import static buildcraft.compat.module.waila.HWYLAPlugin.WAILA_MOD_ID; - -import java.util.List; -import javax.annotation.Nonnull; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.fml.common.Optional; - -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; -import mcp.mobius.waila.api.IWailaDataProvider; - -@Optional.InterfaceList({ - @Optional.Interface(modid = WAILA_MOD_ID, iface = "mcp.mobius.waila.api.IWailaDataProvider") -}) -class BaseWailaDataProvider implements IWailaDataProvider { - @Nonnull - @Override - @Optional.Method(modid = WAILA_MOD_ID) - public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) { - return ItemStack.EMPTY; +import mcp.mobius.waila.api.*; +import mcp.mobius.waila.api.config.IPluginConfig; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; + +//class BaseWailaDataProvider implements IWailaDataProvider +public interface BaseWailaDataProvider { + + static abstract class BodyProvider implements IComponentProvider { + @Override + public void appendTooltip(ITooltip iTooltip, BlockAccessor blockAccessor, IPluginConfig iPluginConfig) { + getWailaBody(iTooltip, blockAccessor, iPluginConfig); + } + + abstract void getWailaBody(ITooltip iTooltip, BlockAccessor accessor, IPluginConfig iPluginConfig); } - @Nonnull - @Override - @Optional.Method(modid = WAILA_MOD_ID) - public List getWailaHead(ItemStack itemStack, List currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config) { - return currentTip; - } + static abstract class NBTProvider implements IServerDataProvider { + @Override + public void appendServerData(CompoundTag tag, ServerPlayer player, Level blockAccessor, BlockEntity blockEntity, boolean showDetails) { + getNBTData(tag, player, blockAccessor, blockEntity, showDetails); + } - @Nonnull - @Override - @Optional.Method(modid = WAILA_MOD_ID) - public List getWailaBody(ItemStack itemStack, List currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config) { - return currentTip; + abstract void getNBTData(CompoundTag tag, ServerPlayer player, Level blockAccessor, BlockEntity blockEntity, boolean showDetails); } - @Nonnull - @Override - @Optional.Method(modid = WAILA_MOD_ID) - public List getWailaTail(ItemStack itemStack, List currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config) { - return currentTip; + static abstract class BodyProviderEntity implements IEntityComponentProvider { + @Override + public void appendTooltip(ITooltip iTooltip, EntityAccessor blockAccessor, IPluginConfig iPluginConfig) { + getWailaBody(iTooltip, blockAccessor, iPluginConfig); + } + + abstract void getWailaBody(ITooltip iTooltip, EntityAccessor accessor, IPluginConfig iPluginConfig); } - @Nonnull - @Override - @Optional.Method(modid = WAILA_MOD_ID) - public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) { - return tag; + static abstract class NBTProviderEntity implements IServerDataProvider { + @Override + public void appendServerData(CompoundTag tag, ServerPlayer player, Level world, Entity entity, boolean showDetails) { + getNBTData(tag, player, world, entity, showDetails); + } + + abstract void getNBTData(CompoundTag tag, ServerPlayer player, Level world, Entity entity, boolean showDetails); } } diff --git a/common/buildcraft/compat/module/waila/HWYLAPlugin.java b/common/buildcraft/compat/module/waila/HWYLAPlugin.java index 2ddff63..d36979e 100644 --- a/common/buildcraft/compat/module/waila/HWYLAPlugin.java +++ b/common/buildcraft/compat/module/waila/HWYLAPlugin.java @@ -1,49 +1,43 @@ package buildcraft.compat.module.waila; -import static buildcraft.compat.module.waila.HWYLAPlugin.WAILA_MOD_ID; - -import net.minecraft.item.ItemStack; - -import net.minecraftforge.fml.common.Optional; - -import buildcraft.api.mj.ILaserTarget; - -import buildcraft.lib.tile.craft.IAutoCraft; - -import mcp.mobius.waila.api.IWailaDataProvider; -import mcp.mobius.waila.api.IWailaPlugin; -import mcp.mobius.waila.api.IWailaRegistrar; -import mcp.mobius.waila.api.SpecialChars; -import mcp.mobius.waila.api.WailaPlugin; +import buildcraft.api.robots.EntityRobotBase; +import buildcraft.lib.block.BlockBCTile_Neptune; +import buildcraft.lib.tile.TileBC_Neptune; +import mcp.mobius.waila.api.*; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.level.block.entity.BlockEntity; @WailaPlugin -@Optional.InterfaceList({ - @Optional.Interface(modid = WAILA_MOD_ID, iface = "mcp.mobius.waila.api.IWailaPlugin") -}) public class HWYLAPlugin implements IWailaPlugin { - static final String WAILA_MOD_ID = "waila"; - + // Calen: in 1.18.2 we should use Block or TE class instead of interface here, it's too difficult to get all matched if allowing some BC modules absent, + // so just use TileBC_Neptune and BlockBCTile_Neptune @Override - public void register(IWailaRegistrar registrar) { - IWailaDataProvider autoCraftProvider = new AutoCraftDataProvider(); - registrar.registerNBTProvider(autoCraftProvider, IAutoCraft.class); - registrar.registerBodyProvider(autoCraftProvider, IAutoCraft.class); - - IWailaDataProvider laserTargetProvider = new LaserTargetDataProvider(); - registrar.registerNBTProvider(laserTargetProvider, ILaserTarget.class); - registrar.registerBodyProvider(laserTargetProvider, ILaserTarget.class); + public void register(IWailaCommonRegistration registrar) { + IServerDataProvider autoCraftNbtProvider = new AutoCraftDataProvider.NBTProvider(); + IServerDataProvider laserTargetNbtProvider = new LaserTargetDataProvider.NBTProvider(); + IServerDataProvider assemblyCraftNbtProvider = new AssemblyCraftDataProvider.NBTProvider(); + IServerDataProvider mjStorageNbtProvider = new MjStorageDataProvider.NBTProvider(); + IServerDataProvider robotPowerNbtProvider = new RobotPowerDataProvider.NBTProvider(); + + registrar.registerBlockDataProvider(autoCraftNbtProvider, TileBC_Neptune.class); + registrar.registerBlockDataProvider(laserTargetNbtProvider, TileBC_Neptune.class); + registrar.registerBlockDataProvider(assemblyCraftNbtProvider, TileBC_Neptune.class); + registrar.registerBlockDataProvider(mjStorageNbtProvider, TileBC_Neptune.class); + registrar.registerEntityDataProvider(robotPowerNbtProvider, EntityRobotBase.class); } - static String getItemStackString(ItemStack stack) { - return getItemStackString(stack, "1"); - } - - private static String getItemStackString(ItemStack stack, String thing) { - // TODO: find out what that 'thing' really is - return SpecialChars.getRenderString("waila.stack", thing, - stack.getItem().getRegistryName().toString(), - String.valueOf(stack.getCount()), - String.valueOf(stack.getItemDamage()) - ); + @Override + public void registerClient(IWailaClientRegistration registrar) { + IComponentProvider autoCraftBodyProvider = new AutoCraftDataProvider.BodyProvider(); + IComponentProvider laserTargetBodyProvider = new LaserTargetDataProvider.BodyProvider(); + IComponentProvider assemblyCraftBodyProvider = new AssemblyCraftDataProvider.BodyProvider(); + IComponentProvider mjStorageBodyProvider = new MjStorageDataProvider.BodyProvider(); + IEntityComponentProvider robotPowerBodyProvider = new RobotPowerDataProvider.BodyProvider(); + + registrar.registerComponentProvider(autoCraftBodyProvider, TooltipPosition.BODY, BlockBCTile_Neptune.class); + registrar.registerComponentProvider(laserTargetBodyProvider, TooltipPosition.BODY, BlockBCTile_Neptune.class); + registrar.registerComponentProvider(assemblyCraftBodyProvider, TooltipPosition.BODY, BlockBCTile_Neptune.class); + registrar.registerComponentProvider(mjStorageBodyProvider, TooltipPosition.BODY, BlockBCTile_Neptune.class); + registrar.registerComponentProvider(robotPowerBodyProvider, TooltipPosition.BODY, EntityRobotBase.class); } } diff --git a/common/buildcraft/compat/module/waila/LaserTargetDataProvider.java b/common/buildcraft/compat/module/waila/LaserTargetDataProvider.java index 426e975..4178106 100644 --- a/common/buildcraft/compat/module/waila/LaserTargetDataProvider.java +++ b/common/buildcraft/compat/module/waila/LaserTargetDataProvider.java @@ -1,56 +1,44 @@ package buildcraft.compat.module.waila; -import static buildcraft.compat.module.waila.HWYLAPlugin.WAILA_MOD_ID; - -import java.util.List; -import javax.annotation.Nonnull; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.TextFormatting; -import net.minecraft.world.World; -import net.minecraftforge.common.util.Constants; -import net.minecraftforge.fml.common.Optional; import buildcraft.api.mj.ILaserTarget; import buildcraft.api.mj.MjAPI; +import mcp.mobius.waila.api.BlockAccessor; +import mcp.mobius.waila.api.ITooltip; +import mcp.mobius.waila.api.config.IPluginConfig; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.Tag; +import net.minecraft.network.chat.TranslatableComponent; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; -import mcp.mobius.waila.api.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; +abstract class LaserTargetDataProvider { -class LaserTargetDataProvider extends BaseWailaDataProvider { - @Nonnull - @Override - @Optional.Method(modid = WAILA_MOD_ID) - public List getWailaBody(ItemStack itemStack, List currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config) { - TileEntity tile = accessor.getTileEntity(); - if (tile instanceof ILaserTarget) { - NBTTagCompound nbt = accessor.getNBTData(); - if (nbt.hasKey("required_power", Constants.NBT.TAG_LONG)) { - long power = nbt.getLong("required_power"); - if (power > 0) { - currentTip.add(TextFormatting.WHITE + "Waiting from laser: " + TextFormatting.AQUA + MjAPI.formatMj(power) + " MJ"); + static class BodyProvider extends BaseWailaDataProvider.BodyProvider { + @Override + public void getWailaBody(ITooltip currentTip, BlockAccessor accessor, IPluginConfig iPluginConfig) { + BlockEntity tile = accessor.getBlockEntity(); + if (tile instanceof ILaserTarget) { + CompoundTag nbt = accessor.getServerData(); + if (nbt.contains("required_power", Tag.TAG_LONG)) { + long power = nbt.getLong("required_power"); + if (power > 0L) { + currentTip.add(new TranslatableComponent("buildcraft.waila.waiting_for_laser", MjAPI.formatMj(power))); + } } } - } else { - currentTip.add(TextFormatting.RED + "{wrong tile entity}"); +// else { +// currentTip.add(new TextComponent(ChatFormatting.RED + "{wrong tile entity}")); +// } } - return currentTip; } - @Nonnull - @Override - @Optional.Method(modid = WAILA_MOD_ID) - public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) { - NBTTagCompound nbt = super.getNBTData(player, te, tag, world, pos); - - TileEntity tile = world.getTileEntity(pos); - if (tile instanceof ILaserTarget) { - ILaserTarget target = ILaserTarget.class.cast(tile); - nbt.setLong("required_power", target.getRequiredLaserPower()); + static class NBTProvider extends BaseWailaDataProvider.NBTProvider { + @Override + public void getNBTData(CompoundTag nbt, ServerPlayer player, Level world, BlockEntity tile, boolean showDetails) { + if (tile instanceof ILaserTarget target) { + nbt.putLong("required_power", target.getRequiredLaserPower()); + } } - - return nbt; } } diff --git a/common/buildcraft/compat/module/waila/MjStorageDataProvider.java b/common/buildcraft/compat/module/waila/MjStorageDataProvider.java new file mode 100644 index 0000000..8937470 --- /dev/null +++ b/common/buildcraft/compat/module/waila/MjStorageDataProvider.java @@ -0,0 +1,58 @@ +package buildcraft.compat.module.waila; + +import buildcraft.api.mj.MjAPI; +import buildcraft.lib.tile.TileBC_Neptune; +import mcp.mobius.waila.api.BlockAccessor; +import mcp.mobius.waila.api.ITooltip; +import mcp.mobius.waila.api.config.IPluginConfig; +import mcp.mobius.waila.impl.ui.BorderStyle; +import mcp.mobius.waila.impl.ui.ProgressElement; +import mcp.mobius.waila.impl.ui.ProgressStyle; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.Tag; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntity; + +public class MjStorageDataProvider { + static class BodyProvider extends BaseWailaDataProvider.BodyProvider { + private static final ProgressStyle PROGRESS_STYLE; + + static { + PROGRESS_STYLE = new ProgressStyle(); + PROGRESS_STYLE.color(-15731468, -16721961) + .textColor(DyeColor.WHITE.getTextColor()); + } + + @Override + public void getWailaBody(ITooltip currentTip, BlockAccessor accessor, IPluginConfig iPluginConfig) { + if (accessor.getBlockEntity() instanceof TileBC_Neptune tileBC) { + tileBC.getCapability(MjAPI.CAP_READABLE).ifPresent(mjReadable -> { + CompoundTag nbt = accessor.getServerData(); + if (nbt.contains("mj_storage", Tag.TAG_COMPOUND)) { + CompoundTag mj_storage_Tag = nbt.getCompound("mj_storage"); + long mj_capability = mj_storage_Tag.getLong("mj_capability"); + long mj_stored = mj_storage_Tag.getLong("mj_stored"); + currentTip.add(new ProgressElement((float) (((double) mj_stored) / ((double) mj_capability)), new TextComponent(mj_stored + " MJ/" + mj_capability + "MJ"), PROGRESS_STYLE, new BorderStyle())); + } + }); + } + } + } + + static class NBTProvider extends BaseWailaDataProvider.NBTProvider { + @Override + public void getNBTData(CompoundTag nbt, ServerPlayer player, Level world, BlockEntity tile, boolean showDetails) { + if (tile instanceof TileBC_Neptune tileBC) { + tileBC.getCapability(MjAPI.CAP_READABLE).ifPresent(mjReadable -> { + CompoundTag mj_storage_Tag = new CompoundTag(); + mj_storage_Tag.putLong("mj_capability", mjReadable.getCapacity() / MjAPI.MJ); + mj_storage_Tag.putLong("mj_stored", mjReadable.getStored() / MjAPI.MJ); + nbt.put("mj_storage", mj_storage_Tag); + }); + } + } + } +} diff --git a/common/buildcraft/compat/module/waila/RobotPowerDataProvider.java b/common/buildcraft/compat/module/waila/RobotPowerDataProvider.java new file mode 100644 index 0000000..4b3f193 --- /dev/null +++ b/common/buildcraft/compat/module/waila/RobotPowerDataProvider.java @@ -0,0 +1,54 @@ +package buildcraft.compat.module.waila; + +import buildcraft.api.mj.MjAPI; +import buildcraft.api.robots.EntityRobotBase; +import mcp.mobius.waila.api.EntityAccessor; +import mcp.mobius.waila.api.ITooltip; +import mcp.mobius.waila.api.config.IPluginConfig; +import mcp.mobius.waila.impl.ui.BorderStyle; +import mcp.mobius.waila.impl.ui.ProgressElement; +import mcp.mobius.waila.impl.ui.ProgressStyle; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.Tag; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.item.DyeColor; +import net.minecraft.world.level.Level; + +public class RobotPowerDataProvider { + static class BodyProvider extends BaseWailaDataProvider.BodyProviderEntity { + private static final ProgressStyle PROGRESS_STYLE; + + static { + PROGRESS_STYLE = new ProgressStyle(); + PROGRESS_STYLE.color(-15731468, -16721961) + .textColor(DyeColor.WHITE.getTextColor()); + } + + @Override + public void getWailaBody(ITooltip currentTip, EntityAccessor accessor, IPluginConfig iPluginConfig) { + if (accessor.getEntity() instanceof EntityRobotBase) { + CompoundTag nbt = accessor.getServerData(); + if (nbt.contains("mj_storage", Tag.TAG_COMPOUND)) { + CompoundTag mj_storage_Tag = nbt.getCompound("mj_storage"); + long mj_capability = mj_storage_Tag.getLong("mj_capability"); + long mj_stored = mj_storage_Tag.getLong("mj_stored"); + currentTip.add(new ProgressElement((float) (((double) mj_stored) / ((double) mj_capability)), new TextComponent(mj_stored + " MJ/" + mj_capability + "MJ"), PROGRESS_STYLE, new BorderStyle())); + } + } + } + } + + static class NBTProvider extends BaseWailaDataProvider.NBTProviderEntity { + @Override + public void getNBTData(CompoundTag nbt, ServerPlayer player, Level world, Entity entity, boolean showDetails) { + if (entity instanceof EntityRobotBase) { + CompoundTag mj_storage_Tag = new CompoundTag(); + mj_storage_Tag.putLong("mj_capability", ((EntityRobotBase) entity).getBattery().getCapacity() / MjAPI.MJ); + mj_storage_Tag.putLong("mj_stored", ((EntityRobotBase) entity).getBattery().getStored() / MjAPI.MJ); + nbt.put("mj_storage", mj_storage_Tag); + } + } + } +} diff --git a/common/buildcraft/compat/network/CompatGui.java b/common/buildcraft/compat/network/CompatGui.java index 3c5d599..75212fc 100644 --- a/common/buildcraft/compat/network/CompatGui.java +++ b/common/buildcraft/compat/network/CompatGui.java @@ -1,144 +1,160 @@ -package buildcraft.compat.network; - -import javax.annotation.Nullable; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; - -import net.minecraftforge.fml.common.SidedProxy; -import net.minecraftforge.fml.common.network.IGuiHandler; - -import buildcraft.compat.BCCompat; -import buildcraft.compat.CompatUtils; - -// Half-decent class (inspired by how forestry does things) -// This really wants fleshing out and moving into mainline buildcraft though -// Along with a sensible way of dealing with pluggables etc -public enum CompatGui { - - FORESTRY_PROPOLIS_PIPE(IGuiTarget.TILE); - - static final CompatGui[] VALUES = values(); - - @SidedProxy(modId = BCCompat.MODID) - public static CommonProxy guiHandlerProxy; - - public final IGuiTarget target; - - private CompatGui(IGuiTarget target) { - this.target = target; - } - - public void openGui(EntityPlayer player) { - openGui(player, 0, 0, 0, 0); - } - - public void openGui(EntityPlayer player, BlockPos pos) { - openGui(player, pos.getX(), pos.getY(), pos.getZ(), 0); - } - - public void openGui(EntityPlayer player, int x, int y, int z) { - openGui(player, x, y, z, 0); - } - - public void openGui(EntityPlayer player, int data) { - openGui(player, 0, 0, 0, data); - } - - public void openGui(EntityPlayer player, BlockPos pos, int data) { - openGui(player, pos.getX(), pos.getY(), pos.getZ(), data); - } - - public void openGui(EntityPlayer player, int x, int y, int z, int data) { - player.openGui(BCCompat.instance, packGui(this, data), player.world, x, y, z); - } - - protected static int packGui(Enum gui, int data) { - if (data < 0 || data > 0xFF_FF_FF) { - throw new IllegalArgumentException("Data must be between 0 and 0xFF_FF_FF (inclusive)"); - } - return (data << 8) | gui.ordinal(); - } - - @Nullable - protected static CompatGui getGui(int id) { - id &= 0xFF; - if (id < 0 || id >= CompatGui.VALUES.length) { - return null; - } - return CompatGui.VALUES[id]; - } - - protected static int getData(int id) { - return id >>> 8; - } - - @FunctionalInterface - public interface IGuiTarget { - public static final IGuiTarget TILE = (player, world, x, y, z, data) -> { - TileEntity tile = world.getTileEntity(new BlockPos(x, y, z)); - if (tile instanceof IGuiCreator) { - return (IGuiCreator) tile; - } - if (tile != null) { - return tile.getCapability(CompatUtils.CAP_GUI_CREATOR, null); - } - return null; - }; - - @Nullable - IGuiCreator getCreator(EntityPlayer player, World world, int x, int y, int z, int data); - } - - public static abstract class CommonProxy implements IGuiHandler { - - @Nullable - protected static IGuiCreator getGuiCreator(int id, EntityPlayer player, World world, int x, int y, int z) { - CompatGui type = getGui(id); - int data = getData(id); - if (type == null) { - return null; - } - IGuiCreator creator = type.target.getCreator(player, world, x, y, z, data); - if (creator == null || creator.getGuiType() != type) { - return null; - } - return creator; - } - - @Override - @Nullable - public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { - IGuiCreator creator = getGuiCreator(id, player, world, x, y, z); - if (creator == null) { - return null; - } - return creator.getServerGuiElement(getData(id), player); - } - } - - public static class ServerProxy extends CommonProxy { - - @Override - @Nullable - public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { - return null; - } - } - - public static class ClientProxy extends CommonProxy { - - @Override - @Nullable - public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { - IGuiCreator creator = getGuiCreator(id, player, world, x, y, z); - if (creator == null) { - return null; - } - return creator.getClientGuiElement(getData(id), player); - } - } - -} +//package buildcraft.compat.network; +// +//import buildcraft.compat.BCCompat; +//import buildcraft.compat.CompatUtils; +//import net.minecraft.core.BlockPos; +//import net.minecraft.core.Direction; +//import net.minecraft.world.entity.player.Player; +//import net.minecraft.world.level.Level; +//import net.minecraft.world.level.block.entity.BlockEntity; +// +//import javax.annotation.Nullable; +// +//public enum CompatGui +//{ +// FORESTRY_PROPOLIS_PIPE(CompatGui.IGuiTarget.TILE); +// +// static final CompatGui[] VALUES = values(); +// // @SidedProxy( +//// modId = "buildcraftcompat" +//// ) +// public static CommonProxy guiHandlerProxy; +// public final IGuiTarget target; +// +// private CompatGui(IGuiTarget target) +// { +// this.target = target; +// } +// +// public void openGui(EntityPlayer player) +// { +// this.openGui(player, 0, 0, 0, 0); +// } +// +// public void openGui(EntityPlayer player, BlockPos pos) +// { +// this.openGui(player, pos.func_177958_n(), pos.func_177956_o(), pos.func_177952_p(), 0); +// } +// +// public void openGui(EntityPlayer player, int x, int y, int z) +// { +// this.openGui(player, x, y, z, 0); +// } +// +// public void openGui(EntityPlayer player, int data) +// { +// this.openGui(player, 0, 0, 0, data); +// } +// +// public void openGui(EntityPlayer player, BlockPos pos, int data) +// { +// this.openGui(player, pos.func_177958_n(), pos.func_177956_o(), pos.func_177952_p(), data); +// } +// +// public void openGui(EntityPlayer player, int x, int y, int z, int data) +// { +// player.openGui(BCCompat.instance, packGui(this, data), player.field_70170_p, x, y, z); +// } +// +// protected static int packGui(Enum gui, int data) +// { +// if (data >= 0 && data <= 16777215) +// { +// return data << 8 | gui.ordinal(); +// } +// else +// { +// throw new IllegalArgumentException("Data must be between 0 and 0xFF_FF_FF (inclusive)"); +// } +// } +// +// @Nullable +// protected static CompatGui getGui(int id) +// { +// id &= 255; +// return id >= 0 && id < VALUES.length ? VALUES[id] : null; +// } +// +// protected static int getData(int id) +// { +// return id >>> 8; +// } +// +// public static class ClientProxy extends CommonProxy +// { +// public ClientProxy() +// { +// } +// +// @Nullable +// public Object getClientGuiElement(int id, Player player, Level world, int x, int y, int z) +// { +// IGuiCreator creator = getGuiCreator(id, player, world, x, y, z); +// return creator == null ? null : creator.getClientGuiElement(CompatGui.getData(id), player); +// } +// } +// +// public static class ServerProxy extends CommonProxy +// { +// public ServerProxy() +// { +// } +// +// @Nullable +// public Object getClientGuiElement(int id, Player player, Level world, int x, int y, int z) +// { +// return null; +// } +// } +// +// // public abstract static class CommonProxy implements IGuiHandler +// public abstract static class CommonProxy +// { +// public CommonProxy() +// { +// } +// +// @Nullable +// protected static IGuiCreator getGuiCreator(int id, Player player, Level world, int x, int y, int z) +// { +// CompatGui type = CompatGui.getGui(id); +// int data = CompatGui.getData(id); +// if (type == null) +// { +// return null; +// } +// else +// { +// IGuiCreator creator = type.target.getCreator(player, world, x, y, z, data); +// return creator != null && creator.getGuiType() == type ? creator : null; +// } +// } +// +// @Nullable +// public Object getServerGuiElement(int id, Player player, Level world, int x, int y, int z) +// { +// IGuiCreator creator = getGuiCreator(id, player, world, x, y, z); +// return creator == null ? null : creator.getServerGuiElement(CompatGui.getData(id), player); +// } +// } +// +// @FunctionalInterface +// public interface IGuiTarget +// { +// IGuiTarget TILE = (player, world, x, y, z, data) -> +// { +// BlockEntity tile = world.getBlockEntity(new BlockPos(x, y, z)); +// if (tile instanceof IGuiCreator) +// { +// return (IGuiCreator) tile; +// } +// else +// { +// return tile != null ? (IGuiCreator) tile.getCapability(CompatUtils.CAP_GUI_CREATOR, null) : null; +// } +// }; +// +// @Nullable +// IGuiCreator getCreator(Player var1, Level var2, int var3, int var4, int var5, int var6); +// } +//} diff --git a/common/buildcraft/compat/network/IGuiCreator.java b/common/buildcraft/compat/network/IGuiCreator.java index c1d26fe..7897365 100644 --- a/common/buildcraft/compat/network/IGuiCreator.java +++ b/common/buildcraft/compat/network/IGuiCreator.java @@ -1,25 +1,22 @@ package buildcraft.compat.network; -import javax.annotation.Nullable; - -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; +import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.inventory.AbstractContainerMenu; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import javax.annotation.Nullable; -/** A creator that can */ -// TODO: Move this into bc lib and make it more useful! public interface IGuiCreator { Enum getGuiType(); - /** @param data The extra 24 bits that are unused by the byte ID. */ @Nullable - @SideOnly(Side.CLIENT) - GuiContainer getClientGuiElement(int data, EntityPlayer player); + @OnlyIn(Dist.CLIENT) +// GuiContainer getClientGuiElement(int var1, EntityPlayer var2); + AbstractContainerScreen getClientGuiElement(int var1, Player var2); - /** @param data The extra 24 bits that are unused by the byte ID. */ @Nullable - Container getServerGuiElement(int data, EntityPlayer player); +// Container getServerGuiElement(int var1, EntityPlayer var2); + AbstractContainerMenu getServerGuiElement(int var1, Player var2); } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index ca78035..41d9927 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 66ad866..41dfb87 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Tue Sep 05 20:44:05 EEST 2017 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.13-bin.zip +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 27309d9..1b6c787 100755 --- a/gradlew +++ b/gradlew @@ -1,78 +1,129 @@ -#!/usr/bin/env bash +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum -warn ( ) { +warn () { echo "$*" -} +} >&2 -die ( ) { +die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -81,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -89,76 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=$((i+1)) + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") -} -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" - -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 832fdb6..107acd3 100755 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -13,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -35,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -45,34 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/mod_info/META-INF/mods.toml b/mod_info/META-INF/mods.toml new file mode 100644 index 0000000..bbbd345 --- /dev/null +++ b/mod_info/META-INF/mods.toml @@ -0,0 +1,151 @@ +modLoader="javafml" +loaderVersion="[32,)" +license="Minecraft Mod Public License" +issueTrackerURL="" +[[mods]] +modId="buildcraftlib" +displayName="BuildCraft Lib" +version="7.99.24.9" +description="Library mod used by buildcraft." +credits="Created by SpaceToad" +logoFile="logo.png" +displayURL="http://www.mod-buildcraft.com/" +updateJSONURL="" +authors="SpaceToad, BuildCraft Team" + +[[mods]] +modId="buildcraftcore" +displayName="BuildCraft" +version="7.99.24.9" +description="Extending Minecraft with pipes, auto-crafting, quarries, engines and much more!" +credits="Created by SpaceToad" +logoFile="logo.png" +displayURL="http://www.mod-buildcraft.com/" +updateJSONURL="" +authors="SpaceToad, BuildCraft Team" + +[[mods]] +modId="buildcraftbuilders" +displayName="BuildCraft Builders" +version="7.99.24.9" +description="Extending Minecraft with pipes, auto-crafting, quarries, engines and much more! (Builders Component)" +credits="Created by SpaceToad" +logoFile="logo.png" +displayURL="http://www.mod-buildcraft.com/" +updateJSONURL="" +authors="SpaceToad, BuildCraft Team" + +[[mods]] +modId="buildcraftenergy" +displayName="BuildCraft Energy" +version="7.99.24.9" +description="Extending Minecraft with pipes, auto-crafting, quarries, engines and much more! (Energy Component)" +credits="Created by SpaceToad" +logoFile="logo.png" +displayURL="http://www.mod-buildcraft.com/" +updateJSONURL="" +authors="SpaceToad, BuildCraft Team" + +[[mods]] +modId="buildcraftfactory" +displayName="BuildCraft Factory" +version="7.99.24.9" +description="Extending Minecraft with pipes, auto-crafting, quarries, engines and much more! (Factory Component)" +credits="Created by SpaceToad" +logoFile="logo.png" +displayURL="http://www.mod-buildcraft.com/" +updateJSONURL="" +authors="SpaceToad, BuildCraft Team" + +[[mods]] +modId="buildcraftsilicon" +displayName="BuildCraft Silicon" +version="7.99.24.9" +description="Extending Minecraft with pipes, auto-crafting, quarries, engines and much more! (Silicon Component)" +credits="Created by SpaceToad" +logoFile="logo.png" +displayURL="http://www.mod-buildcraft.com/" +updateJSONURL="" +authors="SpaceToad, BuildCraft Team" + +[[mods]] +modId="buildcrafttransport" +displayName="BuildCraft Transport" +version="7.99.24.9" +description="Extending Minecraft with pipes, auto-crafting, quarries, engines and much more! (Transport Component)" +credits="Created by SpaceToad" +logoFile="logo.png" +displayURL="http://www.mod-buildcraft.com/" +updateJSONURL="" +authors="SpaceToad, BuildCraft Team" + +[[mods]] +modId="buildcraftrobotics" +displayName="BuildCraft Robotics" +version="7.99.24.9" +description="Extending Minecraft with pipes, auto-crafting, quarries, engines and much more! (Robotics Component)" +credits="Created by SpaceToad" +logoFile="logo.png" +displayURL="http://www.mod-buildcraft.com/" +updateJSONURL="" +authors="SpaceToad, BuildCraft Team" + +[[mods]] +modId="buildcraftcompat" +displayName="BuildCraft Compat" +version="7.99.24.9" +description="Compatibility add-on for BuildCraft" +credits="Created by asie" +logoFile="logo.png" +displayURL="http://www.mod-buildcraft.com/" +updateJSONURL="" +authors="BuildCraft Team" + +[[dependencies.buildcraftcore]] + modId="forge" + mandatory=true + versionRange="[40,)" + ordering="NONE" + side="BOTH" +[[dependencies.buildcraftcore]] + modId="minecraft" + mandatory=true + versionRange="[1.18,1.19)" + ordering="NONE" + side="BOTH" +[[dependencies.buildcraftcore]] + modId="buildcraftlib" + mandatory=true + versionRange="[0.0.0,)" + ordering="AFTER" + side="BOTH" +[[dependencies.buildcraftenergy]] + modId="buildcraftcore" + mandatory=true + versionRange="[0.0.0,)" + ordering="AFTER" + side="BOTH" +[[dependencies.buildcraftbuilders]] + modId="buildcraftcore" + mandatory=true + versionRange="[0.0.0,)" + ordering="AFTER" + side="BOTH" +[[dependencies.buildcrafttransport]] + modId="buildcraftcore" + mandatory=true + versionRange="[0.0.0,)" + ordering="AFTER" + side="BOTH" +[[dependencies.buildcraftrobotics]] + modId="buildcraftcore" + mandatory=true + versionRange="[0.0.0,)" + ordering="AFTER" + side="BOTH" +[[dependencies.buildcraftcompat]] + modId="buildcraftcore" + mandatory=true + versionRange="[0.0.0,)" + ordering="AFTER" + side="BOTH" diff --git a/resources/META-INF/mods.toml_ b/resources/META-INF/mods.toml_ new file mode 100644 index 0000000..9864995 --- /dev/null +++ b/resources/META-INF/mods.toml_ @@ -0,0 +1,32 @@ +modLoader="javafml" +loaderVersion="[32,)" +license="Minecraft Mod Public License" +issueTrackerURL="" +[[mods]] +modId="buildcraftlib" +displayName="BuildCraft Lib" +version="7.99.24.9" +description="Library mod used by buildcraft." +credits="Created by SpaceToad" +logoFile="logo.png" +displayURL="http://www.mod-buildcraft.com/" +updateJSONURL="" +authors="SpaceToad, BuildCraft Team" + +[[mods]] +modId="buildcraftcompat" +displayName="BuildCraft Compat" +version="7.99.24.9" +description="Compatibility add-on for BuildCraft" +credits="Created by asie" +logoFile="logo.png" +displayURL="http://www.mod-buildcraft.com/" +updateJSONURL="" +authors="BuildCraft Team" + +[[dependencies.buildcraftcompat]] + modId="buildcraftcore" + mandatory=true + versionRange="[0.0.0,)" + ordering="AFTER" + side="BOTH" diff --git a/resources/assets/buildcraftcompat/lang/de_DE.lang b/resources/assets/buildcraftcompat/lang/de_DE.lang deleted file mode 100644 index 03ffea5..0000000 --- a/resources/assets/buildcraftcompat/lang/de_DE.lang +++ /dev/null @@ -1,20 +0,0 @@ -#################### -# APIARIST'S PIPE -#################### - -item.buildcraftPipe.pipeitemspropolis.name=Bienenrohr - -for.gui.pipe.filter.anything=Alles -for.gui.pipe.filter.bee=Alle Bienen -for.gui.pipe.filter.cave=Höhlenbewohner -for.gui.pipe.filter.closed=Geschlossen -for.gui.pipe.filter.drone=Dronen -for.gui.pipe.filter.flyer=Starke Flieger -for.gui.pipe.filter.item=Gegenstände -for.gui.pipe.filter.nocturnal=Nachtaktive -for.gui.pipe.filter.princess=Prinzessinnen -for.gui.pipe.filter.pure_breed=Reinrassige -for.gui.pipe.filter.pure_cave=Reinrassige Höhlenbewohner -for.gui.pipe.filter.pure_flyer=Reinrassig starke Flieger -for.gui.pipe.filter.pure_nocturnal=Reinrassig nachtaktive -for.gui.pipe.filter.queen=Königinnen diff --git a/resources/assets/buildcraftcompat/lang/de_de.json b/resources/assets/buildcraftcompat/lang/de_de.json new file mode 100644 index 0000000..728942c --- /dev/null +++ b/resources/assets/buildcraftcompat/lang/de_de.json @@ -0,0 +1,24 @@ +{ + //################### + // APIARIST'S PIPE + //################### + + "item.buildcraftPipe.pipeitemspropolis.name": "Bienenrohr", + + "for.gui.pipe.filter.anything": "Alles", + "for.gui.pipe.filter.bee": "Alle Bienen", + "for.gui.pipe.filter.cave": "Höhlenbewohner", + "for.gui.pipe.filter.closed": "Geschlossen", + "for.gui.pipe.filter.drone": "Dronen", + "for.gui.pipe.filter.flyer": "Starke Flieger", + "for.gui.pipe.filter.item": "Gegenstände", + "for.gui.pipe.filter.nocturnal": "Nachtaktive", + "for.gui.pipe.filter.princess": "Prinzessinnen", + "for.gui.pipe.filter.pure_breed": "Reinrassige", + "for.gui.pipe.filter.pure_cave": "Reinrassige Höhlenbewohner", + "for.gui.pipe.filter.pure_flyer": "Reinrassig starke Flieger", + "for.gui.pipe.filter.pure_nocturnal": "Reinrassig nachtaktive", + "for.gui.pipe.filter.queen": "Königinnen", + + "null": "=w=" +} diff --git a/resources/assets/buildcraftcompat/lang/en_US.lang b/resources/assets/buildcraftcompat/lang/en_US.lang deleted file mode 100644 index 3975239..0000000 --- a/resources/assets/buildcraftcompat/lang/en_US.lang +++ /dev/null @@ -1,25 +0,0 @@ -#################### -# APIARIST'S PIPE -#################### - -item.buildcraftPipe.pipeitemspropolis.name=Apiarist's Pipe - -for.gui.pipe.filter.anything=Anything -for.gui.pipe.filter.bee=Any Bees -for.gui.pipe.filter.cave=Cave-Dwellers -for.gui.pipe.filter.closed=Closed -for.gui.pipe.filter.drone=Drones -for.gui.pipe.filter.flyer=Strong Flyers -for.gui.pipe.filter.item=Items -for.gui.pipe.filter.natural=Natural Origin -for.gui.pipe.filter.nocturnal=Nocturnal Bees -for.gui.pipe.filter.princess=Princesses -for.gui.pipe.filter.pure_breed=Pure-Bred Bees -for.gui.pipe.filter.pure_cave=Pure Cave-Dwellers -for.gui.pipe.filter.pure_flyer=Pure Flyers -for.gui.pipe.filter.pure_nocturnal=Pure Nocturnal Bees -for.gui.pipe.filter.queen=Queen - -gate.trigger.mfr.backstuffed=Has Drops -gate.trigger.mfr.conreversed=Conveyor Reversed -gate.trigger.mfr.conrunning=Conveyor Running \ No newline at end of file diff --git a/resources/assets/buildcraftcompat/lang/en_us.json b/resources/assets/buildcraftcompat/lang/en_us.json new file mode 100644 index 0000000..03be0b4 --- /dev/null +++ b/resources/assets/buildcraftcompat/lang/en_us.json @@ -0,0 +1,45 @@ +{ + //################### + // APIARIST'S PIPE + //################### + + "item.buildcraftPipe.pipeitemspropolis.name": "Apiarist's Pipe", + + "for.gui.pipe.filter.anything": "Anything", + "for.gui.pipe.filter.bee": "Any Bees", + "for.gui.pipe.filter.cave": "Cave-Dwellers", + "for.gui.pipe.filter.closed": "Closed", + "for.gui.pipe.filter.drone": "Drones", + "for.gui.pipe.filter.flyer": "Strong Flyers", + "for.gui.pipe.filter.item": "Items", + "for.gui.pipe.filter.natural": "Natural Origin", + "for.gui.pipe.filter.nocturnal": "Nocturnal Bees", + "for.gui.pipe.filter.princess": "Princesses", + "for.gui.pipe.filter.pure_breed": "Pure-Bred Bees", + "for.gui.pipe.filter.pure_cave": "Pure Cave-Dwellers", + "for.gui.pipe.filter.pure_flyer": "Pure Flyers", + "for.gui.pipe.filter.pure_nocturnal": "Pure Nocturnal Bees", + "for.gui.pipe.filter.queen": "Queen", + + "gate.trigger.mfr.backstuffed": "Has Drops", + "gate.trigger.mfr.conreversed": "Conveyor Reversed", + "gate.trigger.mfr.conrunning": "Conveyor Running", + + // Calen 1.18.2 + // JEI + "buildcraft.jei.title.heatable_fluids": "Heatable Fluids", + "buildcraft.jei.title.coolable_fluids": "Coolable Fluids", + "buildcraft.jei.title.distillable_fluids": "Distillable Fluids", + "buildcraft.jei.title.combustion_engine_fuels": "Combustion Engine Fuels", + "buildcraft.jei.title.combustion_engine_fuels.burn_time": "Burns for %ds", + "buildcraft.jei.title.combustion_engine_fuels.burn_speed": " at %s MJ/t", + "buildcraft.jei.title.combustion_engine_fuels.burn_total": " total %s MJ", + + // Waila + "buildcraft.waila.crafting": "§fMaking: ", + "buildcraft.waila.no_recipe": "§7No recipe", + "buildcraft.waila.crafting_from": "§fFrom: ", + "buildcraft.waila.waiting_for_laser": "§fWaiting from laser: §b%s MJ", + + "null": "=w=" +} diff --git a/resources/assets/buildcraftcompat/lang/fr_FR.lang b/resources/assets/buildcraftcompat/lang/fr_FR.lang deleted file mode 100644 index 02f01f3..0000000 --- a/resources/assets/buildcraftcompat/lang/fr_FR.lang +++ /dev/null @@ -1,20 +0,0 @@ -#################### -# APIARIST'S PIPE -#################### - -item.buildcraftPipe.pipeitemspropolis.name=Tuyau de transport d'apiculteur - -for.gui.pipe.filter.anything=Tout -for.gui.pipe.filter.bee=Toutes abeilles -for.gui.pipe.filter.cave=De cave -for.gui.pipe.filter.closed=Rien -for.gui.pipe.filter.drone=Ouvrières -for.gui.pipe.filter.flyer=Les volantes -for.gui.pipe.filter.item=Éléments -for.gui.pipe.filter.nocturnal=Les noctures -for.gui.pipe.filter.princess=Princesses -for.gui.pipe.filter.pure_breed=Pures races -for.gui.pipe.filter.pure_cave=De cave pures -for.gui.pipe.filter.pure_flyer=Volantes pures -for.gui.pipe.filter.pure_nocturnal=Nocturne pures -for.gui.pipe.filter.queen=Reines diff --git a/resources/assets/buildcraftcompat/lang/fr_fr.json b/resources/assets/buildcraftcompat/lang/fr_fr.json new file mode 100644 index 0000000..d35b127 --- /dev/null +++ b/resources/assets/buildcraftcompat/lang/fr_fr.json @@ -0,0 +1,24 @@ +{ + //################### + // APIARIST'S PIPE + //################### + + "item.buildcraftPipe.pipeitemspropolis.name": "Tuyau de transport d'apiculteur", + + "for.gui.pipe.filter.anything": "Tout", + "for.gui.pipe.filter.bee": "Toutes abeilles", + "for.gui.pipe.filter.cave": "De cave", + "for.gui.pipe.filter.closed": "Rien", + "for.gui.pipe.filter.drone": "Ouvrières", + "for.gui.pipe.filter.flyer": "Les volantes", + "for.gui.pipe.filter.item": "Éléments", + "for.gui.pipe.filter.nocturnal": "Les noctures", + "for.gui.pipe.filter.princess": "Princesses", + "for.gui.pipe.filter.pure_breed": "Pures races", + "for.gui.pipe.filter.pure_cave": "De cave pures", + "for.gui.pipe.filter.pure_flyer": "Volantes pures", + "for.gui.pipe.filter.pure_nocturnal": "Nocturne pures", + "for.gui.pipe.filter.queen": "Reines", + + "null": "=w=" +} diff --git a/resources/assets/buildcraftcompat/lang/ko_KR.lang b/resources/assets/buildcraftcompat/lang/ko_KR.lang deleted file mode 100644 index bdcfa70..0000000 --- a/resources/assets/buildcraftcompat/lang/ko_KR.lang +++ /dev/null @@ -1,20 +0,0 @@ -#################### -# APIARIST'S PIPE -#################### - -item.buildcraftPipe.pipeitemspropolis.name=양봉업자의 파이프 - -for.gui.pipe.filter.anything=모든 아이템과 벌을 통과 -for.gui.pipe.filter.bee=모든 벌들 -for.gui.pipe.filter.cave=동굴 속에서도 작업 가능 -for.gui.pipe.filter.closed=아이템을 받지 않음 -for.gui.pipe.filter.drone=일벌 -for.gui.pipe.filter.flyer=우천시에도 작업 가능 -for.gui.pipe.filter.item=아이템만 -for.gui.pipe.filter.nocturnal=야행성 벌 -for.gui.pipe.filter.princess=공주벌 -for.gui.pipe.filter.pure_breed=공주벌 -for.gui.pipe.filter.pure_cave=동굴 속에서도 작업 가능한 순종 벌 -for.gui.pipe.filter.pure_flyer=우천시에도 작업 가능한 순종 벌 -for.gui.pipe.filter.pure_nocturnal=순종 야행성 벌 -for.gui.pipe.filter.queen=여왕벌 diff --git a/resources/assets/buildcraftcompat/lang/ko_kr.json b/resources/assets/buildcraftcompat/lang/ko_kr.json new file mode 100644 index 0000000..aba0c09 --- /dev/null +++ b/resources/assets/buildcraftcompat/lang/ko_kr.json @@ -0,0 +1,24 @@ +{ + //################### + // APIARIST'S PIPE + //################### + + "item.buildcraftPipe.pipeitemspropolis.name": "양봉업자의 파이프", + + "for.gui.pipe.filter.anything": "모든 아이템과 벌을 통과", + "for.gui.pipe.filter.bee": "모든 벌들", + "for.gui.pipe.filter.cave": "동굴 속에서도 작업 가능", + "for.gui.pipe.filter.closed": "아이템을 받지 않음", + "for.gui.pipe.filter.drone": "일벌", + "for.gui.pipe.filter.flyer": "우천시에도 작업 가능", + "for.gui.pipe.filter.item": "아이템만", + "for.gui.pipe.filter.nocturnal": "야행성 벌", + "for.gui.pipe.filter.princess": "공주벌", + "for.gui.pipe.filter.pure_breed": "공주벌", + "for.gui.pipe.filter.pure_cave": "동굴 속에서도 작업 가능한 순종 벌", + "for.gui.pipe.filter.pure_flyer": "우천시에도 작업 가능한 순종 벌", + "for.gui.pipe.filter.pure_nocturnal": "순종 야행성 벌", + "for.gui.pipe.filter.queen": "여왕벌", + + "null": "=w=" +} diff --git a/resources/assets/buildcraftcompat/lang/pt_BR.lang b/resources/assets/buildcraftcompat/lang/pt_BR.lang deleted file mode 100644 index 35da29d..0000000 --- a/resources/assets/buildcraftcompat/lang/pt_BR.lang +++ /dev/null @@ -1,20 +0,0 @@ -#################### -# APIARIST'S PIPE -#################### - -item.buildcraftPipe.pipeitemspropolis.name=Tubo do Apicultor - -for.gui.pipe.filter.anything=Nada -for.gui.pipe.filter.bee=Quaisquer Abelhas -for.gui.pipe.filter.cave=Habitante de Cavernas -for.gui.pipe.filter.closed=Fechado -for.gui.pipe.filter.drone=Zangões -for.gui.pipe.filter.flyer=Insetos Fortes -for.gui.pipe.filter.item=Ítens -for.gui.pipe.filter.nocturnal=Abelhas Noturnas -for.gui.pipe.filter.princess=Princesas -for.gui.pipe.filter.pure_breed=Abelhas de Raça Pura -for.gui.pipe.filter.pure_cave=Puras Habitantes das Cavernas -for.gui.pipe.filter.pure_flyer=Insetos Puros -for.gui.pipe.filter.pure_nocturnal=Abelhas Noturnas Puras -for.gui.pipe.filter.queen=Rainha diff --git a/resources/assets/buildcraftcompat/lang/pt_br.json b/resources/assets/buildcraftcompat/lang/pt_br.json new file mode 100644 index 0000000..8a5185f --- /dev/null +++ b/resources/assets/buildcraftcompat/lang/pt_br.json @@ -0,0 +1,24 @@ +{ + //################### + // APIARIST'S PIPE + //################### + + "item.buildcraftPipe.pipeitemspropolis.name": "Tubo do Apicultor", + + "for.gui.pipe.filter.anything": "Nada", + "for.gui.pipe.filter.bee": "Quaisquer Abelhas", + "for.gui.pipe.filter.cave": "Habitante de Cavernas", + "for.gui.pipe.filter.closed": "Fechado", + "for.gui.pipe.filter.drone": "Zangões", + "for.gui.pipe.filter.flyer": "Insetos Fortes", + "for.gui.pipe.filter.item": "Ítens", + "for.gui.pipe.filter.nocturnal": "Abelhas Noturnas", + "for.gui.pipe.filter.princess": "Princesas", + "for.gui.pipe.filter.pure_breed": "Abelhas de Raça Pura", + "for.gui.pipe.filter.pure_cave": "Puras Habitantes das Cavernas", + "for.gui.pipe.filter.pure_flyer": "Insetos Puros", + "for.gui.pipe.filter.pure_nocturnal": "Abelhas Noturnas Puras", + "for.gui.pipe.filter.queen": "Rainha", + + "null": "=w=" +} diff --git a/resources/assets/buildcraftcompat/lang/ru_RU.lang b/resources/assets/buildcraftcompat/lang/ru_RU.lang deleted file mode 100644 index 4d41e5a..0000000 --- a/resources/assets/buildcraftcompat/lang/ru_RU.lang +++ /dev/null @@ -1,25 +0,0 @@ -#################### -# APIARIST'S PIPE -#################### - -item.buildcraftPipe.pipeitemspropolis.name=Труба пчеловода - -for.gui.pipe.filter.anything=Всё -for.gui.pipe.filter.bee=Любые пчелы -for.gui.pipe.filter.cave=Пещерные -for.gui.pipe.filter.closed=Закрыт -for.gui.pipe.filter.drone=Трутни -for.gui.pipe.filter.flyer=Летуны -for.gui.pipe.filter.item=Предметы -for.gui.pipe.filter.natural=Естественного происх. -for.gui.pipe.filter.nocturnal=Ночные -for.gui.pipe.filter.princess=Принцессы -for.gui.pipe.filter.pure_breed=Чистопородные -for.gui.pipe.filter.pure_cave=Породистые пещерные -for.gui.pipe.filter.pure_flyer=Породистые летуны -for.gui.pipe.filter.pure_nocturnal=Породистые ночные -for.gui.pipe.filter.queen=Матки - -gate.trigger.mfr.backstuffed=Есть предметы -gate.trigger.mfr.conreversed=Конвейер реверсирован -gate.trigger.mfr.conrunning=Конвейер работает \ No newline at end of file diff --git a/resources/assets/buildcraftcompat/lang/ru_ru.json b/resources/assets/buildcraftcompat/lang/ru_ru.json new file mode 100644 index 0000000..1be6465 --- /dev/null +++ b/resources/assets/buildcraftcompat/lang/ru_ru.json @@ -0,0 +1,29 @@ +{ + //################### + // APIARIST'S PIPE + //################### + + "item.buildcraftPipe.pipeitemspropolis.name": "Труба пчеловода", + + "for.gui.pipe.filter.anything": "Всё", + "for.gui.pipe.filter.bee": "Любые пчелы", + "for.gui.pipe.filter.cave": "Пещерные", + "for.gui.pipe.filter.closed": "Закрыт", + "for.gui.pipe.filter.drone": "Трутни", + "for.gui.pipe.filter.flyer": "Летуны", + "for.gui.pipe.filter.item": "Предметы", + "for.gui.pipe.filter.natural": "Естественного происх.", + "for.gui.pipe.filter.nocturnal": "Ночные", + "for.gui.pipe.filter.princess": "Принцессы", + "for.gui.pipe.filter.pure_breed": "Чистопородные", + "for.gui.pipe.filter.pure_cave": "Породистые пещерные", + "for.gui.pipe.filter.pure_flyer": "Породистые летуны", + "for.gui.pipe.filter.pure_nocturnal": "Породистые ночные", + "for.gui.pipe.filter.queen": "Матки", + + "gate.trigger.mfr.backstuffed": "Есть предметы", + "gate.trigger.mfr.conreversed": "Конвейер реверсирован", + "gate.trigger.mfr.conrunning": "Конвейер работает", + + "null": "=w=" +} diff --git a/resources/assets/buildcraftcompat/lang/uk_UA.lang b/resources/assets/buildcraftcompat/lang/uk_UA.lang deleted file mode 100644 index 711c823..0000000 --- a/resources/assets/buildcraftcompat/lang/uk_UA.lang +++ /dev/null @@ -1,20 +0,0 @@ -#################### -# APIARIST'S PIPE -#################### - -item.buildcraftPipe.pipeitemspropolis.name=Труба пчеловода - -for.gui.pipe.filter.anything=Всё -for.gui.pipe.filter.bee=Любые пчелы -for.gui.pipe.filter.cave=Пещерные -for.gui.pipe.filter.closed=Закрыт -for.gui.pipe.filter.drone=Трутни -for.gui.pipe.filter.flyer=Летуны -for.gui.pipe.filter.item=Предметы -for.gui.pipe.filter.nocturnal=Ночные -for.gui.pipe.filter.princess=Принцессы -for.gui.pipe.filter.pure_breed=Чистопородные -for.gui.pipe.filter.pure_cave=Породистые пещерные -for.gui.pipe.filter.pure_flyer=Породистые летуны -for.gui.pipe.filter.pure_nocturnal=Породистые ночные -for.gui.pipe.filter.queen=Королевы diff --git a/resources/assets/buildcraftcompat/lang/uk_ua.json b/resources/assets/buildcraftcompat/lang/uk_ua.json new file mode 100644 index 0000000..da44267 --- /dev/null +++ b/resources/assets/buildcraftcompat/lang/uk_ua.json @@ -0,0 +1,24 @@ +{ + //################### + // APIARIST'S PIPE + //################### + + "item.buildcraftPipe.pipeitemspropolis.name": "Труба пчеловода", + + "for.gui.pipe.filter.anything": "Всё", + "for.gui.pipe.filter.bee": "Любые пчелы", + "for.gui.pipe.filter.cave": "Пещерные", + "for.gui.pipe.filter.closed": "Закрыт", + "for.gui.pipe.filter.drone": "Трутни", + "for.gui.pipe.filter.flyer": "Летуны", + "for.gui.pipe.filter.item": "Предметы", + "for.gui.pipe.filter.nocturnal": "Ночные", + "for.gui.pipe.filter.princess": "Принцессы", + "for.gui.pipe.filter.pure_breed": "Чистопородные", + "for.gui.pipe.filter.pure_cave": "Породистые пещерные", + "for.gui.pipe.filter.pure_flyer": "Породистые летуны", + "for.gui.pipe.filter.pure_nocturnal": "Породистые ночные", + "for.gui.pipe.filter.queen": "Королевы", + + "null": "=w=" +} diff --git a/resources/assets/buildcraftcompat/lang/zh_CN.lang b/resources/assets/buildcraftcompat/lang/zh_CN.lang deleted file mode 100644 index e9f5aff..0000000 --- a/resources/assets/buildcraftcompat/lang/zh_CN.lang +++ /dev/null @@ -1,20 +0,0 @@ -#################### -# APIARIST'S PIPE -#################### - -item.buildcraftPipe.pipeitemspropolis.name=养蜂员管道 - -for.gui.pipe.filter.anything=任意物品 -for.gui.pipe.filter.bee=任意蜜蜂 -for.gui.pipe.filter.cave=穴居蜂 -for.gui.pipe.filter.closed=已关闭 -for.gui.pipe.filter.drone=雄蜂 -for.gui.pipe.filter.flyer=强壮飞蜂 -for.gui.pipe.filter.item=物品 -for.gui.pipe.filter.nocturnal=夜行蜜蜂 -for.gui.pipe.filter.princess=公主蜂 -for.gui.pipe.filter.pure_breed=纯种蜜蜂 -for.gui.pipe.filter.pure_cave=纯种穴居蜂 -for.gui.pipe.filter.pure_flyer=纯种飞蜂 -for.gui.pipe.filter.pure_nocturnal=纯种夜行蜜蜂 -for.gui.pipe.filter.queen=蜂后 diff --git a/resources/assets/buildcraftcompat/lang/zh_cn.json b/resources/assets/buildcraftcompat/lang/zh_cn.json new file mode 100644 index 0000000..9bf01fe --- /dev/null +++ b/resources/assets/buildcraftcompat/lang/zh_cn.json @@ -0,0 +1,40 @@ +{ + //################### + // APIARIST'S PIPE + //################### + + "item.buildcraftPipe.pipeitemspropolis.name": "养蜂员管道", + + "for.gui.pipe.filter.anything": "任意物品", + "for.gui.pipe.filter.bee": "任意蜜蜂", + "for.gui.pipe.filter.cave": "穴居蜂", + "for.gui.pipe.filter.closed": "已关闭", + "for.gui.pipe.filter.drone": "雄蜂", + "for.gui.pipe.filter.flyer": "强壮飞蜂", + "for.gui.pipe.filter.item": "物品", + "for.gui.pipe.filter.nocturnal": "夜行蜜蜂", + "for.gui.pipe.filter.princess": "公主蜂", + "for.gui.pipe.filter.pure_breed": "纯种蜜蜂", + "for.gui.pipe.filter.pure_cave": "纯种穴居蜂", + "for.gui.pipe.filter.pure_flyer": "纯种飞蜂", + "for.gui.pipe.filter.pure_nocturnal": "纯种夜行蜜蜂", + "for.gui.pipe.filter.queen": "蜂后", + + // Calen 1.18.2 + // JEI + "buildcraft.jei.title.heatable_fluids": "加热流体", + "buildcraft.jei.title.coolable_fluids": "冷却流体", + "buildcraft.jei.title.distillable_fluids": "蒸馏", + "buildcraft.jei.title.combustion_engine_fuels": "燃油引擎燃料", + "buildcraft.jei.title.combustion_engine_fuels.burn_time": "燃烧时间 %ds", + "buildcraft.jei.title.combustion_engine_fuels.burn_speed": " 产能速率 %s MJ/t", + "buildcraft.jei.title.combustion_engine_fuels.burn_total": " 产能总计 %s MJ", + + // Waila + "buildcraft.waila.crafting": "§f正在合成: ", + "buildcraft.waila.no_recipe": "§7当前没有配方正在合成", + "buildcraft.waila.crafting_from": "§f使用: ", + "buildcraft.waila.waiting_for_laser": "§f还需要能量: §b%s MJ", + + "null": "=w=" +} diff --git a/resources/mcmod.info b/resources/mcmod.info deleted file mode 100644 index 4b57663..0000000 --- a/resources/mcmod.info +++ /dev/null @@ -1,16 +0,0 @@ -[{ - "modid": "buildcraftcompat", - "name": "BuildCraft Compat", - "version": "$version", - "mcversion": "$mcversion", - "description": "Compatibility add-on for BuildCraft", - "credits": "Created by asie", - "url": "http://www.mod-buildcraft.com/", - "updateUrl": "", - "authorList": [ "BuildCraft Team" ], - "parent":"buildcraftcore", - "screenshots": [], - "dependencies": [ - "mod_MinecraftForge" - ] -}]