diff --git a/.gitignore b/.gitignore index 5e19125..f73156f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,26 +1,44 @@ -#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 #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..c1278a7 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.16.5 diff --git a/BuildCraft b/BuildCraft index 656b0a0..75c0b79 160000 --- a/BuildCraft +++ b/BuildCraft @@ -1 +1 @@ -Subproject commit 656b0a00a04bf61ebd9f39f6c3e44eac2818b1ec +Subproject commit 75c0b79cdd5695f35484378afd8bb12777c3296a diff --git a/build.gradle b/build.gradle index 95cf589..37b9863 100755 --- a/build.gradle +++ b/build.gradle @@ -1,31 +1,20 @@ -// DON'T TOUCH THE BUILDSCRIPT[] BLOCK -// its special, and it is only there to make ForgeGradle work correctly. - buildscript { repositories { + maven { url = 'https://maven.minecraftforge.net' } 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 + + classpath 'org.spongepowered:mixingradle:0.7.+' + classpath 'javax.vecmath:vecmath:1.5.2' } } -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" +apply plugin: 'net.minecraftforge.gradle' +// Only edit below this line, the above code adds and enables the necessary things for Forge to be setup. +apply plugin: 'eclipse' +apply plugin: 'maven-publish' ext.configFile = file "build.properties" configFile.withReader { @@ -40,268 +29,298 @@ configFile.withReader { } version = config.compat_version +// version = config.compat_version + "-" + new Date().format("yyyy-MM-dd'T'HH-mm-ssZ") 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}" - - // 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. - - // HWYLA - compileOnly "mcp.mobius.waila:Hwyla:${config.hwyla_version}:api" - runtime "mcp.mobius.waila:Hwyla:${config.hwyla_version}" - - // Forestry - deobfCompile "net.sengir.forestry:forestry_${config.mc_version}:${config.forestry_version}" - - deobfCompile "net.industrial-craft:industrialcraft-2:${config.ic2_version}" - - // CraftTweaker - deobfCompile "CraftTweaker2:CraftTweaker2-API:${config.crafttweaker_version}" - deobfCompile "CraftTweaker2:CraftTweaker2-MC1120-Main:1.12-${config.crafttweaker_version}" -} +java.toolchain.languageVersion = JavaLanguageVersion.of(8) // Mojang ships Java 8 to end users, so your mod should target Java 8. +println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) 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; - } - - 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) - } - } else { - if (addVersionDetails) { - project.version += "-SNAPSHOT" - } - } - + // The mappings can be changed at any time, and must be in the following format. + // Channel: Version: + // snapshot YYYYMMDD Snapshot are built nightly. + // stable # Stables are built at the discretion of the MCP team. + // official MCVersion Official field/method names from Mojang mapping files + // + // You must be aware of the Mojang license when using the 'official' mappings. + // See more information here: https://github.com/MinecraftForge/MCPConfig/blob/master/Mojang.md + // + // 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.16.5' // makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable. - // 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 - - useDepAts = true -} - -compileJava { - options.compilerArgs << "-Xmaxerrs" << "2000" - options.compilerArgs << "-Xmaxwarns" << "2" - options.compilerArgs << "-Xlint:all" - options.compilerArgs << "-Xdiags:verbose" - options.compilerArgs << "-encoding" << "UTF-8" -} + accessTransformer = file('BuildCraft/buildcraft_resources/META-INF/accesstransformer.cfg') + + // 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 changed as needed. + // "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' + + mods { + buildcraftcore { + source sourceSets.main + } + } + } -javadoc { - options.setUse(true) - options.addStringsOption("Xmaxerrs").setValue(["2000"]) - options.addStringsOption("Xmaxwarns").setValue(["2000"]) - options.addStringsOption("Xdoclint:all") - options.setEncoding("UTF-8") -} + server { + workingDirectory project.file('run_server') + + // Recommended logging data for a userdev environment + // The markers can be changed as needed. + // "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' + + mods { + buildcraftcore { + source sourceSets.main + } + } + } -task setupSubProjects(dependsOn: "BuildCraft:sub_projects:expression:generateSources") { - // Just an inter-dependency task + data { + workingDirectory project.file('run') + + // Recommended logging data for a userdev environment + // The markers can be changed as needed. + // "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' + + // 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('BuildCraft/buildcraft_resources_generated/'), '--existing', file('BuildCraft/buildcraft_resources/') + + 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 + // 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' +repositories { + // Put repositories for dependencies here + // ForgeGradle automatically adds the Forge maven and Maven Central for you - // replace version and mcversion - // ${version} and ${mcversion} are the exact strings being replaced - expand 'version': project.version, 'mcversion': project.minecraft.version, 'modid': config.modid + // If you have mod jar dependencies in ./libs, you can declare them as a repository like so: + flatDir { + dir 'libs' } - // copy everything else, that's not the mcmod.info - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' - exclude 'pack.mcmeta' - exclude 'pack.png' + maven { + name 'prog' + url 'https://dvs1.progwml6.com/files/maven' + content { + includeGroup 'mezz.jei' + } } -} - -def createAllModInfo() { - return new File("$projectDir/build/processing/compat-all/mcmod.info") -} - -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]; + 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 { + name 'CraftTweaker' + url "https://maven.blamejared.com" + content { + includeGroup 'com.blamejared.crafttweaker' + } + } + // TOP + maven { + name 'tterrag' + url 'https://maven.tterrag.com/' + content { + includeGroup 'mcjty.theoneprobe' + includeGroup 'team.chisel.ctm' } - 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 } +// maven { +// name 'tterrag maven' +// url "https://maven.tterrag.com/" +// } } -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 modulesDir = new File(libsDir, "modules") +dependencies { + // Specify the version of Minecraft to use, If this is any group other then 'net.minecraft' it is assumed + // that the dep is a ForgeGradle 'patcher' dependency. And it's 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.16.5-36.2.34' -// 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 -} + // Examples using mod jars from ./libs -task compatJar(type: Jar, dependsOn:reobfJar) { - destinationDir = modulesDir - appendix = "compat" - version = project.version + 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) - from(project.ext.jarFile) { - includes.addAll("**") - } -} + compileOnly fg.deobf("curse.maven:jade-324717:3467445") + runtimeOnly fg.deobf("curse.maven:jade-324717:3467445") + +// compileOnly fg.deobf("blank:ae2-${mc_version}:11.7.6") +// runtimeOnly fg.deobf("blank:ae2-${mc_version}:11.7.6") -task allJar(type: Jar, dependsOn: [reobfJar, writeAllModInfo]) { - destinationDir = libsDir - appendix = "all" - version = project.version + compileOnly fg.deobf("com.blamejared.crafttweaker:CraftTweaker-1.16.5:7.1.2.479") + runtimeOnly fg.deobf("com.blamejared.crafttweaker:CraftTweaker-1.16.5:7.1.2.479") - from(createAllModInfo().parentFile) - from(project.ext.jarFile) { - includes.addAll("**") - exclude("mcmod.info") + compileOnly fg.deobf("mcjty.theoneprobe:TheOneProbe-1.16:1.16-3.1.4-22:api") + runtimeOnly fg.deobf("mcjty.theoneprobe:TheOneProbe-1.16:1.16-3.1.4-22") + +// runtimeOnly fg.deobf("net.sengir.forestry:forestry_${minecraft_version}:${forestry_version}") +// runtimeOnly fg.deobf("net.sengir.forestry:forestry_${minecraft_version}:${forestry_version}") + + compileOnly("javax.vecmath:vecmath:1.5.2") + runtimeOnly("javax.vecmath:vecmath:1.5.2") + compileOnly("net.sf.trove4j:trove4j:3.0.3") + runtimeOnly("net.sf.trove4j:trove4j:3.0.3") + + jarJar(group: 'net.sf.trove4j', name: 'trove4j', version: '[3.0.3,)') { + jarJar.pin(it, '3.0.3') + } + jarJar(group: 'javax.vecmath', name: 'vecmath', version: '[1.5.2,)') { + jarJar.pin(it, '1.5.2') } -} -task allSrcJar(type: Jar, dependsOn:[reobfJar, writeAllModInfo, unzipSourceJar]) { - destinationDir = libsDir - appendix = "all" - classifier = "sources" + // Testing + testImplementation "junit:junit:4.12" + testImplementation 'org.hamcrest:hamcrest:2.2' +// compileOnly "junit:junit:4.12" - from(createAllModInfo().parentFile) - from(unzippedSourceJar) { - includes.add("**") - exclude("mcmod.info") + annotationProcessor 'org.spongepowered:mixin:0.8.5:processor' +} + +// Example for how to get properties into the manifest for reading by the 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 task +// 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 +jar.enabled = true - artifact allSrcJar - } - } +// enable Jar-in-Jar +jarJar.enable() + +tasks.named('jarJar') { + // ... } diff --git a/build.properties b/build.properties index 66c247b..57783a3 100644 --- a/build.properties +++ b/build.properties @@ -1,8 +1,25 @@ -compat_version=7.99.15 +# mc_version=1.12.2 +mc_version=1.16.5 +# forge_version=14.23.0.2544 +forge_version=36.2.34 +# mappings_version=snapshot_20171120 +mappings_channel=official +mappings_version=1.16.5 +# mod_version=7.99.24.8 +mod_version=7.99.24.9 +#compat_version=7.99.15 +compat_version=7.99.24.9 + +#jei_version=4.8.5.138 +jei_version=7.8.0.1011 +#top_version=1.12-1.4.19-11 +top_version=1.16-3.0.8-14 +#hwyla_version=1.8.22-B37_1.12 + +jade_api_id=3803228 +jade_id=3803226 -jei_version=4.8.5.138 -top_version=1.12-1.4.19-11 -hwyla_version=1.8.22-B37_1.12 forestry_version=5.7.0.236 -crafttweaker_version=4.1.9.491 +#crafttweaker_version=4.1.9.491 +crafttweaker_version=7.1.2.527 ic2_version=2.8.221-ex112 diff --git a/common/buildcraft/compat/BCCompat.java b/common/buildcraft/compat/BCCompat.java index 72fdbaa..ef00fd9 100644 --- a/common/buildcraft/compat/BCCompat.java +++ b/common/buildcraft/compat/BCCompat.java @@ -1,53 +1,48 @@ -/* - * 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.BCModules; 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; +import buildcraft.lib.config.BCConfig; +import buildcraft.lib.config.Configuration; +import buildcraft.lib.config.EnumRestartRequirement; +import net.minecraftforge.common.ForgeConfigSpec; +import net.minecraftforge.common.ForgeConfigSpec.BooleanValue; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.fml.ModContainer; +import net.minecraftforge.fml.ModList; +import net.minecraftforge.fml.common.Mod; +import net.minecraftforge.fml.config.ModConfig; +import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; +import net.minecraftforge.fml.event.lifecycle.FMLConstructModEvent; +import net.minecraftforge.fml.event.lifecycle.FMLLoadCompleteEvent; -//@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 java.util.HashMap; +import java.util.Map; +//@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,30 +50,48 @@ 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 static Configuration config; + + 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)) { - modules.put(cModId, module); - BCLog.logger.info("[compat] + " + cModId); - module.preInit(); - } else { - BCLog.logger.info("[compat] x " + cModId + " (It has been disabled in the config)"); - } + String _modules = "modules"; + BooleanValue prop = config + .define(_modules, + "", + EnumRestartRequirement.NONE, + cModId, true); + modules.put(cModId, module); + moduleConfigs.put(cModId, prop); +// if (prop.get()) { +// modules.put(cModId, module); +// BCLog.logger.info("[compat] + " + cModId); +// module.preInit(); +// } else { +// BCLog.logger.info("[compat] x " + cModId + " (It has been disabled in the config)"); +// } } else { BCLog.logger.info("[compat] x " + cModId + " (It cannot load)"); } } - @Mod.EventHandler - public static void preInit(final FMLPreInitializationEvent evt) { + @SubscribeEvent + public static void preInit(FMLConstructModEvent evt) { + // Start config + BCModules module = BCModules.COMPAT; + ForgeConfigSpec.Builder builder = new ForgeConfigSpec.Builder(); + config = new Configuration(builder, module); + // init BCLog.logger.info(""); BCLog.logger.info("Starting BuildCraftCompat " + VERSION); BCLog.logger.info("Copyright (c) the BuildCraft team, 2011-2017"); @@ -94,54 +107,48 @@ 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); + // Finalize config + ForgeConfigSpec spec = config.build(); + ModContainer container = ModList.get().getModContainerById(module.getModId()).get(); + container.addConfig(new ModConfig(ModConfig.Type.COMMON, spec, container, config.getFileName())); + } - // 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(); } } - - // @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); - // } } 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..d103182 100644 --- a/common/buildcraft/compat/CompatUtils.java +++ b/common/buildcraft/compat/CompatUtils.java @@ -1,29 +1,22 @@ package buildcraft.compat; -import java.util.List; - +import buildcraft.api.core.CapabilitiesHelper; +import buildcraft.compat.network.IGuiCreator; +import buildcraft.lib.tile.item.ItemHandlerSimple; import com.google.common.collect.Lists; - import net.minecraft.item.ItemStack; - import net.minecraftforge.common.capabilities.Capability; -import buildcraft.api.core.CapabilitiesHelper; - -import buildcraft.lib.tile.item.ItemHandlerSimple; - -import buildcraft.compat.network.IGuiCreator; +import java.util.List; public class CompatUtils { + public static Capability CAP_GUI_CREATOR; - 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 +25,7 @@ public static List compactInventory(ItemHandlerSimple inventory) { boolean handled = false; for (ItemStack existing : stacks) { - if (existing.isItemEqual(stack)) { + if (existing.sameItem(stack)) { existing.grow(stack.getCount()); handled = true; break; @@ -45,4 +38,8 @@ public static List compactInventory(ItemHandlerSimple inventory) { return stacks; } + + public static void regCaps() { + CAP_GUI_CREATOR = CapabilitiesHelper.registerCapability(IGuiCreator.class); + } } diff --git a/common/buildcraft/compat/module/crafttweaker/AssemblyTable.java b/common/buildcraft/compat/module/crafttweaker/AssemblyTable.java index a06e22c..8d2eb9c 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 buildcraft.api.mj.MjAPI; +import buildcraft.api.recipes.IAssemblyRecipe; +import buildcraft.api.recipes.IngredientStack; +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.annotations.ZenRegister; +import com.blamejared.crafttweaker.api.item.IIngredient; +import com.blamejared.crafttweaker.api.item.IItemStack; +import com.blamejared.crafttweaker.api.managers.IRecipeManager; +import com.blamejared.crafttweaker.api.recipes.IRecipeHandler; +import com.blamejared.crafttweaker.api.util.StringUtils; +import com.blamejared.crafttweaker.impl.actions.recipes.ActionAddRecipe; +import com.blamejared.crafttweaker.impl.actions.recipes.ActionRemoveRecipeByName; +import com.blamejared.crafttweaker.impl.helper.ItemStackHelper; import com.google.common.collect.ImmutableSet; -import com.google.common.collect.ImmutableSet.Builder; - +import com.google.common.collect.Lists; import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.IRecipeType; import net.minecraft.item.crafting.Ingredient; import net.minecraft.util.ResourceLocation; +import org.openzen.zencode.java.ZenCodeGlobals; +import org.openzen.zencode.java.ZenCodeType; -import buildcraft.api.mj.MjAPI; -import buildcraft.api.recipes.AssemblyRecipeBasic; -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; +import java.util.stream.Collectors; -@ZenClass("mods.buildcraft.AssemblyTable") -@ModOnly("buildcraftsilicon") -public class AssemblyTable { +//@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 + // 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 IRecipeType 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);", + StringUtils.quoteAndEscape(recipe.getId()), + ItemStackHelper.getCommandString(Lists.newArrayList(recipe.getOutputPreviews()).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, name); + 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, Lists.newArrayList(ctIng.getItems()).stream().findAny().map(IItemStack::getAmount).orElse(1)))); + } + + 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 " + Lists.newArrayList(((IAssemblyRecipe) this.recipe).getOutputPreviews()).get(0); } } } diff --git a/common/buildcraft/compat/module/crafttweaker/CombustionEngine.java b/common/buildcraft/compat/module/crafttweaker/CombustionEngine.java index f1cb66a..2a60ddb 100644 --- a/common/buildcraft/compat/module/crafttweaker/CombustionEngine.java +++ b/common/buildcraft/compat/module/crafttweaker/CombustionEngine.java @@ -1,153 +1,199 @@ 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.annotations.ZenRegister; +import com.blamejared.crafttweaker.api.fluid.IFluidStack; +import com.blamejared.crafttweaker.api.managers.IRecipeManager; +import com.blamejared.crafttweaker.api.recipes.IRecipeHandler; +import com.blamejared.crafttweaker.api.util.StringUtils; +import com.blamejared.crafttweaker.impl.actions.recipes.ActionAddRecipe; +import net.minecraft.fluid.EmptyFluid; +import net.minecraft.item.crafting.IRecipeType; +import net.minecraft.util.ResourceLocation; +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 -> ((IFuel) r.getRecipe()).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.getRecipe() instanceof IFluidCoolant && ((IFluidCoolant) r.getRecipe()).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 -> ((IFuel) r.getRecipe()).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.getRecipe() instanceof IFluidCoolant && ((IFluidCoolant) r.getRecipe()).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 IRecipeType getRecipeType() { + return IFuel.TYPE; + } - static final class AddCleanFuel implements IAction { + @Override + public String dumpToCommandString(final IRecipeManager manager, IFuel recipe) { + if (recipe instanceof IFuelManager.IDirtyFuel) { + IFuelManager.IDirtyFuel dirtyFuel = (IFuelManager.IDirtyFuel) recipe; + return String.format( + "combustionEngine.addDirtyFuel(%s, %s, %s, %s, %s);", + StringUtils.quoteAndEscape(recipe.getId()), + StringUtils.quoteAndEscape(recipe.getFluid().getFluid().getRegistryName()), + recipe.getPowerPerCycle(), + recipe.getTotalBurningTime(), + StringUtils.quoteAndEscape(dirtyFuel.getResidue().getFluid().getRegistryName()) + ); + } else { + return String.format( + "combustionEngine.addCleanFuel(%s, %s, %s, %s);", + StringUtils.quoteAndEscape(recipe.getId()), + StringUtils.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 " + ((IFuel) 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 " + ((IFuel) 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..972b3a9 --- /dev/null +++ b/common/buildcraft/compat/module/crafttweaker/Coolant.java @@ -0,0 +1,132 @@ +package buildcraft.compat.module.crafttweaker; + +import buildcraft.api.fuels.ICoolant; +import buildcraft.api.fuels.IFluidCoolant; +import buildcraft.api.fuels.IFuel; +import buildcraft.api.fuels.ISolidCoolant; +import buildcraft.lib.recipe.coolant.CoolantRegistry; +import com.blamejared.crafttweaker.api.CraftTweakerAPI; +import com.blamejared.crafttweaker.api.annotations.ZenRegister; +import com.blamejared.crafttweaker.api.fluid.IFluidStack; +import com.blamejared.crafttweaker.api.item.IItemStack; +import com.blamejared.crafttweaker.api.managers.IRecipeManager; +import com.blamejared.crafttweaker.api.recipes.IRecipeHandler; +import com.blamejared.crafttweaker.api.util.StringUtils; +import com.blamejared.crafttweaker.impl.actions.recipes.ActionAddRecipe; +import com.blamejared.crafttweaker.impl.helper.ItemStackHelper; +import net.minecraft.fluid.EmptyFluid; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; +import net.minecraft.item.crafting.IRecipeType; +import net.minecraft.util.ResourceLocation; +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.getRecipe() instanceof IFluidCoolant && ((IFluidCoolant) r.getRecipe()).getFluid().equals(fluid))) { + throw new IllegalArgumentException("The fluid " + fluid + " is already registered as a coolant!"); + } else if (CombustionEngine.INSTANCE.getAllRecipes().stream().anyMatch(r -> ((IFuel) r.getRecipe()).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.getRecipe() instanceof ISolidCoolant && ((ISolidCoolant) r.getRecipe()).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 IRecipeType getRecipeType() { + return ICoolant.TYPE; + } + + @Override + public String dumpToCommandString(final IRecipeManager manager, ICoolant recipe) { + if (recipe instanceof IFluidCoolant) { + IFluidCoolant fluidCoolant = (IFluidCoolant) recipe; + return String.format( + "coolant.addFluidCoolant(%s, %s, %s);", + StringUtils.quoteAndEscape(recipe.getId()), + StringUtils.quoteAndEscape(recipe.getFluid().getFluid().getRegistryName()), + fluidCoolant.getDegreesCoolingPerMB() + ); + } else if (recipe instanceof ISolidCoolant) { + ISolidCoolant solidCoolant = (ISolidCoolant) recipe; + return String.format( + "coolant.addSolidCoolant(%s, %s, %s, %s);", + StringUtils.quoteAndEscape(recipe.getId()), + ItemStackHelper.getCommandString(solidCoolant.getSolid()), + StringUtils.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 " + ((ICoolant) 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..a44157d 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.item.Item; +import net.minecraft.util.ResourceLocation; +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..9f286aa 100644 --- a/common/buildcraft/compat/module/jei/BCPluginJEI.java +++ b/common/buildcraft/compat/module/jei/BCPluginJEI.java @@ -1,150 +1,201 @@ 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.IRefineryRecipeManager; - -import buildcraft.lib.fluid.FuelRegistry; -import buildcraft.lib.recipe.AssemblyRecipeRegistry; - 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.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.silicon.BCSiliconBlocks; import buildcraft.silicon.container.ContainerAssemblyTable; - -import mezz.jei.api.IGuiHelper; +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.VanillaRecipeCategoryUid; +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.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraftforge.fml.ModList; -@JEIPlugin +import java.util.Arrays; +import java.util.List; + +@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(ImmutableList.copyOf(Minecraft.getInstance().level.getRecipeManager().getAllRecipesFor(IRefineryRecipeManager.ICoolableRecipe.TYPE)), CategoryCoolable.UID); +// registry.addRecipes(ImmutableList.copyOf(BuildcraftRecipeRegistry.refineryRecipes.getDistillationRegistry().getAllRecipes()), new ResourceLocation("buildcraft:category_distiller")); + registry.addRecipes(ImmutableList.copyOf(Minecraft.getInstance().level.getRecipeManager().getAllRecipesFor(IRefineryRecipeManager.IDistillationRecipe.TYPE)), CategoryDistiller.UID); +// registry.addRecipes(ImmutableList.copyOf(BuildcraftRecipeRegistry.refineryRecipes.getHeatableRegistry().getAllRecipes()), new ResourceLocation("buildcraft:category_heatable")); + registry.addRecipes(ImmutableList.copyOf(Minecraft.getInstance().level.getRecipeManager().getAllRecipesFor(IRefineryRecipeManager.IHeatableRecipe.TYPE)), CategoryHeatable.UID); } + 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(ImmutableList.copyOf(Minecraft.getInstance().level.getRecipeManager().getAllRecipesFor(IFuel.TYPE)), CategoryCombustionEngine.UID); } - 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(ImmutableList.copyOf(Minecraft.getInstance().level.getRecipeManager().getAllRecipesFor(AssemblyRecipe.TYPE)), CategoryAssemblyTable.UID); } + } - 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(), VanillaRecipeCategoryUid.CRAFTING); +// registry.addRecipeTransferHandler(new AdvancedCraftingItemsTransferHandler(), "minecraft.crafting"); + registry.addRecipeTransferHandler(new AdvancedCraftingItemsTransferHandler(), VanillaRecipeCategoryUid.CRAFTING); +// registry.addRecipeTransferHandler(ContainerAssemblyTable.class, "buildcraft-compat:silicon.assembly", 36, 12, 0, 36); + registry.addRecipeTransferHandler(ContainerAssemblyTable.class, CategoryAssemblyTable.UID, 36, 12, 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)) }); } 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.UID); + } + + if (BCFactoryBlocks.heatExchange != null) { +// registry.addRecipeCatalyst(new ItemStack(BCFactoryBlocks.heatExchange.get()), new String[]{"buildcraft:category_coolable"}); + registry.addRecipeCatalyst(new ItemStack(BCFactoryBlocks.heatExchange.get()), CategoryCoolable.UID); +// registry.addRecipeCatalyst(new ItemStack(BCFactoryBlocks.heatExchange.get()), new String[]{"buildcraft:category_heatable"}); + registry.addRecipeCatalyst(new ItemStack(BCFactoryBlocks.heatExchange.get()), CategoryHeatable.UID); + } + + if (BCFactoryBlocks.autoWorkbenchItems != null) { + registry.addRecipeCatalyst(new ItemStack(BCFactoryBlocks.autoWorkbenchItems.get()), VanillaRecipeCategoryUid.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()), VanillaRecipeCategoryUid.FUEL); + } + +// 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.UID); + } + } + } + + 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.UID); + } + + if (BCSiliconBlocks.advancedCraftingTable != null) { +// registry.addRecipeCatalyst(new ItemStack(BCSiliconBlocks.advancedCraftingTable.get()), new String[]{"minecraft.crafting"}); + registry.addRecipeCatalyst(new ItemStack(BCSiliconBlocks.advancedCraftingTable.get()), VanillaRecipeCategoryUid.CRAFTING); + } + } + } + + @Override + public void onRuntimeAvailable(IJeiRuntime jeiRuntime) { + BCPluginJEI.jeiRuntime = jeiRuntime; + } } diff --git a/common/buildcraft/compat/module/jei/energy/combustionengine/CategoryCombustionEngine.java b/common/buildcraft/compat/module/jei/energy/combustionengine/CategoryCombustionEngine.java index 323ec89..9170081 100644 --- a/common/buildcraft/compat/module/jei/energy/combustionengine/CategoryCombustionEngine.java +++ b/common/buildcraft/compat/module/jei/energy/combustionengine/CategoryCombustionEngine.java @@ -1,40 +1,87 @@ 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 buildcraft.api.fuels.IFuel; +import buildcraft.api.fuels.IFuelManager; +import buildcraft.api.fuels.IFuelManager.IDirtyFuel; +import buildcraft.api.mj.MjAPI; +import buildcraft.energy.BCEnergyBlocks; +import com.google.common.collect.Lists; +import com.mojang.blaze3d.matrix.MatrixStack; +import mezz.jei.api.constants.VanillaTypes; import mezz.jei.api.gui.IRecipeLayout; +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.IGuiFluidStackGroup; +import mezz.jei.api.helpers.IGuiHelper; import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.BlankRecipeCategory; +import mezz.jei.api.recipe.category.IRecipeCategory; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TranslationTextComponent; +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 { + // 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 FontRenderer 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(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 String getTitle() { +// return new TextComponent("Combustion Engine Fuels"); + return new TranslationTextComponent("buildcraft.jei.title.combustion_engine_fuels").getString(); + } + public String getModName() { return BCModules.ENERGY.name(); } @@ -45,27 +92,68 @@ 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)); + @Override + public void setIngredients(IFuel recipe, IIngredients ingredients) { + ingredients.setInput(VanillaTypes.FLUID, recipe.getFluid()); + if (recipe instanceof IDirtyFuel) { + ingredients.setOutput(VanillaTypes.FLUID, ((IDirtyFuel) recipe).getResidue()); + } + } + + // Calen + private int lastBurnTime = -1; - if (recipeWrapper instanceof WrapperCombustionEngine.Dirty) { -// WrapperCombustionEngine.Dirty dirty = (WrapperCombustionEngine.Dirty)recipeWrapper; + @Override + public void draw(IFuel fuel, MatrixStack 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 TranslationTextComponent("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 TranslationTextComponent("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 TranslationTextComponent("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(IRecipeLayout recipeLayout, IFuel fuel, IIngredients ingredients) { + IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks(); + guiFluidStacks.init(0, true, 1, 15, 16, 16, 1000, false, null); + guiFluidStacks.set(0, new FluidStack(fuel.getFluid(), 1000)); + if (fuel instanceof IFuelManager.IDirtyFuel) { + IFuelManager.IDirtyFuel dirtyFuel = (IFuelManager.IDirtyFuel) fuel; + // Calen: move right 20 to not covered the text +// guiFluidStacks.init(1, false, 95, 15, 16, 16, 1000, false, (IDrawable) null); + guiFluidStacks.init(1, false, 115, 15, 16, 16, 1000, false, (IDrawable) null); +// guiFluidStacks.set(1, (List) ingredients.getOutputs(FluidStack.class).get(0)); + guiFluidStacks.set(1, 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, double mouseX, double mouseY) { + return Lists.newArrayList(); + } + + @Override + public boolean handleClick(IFuel recipe, double mouseX, double mouseY, int mouseButton) { + 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..19274a6 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 mezz.jei.api.MethodsReturnNonnullByDefault; + import javax.annotation.ParametersAreNonnullByDefault; -import mcp.MethodsReturnNonnullByDefault; diff --git a/common/buildcraft/compat/module/jei/factory/CategoryCoolable.java b/common/buildcraft/compat/module/jei/factory/CategoryCoolable.java index 426d952..cc7ecbf 100644 --- a/common/buildcraft/compat/module/jei/factory/CategoryCoolable.java +++ b/common/buildcraft/compat/module/jei/factory/CategoryCoolable.java @@ -1,64 +1,125 @@ 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 buildcraft.api.recipes.IRefineryRecipeManager; +import buildcraft.api.recipes.IRefineryRecipeManager.ICoolableRecipe; +import buildcraft.factory.BCFactoryBlocks; +import buildcraft.lib.misc.StackUtil; +import com.google.common.collect.Lists; +import com.mojang.blaze3d.matrix.MatrixStack; +import mezz.jei.api.constants.VanillaTypes; import mezz.jei.api.gui.IRecipeLayout; +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.IGuiFluidStackGroup; +import mezz.jei.api.helpers.IGuiHelper; import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.BlankRecipeCategory; +import mezz.jei.api.recipe.category.IRecipeCategory; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TranslationTextComponent; + +import java.util.List; -public class CategoryCoolable extends BlankRecipeCategory { - public static final String UID = "buildcraft:category_coolable"; +//public class CategoryCoolable extends BlankRecipeCategory +public class CategoryCoolable implements IRecipeCategory { + 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(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 Class getRecipeClass() { + return IRefineryRecipeManager.ICoolableRecipe.class; + } + public String getTitle() { - return "Coolable Fluids"; +// return new TextComponent("Coolable Fluids"); + return new TranslationTextComponent("buildcraft.jei.title.coolable_fluids").getString(); } - @Override 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) { + public void setIngredients(ICoolableRecipe recipe, IIngredients ingredients) { + ingredients.setInput(VanillaTypes.FLUID, recipe.in()); + ingredients.setOutput(VanillaTypes.FLUID, recipe.out() == null ? StackUtil.EMPTY_FLUID : recipe.out()); + } + + @Override +// public void drawExtras(Minecraft minecraft) + public void draw(IRefineryRecipeManager.ICoolableRecipe recipe, MatrixStack 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); + } + + @Override +// public void setRecipe(IRecipeLayout recipeLayout, WrapperCoolable recipeWrapper, IIngredients ingredients) + public void setRecipe(IRecipeLayout recipeLayout, ICoolableRecipe recipe, IIngredients ingredients) { IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks(); +// guiFluidStacks.init(0, true, 1, 1, 16, 16, 10, false, (IDrawable) null); + guiFluidStacks.init(0, true, 1, 2, 16, 16, 10, false, (IDrawable) null); + guiFluidStacks.set(0, recipe.in()); +// guiFluidStacks.init(1, false, 73, 1, 16, 16, 10, false, (IDrawable) null); + guiFluidStacks.init(1, false, 73, 2, 16, 16, 10, false, (IDrawable) null); +// guiFluidStacks.set(1, (List) ingredients.getOutputs(FluidStack.class).get(0)); + guiFluidStacks.set(1, 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(ICoolableRecipe recipe, 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 handleClick(IRefineryRecipeManager.ICoolableRecipe recipe, double mouseX, double mouseY, int mouseButton) { + return false; } } diff --git a/common/buildcraft/compat/module/jei/factory/CategoryDistiller.java b/common/buildcraft/compat/module/jei/factory/CategoryDistiller.java index 64f4501..c70c16b 100644 --- a/common/buildcraft/compat/module/jei/factory/CategoryDistiller.java +++ b/common/buildcraft/compat/module/jei/factory/CategoryDistiller.java @@ -1,70 +1,130 @@ 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 buildcraft.api.mj.MjAPI; +import buildcraft.api.recipes.IRefineryRecipeManager; +import buildcraft.api.recipes.IRefineryRecipeManager.IDistillationRecipe; +import buildcraft.factory.BCFactoryBlocks; +import com.google.common.collect.Lists; +import com.mojang.blaze3d.matrix.MatrixStack; +import mezz.jei.api.constants.VanillaTypes; import mezz.jei.api.gui.IRecipeLayout; +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.IGuiFluidStackGroup; +import mezz.jei.api.helpers.IGuiHelper; import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.BlankRecipeCategory; +import mezz.jei.api.recipe.category.IRecipeCategory; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TranslationTextComponent; +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 static final String UID = "buildcraft:category_distiller"; +//public class CategoryDistiller extends BlankRecipeCategory +public class CategoryDistiller implements IRecipeCategory { + 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 IDrawable background, slot, fakeBackground; + private final IDrawableAnimated animated; - 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); + @OnlyIn(Dist.CLIENT) + private FontRenderer font = Minecraft.getInstance().font; + + 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(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 String getTitle() { +// return new TextComponent("Distillable Fluids"); + return new TranslationTextComponent("buildcraft.jei.title.distillable_fluids").getString(); + } + 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 setIngredients(IDistillationRecipe recipe, IIngredients ingredients) { + ingredients.setInput(VanillaTypes.FLUID, recipe.in()); + ingredients.setOutputs(VanillaTypes.FLUID, Lists.newArrayList(recipe.outGas(), recipe.outLiquid())); + } @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, MatrixStack 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(IRecipeLayout recipeLayout, IRefineryRecipeManager.IDistillationRecipe recipe, IIngredients ingredients) { + 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)); + guiFluidStacks.set(0, recipe.in()); + guiFluidStacks.init(1, false, 57, 1, 16, 16, 10, false, (IDrawable) null); +// guiFluidStacks.set(1, (List) ingredients.getOutputs(FluidStack.class).get(0)); + guiFluidStacks.set(1, recipe.outGas()); + guiFluidStacks.init(2, false, 57, 46, 16, 16, 10, false, (IDrawable) null); +// guiFluidStacks.set(2, (List) ingredients.getOutputs(FluidStack.class).get(1)); + guiFluidStacks.set(2, 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(IDistillationRecipe recipe, 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 handleClick(IRefineryRecipeManager.IDistillationRecipe recipe, double mouseX, double mouseY, int mouseButton) { + return false; } } diff --git a/common/buildcraft/compat/module/jei/factory/CategoryHeatable.java b/common/buildcraft/compat/module/jei/factory/CategoryHeatable.java index 75300fb..4b7d322 100644 --- a/common/buildcraft/compat/module/jei/factory/CategoryHeatable.java +++ b/common/buildcraft/compat/module/jei/factory/CategoryHeatable.java @@ -1,39 +1,76 @@ 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 buildcraft.api.recipes.IRefineryRecipeManager; +import buildcraft.api.recipes.IRefineryRecipeManager.IHeatableRecipe; +import buildcraft.factory.BCFactoryBlocks; +import buildcraft.lib.misc.StackUtil; +import com.google.common.collect.Lists; +import com.mojang.blaze3d.matrix.MatrixStack; +import mezz.jei.api.constants.VanillaTypes; import mezz.jei.api.gui.IRecipeLayout; +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.IGuiFluidStackGroup; +import mezz.jei.api.helpers.IGuiHelper; import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.BlankRecipeCategory; +import mezz.jei.api.recipe.category.IRecipeCategory; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; + +import java.util.List; -public class CategoryHeatable extends BlankRecipeCategory { - public static final String UID = "buildcraft:category_heatable"; +//public class CategoryHeatable extends BlankRecipeCategory +public class CategoryHeatable implements IRecipeCategory { + 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 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(); - 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); + this.icon = guiHelper.createDrawableIngredient(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 String getTitle() { +// return new TextComponent("Heatable Fluids"); + return new TranslationTextComponent("buildcraft.jei.title.heatable_fluids").getString(); + } + public String getModName() { return BCModules.FACTORY.name(); } @@ -44,22 +81,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) {} + @Override + public void setIngredients(IHeatableRecipe recipe, IIngredients ingredients) { + ingredients.setInput(VanillaTypes.FLUID, recipe.in()); + ingredients.setOutput(VanillaTypes.FLUID, recipe.out() == null ? StackUtil.EMPTY_FLUID : recipe.out()); + } + + @OnlyIn(Dist.CLIENT) + @Override +// public void drawExtras(Minecraft minecraft) + public void draw(IRefineryRecipeManager.IHeatableRecipe recipe, MatrixStack 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) { +// public void setRecipe(IRecipeLayout recipeLayout, WrapperHeatable recipeWrapper, IIngredients ingredients) + public void setRecipe(IRecipeLayout recipeLayout, IHeatableRecipe recipe, IIngredients ingredients) { IGuiFluidStackGroup guiFluidStacks = recipeLayout.getFluidStacks(); +// guiFluidStacks.init(0, true, 1, 1, 16, 16, 10, false, (IDrawable) null); + guiFluidStacks.init(0, true, 1, 2, 16, 16, 10, false, null); +// guiFluidStacks.set(0, (List) ingredients.getInputs(FluidStack.class).get(0)); + guiFluidStacks.set(0, recipe.in()); +// guiFluidStacks.init(1, false, 73, 1, 16, 16, 10, false, (IDrawable) null); + guiFluidStacks.init(1, false, 73, 2, 16, 16, 10, false, (IDrawable) null); +// guiFluidStacks.set(1, (List) ingredients.getOutputs(FluidStack.class).get(0)); + guiFluidStacks.set(1, 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(IHeatableRecipe recipe, 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 handleClick(IRefineryRecipeManager.IHeatableRecipe recipe, double mouseX, double mouseY, int mouseButton) { + 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..b208342 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 mezz.jei.api.MethodsReturnNonnullByDefault; + import javax.annotation.ParametersAreNonnullByDefault; -import mcp.MethodsReturnNonnullByDefault; 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..b96e850 --- /dev/null +++ b/common/buildcraft/compat/module/jei/gui/GuiHandlerBuildCraft.java @@ -0,0 +1,46 @@ +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.Rectangle2d; +import net.minecraft.util.math.MathHelper; + +import javax.annotation.Nonnull; +import java.util.ArrayList; +import java.util.List; + +public class GuiHandlerBuildCraft implements IGuiContainerHandler> { + @Nonnull + @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 endY = MathHelper.ceil(rect.getEndY()); + int width = endX - x; + int height = endY - y; + list.add(new Rectangle2d(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..98b7a67 100644 --- a/common/buildcraft/compat/module/jei/silicon/CategoryAssemblyTable.java +++ b/common/buildcraft/compat/module/jei/silicon/CategoryAssemblyTable.java @@ -1,68 +1,145 @@ package buildcraft.compat.module.jei.silicon; -import java.util.List; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; - import buildcraft.api.BCModules; - -import mezz.jei.api.IGuiHelper; -import mezz.jei.api.gui.IDrawable; -import mezz.jei.api.gui.IGuiItemStackGroup; +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.matrix.MatrixStack; +import mezz.jei.api.constants.VanillaTypes; import mezz.jei.api.gui.IRecipeLayout; +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.IGuiItemStackGroup; +import mezz.jei.api.helpers.IGuiHelper; import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.IRecipeCategory; +import mezz.jei.api.recipe.category.IRecipeCategory; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.Ingredient; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; -public class CategoryAssemblyTable implements IRecipeCategory { - public static final String UID = "buildcraft-compat:silicon.assembly"; +import java.awt.*; +import java.util.List; +import java.util.*; +import java.util.stream.Collectors; - protected final ResourceLocation backgroundLocation; +public class CategoryAssemblyTable implements IRecipeCategory { + // 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; - 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); + private final IDrawable icon; + + private final Map progressBarMap = new HashMap<>(); + private final Map> inputsMap = new HashMap<>(); + private final Map outputsMap = new HashMap<>(); + + @OnlyIn(Dist.CLIENT) + private FontRenderer font = Minecraft.getInstance().font; + + // 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(); + + this.icon = guiHelper.createDrawableIngredient(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())); + } + + 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 String getTitle() { +// return new TextComponent("Assembly Table"); + return new TranslationTextComponent("tile.assemblyTableBlock.name").getString(); + } + public String getModName() { return BCModules.SILICON.name(); } @Override public IDrawable getBackground() { - return background; + return this.background; + } + + @Override + public IDrawable getIcon() { + return this.icon; + } + + @Override + public void setIngredients(IAssemblyRecipe recipe, IIngredients ingredients) { + ingredients.setInputIngredients(recipe.getRequiredIngredientStacks().stream().map(is -> is.ingredient).collect(Collectors.toList())); + ingredients.setOutputs(VanillaTypes.ITEM, Lists.newArrayList(recipe.getOutput())); + } + + @OnlyIn(Dist.CLIENT) + @Override + public void draw(IAssemblyRecipe recipe, MatrixStack 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(IRecipeLayout recipeLayout, WrapperAssemblyTable recipeWrapper, IIngredients ingredients) + public void setRecipe(IRecipeLayout recipeLayout, IAssemblyRecipe recipe, 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); + List> inputs = ingredients.getInputs(VanillaTypes.ITEM); + // 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) { + 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); -// } } guiItemStacks.init(12, false, 110, 11); - guiItemStacks.set(12, ingredients.getOutputs(ItemStack.class).get(0)); +// guiItemStacks.set(12, (List) ingredients.getOutputs(ItemStack.class).get(0)); + guiItemStacks.set(12, ingredients.getOutputs(VanillaTypes.ITEM).get(0)); } } diff --git a/common/buildcraft/compat/module/jei/silicon/CategoryIntegrationTable.java b/common/buildcraft/compat/module/jei/silicon/CategoryIntegrationTable.java index ffe1d16..61ddfe3 100644 --- a/common/buildcraft/compat/module/jei/silicon/CategoryIntegrationTable.java +++ b/common/buildcraft/compat/module/jei/silicon/CategoryIntegrationTable.java @@ -1,77 +1,130 @@ package buildcraft.compat.module.jei.silicon; -import java.util.List; - -import net.minecraft.item.ItemStack; -import net.minecraft.util.ResourceLocation; - import buildcraft.api.BCModules; - -import mezz.jei.api.IGuiHelper; -import mezz.jei.api.gui.IDrawable; -import mezz.jei.api.gui.IGuiItemStackGroup; +import buildcraft.api.mj.MjAPI; +import buildcraft.api.recipes.IntegrationRecipe; +import buildcraft.silicon.BCSiliconBlocks; +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; +import com.mojang.blaze3d.matrix.MatrixStack; +import mezz.jei.api.constants.VanillaTypes; import mezz.jei.api.gui.IRecipeLayout; +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.IGuiItemStackGroup; +import mezz.jei.api.helpers.IGuiHelper; import mezz.jei.api.ingredients.IIngredients; -import mezz.jei.api.recipe.IRecipeCategory; +import mezz.jei.api.recipe.category.IRecipeCategory; +import net.minecraft.block.Blocks; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; -public class CategoryIntegrationTable implements IRecipeCategory { - public static final String UID = "buildcraft-compat:silicon.integration"; +import java.awt.*; +import java.util.List; +import java.util.stream.Collectors; - protected final ResourceLocation backgroundLocation; +//public class CategoryIntegrationTable implements IRecipeCategory +public class CategoryIntegrationTable implements IRecipeCategory { + // 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; - private WrapperIntegrationTable wrapper = null; - 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); + private final IDrawable icon; + + private final IntegrationRecipe recipe; + private final IDrawableAnimated progressBar; + private final List inputs; + private final List outputs; + + @OnlyIn(Dist.CLIENT) + private FontRenderer font = Minecraft.getInstance().font; + + public CategoryIntegrationTable(IGuiHelper guiHelper, IntegrationRecipe recipe) { +// this.background = guiHelper.createDrawable(this.backgroundLocation, 17, 22, 153, 71, 0, 0, 9, 0); + this.background = guiHelper.drawableBuilder(this.backgroundLocation, 17, 22, 153, 71).addPadding(0, 0, 9, 0).build(); + + this.icon = guiHelper.createDrawableIngredient(new ItemStack(BCSiliconBlocks.integrationTable.get())); + + this.recipe = recipe; + // Calen: not impl in 1.12.2 + List inputs = Lists.newArrayList(); + 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); + IDrawableStatic progressDrawable = guiHelper.drawableBuilder(this.backgroundLocation, 176, 17, 4, 69).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 Class getRecipeClass() { + return IntegrationRecipe.class; + } + public String getTitle() { - return "Integration Table"; +// return new TextComponent("Integration Table"); + return new TranslationTextComponent("tile.integrationTableBlock.name").getString(); } - @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; + } + + @Override + public void setIngredients(IntegrationRecipe recipe, IIngredients ingredients) { + ingredients.setInputIngredients(recipe.getRequirements().stream().map(is -> is.ingredient).collect(Collectors.toList())); + ingredients.setOutput(VanillaTypes.ITEM, recipe.getOutput()); + } + - List> inputs = ingredients.getInputs(ItemStack.class); + @OnlyIn(Dist.CLIENT) + @Override + public void draw(IntegrationRecipe recipe, MatrixStack stack, double mouseX, double mouseY) { + this.progressBar.draw(stack, 156, 1); + this.font.draw(stack, MjAPI.formatMj(0L) + " MJ", 80, 52, Color.gray.getRGB()); + + } + + @Override + // public void setRecipe(IRecipeLayout recipeLayout, WrapperIntegrationTable recipeWrapper, IIngredients ingredients) + public void setRecipe(IRecipeLayout recipeLayout, IntegrationRecipe recipe, IIngredients ingredients) { + IGuiItemStackGroup guiItemStacks = recipeLayout.getItemStacks(); +// List> inputs = ingredients.getInputs(ItemStack.class); + List> inputs = ingredients.getInputs(VanillaTypes.ITEM); int inventoryIndex = 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); + 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++; } - // 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.set(inventoryIndex, ingredients.getOutputs(VanillaTypes.ITEM).get(0)); } } 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..fc026ca 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 buildcraft.api.recipes.StackDefinition; import com.google.common.collect.Lists; import net.minecraft.item.ItemStack; -import buildcraft.api.recipes.StackDefinition; + +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..dceeec5 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 mezz.jei.api.MethodsReturnNonnullByDefault; + import javax.annotation.ParametersAreNonnullByDefault; -import mcp.MethodsReturnNonnullByDefault; diff --git a/common/buildcraft/compat/module/jei/transferhandlers/AdvancedCraftingItemsTransferHandler.java b/common/buildcraft/compat/module/jei/transferhandlers/AdvancedCraftingItemsTransferHandler.java index 02282e5..4e6d95e 100644 --- a/common/buildcraft/compat/module/jei/transferhandlers/AdvancedCraftingItemsTransferHandler.java +++ b/common/buildcraft/compat/module/jei/transferhandlers/AdvancedCraftingItemsTransferHandler.java @@ -1,34 +1,32 @@ 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.recipe.transfer.IRecipeTransferError; import mezz.jei.api.recipe.transfer.IRecipeTransferHandler; +import net.minecraft.entity.player.PlayerEntity; + +import javax.annotation.Nullable; public class AdvancedCraftingItemsTransferHandler implements IRecipeTransferHandler { + public AdvancedCraftingItemsTransferHandler() { + } + @Override public Class getContainerClass() { return ContainerAdvancedCraftingTable.class; } - @Nullable @Override - public IRecipeTransferError transferRecipe(ContainerAdvancedCraftingTable container, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer) { + @Nullable + public IRecipeTransferError transferRecipe(ContainerAdvancedCraftingTable container, IRecipeLayout recipeLayout, PlayerEntity 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); + AutoCraftItemsTransferHandler.transferRecipe((itemStacks) -> + { + container.sendSetPhantomSlots(container.tile.invBlueprint, itemStacks); + }, + recipeLayout + ); } return null; diff --git a/common/buildcraft/compat/module/jei/transferhandlers/AssemblyTableTransferHandler.java b/common/buildcraft/compat/module/jei/transferhandlers/AssemblyTableTransferHandler.java index e0ce8ee..0f72a3a 100644 --- a/common/buildcraft/compat/module/jei/transferhandlers/AssemblyTableTransferHandler.java +++ b/common/buildcraft/compat/module/jei/transferhandlers/AssemblyTableTransferHandler.java @@ -1,23 +1,23 @@ package buildcraft.compat.module.jei.transferhandlers; -import javax.annotation.Nullable; -import net.minecraft.entity.player.EntityPlayer; import buildcraft.silicon.container.ContainerAssemblyTable; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.recipe.transfer.IRecipeTransferError; import mezz.jei.api.recipe.transfer.IRecipeTransferHandler; +import net.minecraft.entity.player.PlayerEntity; + +import javax.annotation.Nullable; +// Calen: never used in 1.12.2? 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 IRecipeTransferError transferRecipe(ContainerAssemblyTable container, IRecipeLayout recipeLayout, PlayerEntity 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..4cdb368 100644 --- a/common/buildcraft/compat/module/jei/transferhandlers/AutoCraftItemsTransferHandler.java +++ b/common/buildcraft/compat/module/jei/transferhandlers/AutoCraftItemsTransferHandler.java @@ -1,40 +1,38 @@ 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 com.google.common.collect.Lists; import mezz.jei.api.gui.IRecipeLayout; +import mezz.jei.api.gui.ingredient.IGuiIngredient; import mezz.jei.api.recipe.transfer.IRecipeTransferError; import mezz.jei.api.recipe.transfer.IRecipeTransferHandler; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.ItemStack; + +import javax.annotation.Nullable; +import java.util.List; +import java.util.Map; +import java.util.function.Consumer; public class AutoCraftItemsTransferHandler implements IRecipeTransferHandler { + public AutoCraftItemsTransferHandler() { + } + @Override public Class getContainerClass() { return ContainerAutoCraftItems.class; } - @Nullable @Override - public IRecipeTransferError transferRecipe(ContainerAutoCraftItems container, IRecipeLayout recipeLayout, EntityPlayer player, boolean maxTransfer, boolean doTransfer) { + @Nullable + public IRecipeTransferError transferRecipe(ContainerAutoCraftItems container, IRecipeLayout recipeLayout, PlayerEntity 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 + ); } return null; diff --git a/common/buildcraft/compat/module/jei/transferhandlers/package-info.java b/common/buildcraft/compat/module/jei/transferhandlers/package-info.java index 546f6b9..06f14f8 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 mezz.jei.api.MethodsReturnNonnullByDefault; + import javax.annotation.ParametersAreNonnullByDefault; -import mcp.MethodsReturnNonnullByDefault; diff --git a/common/buildcraft/compat/module/theoneprobe/BCPluginTOP.java b/common/buildcraft/compat/module/theoneprobe/BCPluginTOP.java index 947e923..b526ee6 100644 --- a/common/buildcraft/compat/module/theoneprobe/BCPluginTOP.java +++ b/common/buildcraft/compat/module/theoneprobe/BCPluginTOP.java @@ -1,72 +1,60 @@ package buildcraft.compat.module.theoneprobe; -import static buildcraft.compat.module.theoneprobe.BCPluginTOP.TOP_MOD_ID; - -import java.util.List; - +import buildcraft.api.BCModules; +import buildcraft.api.mj.ILaserTarget; +import buildcraft.api.mj.MjAPI; +import buildcraft.compat.CompatUtils; +import buildcraft.lib.tile.craft.IAssemblyCraft; +import buildcraft.lib.tile.craft.IAutoCraft; import com.google.common.base.Function; - -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import mcjty.theoneprobe.api.*; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; -import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.TranslationTextComponent; 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 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); return null; } - @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, PlayerEntity player, World world, BlockState blockState, IProbeHitData data) { return false; } - @Override - @Optional.Method(modid = TOP_MOD_ID) + // @Method(modid = "theoneprobe") + // public String getID() public String getID() { return "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, PlayerEntity player, World 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())) { + TileEntity entity = world.getBlockEntity(data.getPos()); if (entity instanceof IAutoCraft) { this.addAutoCraftInfo(probeInfo, (IAutoCraft) entity); } @@ -74,36 +62,50 @@ 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 TranslationTextComponent("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 TranslationTextComponent("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 TranslationTextComponent("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 TranslationTextComponent("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 TranslationTextComponent("buildcraft.waila.crafting")).item(result); + } else { + IProbeInfo mainInfo = probeInfo.vertical(); + mainInfo.horizontal(mainInfo.defaultLayoutStyle().alignment(ElementAlignment.ALIGN_CENTER)).text(new TranslationTextComponent("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..f02af54 --- /dev/null +++ b/common/buildcraft/compat/module/waila/AssemblyCraftDataProvider.java @@ -0,0 +1,51 @@ +package buildcraft.compat.module.waila; + +import buildcraft.lib.tile.craft.IAssemblyCraft; +import mcp.mobius.waila.api.IDataAccessor; +import mcp.mobius.waila.api.IPluginConfig; +import net.minecraft.entity.player.ServerPlayerEntity; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; +import net.minecraft.util.text.TranslationTextComponent; +import net.minecraft.world.World; +import net.minecraftforge.common.util.Constants; + +import java.util.List; + +public class AssemblyCraftDataProvider { + static class BodyProvider extends BaseWailaDataProvider.BodyProvider { + @Override + public void getWailaBody(List currentTip, IDataAccessor accessor, IPluginConfig iPluginConfig) { + TileEntity tile = accessor.getTileEntity(); + if (tile instanceof IAssemblyCraft) { +// CompoundTag nbt = accessor.getNBTData(); + CompoundNBT nbt = accessor.getServerData(); + if (nbt.contains("recipe_result", Constants.NBT.TAG_COMPOUND)) { + ItemStack recipe_result = ItemStack.of(nbt.getCompound("recipe_result")); + if (!recipe_result.isEmpty()) { + currentTip.add(new TranslationTextComponent("buildcraft.waila.crafting")); + currentTip.add(HWYLAPlugin.getItemStackString(recipe_result)); + return; + } + } + currentTip.add(new TranslationTextComponent("buildcraft.waila.no_recipe")); + } +// else { +// currentTip.add(new TextComponent(ChatFormatting.RED + "{wrong tile entity}")); +// } + } + } + + static class NBTProvider extends BaseWailaDataProvider.NBTProvider { + @Override + public void getNBTData(CompoundNBT nbt, ServerPlayerEntity player, World world, TileEntity tile) { + if (tile instanceof IAssemblyCraft) { + IAssemblyCraft assembly = (IAssemblyCraft) tile; + 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..6a6dd20 100644 --- a/common/buildcraft/compat/module/waila/AutoCraftDataProvider.java +++ b/common/buildcraft/compat/module/waila/AutoCraftDataProvider.java @@ -1,83 +1,75 @@ 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 buildcraft.compat.CompatUtils; +import buildcraft.lib.tile.craft.IAutoCraft; +import mcp.mobius.waila.api.IDataAccessor; +import mcp.mobius.waila.api.IPluginConfig; +import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.ListNBT; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; +import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.world.World; - import net.minecraftforge.common.util.Constants; -import net.minecraftforge.fml.common.Optional; -import buildcraft.lib.tile.craft.IAutoCraft; - -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(List currentTip, IDataAccessor accessor, IPluginConfig config) { + TileEntity tile = accessor.getTileEntity(); + if (tile instanceof IAutoCraft) { + CompoundNBT nbt = accessor.getServerData(); + if (nbt.contains("recipe_result", Constants.NBT.TAG_COMPOUND)) { + // Calen: add -> create new line / append -> append at the last line + ItemStack result = ItemStack.of(nbt.getCompound("recipe_result")); + currentTip.add(new TranslationTextComponent("buildcraft.waila.crafting")); + currentTip.add(HWYLAPlugin.getItemStackString(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 StringTextComponent("")); + if (nbt.contains("recipe_inputs", Constants.NBT.TAG_LIST)) { + ListNBT list = nbt.getList("recipe_inputs", Constants.NBT.TAG_COMPOUND); + currentTip.add(new TranslationTextComponent("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) { + CompoundNBT compound = list.getCompound(index); + currentTip.add(HWYLAPlugin.getItemStackString(ItemStack.of(compound))); + } } - currentTip.add(inputs.toString()); + } else { + currentTip.add(new TranslationTextComponent("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(CompoundNBT nbt, ServerPlayerEntity player, World world, TileEntity tile) { + if (tile instanceof IAutoCraft) { + IAutoCraft auto = (IAutoCraft) tile; + ItemStack output = auto.getCurrentRecipeOutput(); + if (!output.isEmpty()) { + nbt.put("recipe_result", output.serializeNBT()); + List stacks = CompatUtils.compactInventory(auto.getInvBlueprint()); + ListNBT list = new ListNBT(); - 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..679b20f 100644 --- a/common/buildcraft/compat/module/waila/BaseWailaDataProvider.java +++ b/common/buildcraft/compat/module/waila/BaseWailaDataProvider.java @@ -1,57 +1,35 @@ 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 mcp.mobius.waila.api.IComponentProvider; +import mcp.mobius.waila.api.IDataAccessor; +import mcp.mobius.waila.api.IPluginConfig; +import mcp.mobius.waila.api.IServerDataProvider; +import net.minecraft.entity.player.ServerPlayerEntity; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.ITextComponent; 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; +import java.util.List; -@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; - } +//class BaseWailaDataProvider implements IWailaDataProvider +public interface BaseWailaDataProvider { - @Nonnull - @Override - @Optional.Method(modid = WAILA_MOD_ID) - public List getWailaHead(ItemStack itemStack, List currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config) { - return currentTip; - } + static abstract class BodyProvider implements IComponentProvider { + @Override + public void appendBody(List currentTip, IDataAccessor accessor, IPluginConfig iPluginConfig) { + getWailaBody(currentTip, accessor, iPluginConfig); + } - @Nonnull - @Override - @Optional.Method(modid = WAILA_MOD_ID) - public List getWailaBody(ItemStack itemStack, List currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config) { - return currentTip; + abstract void getWailaBody(List currentTip, IDataAccessor accessor, IPluginConfig iPluginConfig); } - @Nonnull - @Override - @Optional.Method(modid = WAILA_MOD_ID) - public List getWailaTail(ItemStack itemStack, List currentTip, IWailaDataAccessor accessor, IWailaConfigHandler config) { - return currentTip; - } + static abstract class NBTProvider implements IServerDataProvider { + @Override + public void appendServerData(CompoundNBT nbt, ServerPlayerEntity player, World world, TileEntity tile) { + getNBTData(nbt, player, world, tile); + } - @Nonnull - @Override - @Optional.Method(modid = WAILA_MOD_ID) - public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, BlockPos pos) { - return tag; + abstract void getNBTData(CompoundNBT nbt, ServerPlayerEntity player, World world, TileEntity tile); } } diff --git a/common/buildcraft/compat/module/waila/HWYLAPlugin.java b/common/buildcraft/compat/module/waila/HWYLAPlugin.java index 2ddff63..1dbdbce 100644 --- a/common/buildcraft/compat/module/waila/HWYLAPlugin.java +++ b/common/buildcraft/compat/module/waila/HWYLAPlugin.java @@ -1,49 +1,48 @@ package buildcraft.compat.module.waila; -import static buildcraft.compat.module.waila.HWYLAPlugin.WAILA_MOD_ID; - +import buildcraft.lib.block.BlockBCTile_Neptune; +import buildcraft.lib.tile.TileBC_Neptune; +import mcp.mobius.waila.api.*; 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 net.minecraft.tileentity.TileEntity; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; @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(IRegistrar registrar) { + IServerDataProvider autoCraftNbtProvider = new AutoCraftDataProvider.NBTProvider(); + IServerDataProvider laserTargetNbtProvider = new LaserTargetDataProvider.NBTProvider(); + IServerDataProvider assemblyCraftNbtProvider = new AssemblyCraftDataProvider.NBTProvider(); + + registrar.registerBlockDataProvider(autoCraftNbtProvider, TileBC_Neptune.class); + registrar.registerBlockDataProvider(laserTargetNbtProvider, TileBC_Neptune.class); + registrar.registerBlockDataProvider(assemblyCraftNbtProvider, TileBC_Neptune.class); + + IComponentProvider autoCraftBodyProvider = new AutoCraftDataProvider.BodyProvider(); + IComponentProvider laserTargetBodyProvider = new LaserTargetDataProvider.BodyProvider(); + IComponentProvider assemblyCraftBodyProvider = new AssemblyCraftDataProvider.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); } - static String getItemStackString(ItemStack stack) { + static ITextComponent getItemStackString(ItemStack stack) { return getItemStackString(stack, "1"); } - private static String getItemStackString(ItemStack stack, String thing) { + private static ITextComponent 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()) - ); +// return SpecialChars.getRenderString("waila.stack", thing, +// stack.getItem().getRegistryName().toString(), +// String.valueOf(stack.getCount()), +// String.valueOf(stack.getDamageValue()) +// ); + return new StringTextComponent("").append(stack.getDisplayName()).append(" x " + stack.getCount()); } } diff --git a/common/buildcraft/compat/module/waila/LaserTargetDataProvider.java b/common/buildcraft/compat/module/waila/LaserTargetDataProvider.java index 426e975..3cc5b45 100644 --- a/common/buildcraft/compat/module/waila/LaserTargetDataProvider.java +++ b/common/buildcraft/compat/module/waila/LaserTargetDataProvider.java @@ -1,56 +1,46 @@ 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 buildcraft.api.mj.ILaserTarget; +import buildcraft.api.mj.MjAPI; +import mcp.mobius.waila.api.IDataAccessor; +import mcp.mobius.waila.api.IPluginConfig; +import net.minecraft.entity.player.ServerPlayerEntity; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.TextFormatting; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TranslationTextComponent; 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.IWailaConfigHandler; -import mcp.mobius.waila.api.IWailaDataAccessor; +import java.util.List; -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"); +class LaserTargetDataProvider { + static class BodyProvider extends BaseWailaDataProvider.BodyProvider { + @Override + public void getWailaBody(List currentTip, IDataAccessor accessor, IPluginConfig iPluginConfig) { + TileEntity tile = accessor.getTileEntity(); + if (tile instanceof ILaserTarget) { + CompoundNBT nbt = accessor.getServerData(); + if (nbt.contains("required_power", Constants.NBT.TAG_LONG)) { + long power = nbt.getLong("required_power"); + if (power > 0L) { + currentTip.add(new TranslationTextComponent("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(CompoundNBT nbt, ServerPlayerEntity player, World world, TileEntity tile) { + if (tile instanceof ILaserTarget) { + ILaserTarget target = (ILaserTarget) tile; + nbt.putLong("required_power", target.getRequiredLaserPower()); + } } - - return nbt; } } 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..fc7c976 100644 --- a/common/buildcraft/compat/network/IGuiCreator.java +++ b/common/buildcraft/compat/network/IGuiCreator.java @@ -1,25 +1,21 @@ 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.screen.inventory.ContainerScreen; +import net.minecraft.entity.player.PlayerEntity; +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); + ContainerScreen getClientGuiElement(int var1, PlayerEntity 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); + ContainerScreen getServerGuiElement(int var1, PlayerEntity var2); } diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..878bf1f --- /dev/null +++ b/gradle.properties @@ -0,0 +1,4 @@ +# Sets default memory used for gradle commands. Can be overridden by user or command line properties. +# This is required to provide enough memory for the Minecraft decompilation process. +org.gradle.jvmargs=-Xmx3G +org.gradle.daemon=false \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index ca78035..e708b1c 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..dccb57d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#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.3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/mod_info/META-INF/mods.toml b/mod_info/META-INF/mods.toml new file mode 100644 index 0000000..f28ec06 --- /dev/null +++ b/mod_info/META-INF/mods.toml @@ -0,0 +1,151 @@ +modLoader="javafml" +loaderVersion="[36,)" +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="[36,)" + ordering="NONE" + side="BOTH" +[[dependencies.buildcraftcore]] + modId="minecraft" + mandatory=true + versionRange="[1.16,1.17)" + 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" - ] -}]