From c0eb617fa5c146b7a222c5461faf14394508cf4b Mon Sep 17 00:00:00 2001 From: miozune Date: Fri, 15 Jul 2022 14:34:19 +0900 Subject: Expand item limit for Neutron Activator & Add back Low Quality Naquadria Sulphate to the outputs from Concentrated Enriched-Naquadah Sludge (#53) * Expand item limit for Neutron Activator & Add back Low Quality Naquadria Sulphate to the outputs from Concentrated Enriched-Naquadah Sludge * updateBuildScript & spotlessApply --- build.gradle | 265 +- dependencies.gradle | 40 +- repositories.gradle | 52 +- .../goodgenerator/blocks/myFluids/BaseFluid.java | 34 +- .../blocks/myFluids/FluidsBuilder.java | 118 +- .../goodgenerator/blocks/regularBlock/Casing.java | 17 +- .../blocks/regularBlock/ComplexTextureCasing.java | 10 +- .../goodgenerator/blocks/regularBlock/Frame.java | 9 +- .../blocks/regularBlock/ITextureBlock.java | 1 - .../goodgenerator/blocks/regularBlock/TEBlock.java | 43 +- .../blocks/regularBlock/TurbineCasing.java | 40 +- .../blocks/tileEntity/CoolantTower.java | 287 ++- .../blocks/tileEntity/EssentiaHatch.java | 25 +- .../blocks/tileEntity/EssentiaOutputHatch.java | 6 +- .../blocks/tileEntity/EssentiaOutputHatch_ME.java | 36 +- .../blocks/tileEntity/ExtremeHeatExchanger.java | 242 +- .../blocks/tileEntity/FuelRefineFactory.java | 182 +- .../GTMetaTileEntity/DieselGenerator.java | 142 +- .../GTMetaTileEntity/NeutronAccelerator.java | 16 +- .../tileEntity/GTMetaTileEntity/NeutronSensor.java | 50 +- .../tileEntity/GTMetaTileEntity/YOTTAHatch.java | 161 +- .../blocks/tileEntity/LargeEssentiaGenerator.java | 333 +-- .../blocks/tileEntity/LargeEssentiaSmeltery.java | 189 +- .../blocks/tileEntity/LargeFusionComputer1.java | 59 +- .../blocks/tileEntity/LargeFusionComputer2.java | 19 +- .../blocks/tileEntity/LargeFusionComputer3.java | 19 +- .../blocks/tileEntity/LargeFusionComputer4.java | 68 +- .../blocks/tileEntity/LargeFusionComputer5.java | 66 +- .../blocks/tileEntity/MegaPlasmaTurbine.java | 19 +- .../blocks/tileEntity/MultiNqGenerator.java | 220 +- .../blocks/tileEntity/NeutronActivator.java | 172 +- .../blocks/tileEntity/PreciseAssembler.java | 155 +- .../tileEntity/SupercriticalFluidTurbine.java | 31 +- .../tileEntity/UniversalChemicalFuelEngine.java | 215 +- .../blocks/tileEntity/YottaFluidTank.java | 206 +- .../base/GT_MetaTileEntity_LargeTurbineBase.java | 232 +- ...GT_MetaTileEntity_TooltipMultiBlockBase_EM.java | 7 +- .../tileEntity/base/LargeFusionComputer.java | 677 ++--- .../tileEntity/base/LargeFusionComputerPP.java | 669 ++--- .../java/goodgenerator/client/ClientProxy.java | 10 +- .../client/GUI/LargeFusionComputerGUIClient.java | 18 +- .../client/GUI/NeutronActivatorGUIClient.java | 6 +- .../client/GUI/NeutronSensorGUIClient.java | 41 +- .../goodgenerator/client/GUI/YOTTankGUIClient.java | 26 +- .../client/render/BlockRenderHandler.java | 89 +- .../java/goodgenerator/common/CommonProxy.java | 8 +- .../container/NeutronActivatorGUIContainer.java | 9 +- .../common/container/YOTTankGUIContainer.java | 20 +- .../java/goodgenerator/crossmod/LoadedList.java | 1 - .../goodgenerator/crossmod/ic2/CropsLoader.java | 1 - .../crossmod/ic2/GGCropsSaltyRoot.java | 14 +- .../crossmod/nei/ExtremeHeatExchangerHandler.java | 26 +- .../java/goodgenerator/crossmod/nei/IMCForNEI.java | 6 +- .../goodgenerator/crossmod/nei/NEI_Config.java | 4 +- .../crossmod/nei/NeutronActivatorHandler.java | 32 +- .../crossmod/nei/PreciseAssemblerHandler.java | 8 +- .../thaumcraft/LargeEssentiaEnergyData.java | 56 +- .../crossmod/thaumcraft/Research.java | 1166 +++++---- .../java/goodgenerator/items/DepletedFuelRod.java | 7 +- src/main/java/goodgenerator/items/FuelRod.java | 87 +- .../java/goodgenerator/items/MyItemBlocks.java | 37 +- src/main/java/goodgenerator/items/MyItems.java | 194 +- src/main/java/goodgenerator/items/MyMaterial.java | 780 +++--- .../java/goodgenerator/items/RadioactiveItem.java | 3 +- .../items/nuclear/IsotopeMaterial.java | 17 +- .../items/nuclear/IsotopeMaterialLoader.java | 6 +- .../items/nuclear/NuclearMetaItemGenerator.java | 44 +- .../items/nuclear/NuclearTextures.java | 10 +- .../goodgenerator/loader/AchievementLoader.java | 3 +- .../goodgenerator/loader/FuelRecipeLoader.java | 113 +- .../java/goodgenerator/loader/FuelRodLoader.java | 183 +- src/main/java/goodgenerator/loader/Loaders.java | 253 +- .../loader/NaquadahReworkRecipeLoader.java | 658 +++-- .../loader/NeutronActivatorLoader.java | 45 +- .../java/goodgenerator/loader/RecipeLoader.java | 1841 +++++++------ .../java/goodgenerator/loader/RecipeLoader_02.java | 2713 ++++++++++---------- .../java/goodgenerator/main/GG_Config_Loader.java | 133 +- .../java/goodgenerator/main/GoodGenerator.java | 49 +- .../java/goodgenerator/network/MessageMTEBase.java | 15 +- .../network/MessageOpenNeutronSensorGUI.java | 5 +- .../network/MessageResetTileTexture.java | 4 +- .../network/MessageSetNeutronSensorData.java | 8 +- src/main/java/goodgenerator/tabs/MyTabs.java | 2 +- .../java/goodgenerator/util/CharExchanger.java | 94 +- .../java/goodgenerator/util/CrackRecipeAdder.java | 454 +++- .../goodgenerator/util/DescTextLocalization.java | 8 +- src/main/java/goodgenerator/util/ItemRefer.java | 6 +- src/main/java/goodgenerator/util/MaterialFix.java | 207 +- .../java/goodgenerator/util/MyRecipeAdder.java | 357 ++- .../java/goodgenerator/util/StructureHelper.java | 39 +- .../textures/gui/neutron_activator.png | Bin 2986 -> 4019 bytes 91 files changed, 8371 insertions(+), 6677 deletions(-) diff --git a/build.gradle b/build.gradle index c8cf37cd1f..5073008f95 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,4 @@ -//version: 1644894948 +//version: 1656760732 /* DO NOT CHANGE THIS FILE! @@ -6,14 +6,18 @@ Also, you may replace this file at any time if there is an update available. Please check https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/build.gradle for updates. */ -import org.gradle.internal.logging.text.StyledTextOutput -import org.gradle.internal.logging.text.StyledTextOutputFactory -import org.gradle.internal.logging.text.StyledTextOutput.Style import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar +import org.gradle.internal.logging.text.StyledTextOutput.Style +import org.gradle.internal.logging.text.StyledTextOutputFactory +import java.nio.file.Files +import java.nio.file.Paths import java.util.concurrent.TimeUnit +import java.util.zip.ZipEntry +import java.util.zip.ZipInputStream +import java.util.zip.ZipOutputStream buildscript { repositories { @@ -45,13 +49,15 @@ plugins { id 'eclipse' id 'scala' id 'maven-publish' - id 'org.jetbrains.kotlin.jvm' version '1.5.30' apply false - id 'org.jetbrains.kotlin.kapt' version '1.5.30' apply false + id 'org.jetbrains.kotlin.jvm' version '1.5.30' apply false + id 'org.jetbrains.kotlin.kapt' version '1.5.30' apply false + id 'com.google.devtools.ksp' version '1.5.30-1.0.0' apply false id 'org.ajoberstar.grgit' version '4.1.1' id 'com.github.johnrengelman.shadow' version '4.0.4' - id 'com.palantir.git-version' version '0.13.0' apply false + id 'com.palantir.git-version' version '0.13.0' apply false id 'de.undercouch.download' version '5.0.1' - id 'com.github.gmazzo.buildconfig' version '3.0.3' apply false + id 'com.github.gmazzo.buildconfig' version '3.0.3' apply false + id "com.diffplug.spotless" version "6.7.2" } if (project.file('.git/HEAD').isFile()) { @@ -78,6 +84,37 @@ idea { } } +// Spotless autoformatter +// See https://github.com/diffplug/spotless/tree/main/plugin-gradle +// Can be locally toggled via spotless:off/spotless:on comments +spotless { + encoding 'UTF-8' + + format 'misc', { + target '.gitignore' + + trimTrailingWhitespace() + indentWithSpaces(4) + endWithNewline() + } + java { + toggleOffOn() + importOrder() + removeUnusedImports() + palantirJavaFormat('1.1.0') // last version supporting jvm 8 + } + kotlin { + toggleOffOn() + ktfmt('0.39') + } + groovyGradle { + toggleOffOn() + importOrder() + target '*.gradle' + greclipse('4.19.0') // last version supporting jvm 8 + } +} + if(JavaVersion.current() != JavaVersion.VERSION_1_8) { throw new GradleException("This project requires Java 8, but it's running on " + JavaVersion.current()) } @@ -104,6 +141,11 @@ checkPropertyExists("usesShadowedDependencies") checkPropertyExists("developmentEnvironmentUserName") boolean noPublishedSources = project.findProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false +boolean usesMixinDebug = project.findProperty('usesMixinDebug') ?: project.usesMixins.toBoolean() +boolean forceEnableMixins = project.findProperty('forceEnableMixins') ? project.forceEnableMixins.toBoolean() : false +String channel = project.findProperty('channel') ? project.channel : 'stable' +String mappingsVersion = project.findProperty('mappingsVersion') ? project.mappingsVersion : '12' +String remoteMappings = project.findProperty('remoteMappings') ? project.remoteMappings : 'https://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/conf/' String javaSourceDir = "src/main/java/" String scalaSourceDir = "src/main/scala/" @@ -214,13 +256,17 @@ else { def arguments = [] def jvmArguments = [] -if(usesMixins.toBoolean()) { +if (usesMixins.toBoolean() || forceEnableMixins) { arguments += [ - "--tweakClass org.spongepowered.asm.launch.MixinTweaker" - ] - jvmArguments += [ - "-Dmixin.debug.countInjections=true", "-Dmixin.debug.verbose=true", "-Dmixin.debug.export=true" + "--tweakClass org.spongepowered.asm.launch.MixinTweaker" ] + if (usesMixinDebug.toBoolean()) { + jvmArguments += [ + "-Dmixin.debug.countInjections=true", + "-Dmixin.debug.verbose=true", + "-Dmixin.debug.export=true" + ] + } } minecraft { @@ -275,7 +321,7 @@ repositories { name 'Overmind forge repo mirror' url 'https://gregtech.overminddl1.com/' } - if(usesMixins.toBoolean()) { + if(usesMixins.toBoolean() || forceEnableMixins) { maven { name 'sponge' url 'https://repo.spongepowered.org/repository/maven-public' @@ -292,6 +338,8 @@ dependencies { annotationProcessor('com.google.guava:guava:24.1.1-jre') annotationProcessor('com.google.code.gson:gson:2.8.6') annotationProcessor('org.spongepowered:mixin:0.8-SNAPSHOT') + } + if(usesMixins.toBoolean() || forceEnableMixins) { // using 0.8 to workaround a issue in 0.7 which fails mixin application compile('com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH') { // Mixin includes a lot of dependencies that are too up-to-date @@ -312,18 +360,23 @@ def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfig def mixinSrg = "${tasks.reobf.temporaryDir}" + File.separator + "mixins.srg" task generateAssets { - if(usesMixins.toBoolean()) { - getFile("/src/main/resources/mixins." + modId + ".json").text = """{ + if (usesMixins.toBoolean()) { + def mixinConfigFile = getFile("/src/main/resources/mixins." + modId + ".json"); + if (!mixinConfigFile.exists()) { + mixinConfigFile.text = """{ "required": true, "minVersion": "0.7.11", "package": "${modGroup}.${mixinsPackage}", "plugin": "${modGroup}.${mixinPlugin}", "refmap": "${mixingConfigRefMap}", "target": "@env(DEFAULT)", - "compatibilityLevel": "JAVA_8" + "compatibilityLevel": "JAVA_8", + "mixins": [], + "client": [], + "server": [] } - """ + } } } @@ -462,7 +515,7 @@ def getManifestAttributes() { } task sourcesJar(type: Jar) { - from (sourceSets.main.allJava) + from (sourceSets.main.allSource) from (file("$projectDir/LICENSE")) getArchiveClassifier().set('sources') } @@ -517,7 +570,7 @@ task devJar(type: Jar) { } task apiJar(type: Jar) { - from (sourceSets.main.allJava) { + from (sourceSets.main.allSource) { include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**' } @@ -559,7 +612,7 @@ publishing { artifact source: shadowJar, classifier: "" } if(!noPublishedSources) { - artifact source: sourcesJar, classifier: "src" + artifact source: sourcesJar, classifier: "sources" } artifact source: usesShadowedDependencies.toBoolean() ? shadowDevJar : devJar, classifier: "dev" if (apiPackage) { @@ -659,7 +712,103 @@ configure(updateBuildScript) { description = 'Updates the build script to the latest version' } -// Deobfuscation +// Parameter Deobfuscation + +task deobfParams { + doLast { + + String mcpDir = "$project.gradle.gradleUserHomeDir/caches/minecraft/de/oceanlabs/mcp/mcp_$channel/$mappingsVersion" + String mcpZIP = "$mcpDir/mcp_$channel-$mappingsVersion-${minecraftVersion}.zip" + String paramsCSV = "$mcpDir/params.csv" + + download.run { + src "https://maven.minecraftforge.net/de/oceanlabs/mcp/mcp_$channel/$mappingsVersion-$minecraftVersion/mcp_$channel-$mappingsVersion-${minecraftVersion}.zip" + dest mcpZIP + overwrite false + } + + if(!file(paramsCSV).exists()) { + println("Extracting MCP archive ...") + unzip(mcpZIP, mcpDir) + } + + println("Parsing params.csv ...") + Map params = new HashMap<>() + Files.lines(Paths.get(paramsCSV)).forEach{line -> + String[] cells = line.split(",") + if(cells.length > 2 && cells[0].matches("p_i?\\d+_\\d+_")) { + params.put(cells[0], cells[1]) + } + } + + out.style(Style.Success).println("Modified ${replaceParams(file("$projectDir/src/main/java"), params)} files!") + out.style(Style.Failure).println("Don't forget to verify that the code still works as before!\n It could be broken due to duplicate variables existing now\n or parameters taking priority over other variables.") + } +} + +static int replaceParams(File file, Map params) { + int fileCount = 0 + + if(file.isDirectory()) { + for(File f : file.listFiles()) { + fileCount += replaceParams(f, params) + } + return fileCount + } + println("Visiting ${file.getName()} ...") + try { + String content = new String(Files.readAllBytes(file.toPath())) + int hash = content.hashCode() + params.forEach{key, value -> + content = content.replaceAll(key, value) + } + if(hash != content.hashCode()) { + Files.write(file.toPath(), content.getBytes("UTF-8")) + return 1 + } + } catch(Exception e) { + e.printStackTrace() + } + return 0 +} + +// Credit: bitsnaps (https://gist.github.com/bitsnaps/00947f2dce66f4bbdabc67d7e7b33681) +static unzip(String zipFileName, String outputDir) { + byte[] buffer = new byte[16384] + ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFileName)) + ZipEntry zipEntry = zis.getNextEntry() + while (zipEntry != null) { + File newFile = new File(outputDir + File.separator, zipEntry.name) + if (zipEntry.isDirectory()) { + if (!newFile.isDirectory() && !newFile.mkdirs()) { + throw new IOException("Failed to create directory $newFile") + } + } else { + // fix for Windows-created archives + File parent = newFile.parentFile + if (!parent.isDirectory() && !parent.mkdirs()) { + throw new IOException("Failed to create directory $parent") + } + // write file content + FileOutputStream fos = new FileOutputStream(newFile) + int len = 0 + while ((len = zis.read(buffer)) > 0) { + fos.write(buffer, 0, len) + } + fos.close() + } + zipEntry = zis.getNextEntry() + } + zis.closeEntry() + zis.close() +} + +configure(deobfParams) { + group = 'forgegradle' + description = 'Rename all obfuscated parameter names inherited from Minecraft classes' +} + +// Dependency Deobfuscation def deobf(String sourceURL) { try { @@ -672,7 +821,7 @@ def deobf(String sourceURL) { fileName = fileName.substring(lastSlash + 1) } //get rid of extension: - if(fileName.endsWith(".jar")) { + if(fileName.endsWith(".jar") || fileName.endsWith(".litemod")) { fileName = fileName.substring(0, fileName.lastIndexOf(".")) } @@ -684,26 +833,40 @@ def deobf(String sourceURL) { Collections.reverse(parts) hostName = String.join(".", parts) - return deobf(sourceURL, hostName + "/" + fileName) + return deobf(sourceURL, "$hostName/$fileName") } catch(Exception e) { - return deobf(sourceURL, "deobf/" + String.valueOf(sourceURL.hashCode())) + return deobf(sourceURL, "deobf/${sourceURL.hashCode()}") } } // The method above is to be preferred. Use this method if the filename is not at the end of the URL. -def deobf(String sourceURL, String fileName) { - String cacheDir = System.getProperty("user.home") + "/.gradle/caches/" - String bon2Dir = cacheDir + "forge_gradle/deobf" - String bon2File = bon2Dir + "/BON2-2.5.0.jar" - String obfFile = cacheDir + "modules-2/files-2.1/" + fileName + ".jar" - String deobfFile = cacheDir + "modules-2/files-2.1/" + fileName + "-deobf.jar" +def deobf(String sourceURL, String rawFileName) { + String bon2Version = "2.5.1" + String fileName = URLDecoder.decode(rawFileName, "UTF-8") + String cacheDir = "$project.gradle.gradleUserHomeDir/caches" + String bon2Dir = "$cacheDir/forge_gradle/deobf" + String bon2File = "$bon2Dir/BON2-${bon2Version}.jar" + String obfFile = "$cacheDir/modules-2/files-2.1/${fileName}.jar" + String deobfFile = "$cacheDir/modules-2/files-2.1/${fileName}-deobf.jar" if(file(deobfFile).exists()) { return files(deobfFile) } + String mappingsVer + if(remoteMappings) { + String id = "${forgeVersion.split("\\.")[3]}-$minecraftVersion" + String mappingsZIP = "$cacheDir/forge_gradle/maven_downloader/de/oceanlabs/mcp/mcp_snapshot_nodoc/$id/mcp_snapshot_nodoc-${id}.zip" + + zipMappings(mappingsZIP, remoteMappings, bon2Dir) + + mappingsVer = "snapshot_$id" + } else { + mappingsVer = "${channel}_$mappingsVersion" + } + download.run { - src 'https://github.com/GTNewHorizons/BON2/releases/download/2.5.0/BON2-2.5.0.CUSTOM-all.jar' + src "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/com/github/parker8283/BON2/$bon2Version-CUSTOM/BON2-$bon2Version-CUSTOM-all.jar" dest bon2File quiet true overwrite false @@ -717,14 +880,48 @@ def deobf(String sourceURL, String fileName) { } exec { - commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', '1.7.10', '--mappingsVer', 'stable_12', '--notch' + commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch' workingDir bon2Dir - standardOutput = new ByteArrayOutputStream() + standardOutput = new FileOutputStream("${deobfFile}.log") } return files(deobfFile) } +def zipMappings(String zipPath, String url, String bon2Dir) { + File zipFile = new File(zipPath) + if(zipFile.exists()) { + return + } + + String fieldsCache = "$bon2Dir/data/fields.csv" + String methodsCache = "$bon2Dir/data/methods.csv" + + download.run { + src "${url}fields.csv" + dest fieldsCache + quiet true + } + download.run { + src "${url}methods.csv" + dest methodsCache + quiet true + } + + zipFile.getParentFile().mkdirs() + ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile)) + + zos.putNextEntry(new ZipEntry("fields.csv")) + Files.copy(Paths.get(fieldsCache), zos) + zos.closeEntry() + + zos.putNextEntry(new ZipEntry("methods.csv")) + Files.copy(Paths.get(methodsCache), zos) + zos.closeEntry() + + zos.close() +} + // Helper methods def checkPropertyExists(String propertyName) { diff --git a/dependencies.gradle b/dependencies.gradle index 8e2248980c..d6faf819a4 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -2,28 +2,28 @@ dependencies { - compile('com.github.GTNewHorizons:GT5-Unofficial:5.09.40.65-pre:dev') - compile('com.github.GTNewHorizons:StructureLib:1.0.15:dev') - compile('com.github.GTNewHorizons:bartworks:0.5.53-pre:dev') - compile('com.github.GTNewHorizons:NotEnoughItems:2.2.15-GTNH:dev') - compile('com.github.GTNewHorizons:TecTech:5.0.5.1:dev') + compile('com.github.GTNewHorizons:GT5-Unofficial:5.09.40.65-pre:dev') + compile('com.github.GTNewHorizons:StructureLib:1.0.15:dev') + compile('com.github.GTNewHorizons:bartworks:0.5.53-pre:dev') + compile('com.github.GTNewHorizons:NotEnoughItems:2.2.15-GTNH:dev') + compile('com.github.GTNewHorizons:TecTech:5.0.5.1:dev') - compile('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') - compile('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev') + compile('thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev') + compile('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev') - compileOnly('com.github.GTNewHorizons:EnderCore:0.2.6:dev') {transitive = false} - compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-75-GTNH:dev') {transitive = false} - compileOnly('com.github.GTNewHorizons:GTplusplus:1.7.28:dev') {transitive = false} - compileOnly('com.github.GTNewHorizons:AppleCore:3.1.9:dev') {transitive = false} - compileOnly('com.github.GTNewHorizons:ForestryMC:4.4.6:dev') {transitive = false} - compileOnly('com.github.GTNewHorizons:Railcraft:9.13.6:dev') {transitive = false} - compileOnly('com.github.GTNewHorizons:EnderIO:2.3.1.30:dev') {transitive = false} - compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.9:dev') {transitive = false} - compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.27:dev') {transitive = false} - compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.3.16-GTNH:dev') {transitive = false} + compileOnly('com.github.GTNewHorizons:EnderCore:0.2.6:dev') {transitive = false} + compileOnly('com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-75-GTNH:dev') {transitive = false} + compileOnly('com.github.GTNewHorizons:GTplusplus:1.7.28:dev') {transitive = false} + compileOnly('com.github.GTNewHorizons:AppleCore:3.1.9:dev') {transitive = false} + compileOnly('com.github.GTNewHorizons:ForestryMC:4.4.6:dev') {transitive = false} + compileOnly('com.github.GTNewHorizons:Railcraft:9.13.6:dev') {transitive = false} + compileOnly('com.github.GTNewHorizons:EnderIO:2.3.1.30:dev') {transitive = false} + compileOnly('com.github.GTNewHorizons:ExtraCells2:2.5.9:dev') {transitive = false} + compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.27:dev') {transitive = false} + compileOnly('com.github.GTNewHorizons:ThaumicEnergistics:1.3.16-GTNH:dev') {transitive = false} - runtime('com.github.GTNewHorizons:NewHorizonsCoreMod:1.9.20:dev') - runtime('com.github.GTNewHorizons:ForestryMC:4.4.6:dev') + runtime('com.github.GTNewHorizons:NewHorizonsCoreMod:1.9.20:dev') + runtime('com.github.GTNewHorizons:ForestryMC:4.4.6:dev') - //compileOnly('com.github.GTNewHorizons:Avaritia:1.24) + //compileOnly('com.github.GTNewHorizons:Avaritia:1.24) } diff --git a/repositories.gradle b/repositories.gradle index a4ff7a2555..f28ebe6ac3 100644 --- a/repositories.gradle +++ b/repositories.gradle @@ -1,31 +1,31 @@ // Add any additional repositories for your dependencies here repositories { - maven { - name 'GTNH Maven' - url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/' - allowInsecureProtocol - } - maven { - name 'ic2' - url 'https://maven.ic2.player.to/' - metadataSources { - mavenPom() - artifact() - } + maven { + name 'GTNH Maven' + url 'http://jenkins.usrv.eu:8081/nexus/content/groups/public/' + allowInsecureProtocol + } + maven { + name 'ic2' + url 'https://maven.ic2.player.to/' + metadataSources { + mavenPom() + artifact() + } - } - maven { - name 'gt' - url 'https://gregtech.overminddl1.com/' - } - maven { - url 'https://cursemaven.com' - content { - includeGroup 'curse.maven' - } - } - maven { - url 'https://jitpack.io' - } + } + maven { + name 'gt' + url 'https://gregtech.overminddl1.com/' + } + maven { + url 'https://cursemaven.com' + content { + includeGroup 'curse.maven' + } + } + maven { + url 'https://jitpack.io' + } } diff --git a/src/main/java/goodgenerator/blocks/myFluids/BaseFluid.java b/src/main/java/goodgenerator/blocks/myFluids/BaseFluid.java index 9ccbd27e70..078012e64c 100644 --- a/src/main/java/goodgenerator/blocks/myFluids/BaseFluid.java +++ b/src/main/java/goodgenerator/blocks/myFluids/BaseFluid.java @@ -1,5 +1,7 @@ package goodgenerator.blocks.myFluids; +import static goodgenerator.main.GoodGenerator.MOD_ID; + import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.material.Material; @@ -9,46 +11,42 @@ import net.minecraftforge.fluids.BlockFluidClassic; import net.minecraftforge.fluids.Fluid; import net.minecraftforge.fluids.FluidRegistry; -import static goodgenerator.main.GoodGenerator.MOD_ID; - -public class BaseFluid extends BlockFluidClassic{ - @SideOnly( Side.CLIENT ) +public class BaseFluid extends BlockFluidClassic { + @SideOnly(Side.CLIENT) protected IIcon stillIcon; - @SideOnly( Side.CLIENT ) + + @SideOnly(Side.CLIENT) protected IIcon flowingIcon; + private String stillTexture; private String flowingTexture; - public BaseFluid(Fluid fluid, Material material) - { - super( fluid, material ); + public BaseFluid(Fluid fluid, Material material) { + super(fluid, material); } - public void SetTexture(String fluidName) - { + public void SetTexture(String fluidName) { stillTexture = MOD_ID + ":fluids/" + fluidName + ".still"; flowingTexture = MOD_ID + ":fluids/" + fluidName + ".flowing"; } - public static Fluid BuildFluid(String fluidName){ + public static Fluid BuildFluid(String fluidName) { Fluid tFluid = new Fluid(fluidName); FluidRegistry.registerFluid(tFluid); return tFluid; } - @SideOnly( Side.CLIENT ) + @SideOnly(Side.CLIENT) @Override - public void registerBlockIcons( IIconRegister register ) - { + public void registerBlockIcons(IIconRegister register) { stillIcon = register.registerIcon(stillTexture); flowingIcon = register.registerIcon(flowingTexture); - super.getFluid().setIcons( stillIcon, flowingIcon ); + super.getFluid().setIcons(stillIcon, flowingIcon); } @Override - public IIcon getIcon( int side, int meta ) - { - return ( side == 0 || side == 1 ) ? stillIcon : flowingIcon; + public IIcon getIcon(int side, int meta) { + return (side == 0 || side == 1) ? stillIcon : flowingIcon; } } diff --git a/src/main/java/goodgenerator/blocks/myFluids/FluidsBuilder.java b/src/main/java/goodgenerator/blocks/myFluids/FluidsBuilder.java index eb7879200f..87466ea26a 100644 --- a/src/main/java/goodgenerator/blocks/myFluids/FluidsBuilder.java +++ b/src/main/java/goodgenerator/blocks/myFluids/FluidsBuilder.java @@ -1,13 +1,12 @@ package goodgenerator.blocks.myFluids; -import goodgenerator.crossmod.nei.NEI_Config; import cpw.mods.fml.common.registry.GameRegistry; +import goodgenerator.crossmod.nei.NEI_Config; import net.minecraft.block.material.Material; import net.minecraftforge.fluids.Fluid; public class FluidsBuilder { - public FluidsBuilder(){ - } + public FluidsBuilder() {} public static void Register() { crackedNaquadahGas_Lightly(); @@ -27,176 +26,153 @@ public class FluidsBuilder { supercriticalSteam(); } - public static void crackedNaquadahGas_Lightly(){ + public static void crackedNaquadahGas_Lightly() { Fluid tmp = BaseFluid.BuildFluid("lightlyCrackedNaquadahGas"); - tmp.setGaseous(true) - .setTemperature(800); + tmp.setGaseous(true).setTemperature(800); BaseFluid tmp2 = new BaseFluid(tmp, Material.water); tmp2.SetTexture("lightlyCrackedNaquadahGas"); tmp2.setBlockName("lightlyCrackedNaquadahGas"); - GameRegistry.registerBlock(tmp2,"lightlyCrackedNaquadahGas"); + GameRegistry.registerBlock(tmp2, "lightlyCrackedNaquadahGas"); NEI_Config.hide(tmp2); } - public static void crackedNaquadahGas_Moderately(){ + public static void crackedNaquadahGas_Moderately() { Fluid tmp = BaseFluid.BuildFluid("moderatelyCrackedNaquadahGas"); - tmp.setGaseous(true) - .setTemperature(800); + tmp.setGaseous(true).setTemperature(800); BaseFluid tmp2 = new BaseFluid(tmp, Material.water); tmp2.SetTexture("moderatelyCrackedNaquadahGas"); tmp2.setBlockName("moderatelyCrackedNaquadahGas"); - GameRegistry.registerBlock(tmp2,"moderatelyCrackedNaquadahGas"); + GameRegistry.registerBlock(tmp2, "moderatelyCrackedNaquadahGas"); NEI_Config.hide(tmp2); } - public static void crackedNaquadahGas_Heavily(){ + public static void crackedNaquadahGas_Heavily() { Fluid tmp = BaseFluid.BuildFluid("heavilyCrackedNaquadahGas"); - tmp.setGaseous(true) - .setTemperature(800); + tmp.setGaseous(true).setTemperature(800); BaseFluid tmp2 = new BaseFluid(tmp, Material.water); tmp2.SetTexture("heavilyCrackedNaquadahGas"); tmp2.setBlockName("heavilyCrackedNaquadahGas"); - GameRegistry.registerBlock(tmp2,"heavilyCrackedNaquadahGas"); + GameRegistry.registerBlock(tmp2, "heavilyCrackedNaquadahGas"); NEI_Config.hide(tmp2); } - public static void crackedLightNaquadahFuel_Lightly(){ + public static void crackedLightNaquadahFuel_Lightly() { Fluid tmp = BaseFluid.BuildFluid("lightlyCrackedLightNaquadahFuel"); - tmp.setGaseous(false) - .setTemperature(1200); + tmp.setGaseous(false).setTemperature(1200); BaseFluid tmp2 = new BaseFluid(tmp, Material.water); tmp2.SetTexture("lightlyCrackedLightNaquadahFuel"); tmp2.setBlockName("lightlyCrackedLightNaquadahFuel"); - GameRegistry.registerBlock(tmp2,"lightlyCrackedLightNaquadahFuel"); + GameRegistry.registerBlock(tmp2, "lightlyCrackedLightNaquadahFuel"); NEI_Config.hide(tmp2); } - public static void crackedLightNaquadahFuel_Moderately(){ + public static void crackedLightNaquadahFuel_Moderately() { Fluid tmp = BaseFluid.BuildFluid("moderatelyCrackedLightNaquadahFuel"); - tmp.setGaseous(false) - .setTemperature(1200); + tmp.setGaseous(false).setTemperature(1200); BaseFluid tmp2 = new BaseFluid(tmp, Material.water); tmp2.SetTexture("moderatelyCrackedLightNaquadahFuel"); tmp2.setBlockName("moderatelyCrackedLightNaquadahFuel"); - GameRegistry.registerBlock(tmp2,"moderatelyCrackedLightNaquadahFuel"); + GameRegistry.registerBlock(tmp2, "moderatelyCrackedLightNaquadahFuel"); NEI_Config.hide(tmp2); } - public static void crackedLightNaquadahFuel_Heavily(){ + public static void crackedLightNaquadahFuel_Heavily() { Fluid tmp = BaseFluid.BuildFluid("heavilyCrackedLightNaquadahFuel"); - tmp.setGaseous(false) - .setTemperature(1200); + tmp.setGaseous(false).setTemperature(1200); BaseFluid tmp2 = new BaseFluid(tmp, Material.water); tmp2.SetTexture("heavilyCrackedLightNaquadahFuel"); tmp2.setBlockName("heavilyCrackedLightNaquadahFuel"); - GameRegistry.registerBlock(tmp2,"heavilyCrackedLightNaquadahFuel"); + GameRegistry.registerBlock(tmp2, "heavilyCrackedLightNaquadahFuel"); NEI_Config.hide(tmp2); } - public static void crackedHeavyNaquadahFuel_Lightly(){ + public static void crackedHeavyNaquadahFuel_Lightly() { Fluid tmp = BaseFluid.BuildFluid("lightlyCrackedHeavyNaquadahFuel"); - tmp.setGaseous(false) - .setTemperature(1200); + tmp.setGaseous(false).setTemperature(1200); BaseFluid tmp2 = new BaseFluid(tmp, Material.water); tmp2.SetTexture("lightlyCrackedHeavyNaquadahFuel"); tmp2.setBlockName("lightlyCrackedHeavyNaquadahFuel"); - GameRegistry.registerBlock(tmp2,"lightlyCrackedHeavyNaquadahFuel"); + GameRegistry.registerBlock(tmp2, "lightlyCrackedHeavyNaquadahFuel"); NEI_Config.hide(tmp2); } - public static void crackedHeavyNaquadahFuel_Moderately(){ + public static void crackedHeavyNaquadahFuel_Moderately() { Fluid tmp = BaseFluid.BuildFluid("moderatelyCrackedHeavyNaquadahFuel"); - tmp.setGaseous(false) - .setTemperature(1200); + tmp.setGaseous(false).setTemperature(1200); BaseFluid tmp2 = new BaseFluid(tmp, Material.water); tmp2.SetTexture("moderatelyCrackedHeavyNaquadahFuel"); tmp2.setBlockName("moderatelyCrackedHeavyNaquadahFuel"); - GameRegistry.registerBlock(tmp2,"moderatelyCrackedHeavyNaquadahFuel"); + GameRegistry.registerBlock(tmp2, "moderatelyCrackedHeavyNaquadahFuel"); NEI_Config.hide(tmp2); } - public static void crackedHeavyNaquadahFuel_Heavily(){ + public static void crackedHeavyNaquadahFuel_Heavily() { Fluid tmp = BaseFluid.BuildFluid("heavilyCrackedHeavyNaquadahFuel"); - tmp.setGaseous(false) - .setTemperature(1200); + tmp.setGaseous(false).setTemperature(1200); BaseFluid tmp2 = new BaseFluid(tmp, Material.water); tmp2.SetTexture("heavilyCrackedHeavyNaquadahFuel"); tmp2.setBlockName("heavilyCrackedHeavyNaquadahFuel"); - GameRegistry.registerBlock(tmp2,"heavilyCrackedHeavyNaquadahFuel"); + GameRegistry.registerBlock(tmp2, "heavilyCrackedHeavyNaquadahFuel"); NEI_Config.hide(tmp2); } - public static void crackedNaquadahAsphalt_Lightly(){ + public static void crackedNaquadahAsphalt_Lightly() { Fluid tmp = BaseFluid.BuildFluid("lightlyCrackedNaquadahAsphalt"); - tmp.setGaseous(false) - .setTemperature(1800) - .setDensity(20000) - .setViscosity(20000); + tmp.setGaseous(false).setTemperature(1800).setDensity(20000).setViscosity(20000); BaseFluid tmp2 = new BaseFluid(tmp, Material.water); tmp2.SetTexture("lightlyCrackedNaquadahAsphalt"); tmp2.setBlockName("lightlyCrackedNaquadahAsphalt"); - GameRegistry.registerBlock(tmp2,"lightlyCrackedNaquadahAsphalt"); + GameRegistry.registerBlock(tmp2, "lightlyCrackedNaquadahAsphalt"); NEI_Config.hide(tmp2); } - public static void crackedNaquadahAsphalt_Moderately(){ + public static void crackedNaquadahAsphalt_Moderately() { Fluid tmp = BaseFluid.BuildFluid("moderatelyCrackedNaquadahAsphalt"); - tmp.setGaseous(false) - .setTemperature(1800) - .setDensity(20000) - .setViscosity(20000); + tmp.setGaseous(false).setTemperature(1800).setDensity(20000).setViscosity(20000); BaseFluid tmp2 = new BaseFluid(tmp, Material.water); tmp2.SetTexture("moderatelyCrackedNaquadahAsphalt"); tmp2.setBlockName("moderatelyCrackedNaquadahAsphalt"); - GameRegistry.registerBlock(tmp2,"moderatelyCrackedNaquadahAsphalt"); + GameRegistry.registerBlock(tmp2, "moderatelyCrackedNaquadahAsphalt"); NEI_Config.hide(tmp2); } - public static void crackedNaquadahAsphalt_Heavily(){ + public static void crackedNaquadahAsphalt_Heavily() { Fluid tmp = BaseFluid.BuildFluid("heavilyCrackedNaquadahAsphalt"); - tmp.setGaseous(false) - .setTemperature(1800) - .setDensity(20000) - .setViscosity(20000); + tmp.setGaseous(false).setTemperature(1800).setDensity(20000).setViscosity(20000); BaseFluid tmp2 = new BaseFluid(tmp, Material.water); tmp2.SetTexture("heavilyCrackedNaquadahAsphalt"); tmp2.setBlockName("heavilyCrackedNaquadahAsphalt"); - GameRegistry.registerBlock(tmp2,"heavilyCrackedNaquadahAsphalt"); + GameRegistry.registerBlock(tmp2, "heavilyCrackedNaquadahAsphalt"); NEI_Config.hide(tmp2); } - public static void combustionPromotor(){ + public static void combustionPromotor() { Fluid tmp = BaseFluid.BuildFluid("combustionPromotor"); - tmp.setGaseous(false) - .setTemperature(300); + tmp.setGaseous(false).setTemperature(300); BaseFluid tmp2 = new BaseFluid(tmp, Material.water); tmp2.SetTexture("combustionPromotor"); tmp2.setBlockName("combustionPromotor"); - GameRegistry.registerBlock(tmp2,"combustionPromotor"); + GameRegistry.registerBlock(tmp2, "combustionPromotor"); NEI_Config.hide(tmp2); } - public static void coalTar(){ + public static void coalTar() { Fluid tmp = BaseFluid.BuildFluid("fluid.coalTar"); - tmp.setGaseous(false) - .setTemperature(450) - .setUnlocalizedName("fluid.coalTar"); + tmp.setGaseous(false).setTemperature(450).setUnlocalizedName("fluid.coalTar"); BaseFluid tmp2 = new BaseFluid(tmp, Material.water); tmp2.SetTexture("coalTar"); tmp2.setBlockTextureName("coalTar"); - GameRegistry.registerBlock(tmp2,"coalTar"); + GameRegistry.registerBlock(tmp2, "coalTar"); NEI_Config.hide(tmp2); } - public static void supercriticalSteam(){ + public static void supercriticalSteam() { Fluid tmp = BaseFluid.BuildFluid("supercriticalSteam"); - tmp.setGaseous(true) - .setTemperature(648) - .setUnlocalizedName("supercriticalSteam"); + tmp.setGaseous(true).setTemperature(648).setUnlocalizedName("supercriticalSteam"); BaseFluid tmp2 = new BaseFluid(tmp, Material.water); tmp2.SetTexture("supercriticalSteam"); tmp2.setBlockTextureName("supercriticalSteam"); - GameRegistry.registerBlock(tmp2,"supercriticalSteam"); + GameRegistry.registerBlock(tmp2, "supercriticalSteam"); NEI_Config.hide(tmp2); } } diff --git a/src/main/java/goodgenerator/blocks/regularBlock/Casing.java b/src/main/java/goodgenerator/blocks/regularBlock/Casing.java index 7a1db3278d..8808abd169 100644 --- a/src/main/java/goodgenerator/blocks/regularBlock/Casing.java +++ b/src/main/java/goodgenerator/blocks/regularBlock/Casing.java @@ -1,9 +1,10 @@ package goodgenerator.blocks.regularBlock; -import goodgenerator.main.GoodGenerator; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import goodgenerator.main.GoodGenerator; import gregtech.api.GregTech_API; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; @@ -16,12 +17,11 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import java.util.List; - public class Casing extends Block { @SideOnly(Side.CLIENT) protected IIcon[] texture; + String[] textureNames; protected String name; @@ -30,29 +30,29 @@ public class Casing extends Block { this.setHardness(9.0F); this.setResistance(5.0F); this.name = name; - this.setHarvestLevel("wrench",2); + this.setHarvestLevel("wrench", 2); this.setCreativeTab(GoodGenerator.GG); GregTech_API.registerMachineBlock(this, -1); } - public Casing(String name, String[] texture){ + public Casing(String name, String[] texture) { super(Material.iron); this.setHardness(9.0F); this.setResistance(5.0F); this.name = name; this.textureNames = texture; - this.setHarvestLevel("wrench",2); + this.setHarvestLevel("wrench", 2); this.setCreativeTab(GoodGenerator.GG); GregTech_API.registerMachineBlock(this, -1); } - public Casing(String name, String[] texture, Material material){ + public Casing(String name, String[] texture, Material material) { super(material); this.setHardness(9.0F); this.setResistance(5.0F); this.name = name; this.textureNames = texture; - this.setHarvestLevel("wrench",2); + this.setHarvestLevel("wrench", 2); this.setCreativeTab(GoodGenerator.GG); GregTech_API.registerMachineBlock(this, -1); } @@ -119,5 +119,4 @@ public class Casing extends Block { public boolean canCreatureSpawn(EnumCreatureType type, IBlockAccess world, int x, int y, int z) { return false; } - } diff --git a/src/main/java/goodgenerator/blocks/regularBlock/ComplexTextureCasing.java b/src/main/java/goodgenerator/blocks/regularBlock/ComplexTextureCasing.java index 18a1629cbf..149a1b2bfb 100644 --- a/src/main/java/goodgenerator/blocks/regularBlock/ComplexTextureCasing.java +++ b/src/main/java/goodgenerator/blocks/regularBlock/ComplexTextureCasing.java @@ -2,22 +2,21 @@ package goodgenerator.blocks.regularBlock; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -import java.util.List; - -public class ComplexTextureCasing extends Casing{ +public class ComplexTextureCasing extends Casing { @SideOnly(Side.CLIENT) protected IIcon[] texture1, texture2; String[] textureSide; String[] textureTopAndDown; - public ComplexTextureCasing(String name, String[] textureSide, String[] textureTopAndDown){ + public ComplexTextureCasing(String name, String[] textureSide, String[] textureTopAndDown) { super(name); this.textureSide = textureSide; this.textureTopAndDown = textureTopAndDown; @@ -28,8 +27,7 @@ public class ComplexTextureCasing extends Casing{ public IIcon getIcon(int side, int meta) { if (side < 2) { return meta < this.texture2.length ? this.texture2[meta] : this.texture2[0]; - } - else { + } else { return meta < this.texture1.length ? this.texture1[meta] : this.texture1[0]; } } diff --git a/src/main/java/goodgenerator/blocks/regularBlock/Frame.java b/src/main/java/goodgenerator/blocks/regularBlock/Frame.java index 90c38c4cce..f5a62bed4f 100644 --- a/src/main/java/goodgenerator/blocks/regularBlock/Frame.java +++ b/src/main/java/goodgenerator/blocks/regularBlock/Frame.java @@ -5,9 +5,9 @@ import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.material.Material; import net.minecraft.world.IBlockAccess; -public class Frame extends Casing{ - public Frame(String name,String[] texture){ - super(name,texture, Material.iron); +public class Frame extends Casing { + public Frame(String name, String[] texture) { + super(name, texture, Material.iron); } @Override @@ -18,8 +18,7 @@ public class Frame extends Casing{ @Override @SideOnly(Side.CLIENT) public boolean shouldSideBeRendered(IBlockAccess worldClient, int xCoord, int yCoord, int zCoord, int aSide) { - if (worldClient.getBlock(xCoord, yCoord, zCoord) instanceof Frame) - return false; + if (worldClient.getBlock(xCoord, yCoord, zCoord) instanceof Frame) return false; return super.shouldSideBeRendered(worldClient, xCoord, yCoord, zCoord, aSide); } diff --git a/src/main/java/goodgenerator/blocks/regularBlock/ITextureBlock.java b/src/main/java/goodgenerator/blocks/regularBlock/ITextureBlock.java index eba7c2c890..914552ad8d 100644 --- a/src/main/java/goodgenerator/blocks/regularBlock/ITextureBlock.java +++ b/src/main/java/goodgenerator/blocks/regularBlock/ITextureBlock.java @@ -13,5 +13,4 @@ public interface ITextureBlock { ITexture[] getTexture(Block aBlock, byte aSide, IBlockAccess aWorld, int xCoord, int yCoord, int zCoord); ITexture[] getTexture(Block aBlock, int aMeta, byte aSide); - } diff --git a/src/main/java/goodgenerator/blocks/regularBlock/TEBlock.java b/src/main/java/goodgenerator/blocks/regularBlock/TEBlock.java index 3be9619968..df98dc67dd 100644 --- a/src/main/java/goodgenerator/blocks/regularBlock/TEBlock.java +++ b/src/main/java/goodgenerator/blocks/regularBlock/TEBlock.java @@ -1,13 +1,14 @@ package goodgenerator.blocks.regularBlock; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import goodgenerator.blocks.tileEntity.EssentiaHatch; import goodgenerator.blocks.tileEntity.EssentiaOutputHatch; import goodgenerator.blocks.tileEntity.EssentiaOutputHatch_ME; import goodgenerator.main.GoodGenerator; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.GregTech_API; import gregtech.api.util.GT_Utility; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; import net.minecraft.block.material.Material; @@ -26,46 +27,45 @@ import net.minecraft.world.World; import thaumcraft.api.aspects.Aspect; import thaumcraft.api.aspects.IEssentiaContainerItem; -import java.util.List; - public class TEBlock extends BlockContainer { @SideOnly(Side.CLIENT) protected IIcon[] texture; + String[] textureNames; protected String name; protected int index; - public TEBlock(String name, String[] texture, CreativeTabs Tab){ + public TEBlock(String name, String[] texture, CreativeTabs Tab) { super(Material.iron); this.setHardness(9.0F); this.setResistance(5.0F); this.name = name; this.textureNames = texture; - this.setHarvestLevel("wrench",2); + this.setHarvestLevel("wrench", 2); this.setCreativeTab(GoodGenerator.GG); GregTech_API.registerMachineBlock(this, -1); } - public TEBlock(String name, String[] texture, int index){ + public TEBlock(String name, String[] texture, int index) { super(Material.iron); this.setHardness(9.0F); this.setResistance(5.0F); this.name = name; this.textureNames = texture; - this.setHarvestLevel("wrench",2); + this.setHarvestLevel("wrench", 2); this.index = index; this.setCreativeTab(GoodGenerator.GG); GregTech_API.registerMachineBlock(this, -1); } - public TEBlock(String name, String[] texture, Material material){ + public TEBlock(String name, String[] texture, Material material) { super(material); this.setHardness(9.0F); this.setResistance(5.0F); this.name = name; this.textureNames = texture; - this.setHarvestLevel("wrench",2); + this.setHarvestLevel("wrench", 2); this.setCreativeTab(GoodGenerator.GG); GregTech_API.registerMachineBlock(this, -1); } @@ -153,7 +153,8 @@ public class TEBlock extends BlockContainer { } @Override - public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) { if (world.isRemote) { return false; } else { @@ -163,10 +164,21 @@ public class TEBlock extends BlockContainer { ItemStack tItemStack = player.getHeldItem(); if (tItemStack != null) { Item tItem = tItemStack.getItem(); - if (tItem instanceof IEssentiaContainerItem && ((IEssentiaContainerItem) tItem).getAspects(player.getHeldItem()) != null && ((IEssentiaContainerItem) tItem).getAspects(player.getHeldItem()).size() > 0) { - Aspect tLocked = ((IEssentiaContainerItem) tItem).getAspects(player.getHeldItem()).getAspects()[0]; + if (tItem instanceof IEssentiaContainerItem + && ((IEssentiaContainerItem) tItem).getAspects(player.getHeldItem()) != null + && ((IEssentiaContainerItem) tItem) + .getAspects(player.getHeldItem()) + .size() + > 0) { + Aspect tLocked = ((IEssentiaContainerItem) tItem) + .getAspects(player.getHeldItem()) + .getAspects()[0]; ((EssentiaHatch) tile).setLockedAspect(tLocked); - GT_Utility.sendChatToPlayer(player, String.format(StatCollector.translateToLocal("essentiahatch.chat.0"), tLocked.getLocalizedDescription())); + GT_Utility.sendChatToPlayer( + player, + String.format( + StatCollector.translateToLocal("essentiahatch.chat.0"), + tLocked.getLocalizedDescription())); } } else { ((EssentiaHatch) tile).setLockedAspect(null); @@ -180,7 +192,8 @@ public class TEBlock extends BlockContainer { ItemStack tItemStack = player.getHeldItem(); if (tItemStack == null) { ((EssentiaOutputHatch) tile).clear(); - GT_Utility.sendChatToPlayer(player, StatCollector.translateToLocal("essentiaoutputhatch.chat.0")); + GT_Utility.sendChatToPlayer( + player, StatCollector.translateToLocal("essentiaoutputhatch.chat.0")); } return true; } else return false; diff --git a/src/main/java/goodgenerator/blocks/regularBlock/TurbineCasing.java b/src/main/java/goodgenerator/blocks/regularBlock/TurbineCasing.java index 6fd25af048..b07d173491 100644 --- a/src/main/java/goodgenerator/blocks/regularBlock/TurbineCasing.java +++ b/src/main/java/goodgenerator/blocks/regularBlock/TurbineCasing.java @@ -1,7 +1,7 @@ package goodgenerator.blocks.regularBlock; -import goodgenerator.client.render.BlockRenderHandler; import goodgenerator.blocks.tileEntity.base.GT_MetaTileEntity_LargeTurbineBase; +import goodgenerator.client.render.BlockRenderHandler; import goodgenerator.main.GoodGenerator; import gregtech.api.enums.Textures; import gregtech.api.interfaces.IIconContainer; @@ -12,19 +12,19 @@ import net.minecraft.block.Block; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockAccess; -public class TurbineCasing extends Casing implements ITextureBlock{ +public class TurbineCasing extends Casing implements ITextureBlock { public static IIconContainer[][] turbineShape = new IIconContainer[3][9]; public IIconContainer base; static { - for (int i = 0; i < 3; i ++) - for (int j = 1; j <= 9; j ++) + for (int i = 0; i < 3; i++) + for (int j = 1; j <= 9; j++) turbineShape[i][j - 1] = new Textures.BlockIcons.CustomIcon("icons/turbines/TURBINE_" + i + "" + j); } public TurbineCasing(String name, String texture) { - super(name, new String[]{GoodGenerator.MOD_ID + ":" + texture}); + super(name, new String[] {GoodGenerator.MOD_ID + ":" + texture}); base = new Textures.BlockIcons.CustomIcon("icons/" + texture); } @@ -32,7 +32,8 @@ public class TurbineCasing extends Casing implements ITextureBlock{ TileEntity tTileEntity = aWorld.getTileEntity(aX, aY, aZ); if (!(tTileEntity instanceof IGregTechTileEntity)) return 0; IGregTechTileEntity tTile = (IGregTechTileEntity) tTileEntity; - if (tTile.getMetaTileEntity() instanceof GT_MetaTileEntity_LargeTurbineBase && tTile.getFrontFacing() == aSide) { + if (tTile.getMetaTileEntity() instanceof GT_MetaTileEntity_LargeTurbineBase + && tTile.getFrontFacing() == aSide) { if (tTile.isActive()) return 1; return ((GT_MetaTileEntity_LargeTurbineBase) tTile.getMetaTileEntity()).hasTurbine() ? 2 : 3; } @@ -41,10 +42,7 @@ public class TurbineCasing extends Casing implements ITextureBlock{ public ITexture[] getTurbineCasing(int iconIndex, boolean active, boolean hasTurbine) { int states = active ? 0 : hasTurbine ? 1 : 2; - return new ITexture[] { - TextureFactory.of(base), - TextureFactory.of(turbineShape[states][iconIndex]) - }; + return new ITexture[] {TextureFactory.of(base), TextureFactory.of(turbineShape[states][iconIndex])}; } @Override @@ -54,10 +52,10 @@ public class TurbineCasing extends Casing implements ITextureBlock{ case 0: for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { - if (i == 0 && j == 0) - continue; + if (i == 0 && j == 0) continue; int tState; - if ((tState = isTurbineControllerWithSide(aWorld, xCoord + j, yCoord, zCoord + i, aSide)) != 0) { + if ((tState = isTurbineControllerWithSide(aWorld, xCoord + j, yCoord, zCoord + i, aSide)) + != 0) { return getTurbineCasing(4 - i * 3 - j, tState == 1, tState == 2); } } @@ -66,10 +64,10 @@ public class TurbineCasing extends Casing implements ITextureBlock{ case 1: for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { - if (i == 0 && j == 0) - continue; + if (i == 0 && j == 0) continue; int tState; - if ((tState = isTurbineControllerWithSide(aWorld, xCoord + j, yCoord + i, zCoord, aSide)) != 0) { + if ((tState = isTurbineControllerWithSide(aWorld, xCoord + j, yCoord + i, zCoord, aSide)) + != 0) { return getTurbineCasing(4 + i * 3 - j * tInvertLeftRightMod, tState == 1, tState == 2); } } @@ -78,10 +76,10 @@ public class TurbineCasing extends Casing implements ITextureBlock{ case 2: for (int i = -1; i < 2; i++) { for (int j = -1; j < 2; j++) { - if (i == 0 && j == 0) - continue; + if (i == 0 && j == 0) continue; int tState; - if ((tState = isTurbineControllerWithSide(aWorld, xCoord, yCoord + i, zCoord + j, aSide)) != 0) { + if ((tState = isTurbineControllerWithSide(aWorld, xCoord, yCoord + i, zCoord + j, aSide)) + != 0) { return getTurbineCasing(4 + i * 3 + j * tInvertLeftRightMod, tState == 1, tState == 2); } } @@ -93,9 +91,7 @@ public class TurbineCasing extends Casing implements ITextureBlock{ @Override public ITexture[] getTexture(Block aBlock, int aMeta, byte aSide) { - return new ITexture[] { - TextureFactory.of(base) - }; + return new ITexture[] {TextureFactory.of(base)}; } @Override diff --git a/src/main/java/goodgenerator/blocks/tileEntity/CoolantTower.java b/src/main/java/goodgenerator/blocks/tileEntity/CoolantTower.java index 67dc2b9101..f011934b66 100644 --- a/src/main/java/goodgenerator/blocks/tileEntity/CoolantTower.java +++ b/src/main/java/goodgenerator/blocks/tileEntity/CoolantTower.java @@ -1,5 +1,11 @@ package goodgenerator.blocks.tileEntity; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; +import static goodgenerator.util.DescTextLocalization.BLUE_PRINT_INFO; +import static gregtech.api.enums.Textures.BlockIcons.*; +import static gregtech.api.util.GT_StructureUtility.ofFrame; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; + import com.github.technus.tectech.thing.metaTileEntity.multi.base.GT_MetaTileEntity_MultiblockBase_EM; import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable; import com.gtnewhorizon.structurelib.structure.IStructureDefinition; @@ -21,12 +27,6 @@ import gregtech.api.util.GT_Utility; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; -import static goodgenerator.util.DescTextLocalization.BLUE_PRINT_INFO; -import static gregtech.api.enums.Textures.BlockIcons.*; -import static gregtech.api.util.GT_StructureUtility.ofFrame; -import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; - public class CoolantTower extends GT_MetaTileEntity_TooltipMultiBlockBase_EM implements IConstructable { protected IStructureDefinition multiDefinition = null; @@ -42,38 +42,187 @@ public class CoolantTower extends GT_MetaTileEntity_TooltipMultiBlockBase_EM imp @Override public IStructureDefinition getStructure_EM() { - if(multiDefinition == null) { - multiDefinition = StructureDefinition - .builder() - .addShape(mName, - transpose(new String[][]{ - {" ", " ", " BBB ", " B B ", " B B ", " B B ", " B B ", " B B ", " BBB ", " ", " "}, - {" ", " ", " BBB ", " BBBBB ", " BB BB ", " BB BB ", " BB BB ", " BBBBB ", " BBB ", " ", " "}, - {" ", " ", " ", " BBB ", " B B ", " B B ", " B B ", " BBB ", " ", " ", " "}, - {" ", " ", " ", " BBB ", " B B ", " B B ", " B B ", " BBB ", " ", " ", " "}, - {" ", " ", " ", " BBB ", " B B ", " B B ", " B B ", " BBB ", " ", " ", " "}, - {" ", " ", " BBB ", " BBBBB ", " BB BB ", " BB BB ", " BB BB ", " BBBBB ", " BBB ", " ", " "}, - {" ", " ", " BBB ", " B B ", " B B ", " B B ", " B B ", " B B ", " BBB ", " ", " "}, - {" ", " ", " BBB ", " B B ", " B B ", " B B ", " B B ", " B B ", " BBB ", " ", " "}, - {" ", " BBB ", " BBBBB ", " BB BB ", " BB BB ", " BB BB ", " BB BB ", " BB BB ", " BBBBB ", " BBB ", " "}, - {" ", " BBB ", " B B ", " B B ", " B B ", " B B ", " B B ", " B B ", " B B ", " BBB ", " "}, - {" ", " BBBBB ", " BB BB ", " BB BB ", " B B ", " B B ", " B B ", " BB BB ", " BB BB ", " BBBBB ", " "}, - {" HH~HH ", " HBBBBBH ", " HB BH ", "HB BH", "HB BH", "HB BH", "HB BH", "HB BH", " HB BH ", " HBBBBBH ", " HHHHH "}, - {" CCCCC ", " C C ", " C C ", "C C", "C C", "C C", "C C", "C C", " C C ", " C C ", " CCCCC "}, - }) - ).addElement('B', - ofBlockAnyMeta(GregTech_API.sBlockConcretes, 8) - ).addElement('C', - ofFrame(Materials.TungstenCarbide) - ).addElement('H', - ofChain( - ofHatchAdder( - CoolantTower::addIOFluidToMachineList, CASING_INDEX, 1 - ), - ofBlockAnyMeta(GregTech_API.sBlockConcretes, 8) - ) - ) - .build(); + if (multiDefinition == null) { + multiDefinition = StructureDefinition.builder() + .addShape(mName, transpose(new String[][] { + { + " ", + " ", + " BBB ", + " B B ", + " B B ", + " B B ", + " B B ", + " B B ", + " BBB ", + " ", + " " + }, + { + " ", + " ", + " BBB ", + " BBBBB ", + " BB BB ", + " BB BB ", + " BB BB ", + " BBBBB ", + " BBB ", + " ", + " " + }, + { + " ", + " ", + " ", + " BBB ", + " B B ", + " B B ", + " B B ", + " BBB ", + " ", + " ", + " " + }, + { + " ", + " ", + " ", + " BBB ", + " B B ", +