diff --git a/build.gradle b/build.gradle index c9bb6ce7..e182c451 100644 --- a/build.gradle +++ b/build.gradle @@ -1,34 +1,41 @@ -//version: 1642484596 +//version: 1656760175 /* DO NOT CHANGE THIS FILE! 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 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 { maven { - name = "forge" - url = "https://maven.minecraftforge.net" + name 'forge' + url 'https://maven.minecraftforge.net' } maven { - name = "sonatype" - url = "https://oss.sonatype.org/content/repositories/snapshots/" + name 'sonatype' + url 'https://oss.sonatype.org/content/repositories/snapshots/' } maven { - name = "Scala CI dependencies" - url = "https://repo1.maven.org/maven2/" + name 'Scala CI dependencies' + url 'https://repo1.maven.org/maven2/' } maven { - name = "jitpack" - url = "https://jitpack.io" + name 'jitpack' + url 'https://jitpack.io' } } dependencies { @@ -37,14 +44,28 @@ buildscript { } plugins { + id 'java-library' id 'idea' + id 'eclipse' id 'scala' - id("org.ajoberstar.grgit") version("3.1.1") - id("com.github.johnrengelman.shadow") version("4.0.4") - id("com.palantir.git-version") version("0.12.3") - id("maven-publish") + id 'maven-publish' + id 'org.jetbrains.kotlin.jvm' version '1.5.30' apply false + id 'org.jetbrains.kotlin.kapt' version '1.5.30' apply false + id 'com.google.devtools.ksp' version '1.5.30-1.0.0' apply false + id 'org.ajoberstar.grgit' version '4.1.1' + id 'com.github.johnrengelman.shadow' version '4.0.4' + 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.diffplug.spotless" version "6.7.2" } +if (project.file('.git/HEAD').isFile()) { + apply plugin: 'com.palantir.git-version' +} + +def out = services.get(StyledTextOutputFactory).create('an-output') + apply plugin: 'forge' def projectJavaVersion = JavaLanguageVersion.of(8) @@ -63,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()) } @@ -89,27 +141,34 @@ checkPropertyExists("usesShadowedDependencies") checkPropertyExists("developmentEnvironmentUserName") boolean noPublishedSources = project.findProperty("noPublishedSources") ? project.noPublishedSources.toBoolean() : false +boolean usesMixinDebug = project.findProperty('usesMixinDebug') ?: project.usesMixins.toBoolean() +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/" +String kotlinSourceDir = "src/main/kotlin/" String targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") String targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") -if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) { - throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala) +String targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") +if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { + throw new GradleException("Could not resolve \"modGroup\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin) } if(apiPackage) { targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") - if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) { - throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala) + targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { + throw new GradleException("Could not resolve \"apiPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin) } } if(accessTransformersFile) { String targetFile = "src/main/resources/META-INF/" + accessTransformersFile - if(getFile(targetFile).exists() == false) { + if(!getFile(targetFile).exists()) { throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile) } } @@ -121,15 +180,17 @@ if(usesMixins.toBoolean()) { targetPackageJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") targetPackageScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") - if((getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists()) == false) { - throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala) + targetPackageKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinsPackage.toString().replaceAll("\\.", "/") + if(!(getFile(targetPackageJava).exists() || getFile(targetPackageScala).exists() || getFile(targetPackageKotlin).exists())) { + throw new GradleException("Could not resolve \"mixinsPackage\"! Could not find " + targetPackageJava + " or " + targetPackageScala + " or " + targetPackageKotlin) } String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".scala" String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".java" - if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) { - throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava) + String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + mixinPlugin.toString().replaceAll("\\.", "/") + ".kt" + if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) { + throw new GradleException("Could not resolve \"mixinPlugin\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin) } } @@ -137,8 +198,9 @@ if(coreModClass) { String targetFileJava = javaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" String targetFileScala = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".scala" String targetFileScalaJava = scalaSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".java" - if((getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists()) == false) { - throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava) + String targetFileKotlin = kotlinSourceDir + modGroup.toString().replaceAll("\\.", "/") + "/" + coreModClass.toString().replaceAll("\\.", "/") + ".kt" + if(!(getFile(targetFileJava).exists() || getFile(targetFileScala).exists() || getFile(targetFileScalaJava).exists() || getFile(targetFileKotlin).exists())) { + throw new GradleException("Could not resolve \"coreModClass\"! Could not find " + targetFileJava + " or " + targetFileScala + " or " + targetFileScalaJava + " or " + targetFileKotlin) } } @@ -151,17 +213,35 @@ configurations.all { } // Fix Jenkins' Git: chmod a file should not be detected as a change and append a '.dirty' to the version -'git config core.fileMode false'.execute() +try { + 'git config core.fileMode false'.execute() +} +catch (Exception ignored) { + out.style(Style.Failure).println("git isn't installed at all") +} // Pulls version first from the VERSION env and then git tag String identifiedVersion +String versionOverride = System.getenv("VERSION") ?: null try { - String versionOverride = System.getenv("VERSION") ?: null identifiedVersion = versionOverride == null ? gitVersion() : versionOverride - version = minecraftVersion + "-" + identifiedVersion } -catch (Exception e) { - throw new IllegalStateException("This mod must be version controlled by Git AND the repository must provide at least one tag, or the VERSION override must be set!"); +catch (Exception ignored) { + out.style(Style.Failure).text( + 'This mod must be version controlled by Git AND the repository must provide at least one tag,\n' + + 'or the VERSION override must be set! ').style(Style.SuccessHeader).text('(Do NOT download from GitHub using the ZIP option, instead\n' + + 'clone the repository, see ').style(Style.Info).text('https://gtnh.miraheze.org/wiki/Development').style(Style.SuccessHeader).println(' for details.)' + ) + versionOverride = 'NO-GIT-TAG-SET' + identifiedVersion = versionOverride +} +version = minecraftVersion + '-' + identifiedVersion +ext { + modVersion = identifiedVersion +} + +if(identifiedVersion == versionOverride) { + out.style(Style.Failure).text('Override version to ').style(Style.Identifier).text(modVersion).style(Style.Failure).println('!\7') } group = modGroup @@ -172,9 +252,25 @@ else { archivesBaseName = modId } +def arguments = [] +def jvmArguments = [] + +if (usesMixins.toBoolean()) { + arguments += [ + "--tweakClass org.spongepowered.asm.launch.MixinTweaker" + ] + if (usesMixinDebug.toBoolean()) { + jvmArguments += [ + "-Dmixin.debug.countInjections=true", + "-Dmixin.debug.verbose=true", + "-Dmixin.debug.export=true" + ] + } +} + minecraft { - version = minecraftVersion + "-" + forgeVersion + "-" + minecraftVersion - runDir = "run" + version = minecraftVersion + '-' + forgeVersion + '-' + minecraftVersion + runDir = 'run' if (replaceGradleTokenInFile) { replaceIn replaceGradleTokenInFile @@ -185,16 +281,30 @@ minecraft { replace gradleTokenModName, modName } if(gradleTokenVersion) { - replace gradleTokenVersion, versionDetails().lastTag + replace gradleTokenVersion, modVersion } if(gradleTokenGroupName) { replace gradleTokenGroupName, modGroup } } + + clientIntellijRun { + args(arguments) + jvmArgs(jvmArguments) + + if(developmentEnvironmentUserName) { + args("--username", developmentEnvironmentUserName) + } + } + + serverIntellijRun { + args(arguments) + jvmArgs(jvmArguments) + } } -if(file("addon.gradle").exists()) { - apply from: "addon.gradle" +if(file('addon.gradle').exists()) { + apply from: 'addon.gradle' } apply from: 'repositories.gradle' @@ -207,58 +317,63 @@ configurations { repositories { maven { - name = "Overmind forge repo mirror" - url = "https://gregtech.overminddl1.com/" + name 'Overmind forge repo mirror' + url 'https://gregtech.overminddl1.com/' } if(usesMixins.toBoolean()) { maven { - name = "sponge" - url = "https://repo.spongepowered.org/repository/maven-public" + name 'sponge' + url 'https://repo.spongepowered.org/repository/maven-public' } maven { - url = "https://jitpack.io" + url 'https://jitpack.io' } } } dependencies { if(usesMixins.toBoolean()) { - annotationProcessor("org.ow2.asm:asm-debug-all:5.0.3") - annotationProcessor("com.google.guava:guava:24.1.1-jre") - annotationProcessor("com.google.code.gson:gson:2.8.6") - annotationProcessor("org.spongepowered:mixin:0.8-SNAPSHOT") + annotationProcessor('org.ow2.asm:asm-debug-all:5.0.3') + annotationProcessor('com.google.guava:guava:24.1.1-jre') + annotationProcessor('com.google.code.gson:gson:2.8.6') + annotationProcessor('org.spongepowered:mixin:0.8-SNAPSHOT') // using 0.8 to workaround a issue in 0.7 which fails mixin application - compile("com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH") { + compile('com.github.GTNewHorizons:SpongePoweredMixin:0.7.12-GTNH') { // Mixin includes a lot of dependencies that are too up-to-date - exclude module: "launchwrapper" - exclude module: "guava" - exclude module: "gson" - exclude module: "commons-io" - exclude module: "log4j-core" + exclude module: 'launchwrapper' + exclude module: 'guava' + exclude module: 'gson' + exclude module: 'commons-io' + exclude module: 'log4j-core' } - compile("com.github.GTNewHorizons:SpongeMixins:1.5.0") + compile('com.github.GTNewHorizons:SpongeMixins:1.5.0') } } apply from: 'dependencies.gradle' -def mixingConfigRefMap = "mixins." + modId + ".refmap.json" +def mixingConfigRefMap = 'mixins.' + modId + '.refmap.json' def refMap = "${tasks.compileJava.temporaryDir}" + File.separator + mixingConfigRefMap 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": [] } - """ + } } } @@ -322,15 +437,6 @@ afterEvaluate { } runClient { - def arguments = [] - - if(usesMixins.toBoolean()) { - arguments += [ - "--mods=../build/libs/$modId-${version}.jar", - "--tweakClass org.spongepowered.asm.launch.MixinTweaker" - ] - } - if(developmentEnvironmentUserName) { arguments += [ "--username", @@ -339,19 +445,12 @@ runClient { } args(arguments) + jvmArgs(jvmArguments) } runServer { - def arguments = [] - - if (usesMixins.toBoolean()) { - arguments += [ - "--mods=../build/libs/$modId-${version}.jar", - "--tweakClass org.spongepowered.asm.launch.MixinTweaker" - ] - } - args(arguments) + jvmArgs(jvmArguments) } tasks.withType(JavaExec).configureEach { @@ -362,8 +461,7 @@ tasks.withType(JavaExec).configureEach { ) } -processResources -{ +processResources { // this will ensure that this task is redone when the versions change. inputs.property "version", project.version inputs.property "mcversion", project.minecraft.version @@ -372,18 +470,18 @@ processResources from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' - // replace version and mcversion + // replace modVersion and minecraftVersion expand "minecraftVersion": project.minecraft.version, - "modVersion": versionDetails().lastTag, - "modId": modId, - "modName": modName + "modVersion": modVersion, + "modId": modId, + "modName": modName } if(usesMixins.toBoolean()) { from refMap } - // copy everything else, thats not the mcmod.info + // copy everything else that's not the mcmod.info from(sourceSets.main.resources.srcDirs) { exclude 'mcmod.info' } @@ -391,7 +489,7 @@ processResources def getManifestAttributes() { def manifestAttributes = [:] - if(containsMixinsAndOrCoreModOnly.toBoolean() == false && (usesMixins.toBoolean() || coreModClass)) { + if(!containsMixinsAndOrCoreModOnly.toBoolean() && (usesMixins.toBoolean() || coreModClass)) { manifestAttributes += ["FMLCorePluginContainsFMLMod": true] } @@ -407,14 +505,14 @@ def getManifestAttributes() { manifestAttributes += [ "TweakClass" : "org.spongepowered.asm.launch.MixinTweaker", "MixinConfigs" : "mixins." + modId + ".json", - "ForceLoadAsMod" : containsMixinsAndOrCoreModOnly.toBoolean() == false + "ForceLoadAsMod" : !containsMixinsAndOrCoreModOnly.toBoolean() ] } return manifestAttributes } task sourcesJar(type: Jar) { - from (sourceSets.main.allJava) + from (sourceSets.main.allSource) from (file("$projectDir/LICENSE")) getArchiveClassifier().set('sources') } @@ -469,7 +567,7 @@ task devJar(type: Jar) { } task apiJar(type: Jar) { - from (sourceSets.main.allJava) { + from (sourceSets.main.allSource) { include modGroup.toString().replaceAll("\\.", "/") + "/" + apiPackage.toString().replaceAll("\\.", "/") + '/**' } @@ -494,13 +592,24 @@ artifacts { } } -// publishing +// The gradle metadata includes all of the additional deps that we disabled from POM generation (including forgeBin with no groupID), +// and isn't strictly needed with the POM so just disable it. +tasks.withType(GenerateModuleMetadata) { + enabled = false +} + +// workaround variable hiding in pom processing +def projectConfigs = project.configurations + publishing { publications { maven(MavenPublication) { - artifact source: usesShadowedDependencies.toBoolean() ? shadowJar : jar, classifier: "" + from components.java + if(usesShadowedDependencies.toBoolean()) { + 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) { @@ -511,6 +620,25 @@ publishing { artifactId = System.getenv("ARTIFACT_ID") ?: project.name // Using the identified version, not project.version as it has the prepended 1.7.10 version = System.getenv("RELEASE_VERSION") ?: identifiedVersion + + // remove extra garbage from minecraft and minecraftDeps configuration + pom.withXml { + def badArtifacts = [:].withDefault {[] as Set} + for (configuration in [projectConfigs.minecraft, projectConfigs.minecraftDeps]) { + for (dependency in configuration.allDependencies) { + badArtifacts[dependency.group == null ? "" : dependency.group] += dependency.name + } + } + // example for specifying extra stuff to ignore + // badArtifacts["org.example.group"] += "artifactName" + + Node pomNode = asNode() + pomNode.dependencies.'*'.findAll() { + badArtifacts[it.groupId.text()].contains(it.artifactId.text()) + }.each() { + it.parent().remove(it) + } + } } } @@ -538,7 +666,7 @@ if (isNewBuildScriptVersionAvailable(projectDir.toString())) { if (autoUpdateBuildScript.toBoolean()) { performBuildScriptUpdate(projectDir.toString()) } else { - println("Build script update available! Run 'gradle updateBuildScript'") + out.style(Style.SuccessHeader).println("Build script update available! Run 'gradle updateBuildScript'") } } @@ -550,7 +678,7 @@ boolean performBuildScriptUpdate(String projectDir) { if (isNewBuildScriptVersionAvailable(projectDir)) { def buildscriptFile = getFile("build.gradle") availableBuildScriptUrl().withInputStream { i -> buildscriptFile.withOutputStream { it << i } } - print("Build script updated. Please REIMPORT the project or RESTART your IDE!") + out.style(Style.Success).print("Build script updated. Please REIMPORT the project or RESTART your IDE!") return true } return false @@ -581,10 +709,220 @@ configure(updateBuildScript) { description = 'Updates the build script to the latest version' } +// 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 { + URL url = new URL(sourceURL) + String fileName = url.getFile() + + //get rid of directories: + int lastSlash = fileName.lastIndexOf("/") + if(lastSlash > 0) { + fileName = fileName.substring(lastSlash + 1) + } + //get rid of extension: + if(fileName.endsWith(".jar") || fileName.endsWith(".litemod")) { + fileName = fileName.substring(0, fileName.lastIndexOf(".")) + } + + String hostName = url.getHost() + if(hostName.startsWith("www.")) { + hostName = hostName.substring(4) + } + List parts = Arrays.asList(hostName.split("\\.")) + Collections.reverse(parts) + hostName = String.join(".", parts) + + return deobf(sourceURL, "$hostName/$fileName") + } catch(Exception e) { + 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 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 "http://jenkins.usrv.eu:8081/nexus/content/repositories/releases/com/github/parker8283/BON2/$bon2Version-CUSTOM/BON2-$bon2Version-CUSTOM-all.jar" + dest bon2File + quiet true + overwrite false + } + + download.run { + src sourceURL + dest obfFile + quiet true + overwrite false + } + + exec { + commandLine 'java', '-jar', bon2File, '--inputJar', obfFile, '--outputJar', deobfFile, '--mcVer', minecraftVersion, '--mappingsVer', mappingsVer, '--notch' + workingDir bon2Dir + standardOutput = new FileOutputStream("${deobfFile}.log") + } + + return files(deobfFile) +} + +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) { - if (project.hasProperty(propertyName) == false) { + if (!project.hasProperty(propertyName)) { throw new GradleException("This project requires a property \"" + propertyName + "\"! Please add it your \"gradle.properties\". You can find all properties and their description here: https://github.com/GTNewHorizons/ExampleMod1.7.10/blob/main/gradle.properties") } } diff --git a/dependencies.gradle b/dependencies.gradle index c4593d8a..940d069f 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -2,25 +2,25 @@ dependencies { - compile("com.github.GTNewHorizons:Mantle:0.3.4:dev") + compile("com.github.GTNewHorizons:Mantle:0.3.4:dev") - compileOnly("com.github.GTNewHorizons:waila:1.5.18:dev") { - transitive = false - } - compileOnly("com.github.GTNewHorizons:ForgeMultipart:1.2.7:dev") { - transitive = false - } - compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.1.22-GTNH:dev") { - transitive = false - } - compileOnly("com.github.GTNewHorizons:TinkersConstruct:1.9.0.9-GTNH:dev") { - transitive = false - } + compileOnly("com.github.GTNewHorizons:waila:1.5.21:dev") { + transitive = false + } + compileOnly("com.github.GTNewHorizons:ForgeMultipart:1.2.7:dev") { + transitive = false + } + compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.2.17-GTNH:dev") { + transitive = false + } + compileOnly("com.github.GTNewHorizons:TinkersConstruct:1.9.0-16-GTNH:dev") { + transitive = false + } - compileOnly("curse.maven:minefactory-reloaded-66672:2366150") { - transitive = false - } - compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") { - transitive = false - } + compileOnly("curse.maven:minefactory-reloaded-66672:2366150") { + transitive = false + } + compileOnly("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev") { + transitive = false + } } diff --git a/repositories.gradle b/repositories.gradle index 77f2a1b9..8ba89bc5 100644 --- a/repositories.gradle +++ b/repositories.gradle @@ -1,14 +1,14 @@ // Add any additional repositiroes for your dependencies here repositories { - maven { - name = "GTNH Maven" - url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" - } - maven { - url "https://cursemaven.com" - } - maven { - url = "https://jitpack.io" - } + maven { + name = "GTNH Maven" + url = "http://jenkins.usrv.eu:8081/nexus/content/groups/public/" + } + maven { + url "https://cursemaven.com" + } + maven { + url = "https://jitpack.io" + } } diff --git a/src/main/java/mods/natura/CloudMaterial.java b/src/main/java/mods/natura/CloudMaterial.java index ad619823..eaada160 100644 --- a/src/main/java/mods/natura/CloudMaterial.java +++ b/src/main/java/mods/natura/CloudMaterial.java @@ -6,13 +6,13 @@ public class CloudMaterial extends Material { public CloudMaterial() { super(MapColor.snowColor); - //this.setReplaceable(); + // this.setReplaceable(); this.setNoPushMobility(); } /* Returns if blocks of these materials are liquids. */ @Override - public boolean isLiquid () { + public boolean isLiquid() { return false; } @@ -31,5 +31,4 @@ public boolean isSolid() { public boolean getCanBlockGrass() { return false; } - } diff --git a/src/main/java/mods/natura/Natura.java b/src/main/java/mods/natura/Natura.java index 039a96ac..71720a8d 100644 --- a/src/main/java/mods/natura/Natura.java +++ b/src/main/java/mods/natura/Natura.java @@ -1,22 +1,22 @@ package mods.natura; -import java.util.Random; - -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.EventHandler; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; +import cpw.mods.fml.common.event.FMLInterModComms; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.eventhandler.Event.Result; import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.GameRegistry; +import java.util.HashMap; +import java.util.Map; +import java.util.Random; import mantle.lib.TabTools; import mantle.pulsar.control.PulseManager; import mods.natura.common.NContent; @@ -41,6 +41,7 @@ import net.minecraft.entity.passive.EntitySheep; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.EntityJoinWorldEvent; @@ -48,20 +49,29 @@ import net.minecraftforge.event.entity.player.EntityInteractEvent; import net.minecraftforge.event.world.ChunkDataEvent; import net.minecraftforge.oredict.OreDictionary; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; -@Mod(modid = "Natura", name = "Natura", version = "GRADLETOKEN_VERSION", acceptedMinecraftVersions = "[1.7.10]", dependencies = "required-after:Mantle;after:TConstruct") +@Mod( + modid = "Natura", + name = "Natura", + version = "GRADLETOKEN_VERSION", + acceptedMinecraftVersions = "[1.7.10]", + dependencies = "required-after:Mantle;after:TConstruct") public class Natura { /* Proxies for sides, used for graphics processing */ @SidedProxy(clientSide = "mods.natura.client.NProxyClient", serverSide = "mods.natura.common.NProxyCommon") public static NProxyCommon proxy; + public static final String modID = "Natura"; /* Instance of this mod, used for grabbing prototype fields */ @Instance(modID) public static Natura instance; + public static Material cloud = new CloudMaterial(); public static Logger logger = LogManager.getLogger(modID); - + public static final PulseManager pulsar = new PulseManager(modID, "Natura-Dynamic"); @EventHandler @@ -86,11 +96,20 @@ public void preInit(FMLPreInitializationEvent evt) { public static BaseCloudWorldgen clouds; public static BaseTreeWorldgen trees; + public static final int DIM_WORLDGEN_CROP_BIT = 1; + public static final int DIM_WORLDGEN_CLOUD_BIT = 2; + public static final int DIM_WORLDGEN_TREE_BIT = 4; + private static final Map dimensionWorldgenOverrides = new HashMap<>(); + @EventHandler public void init(FMLInitializationEvent evt) { - if(PHNatura.enableBerryBushes | PHNatura.enableNetherBerryBushes) GameRegistry.registerWorldGenerator(crops = new BaseCropWorldgen(), 20); // TODO 1.7 Find correct weight (param 2) - GameRegistry.registerWorldGenerator(clouds = new BaseCloudWorldgen(), 20); // TODO 1.7 Find correct weight (param 2) - GameRegistry.registerWorldGenerator(trees = new BaseTreeWorldgen(), 20); // TODO 1.7 Find correct weight (param 2) + if (PHNatura.enableBerryBushes | PHNatura.enableNetherBerryBushes) + GameRegistry.registerWorldGenerator( + crops = new BaseCropWorldgen(), 20); // TODO 1.7 Find correct weight (param 2) + GameRegistry.registerWorldGenerator( + clouds = new BaseCloudWorldgen(), 20); // TODO 1.7 Find correct weight (param 2) + GameRegistry.registerWorldGenerator( + trees = new BaseTreeWorldgen(), 20); // TODO 1.7 Find correct weight (param 2) proxy.registerRenderer(); NetworkRegistry.INSTANCE.registerGuiHandler(instance, new NGuiHandler()); @@ -121,6 +140,45 @@ public void postInit(FMLPostInitializationEvent evt) { pulsar.postInit(evt); } + /** + * IMC Handler + * + * Message tag: set-worldgen-overrides + * Message NBT data: + * dimensions: int[] - array of dimension IDs to update + * settings: int[] - array of settings to set for the corresponding dimension IDs + * Both arrays must be of the same length + * Settings format: integer with bitfields, enable bits: 1 = crops (berry bushes), 2 = clouds, 4 = trees + */ + @EventHandler + public void imcHandler(FMLInterModComms.IMCEvent event) { + for (final FMLInterModComms.IMCMessage message : event.getMessages()) { + try { + if (message.key.equalsIgnoreCase("set-worldgen-overrides") && message.isNBTMessage()) { + NBTTagCompound tag = message.getNBTValue(); + int[] dimensions = tag.getIntArray("dimensions"); + int[] settings = tag.getIntArray("settings"); + if (dimensions == null || settings == null || dimensions.length != settings.length) { + FMLLog.warning("Invalid Natura IMC format, mismatched array lengths"); + continue; + } + synchronized (dimensionWorldgenOverrides) { + for (int i = 0; i < dimensions.length; i++) { + dimensionWorldgenOverrides.put(dimensions[i], settings[i]); + } + } + } + } catch (Exception e) { + FMLLog.warning("Exception while handling a Natura IMC message `{}`", message.key, e); + } + } + } + + public static int getDimensionWorldgenOverrides(int dimId) { + Integer val = dimensionWorldgenOverrides.get(dimId); + return (val != null) ? val : Integer.MAX_VALUE; + } + @SubscribeEvent public void bonemealEvent(BonemealEvent event) { if (!event.world.isRemote && !event.isCanceled() && event.getResult() != Result.ALLOW) { @@ -139,11 +197,15 @@ public void bonemealEvent(BonemealEvent event) { @SubscribeEvent public void interactEvent(EntityInteractEvent event) { - //if (event.target == null) + // if (event.target == null) if (event.target instanceof EntityCow || event.target instanceof EntitySheep) { ItemStack equipped = event.entityPlayer.getCurrentEquippedItem(); EntityAnimal creature = (EntityAnimal) event.target; - if (equipped != null && equipped.getItem() == NContent.plantItem && equipped.getItemDamage() == 0 && creature.getGrowingAge() == 0 && !creature.isInLove()) { + if (equipped != null + && equipped.getItem() == NContent.plantItem + && equipped.getItemDamage() == 0 + && creature.getGrowingAge() == 0 + && !creature.isInLove()) { EntityPlayer player = event.entityPlayer; if (!player.capabilities.isCreativeMode) { --equipped.stackSize; @@ -161,20 +223,22 @@ public void interactEvent(EntityInteractEvent event) { @SubscribeEvent public void spawnEvent(EntityJoinWorldEvent event) { if (event.entity instanceof EntityCow || event.entity instanceof EntitySheep) { - ((EntityLiving) event.entity).tasks.addTask(3, new EntityAITempt((EntityCreature) event.entity, 0.25F, NContent.plantItem, false)); + ((EntityLiving) event.entity) + .tasks.addTask( + 3, new EntityAITempt((EntityCreature) event.entity, 0.25F, NContent.plantItem, false)); } else if (event.entity instanceof EntityChicken) { - ((EntityLiving) event.entity).tasks.addTask(3, new EntityAITempt((EntityCreature) event.entity, 0.25F, NContent.seeds, false)); + ((EntityLiving) event.entity) + .tasks.addTask(3, new EntityAITempt((EntityCreature) event.entity, 0.25F, NContent.seeds, false)); } } public static boolean retrogen; @SubscribeEvent - public void chunkDataSave (ChunkDataEvent.Save event) { + public void chunkDataSave(ChunkDataEvent.Save event) { event.getData().setBoolean("Natura.Retrogen", true); } NContent content; public static Random random = new Random(); - } diff --git a/src/main/java/mods/natura/blocks/CloudBlock.java b/src/main/java/mods/natura/blocks/CloudBlock.java index 860b70fc..2f8ee236 100644 --- a/src/main/java/mods/natura/blocks/CloudBlock.java +++ b/src/main/java/mods/natura/blocks/CloudBlock.java @@ -17,7 +17,7 @@ public class CloudBlock extends NBlock { public CloudBlock() { - super(Natura.cloud, 0.3F, new String[] { "cloud_white", "cloud_gray", "cloud_dark", "cloud_sulfur" }); + super(Natura.cloud, 0.3F, new String[] {"cloud_white", "cloud_gray", "cloud_dark", "cloud_sulfur"}); this.setStepSound(soundTypeCloth); this.setBlockName("cloud"); this.setCreativeTab(NaturaTab.tab); @@ -30,7 +30,15 @@ public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity e EntityArrow entityarrow = (EntityArrow) entity; if (entityarrow.isBurning()) { - this.explode(world, x, y, z, 1, entityarrow.shootingEntity instanceof EntityLiving ? (EntityLiving) entityarrow.shootingEntity : null); + this.explode( + world, + x, + y, + z, + 1, + entityarrow.shootingEntity instanceof EntityLiving + ? (EntityLiving) entityarrow.shootingEntity + : null); world.setBlockToAir(x, y, z); return; } @@ -43,9 +51,12 @@ public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity e } @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) { int meta = world.getBlockMetadata(x, y, z); - if (meta == 3 && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() == Items.flint_and_steel) { + if (meta == 3 + && player.getCurrentEquippedItem() != null + && player.getCurrentEquippedItem().getItem() == Items.flint_and_steel) { world.setBlockToAir(x, y, z); this.explode(world, x, y, z, 1, player); return true; @@ -119,5 +130,4 @@ public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, return AxisAlignedBB.getBoundingBox(x, y, z, x + 1.0D, y + 0.0625D, z + 1.0D); } } - } diff --git a/src/main/java/mods/natura/blocks/GrassBlock.java b/src/main/java/mods/natura/blocks/GrassBlock.java index ad3f37be..f00d3424 100644 --- a/src/main/java/mods/natura/blocks/GrassBlock.java +++ b/src/main/java/mods/natura/blocks/GrassBlock.java @@ -1,9 +1,8 @@ package mods.natura.blocks; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mods.natura.client.GrassColorizerAlternate; import mods.natura.common.NaturaTab; import net.minecraft.block.Block; @@ -27,13 +26,13 @@ public GrassBlock() { @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons (IIconRegister iconRegister) { + public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon("natura:grass_top"); } @Override @SideOnly(Side.CLIENT) - public IIcon getIcon (int side, int meta) { + public IIcon getIcon(int side, int meta) { return this.blockIcon; } @@ -62,12 +61,12 @@ public int getRenderColor(int meta) { double d0 = 0.5D; double d1 = 1.0D; switch (meta) { - case 1: - return GrassColorizerAlternate.getBlueGrassColor(d0, 0.5D); - case 2: - return GrassColorizerAlternate.getOrangeGrassColor(1.0D, 1.0D); - default: - return ColorizerGrass.getGrassColor(d0, d1); + case 1: + return GrassColorizerAlternate.getBlueGrassColor(d0, 0.5D); + case 2: + return GrassColorizerAlternate.getOrangeGrassColor(1.0D, 1.0D); + default: + return ColorizerGrass.getGrassColor(d0, d1); } } @@ -86,18 +85,18 @@ public int colorMultiplier(IBlockAccess world, int x, int y, int z) { double temp = 0d; double rainfall = 0d; switch (meta) { - case 1: - temp = MathHelper.clamp_float(biome.getFloatTemperature(x, y, z), 0.0F, 1.0F); - rainfall = MathHelper.clamp_float(biome.getFloatRainfall(), 0.0F, 1.0F); - grassColor = GrassColorizerAlternate.getBlueGrassColor(temp, rainfall); - break; - case 2: - temp = MathHelper.clamp_float(biome.getFloatTemperature(x, y, z), 0.0F, 1.0F); - rainfall = MathHelper.clamp_float(biome.getFloatRainfall(), 0.0F, 1.0F); - grassColor = GrassColorizerAlternate.getOrangeGrassColor(temp, rainfall); - break; - default: - grassColor = biome.getBiomeGrassColor(x, y, z); + case 1: + temp = MathHelper.clamp_float(biome.getFloatTemperature(x, y, z), 0.0F, 1.0F); + rainfall = MathHelper.clamp_float(biome.getFloatRainfall(), 0.0F, 1.0F); + grassColor = GrassColorizerAlternate.getBlueGrassColor(temp, rainfall); + break; + case 2: + temp = MathHelper.clamp_float(biome.getFloatTemperature(x, y, z), 0.0F, 1.0F); + rainfall = MathHelper.clamp_float(biome.getFloatRainfall(), 0.0F, 1.0F); + grassColor = GrassColorizerAlternate.getOrangeGrassColor(temp, rainfall); + break; + default: + grassColor = biome.getBiomeGrassColor(x, y, z); } l += (grassColor & 16711680) >> 16; i1 += (grassColor & 65280) >> 8; @@ -106,5 +105,4 @@ public int colorMultiplier(IBlockAccess world, int x, int y, int z) { } return (l / 9 & 255) << 16 | (i1 / 9 & 255) << 8 | j1 / 9 & 255; } - } diff --git a/src/main/java/mods/natura/blocks/GrassSlab.java b/src/main/java/mods/natura/blocks/GrassSlab.java index c18de784..12cff5ce 100644 --- a/src/main/java/mods/natura/blocks/GrassSlab.java +++ b/src/main/java/mods/natura/blocks/GrassSlab.java @@ -1,9 +1,8 @@ package mods.natura.blocks; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mods.natura.client.GrassColorizerAlternate; import mods.natura.common.NaturaTab; import net.minecraft.block.material.Material; @@ -32,7 +31,7 @@ public void registerBlockIcons(IIconRegister iconRegister) { @Override @SideOnly(Side.CLIENT) - public IIcon getIcon (int side, int meta) { + public IIcon getIcon(int side, int meta) { return this.blockIcon; } @@ -61,14 +60,13 @@ public int getRenderColor(int meta) { double d0 = 0.5D; double d1 = 1.0D; switch (meta) { - case 1: - return GrassColorizerAlternate.getBlueGrassColor(d0, 0.5D); - case 2: - return GrassColorizerAlternate.getOrangeGrassColor(1.0D, 1.0D); - default: - return ColorizerGrass.getGrassColor(d0, d1); + case 1: + return GrassColorizerAlternate.getBlueGrassColor(d0, 0.5D); + case 2: + return GrassColorizerAlternate.getOrangeGrassColor(1.0D, 1.0D); + default: + return ColorizerGrass.getGrassColor(d0, d1); } - } @Override @@ -86,18 +84,18 @@ public int colorMultiplier(IBlockAccess world, int x, int y, int z) { double temp = 0d; double rainfall = 0d; switch (meta) { - case 1: - temp = MathHelper.clamp_float(biome.getFloatTemperature(x, y, z), 0.0F, 1.0F); - rainfall = MathHelper.clamp_float(biome.getFloatRainfall(), 0.0F, 1.0F); - grassColor = GrassColorizerAlternate.getBlueGrassColor(temp, rainfall); - break; - case 2: - temp = MathHelper.clamp_float(biome.getFloatTemperature(x, y, z), 0.0F, 1.0F); - rainfall = MathHelper.clamp_float(biome.getFloatRainfall(), 0.0F, 1.0F); - grassColor = GrassColorizerAlternate.getOrangeGrassColor(temp, rainfall); - break; - default: - grassColor = biome.getBiomeGrassColor(x, y, z); + case 1: + temp = MathHelper.clamp_float(biome.getFloatTemperature(x, y, z), 0.0F, 1.0F); + rainfall = MathHelper.clamp_float(biome.getFloatRainfall(), 0.0F, 1.0F); + grassColor = GrassColorizerAlternate.getBlueGrassColor(temp, rainfall); + break; + case 2: + temp = MathHelper.clamp_float(biome.getFloatTemperature(x, y, z), 0.0F, 1.0F); + rainfall = MathHelper.clamp_float(biome.getFloatRainfall(), 0.0F, 1.0F); + grassColor = GrassColorizerAlternate.getOrangeGrassColor(temp, rainfall); + break; + default: + grassColor = biome.getBiomeGrassColor(x, y, z); } l += (grassColor & 16711680) >> 16; i1 += (grassColor & 65280) >> 8; @@ -106,5 +104,4 @@ public int colorMultiplier(IBlockAccess world, int x, int y, int z) { } return (l / 9 & 255) << 16 | (i1 / 9 & 255) << 8 | j1 / 9 & 255; } - } diff --git a/src/main/java/mods/natura/blocks/NBlock.java b/src/main/java/mods/natura/blocks/NBlock.java index 0ff7e25e..98ac03c3 100644 --- a/src/main/java/mods/natura/blocks/NBlock.java +++ b/src/main/java/mods/natura/blocks/NBlock.java @@ -1,9 +1,8 @@ package mods.natura.blocks; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mods.natura.common.NaturaTab; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -51,5 +50,4 @@ public void getSubBlocks(Item id, CreativeTabs tab, List list) { list.add(new ItemStack(id, 1, iter)); } } - } diff --git a/src/main/java/mods/natura/blocks/NButton.java b/src/main/java/mods/natura/blocks/NButton.java index 6b34a6b6..c323416d 100644 --- a/src/main/java/mods/natura/blocks/NButton.java +++ b/src/main/java/mods/natura/blocks/NButton.java @@ -21,13 +21,11 @@ public NButton(Block block, int meta) { @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) { - } + public void registerBlockIcons(IIconRegister iconRegister) {} @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int meta) { return modelBlock.getIcon(side, modelMeta); } - } diff --git a/src/main/java/mods/natura/blocks/NFenceGate.java b/src/main/java/mods/natura/blocks/NFenceGate.java index b56eb861..598cf510 100644 --- a/src/main/java/mods/natura/blocks/NFenceGate.java +++ b/src/main/java/mods/natura/blocks/NFenceGate.java @@ -21,13 +21,11 @@ public NFenceGate(Block block, int meta) { @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) { - } + public void registerBlockIcons(IIconRegister iconRegister) {} @Override @SideOnly(Side.CLIENT) - public IIcon getIcon (int side, int meta) { + public IIcon getIcon(int side, int meta) { return modelBlock.getIcon(side, modelMeta); } - } diff --git a/src/main/java/mods/natura/blocks/NLadder.java b/src/main/java/mods/natura/blocks/NLadder.java index 7787f947..649760c3 100644 --- a/src/main/java/mods/natura/blocks/NLadder.java +++ b/src/main/java/mods/natura/blocks/NLadder.java @@ -1,9 +1,8 @@ package mods.natura.blocks; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mods.natura.common.NaturaTab; import net.minecraft.block.BlockLadder; import net.minecraft.client.renderer.texture.IIconRegister; @@ -36,8 +35,7 @@ public void registerBlockIcons(IIconRegister iconRegister) { @Override @SideOnly(Side.CLIENT) - public IIcon getIcon(int side, int meta) - { + public IIcon getIcon(int side, int meta) { return icons[meta / 4]; } @@ -47,5 +45,4 @@ public void getSubBlocks(Item id, CreativeTabs tab, List list) { list.add(new ItemStack(id, 1, iter * 4)); } } - } diff --git a/src/main/java/mods/natura/blocks/NPressurePlate.java b/src/main/java/mods/natura/blocks/NPressurePlate.java index 0894f0e0..29ca9dba 100644 --- a/src/main/java/mods/natura/blocks/NPressurePlate.java +++ b/src/main/java/mods/natura/blocks/NPressurePlate.java @@ -22,13 +22,11 @@ public NPressurePlate(Material material, Sensitivity s, Block block, int meta) { @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) { - } + public void registerBlockIcons(IIconRegister iconRegister) {} @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int meta) { return modelBlock.getIcon(side, modelMeta); } - } diff --git a/src/main/java/mods/natura/blocks/NSlabBase.java b/src/main/java/mods/natura/blocks/NSlabBase.java index 474ddfec..5e5fce8b 100644 --- a/src/main/java/mods/natura/blocks/NSlabBase.java +++ b/src/main/java/mods/natura/blocks/NSlabBase.java @@ -1,9 +1,8 @@ package mods.natura.blocks; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mods.natura.common.NaturaTab; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -36,7 +35,8 @@ public NSlabBase(Material material, Block model, int meta, int totalSize) { } @Override - public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB axisalignedbb, List arraylist, Entity entity) { + public void addCollisionBoxesToList( + World world, int x, int y, int z, AxisAlignedBB axisalignedbb, List arraylist, Entity entity) { setBlockBoundsBasedOnState(world, x, y, z); super.addCollisionBoxesToList(world, x, y, z, axisalignedbb, arraylist, entity); } @@ -55,11 +55,18 @@ public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) } @Override - public int onBlockPlaced(World par1World, int blockX, int blockY, int blockZ, int side, float clickX, float clickY, float clickZ, int metadata) { - if (side == 1) - return metadata; - if (side == 0 || clickY >= 0.5F) - return metadata | 8; + public int onBlockPlaced( + World par1World, + int blockX, + int blockY, + int blockZ, + int side, + float clickX, + float clickY, + float clickZ, + int metadata) { + if (side == 1) return metadata; + if (side == 0 || clickY >= 0.5F) return metadata | 8; return metadata; } @@ -76,12 +83,11 @@ public boolean renderAsNormalBlock() { @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) { - } + public void registerBlockIcons(IIconRegister iconRegister) {} @Override @SideOnly(Side.CLIENT) - public IIcon getIcon (int side, int meta) { + public IIcon getIcon(int side, int meta) { meta = meta % 8 + startingMeta; return modelBlock.getIcon(side, meta); } @@ -95,8 +101,7 @@ public void getSubBlocks(Item id, CreativeTabs tab, List list) { } @Override - public int damageDropped (int meta) { + public int damageDropped(int meta) { return meta % 8; } - } diff --git a/src/main/java/mods/natura/blocks/NStairs.java b/src/main/java/mods/natura/blocks/NStairs.java index 86bee219..9c0b0ba3 100644 --- a/src/main/java/mods/natura/blocks/NStairs.java +++ b/src/main/java/mods/natura/blocks/NStairs.java @@ -10,5 +10,4 @@ public NStairs(Block par2Block, int par3) { this.setCreativeTab(NaturaTab.tab); this.setLightOpacity(0); } - } diff --git a/src/main/java/mods/natura/blocks/NTrapdoor.java b/src/main/java/mods/natura/blocks/NTrapdoor.java index 1a9b06a5..c4d36d92 100644 --- a/src/main/java/mods/natura/blocks/NTrapdoor.java +++ b/src/main/java/mods/natura/blocks/NTrapdoor.java @@ -29,5 +29,4 @@ public void registerBlockIcons(IIconRegister iconRegister) { public IIcon getIcon(int side, int meta) { return this.blockIcon; } - } diff --git a/src/main/java/mods/natura/blocks/NaturaSnow.java b/src/main/java/mods/natura/blocks/NaturaSnow.java index 99e13788..de65b6b5 100644 --- a/src/main/java/mods/natura/blocks/NaturaSnow.java +++ b/src/main/java/mods/natura/blocks/NaturaSnow.java @@ -1,7 +1,6 @@ package mods.natura.blocks; import java.util.Random; - import net.minecraft.block.BlockSnow; import net.minecraft.init.Blocks; import net.minecraft.world.EnumSkyBlock; @@ -39,13 +38,11 @@ void scanHeight(World world, int x, int y, int z, Random random) { if (world.isAirBlock(x, y + 1, z)) { int var6; - for (var6 = 1; world.getBlock(x, y - var6, z) == Blocks.snow; ++var6) { - } + for (var6 = 1; world.getBlock(x, y - var6, z) == Blocks.snow; ++var6) {} if (var6 < 3) { world.setBlock(x, y, z, Blocks.snow, 0, 3); } } } - } diff --git a/src/main/java/mods/natura/blocks/crops/BerryBush.java b/src/main/java/mods/natura/blocks/crops/BerryBush.java index ed9c9e12..ff9bcdba 100644 --- a/src/main/java/mods/natura/blocks/crops/BerryBush.java +++ b/src/main/java/mods/natura/blocks/crops/BerryBush.java @@ -1,10 +1,9 @@ package mods.natura.blocks.crops; -import java.util.List; -import java.util.Random; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; +import java.util.Random; import mods.natura.client.BerryRender; import mods.natura.common.NContent; import mods.natura.common.NaturaTab; @@ -31,7 +30,16 @@ public class BerryBush extends BlockLeavesBase implements IPlantable { Random random; public IIcon[] fastIcons; public IIcon[] fancyIcons; - public static String[] textureNames = new String[] { "raspberry", "blueberry", "blackberry", "geoberry", "raspberry_ripe", "blueberry_ripe", "blackberry_ripe", "geoberry_ripe" }; + public static String[] textureNames = new String[] { + "raspberry", + "blueberry", + "blackberry", + "geoberry", + "raspberry_ripe", + "blueberry_ripe", + "blackberry_ripe", + "geoberry_ripe" + }; public BerryBush() { super(Material.leaves, false); @@ -60,12 +68,12 @@ public void registerBlockIcons(IIconRegister iconRegister) { @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int metadata) { - return (Blocks.leaves.isOpaqueCube() ? fastIcons : fancyIcons)[metadata % 4 + (metadata < 12 ? 0 : 4)]; + return (Blocks.leaves.isOpaqueCube() ? fastIcons : fancyIcons)[metadata % 4 + (metadata < 12 ? 0 : 4)]; } /* Bushes are stored by size then type */ @Override - public int damageDropped (int metadata) { + public int damageDropped(int metadata) { return metadata % 4; } @@ -128,30 +136,38 @@ public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player int meta = world.getBlockMetadata(x, y, z); if (meta >= 12) { world.setBlock(x, y, z, this, meta - 4, 3); - EntityItem entityitem = new EntityItem(world, player.posX, player.posY - 1.0D, player.posZ, new ItemStack(NContent.berryItem, 1, meta - 12)); + EntityItem entityitem = new EntityItem( + world, + player.posX, + player.posY - 1.0D, + player.posZ, + new ItemStack(NContent.berryItem, 1, meta - 12)); world.spawnEntityInWorld(entityitem); - if (!(player instanceof FakePlayer)) - entityitem.onCollideWithPlayer(player); + if (!(player instanceof FakePlayer)) entityitem.onCollideWithPlayer(player); } } } /* Right-click harvests berries */ @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;*/ + return false;*/ int meta = world.getBlockMetadata(x, y, z); - if (meta >= 12) { - if (world.isRemote) - return true; + if (meta >= 12) { + if (world.isRemote) return true; world.setBlock(x, y, z, this, meta - 4, 3); - EntityItem entityitem = new EntityItem(world, player.posX, player.posY - 1.0D, player.posZ, new ItemStack(NContent.berryItem, 1, meta - 12)); + EntityItem entityitem = new EntityItem( + world, + player.posX, + player.posY - 1.0D, + player.posZ, + new ItemStack(NContent.berryItem, 1, meta - 12)); world.spawnEntityInWorld(entityitem); - if (!(player instanceof FakePlayer)) - entityitem.onCollideWithPlayer(player); + if (!(player instanceof FakePlayer)) entityitem.onCollideWithPlayer(player); return true; } return false; @@ -177,31 +193,32 @@ public int getRenderType() { @Override public boolean shouldSideBeRendered(IBlockAccess blockAccess, int x, int y, int z, int side) { Block block = blockAccess.getBlock(x, y, z); - //If the block touching the side is same type of bush and not fully grown then render side. + // If the block touching the side is same type of bush and not fully grown then render side. if (block == this & blockAccess.getBlockMetadata(x, y, z) < 8) { return true; - //If this block is fully grown and is touching a bush (fast mode) or solid block then don't render (Would be way less complex if metadata was passed in) + // If this block is fully grown and is touching a bush (fast mode) or solid block then don't render (Would + // be way less complex if metadata was passed in) } else if ((Blocks.leaves.isOpaqueCube() & block == this) | block.isOpaqueCube()) { - switch(side) { - case 0://-y - return false; - case 1://+y - if (blockAccess.getBlockMetadata(x, y - 1, z) > 7) return false; - break; - case 2://-z - if (blockAccess.getBlockMetadata(x, y, z + 1) > 7) return false; - break; - case 3://+z - if (blockAccess.getBlockMetadata(x, y, z - 1) > 7) return false; - break; - case 4://-x - if (blockAccess.getBlockMetadata(x + 1, y, z) > 7) return false; - break; - case 5://+x - if (blockAccess.getBlockMetadata(x - 1, y, z) > 7) return false; + switch (side) { + case 0: // -y + return false; + case 1: // +y + if (blockAccess.getBlockMetadata(x, y - 1, z) > 7) return false; + break; + case 2: // -z + if (blockAccess.getBlockMetadata(x, y, z + 1) > 7) return false; + break; + case 3: // +z + if (blockAccess.getBlockMetadata(x, y, z - 1) > 7) return false; + break; + case 4: // -x + if (blockAccess.getBlockMetadata(x + 1, y, z) > 7) return false; + break; + case 5: // +x + if (blockAccess.getBlockMetadata(x - 1, y, z) > 7) return false; } } - //If none of the above then render side. + // If none of the above then render side. return true; } @@ -214,8 +231,7 @@ public void updateTick(World world, int x, int y, int z, Random random1) { int height; - for (height = 1; world.getBlock(x, y - height, z) == this; ++height) { - } + for (height = 1; world.getBlock(x, y - height, z) == this; ++height) {} if (random1.nextInt(20) == 0 && world.getBlockLightValue(x, y, z) >= 8) { int md = world.getBlockMetadata(x, y, z); @@ -229,8 +245,7 @@ public void updateTick(World world, int x, int y, int z, Random random1) { } public boolean canSustainPlant(World world, int x, int y, int z, ForgeDirection direction, IPlantable plant) { - if (plant instanceof BerryBush) - return (world.getBlockMetadata(x, y, z) > 7); + if (plant instanceof BerryBush) return (world.getBlockMetadata(x, y, z) > 7); return super.canSustainPlant(world, x, y, z, direction, plant); } @@ -279,21 +294,18 @@ public boolean boneFertilize(World world, int x, int y, int z, Random random) { if (meta / 4 < 2) { int setMeta = random.nextInt(2) + 1 + meta / 4; - if (setMeta > 2) - setMeta = 2; + if (setMeta > 2) setMeta = 2; world.setBlockMetadataWithNotify(x, y, z, meta % 4 + setMeta * 4, 4); return true; } Block block = world.getBlock(x, y + 1, z); if (block == null || world.isAirBlock(x, y + 1, z)) { - if (random.nextInt(3) == 0) - world.setBlock(x, y + 1, z, this, meta % 4, 3); + if (random.nextInt(3) == 0) world.setBlock(x, y + 1, z, this, meta % 4, 3); return true; } return false; } - } diff --git a/src/main/java/mods/natura/blocks/crops/CropBlock.java b/src/main/java/mods/natura/blocks/crops/CropBlock.java index bdfa916f..8654b855 100644 --- a/src/main/java/mods/natura/blocks/crops/CropBlock.java +++ b/src/main/java/mods/natura/blocks/crops/CropBlock.java @@ -1,10 +1,9 @@ package mods.natura.blocks.crops; -import java.util.ArrayList; -import java.util.Random; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.Random; import mods.natura.client.CropRender; import mods.natura.common.NContent; import net.minecraft.block.Block; @@ -27,16 +26,16 @@ public CropBlock() { this.setTickRandomly(true); float var3 = 0.5F; this.setBlockBounds(0.5F - var3, 0.0F, 0.5F - var3, 0.5F + var3, 0.25F, 0.5F + var3); - //this.setCreativeTab((CreativeTabs) null); + // this.setCreativeTab((CreativeTabs) null); this.setHardness(0.0F); this.setStepSound(soundTypeGrass); this.disableStats(); } - + public int getMaxGrowth(int meta) { return (meta < 4) ? 3 : 8; } - + public int getStartGrowth(int meta) { return (meta < 4) ? 0 : 4; } @@ -65,11 +64,9 @@ protected float getGrowthRate(World world, int x, int y, int z, int meta, int li float growth = 0.25f * (light - 7); Block soil = world.getBlock(x, y - 1, z); - if (world.canBlockSeeTheSky(x, y, z) || !requiresSun(meta)) - growth += 2f; + if (world.canBlockSeeTheSky(x, y, z) || !requiresSun(meta)) growth += 2f; - if (soil != null && soil.isFertile(world, x, y - 1, z)) - growth *= 2f; + if (soil != null && soil.isFertile(world, x, y - 1, z)) growth *= 2f; return 1f + growth; } @@ -85,7 +82,8 @@ public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player int meta = world.getBlockMetadata(x, y, z); if (meta == 8) { world.setBlock(x, y, z, this, 6, 3); - EntityItem entityitem = new EntityItem(world, player.posX, player.posY - 1.0D, player.posZ, new ItemStack(NContent.plantItem, 1, 3)); + EntityItem entityitem = new EntityItem( + world, player.posX, player.posY - 1.0D, player.posZ, new ItemStack(NContent.plantItem, 1, 3)); world.spawnEntityInWorld(entityitem); entityitem.onCollideWithPlayer(player); } @@ -94,17 +92,18 @@ public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player /* Right-click harvests crops */ @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;*/ + return false;*/ int meta = world.getBlockMetadata(x, y, z); if (meta == 8) { - if (world.isRemote) - return true; + if (world.isRemote) return true; world.setBlock(x, y, z, this, 6, 3); - EntityItem entityitem = new EntityItem(world, player.posX, player.posY - 1.0D, player.posZ, new ItemStack(NContent.plantItem, 1, 3)); + EntityItem entityitem = new EntityItem( + world, player.posX, player.posY - 1.0D, player.posZ, new ItemStack(NContent.plantItem, 1, 3)); world.spawnEntityInWorld(entityitem); entityitem.onCollideWithPlayer(player); return true; @@ -114,17 +113,18 @@ public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer p @Override public float getBlockHardness(World world, int x, int y, int z) { - if (world.getBlockMetadata(x, y, z) > 3) - return 0.5f; + if (world.getBlockMetadata(x, y, z) > 3) return 0.5f; return this.blockHardness; } public IIcon[] icons; - public String[] textureNames = new String[] { "barley_1", "barley_2", "barley_3", "barley_4", "cotton_1", "cotton_2", "cotton_3", "cotton_4", "cotton_5" }; + public String[] textureNames = new String[] { + "barley_1", "barley_2", "barley_3", "barley_4", "cotton_1", "cotton_2", "cotton_3", "cotton_4", "cotton_5" + }; @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons (IIconRegister iconRegister) { + public void registerBlockIcons(IIconRegister iconRegister) { this.icons = new IIcon[textureNames.length]; for (int i = 0; i < this.icons.length; ++i) { @@ -146,8 +146,7 @@ public int getRenderType() { @Override public Item getItemDropped(int meta, Random random, int fortune) { - if (meta == 3 || meta == 8) - return this.getCropItem(meta); + if (meta == 3 || meta == 8) return this.getCropItem(meta); return this.getSeedItem(meta); } @@ -161,14 +160,12 @@ public Item getSeedItem(int meta) { @Override public int damageDropped(int meta) { - if (meta < 4) - return 0; + if (meta < 4) return 0; return 3; } public int seedDamageDropped(int meta) { - if (meta < 4) - return 0; + if (meta < 4) return 0; return 1; } @@ -215,7 +212,6 @@ public int quantityDropped(int meta, int fortune, Random random) { return random.nextInt(meta/4); }*/ - /* only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) */ @SideOnly(Side.CLIENT) @Override @@ -236,9 +232,8 @@ public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z) { /* Can this block stay at this position. Similar to canPlaceBlockAt except gets checked often with plants. */ @Override public boolean canBlockStay(World world, int x, int y, int z) { - int meta = world.getBlockMetadata(x, y, z); //Wild crops can stay - if (meta == 3 || meta == 8) - return world.getBlock(x, y - 1, z) != Blocks.air; + int meta = world.getBlockMetadata(x, y, z); // Wild crops can stay + if (meta == 3 || meta == 8) return world.getBlock(x, y - 1, z) != Blocks.air; return super.canBlockStay(world, x, y, z); } @@ -246,10 +241,8 @@ public boolean canBlockStay(World world, int x, int y, int z) { @Override public int getPlantMetadata(IBlockAccess world, int x, int y, int z) { int meta = world.getBlockMetadata(x, y, z); - if (meta < 4) - return 0; - else - return 4; + if (meta < 4) return 0; + else return 4; } // isNotFullyGrown @@ -274,13 +267,10 @@ public void func_149853_b(World world, Random random, int x, int y, int z) { int maxGrowth = this.getMaxGrowth(meta); int growthSpan = maxGrowth - this.getStartGrowth(meta); int output = random.nextInt(growthSpan) + 1 + meta; - - if (output > maxGrowth) - output = maxGrowth; - - if (output != meta) - world.setBlockMetadataWithNotify(x, y, z, output, 3); + + if (output > maxGrowth) output = maxGrowth; + + if (output != meta) world.setBlockMetadataWithNotify(x, y, z, output, 3); } } - } diff --git a/src/main/java/mods/natura/blocks/crops/FlowerBlock.java b/src/main/java/mods/natura/blocks/crops/FlowerBlock.java index 8efc5bb2..6b48dbc2 100644 --- a/src/main/java/mods/natura/blocks/crops/FlowerBlock.java +++ b/src/main/java/mods/natura/blocks/crops/FlowerBlock.java @@ -39,5 +39,4 @@ public IIcon getIcon(int p_149691_1_, int p_149691_2_) { public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon("natura:flower_bluebells"); } - } diff --git a/src/main/java/mods/natura/blocks/crops/Glowshroom.java b/src/main/java/mods/natura/blocks/crops/Glowshroom.java index cf13985f..7c90240f 100644 --- a/src/main/java/mods/natura/blocks/crops/Glowshroom.java +++ b/src/main/java/mods/natura/blocks/crops/Glowshroom.java @@ -1,10 +1,9 @@ package mods.natura.blocks.crops; -import java.util.List; -import java.util.Random; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; +import java.util.Random; import mods.natura.common.NaturaTab; import mods.natura.worldgen.GlowshroomGenBlueGreen; import mods.natura.worldgen.GlowshroomGenPurple; @@ -19,7 +18,7 @@ public class Glowshroom extends BlockMushroom { IIcon[] icons; - String[] textureNames = { "green", "purple", "blue" }; + String[] textureNames = {"green", "purple", "blue"}; public Glowshroom() { super(); @@ -74,22 +73,21 @@ public void updateTick(World world, int x, int y, int z, Random random) { } public boolean fertilizeMushroom(World world, int x, int y, int z, Random random) { - if (world.isRemote) - return false; + if (world.isRemote) return false; int meta = world.getBlockMetadata(x, y, z); world.setBlockToAir(x, y, z); WorldGenerator obj = null; switch (meta) { - case 0: - obj = new GlowshroomGenBlueGreen(true, 0); - break; - case 1: - obj = new GlowshroomGenPurple(true); - break; - case 2: - obj = new GlowshroomGenBlueGreen(true, 1); + case 0: + obj = new GlowshroomGenBlueGreen(true, 0); + break; + case 1: + obj = new GlowshroomGenPurple(true); + break; + case 2: + obj = new GlowshroomGenBlueGreen(true, 1); } if (obj != null && obj.generate(world, random, x, y, z)) { @@ -125,8 +123,6 @@ public int damageDropped(int meta) { @SideOnly(Side.CLIENT) @Override public void getSubBlocks(Item item, CreativeTabs par2CreativeTabs, List par3List) { - for (int i = 0; i < icons.length; i++) - par3List.add(new ItemStack(item, 1, i)); + for (int i = 0; i < icons.length; i++) par3List.add(new ItemStack(item, 1, i)); } - } diff --git a/src/main/java/mods/natura/blocks/crops/HerbBlock.java b/src/main/java/mods/natura/blocks/crops/HerbBlock.java index 648d87b0..4ea1a9c4 100644 --- a/src/main/java/mods/natura/blocks/crops/HerbBlock.java +++ b/src/main/java/mods/natura/blocks/crops/HerbBlock.java @@ -1,7 +1,6 @@ package mods.natura.blocks.crops; import java.util.Random; - import mods.natura.common.NContent; import mods.natura.common.NaturaTab; import net.minecraft.block.Block; @@ -26,7 +25,7 @@ protected HerbBlock() { } @Override - public void updateTick (World world, int x, int y, int z, Random random) { + public void updateTick(World world, int x, int y, int z, Random random) { this.checkAndDropBlock(world, x, y, z); int light = world.getBlockLightValue(x, y, z); @@ -45,8 +44,7 @@ public void updateTick (World world, int x, int y, int z, Random random) { } /* Apply bonemeal to the crops. */ - public void fertilize(World world, int x, int y, int z) { - } + public void fertilize(World world, int x, int y, int z) {} @Override boolean requiresSun(int meta) { @@ -90,5 +88,4 @@ public boolean canBlockStay(World par1World, int x, int y, int z) { Block soil = par1World.getBlock(x, y - 1, z); return soil != null && soil.getMaterial() == Material.rock; } - } diff --git a/src/main/java/mods/natura/blocks/crops/LargeGlowshroom.java b/src/main/java/mods/natura/blocks/crops/LargeGlowshroom.java index addaf6b4..c5a8a768 100644 --- a/src/main/java/mods/natura/blocks/crops/LargeGlowshroom.java +++ b/src/main/java/mods/natura/blocks/crops/LargeGlowshroom.java @@ -1,9 +1,8 @@ package mods.natura.blocks.crops; -import java.util.Random; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.Random; import mods.natura.common.NContent; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -20,10 +19,13 @@ public class LargeGlowshroom extends Block { private final String mushroomType; + @SideOnly(Side.CLIENT) private IIcon iconSkin; + @SideOnly(Side.CLIENT) private IIcon iconStem; + @SideOnly(Side.CLIENT) private IIcon iconInside; @@ -38,9 +40,21 @@ public LargeGlowshroom(Material material, String type) { @SideOnly(Side.CLIENT) @Override public IIcon getIcon(int side, int meta) { - return meta == 10 && side > 1 ? this.iconStem : (meta >= 1 && meta <= 9 && side == 1 ? this.iconSkin : (meta >= 1 && meta <= 3 && side == 2 ? this.iconSkin : (meta >= 7 && meta <= 9 - && side == 3 ? this.iconSkin : ((meta == 1 || meta == 4 || meta == 7) && side == 4 ? this.iconSkin : ((meta == 3 || meta == 6 || meta == 9) && side == 5 ? this.iconSkin - : (meta == 14 ? this.iconSkin : (meta == 15 ? this.iconStem : this.iconInside))))))); + return meta == 10 && side > 1 + ? this.iconStem + : (meta >= 1 && meta <= 9 && side == 1 + ? this.iconSkin + : (meta >= 1 && meta <= 3 && side == 2 + ? this.iconSkin + : (meta >= 7 && meta <= 9 && side == 3 + ? this.iconSkin + : ((meta == 1 || meta == 4 || meta == 7) && side == 4 + ? this.iconSkin + : ((meta == 3 || meta == 6 || meta == 9) && side == 5 + ? this.iconSkin + : (meta == 14 + ? this.iconSkin + : (meta == 15 ? this.iconStem : this.iconInside))))))); } /* Returns the quantity of items to drop on block destruction. */ @@ -57,12 +71,9 @@ public int quantityDropped(Random par1Random) { @Override public int damageDropped(int meta) { - if (this == NContent.glowshroomBlue) - return 2; - if (this == NContent.glowshroomPurple) - return 1; - if (this == NContent.glowshroomGreen) - return 0; + if (this == NContent.glowshroomBlue) return 2; + if (this == NContent.glowshroomPurple) return 1; + if (this == NContent.glowshroomGreen) return 0; return 0; } @@ -95,7 +106,6 @@ public Item getItemDropped(int par1, Random par2Random, int par3) { return Item.getItemFromBlock(NContent.glowshroom); } - /* only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) */ /*@SideOnly(Side.CLIENT) public Item getItem(World world, int x, int y, int z) { @@ -121,8 +131,7 @@ public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, @Override public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { - if (entity.motionY < 0) - entity.motionY *= 0.25F; + if (entity.motionY < 0) entity.motionY *= 0.25F; entity.fallDistance -= 0.25f; if (entity.motionY == 0f) { @@ -135,5 +144,4 @@ public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity e living.addPotionEffect(new PotionEffect(Potion.confusion.id, 100, 0)); } } - } diff --git a/src/main/java/mods/natura/blocks/crops/NetherBerryBush.java b/src/main/java/mods/natura/blocks/crops/NetherBerryBush.java index 24e583b3..674ec1ac 100644 --- a/src/main/java/mods/natura/blocks/crops/NetherBerryBush.java +++ b/src/main/java/mods/natura/blocks/crops/NetherBerryBush.java @@ -1,10 +1,9 @@ package mods.natura.blocks.crops; -import java.util.List; -import java.util.Random; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; +import java.util.Random; import mods.natura.client.BerryRender; import mods.natura.common.NContent; import mods.natura.common.NaturaTab; @@ -30,7 +29,16 @@ public class NetherBerryBush extends BlockLeavesBase implements IPlantable { Random random; public IIcon[] fastIcons; public IIcon[] fancyIcons; - public static String[] textureNames = new String[] { "blightberry", "duskberry", "skyberry", "stingberry", "blightberry_ripe", "duskberry_ripe", "skyberry_ripe", "stingberry_ripe" }; + public static String[] textureNames = new String[] { + "blightberry", + "duskberry", + "skyberry", + "stingberry", + "blightberry_ripe", + "duskberry_ripe", + "skyberry_ripe", + "stingberry_ripe" + }; public NetherBerryBush() { super(Material.leaves, false); @@ -58,7 +66,7 @@ public void registerBlockIcons(IIconRegister iconRegister) { @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int metadata) { - return (Blocks.leaves.isOpaqueCube() ? fastIcons : fancyIcons)[metadata % 4 + (metadata < 12 ? 0 : 4)]; + return (Blocks.leaves.isOpaqueCube() ? fastIcons : fancyIcons)[metadata % 4 + (metadata < 12 ? 0 : 4)]; } /* Bushes are stored by size then type */ @@ -126,7 +134,12 @@ public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player int meta = world.getBlockMetadata(x, y, z); if (meta >= 12) { world.setBlock(x, y, z, this, meta - 4, 3); - EntityItem entityitem = new EntityItem(world, player.posX, player.posY - 1.0D, player.posZ, new ItemStack(NContent.netherBerryItem, 1, meta - 12)); + EntityItem entityitem = new EntityItem( + world, + player.posX, + player.posY - 1.0D, + player.posZ, + new ItemStack(NContent.netherBerryItem, 1, meta - 12)); world.spawnEntityInWorld(entityitem); entityitem.onCollideWithPlayer(player); } @@ -135,17 +148,21 @@ public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player /* Right-click harvests berries */ @Override - 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; + 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; int meta = world.getBlockMetadata(x, y, z); if (meta >= 12) { - if (world.isRemote) - return true; + if (world.isRemote) return true; world.setBlock(x, y, z, this, meta - 4, 3); - EntityItem entityitem = new EntityItem(world, player.posX, player.posY - 1.0D, player.posZ, new ItemStack(NContent.netherBerryItem, 1, meta - 12)); + EntityItem entityitem = new EntityItem( + world, + player.posX, + player.posY - 1.0D, + player.posZ, + new ItemStack(NContent.netherBerryItem, 1, meta - 12)); world.spawnEntityInWorld(entityitem); entityitem.onCollideWithPlayer(player); return true; @@ -174,31 +191,32 @@ public int getRenderType() { @Override public boolean shouldSideBeRendered(IBlockAccess blockAccess, int x, int y, int z, int side) { Block block = blockAccess.getBlock(x, y, z); - //If the block touching the side is same type of bush and not fully grown then render side. + // If the block touching the side is same type of bush and not fully grown then render side. if (block == this & blockAccess.getBlockMetadata(x, y, z) < 8) { return true; - //If this block is fully grown and is touching a bush (fast mode) or solid block then don't render (Would be way less complex if metadata was passed in) + // If this block is fully grown and is touching a bush (fast mode) or solid block then don't render (Would + // be way less complex if metadata was passed in) } else if ((Blocks.leaves.isOpaqueCube() & block == this) | block.isOpaqueCube()) { - switch(side) { - case 0://-y - return false; - case 1://+y - if (blockAccess.getBlockMetadata(x, y - 1, z) > 7) return false; - break; - case 2://-z - if (blockAccess.getBlockMetadata(x, y, z + 1) > 7) return false; - break; - case 3://+z - if (blockAccess.getBlockMetadata(x, y, z - 1) > 7) return false; - break; - case 4://-x - if (blockAccess.getBlockMetadata(x + 1, y, z) > 7) return false; - break; - case 5://+x - if (blockAccess.getBlockMetadata(x - 1, y, z) > 7) return false; + switch (side) { + case 0: // -y + return false; + case 1: // +y + if (blockAccess.getBlockMetadata(x, y - 1, z) > 7) return false; + break; + case 2: // -z + if (blockAccess.getBlockMetadata(x, y, z + 1) > 7) return false; + break; + case 3: // +z + if (blockAccess.getBlockMetadata(x, y, z - 1) > 7) return false; + break; + case 4: // -x + if (blockAccess.getBlockMetadata(x + 1, y, z) > 7) return false; + break; + case 5: // +x + if (blockAccess.getBlockMetadata(x - 1, y, z) > 7) return false; } } - //If none of the above then render side. + // If none of the above then render side. return true; } @@ -211,8 +229,7 @@ public void updateTick(World world, int x, int y, int z, Random random1) { int height; - for (height = 1; world.getBlock(x, y - height, z) == this; ++height) { - } + for (height = 1; world.getBlock(x, y - height, z) == this; ++height) {} if (random1.nextInt(75) == 0) { int md = world.getBlockMetadata(x, y, z); @@ -227,8 +244,7 @@ public void updateTick(World world, int x, int y, int z, Random random1) { /* Resistance to fire */ @Override - public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) - { + public int getFlammability(IBlockAccess world, int x, int y, int z, ForgeDirection face) { return 0; } @@ -271,8 +287,7 @@ public boolean boneFertilize(World world, int x, int y, int z, Random random) { if (meta / 4 < 2) { if (random.nextBoolean()) { int setMeta = random.nextInt(2) + 1 + meta / 4; - if (setMeta > 2) - setMeta = 2; + if (setMeta > 2) setMeta = 2; world.setBlockMetadataWithNotify(x, y, z, meta % 4 + setMeta * 4, 4); } return true; @@ -281,8 +296,7 @@ public boolean boneFertilize(World world, int x, int y, int z, Random random) { Block block = world.getBlock(x, y + 1, z); if (block == null || world.isAirBlock(x, y + 1, z)) { if (random.nextBoolean()) { - if (random.nextInt(3) == 0) - world.setBlock(x, y + 1, z, this, meta % 4, 3); + if (random.nextInt(3) == 0) world.setBlock(x, y + 1, z, this, meta % 4, 3); } return true; @@ -290,5 +304,4 @@ public boolean boneFertilize(World world, int x, int y, int z, Random random) { return false; } - } diff --git a/src/main/java/mods/natura/blocks/crops/ThornVines.java b/src/main/java/mods/natura/blocks/crops/ThornVines.java index f9bb0977..c14c68bb 100644 --- a/src/main/java/mods/natura/blocks/crops/ThornVines.java +++ b/src/main/java/mods/natura/blocks/crops/ThornVines.java @@ -47,7 +47,7 @@ public void registerBlockIcons(IIconRegister iconRegister) { @Override public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { - //entity.motionY *= 1.5D; + // entity.motionY *= 1.5D; if (!(entity instanceof EntityItem) && !(entity instanceof EntityGhast) && Natura.random.nextInt(30) == 0) { DamageSource source = Natura.random.nextBoolean() ? DamageSource.cactus : DamageSource.lava; entity.attackEntityFrom(source, 1); diff --git a/src/main/java/mods/natura/blocks/nether/HeatSand.java b/src/main/java/mods/natura/blocks/nether/HeatSand.java index 201fb789..397ba946 100644 --- a/src/main/java/mods/natura/blocks/nether/HeatSand.java +++ b/src/main/java/mods/natura/blocks/nether/HeatSand.java @@ -42,13 +42,11 @@ public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { if (entity instanceof EntityPlayer) { ItemStack stack = ((EntityPlayer) entity).inventory.getStackInSlot(36); - if (stack == null) - entity.attackEntityFrom(DamageSource.inFire, 1); + if (stack == null) entity.attackEntityFrom(DamageSource.inFire, 1); } else if (entity instanceof EntityLiving && !entity.isImmuneToFire()) { entity.attackEntityFrom(DamageSource.inFire, 1); } /*entity.motionX *= 0.4D; entity.motionZ *= 0.4D;*/ } - } diff --git a/src/main/java/mods/natura/blocks/nether/NetherGlass.java b/src/main/java/mods/natura/blocks/nether/NetherGlass.java index bad96186..f862ead4 100644 --- a/src/main/java/mods/natura/blocks/nether/NetherGlass.java +++ b/src/main/java/mods/natura/blocks/nether/NetherGlass.java @@ -1,10 +1,9 @@ package mods.natura.blocks.nether; -import java.util.List; -import java.util.Random; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; +import java.util.Random; import mods.natura.common.NContent; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -81,16 +80,14 @@ public void registerBlockIcons(IIconRegister iconRegister) { @SideOnly(Side.CLIENT) public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { int meta = world.getBlockMetadata(x, y, z); - if (meta < 1) - return icons[0]; + if (meta < 1) return icons[0]; return icons[1]; } @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int meta) { - if (meta < 1) - return icons[2]; + if (meta < 1) return icons[2]; return icons[3]; } @@ -125,5 +122,4 @@ public void getSubBlocks(Item item, CreativeTabs par2CreativeTabs, List par3List par3List.add(new ItemStack(item, 1, var4)); } } - } diff --git a/src/main/java/mods/natura/blocks/nether/TaintedSoil.java b/src/main/java/mods/natura/blocks/nether/TaintedSoil.java index 01896aea..fdae1b74 100644 --- a/src/main/java/mods/natura/blocks/nether/TaintedSoil.java +++ b/src/main/java/mods/natura/blocks/nether/TaintedSoil.java @@ -13,7 +13,7 @@ public class TaintedSoil extends NBlock { public TaintedSoil() { - super(Material.ground, 2.2f, new String[] { "tainted_soil", "tainted_farmland_dry", "tainted_farmland_heated" }); + super(Material.ground, 2.2f, new String[] {"tainted_soil", "tainted_farmland_dry", "tainted_farmland_heated"}); this.setStepSound(Block.soundTypeGravel); this.setResistance(25f); } @@ -30,14 +30,12 @@ public boolean isReplaceableOreGen(World world, int x, int y, int z, Block targe public boolean canSustainPlant(World world, int x, int y, int z, ForgeDirection direction, IPlantable plant) { EnumPlantType plantType = plant.getPlantType(world, x, y + 1, z); - if (plantType == EnumPlantType.Nether) - return true; + if (plantType == EnumPlantType.Nether) return true; return super.canSustainPlant(world, x, y, z, direction, plant); } @Override public boolean isFireSource(World world, int x, int y, int z, ForgeDirection side) { - return side == UP; + return side == UP; } - } diff --git a/src/main/java/mods/natura/blocks/overrides/AlternateBookshelf.java b/src/main/java/mods/natura/blocks/overrides/AlternateBookshelf.java index 666539e6..ad088b52 100644 --- a/src/main/java/mods/natura/blocks/overrides/AlternateBookshelf.java +++ b/src/main/java/mods/natura/blocks/overrides/AlternateBookshelf.java @@ -1,9 +1,8 @@ package mods.natura.blocks.overrides; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mods.natura.common.NContent; import net.minecraft.block.BlockBookshelf; import net.minecraft.client.renderer.texture.IIconRegister; @@ -23,8 +22,7 @@ public AlternateBookshelf() { @Override @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int metadata) { - if (side == 0 || side == 1) - return NContent.planks.getIcon(side, metadata); + if (side == 0 || side == 1) return NContent.planks.getIcon(side, metadata); return icons[metadata]; } @@ -52,8 +50,6 @@ public float getEnchantPowerBonus(World world, int x, int y, int z) { @SideOnly(Side.CLIENT) @Override public void getSubBlocks(Item item, CreativeTabs tabs, List list) { - for (int i = 0; i < icons.length; i++) - list.add(new ItemStack(item, 1, i)); + for (int i = 0; i < icons.length; i++) list.add(new ItemStack(item, 1, i)); } - } diff --git a/src/main/java/mods/natura/blocks/overrides/AlternateFence.java b/src/main/java/mods/natura/blocks/overrides/AlternateFence.java index b2818772..4dde3388 100644 --- a/src/main/java/mods/natura/blocks/overrides/AlternateFence.java +++ b/src/main/java/mods/natura/blocks/overrides/AlternateFence.java @@ -1,21 +1,17 @@ package mods.natura.blocks.overrides; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mods.natura.client.FenceRender; import mods.natura.common.NContent; -import net.minecraft.block.Block; import net.minecraft.block.BlockFence; -import net.minecraft.block.BlockFenceGate; import net.minecraft.block.material.Material; 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 net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class AlternateFence extends BlockFence { @@ -31,8 +27,7 @@ public IIcon getIcon(int side, int metadata) { @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons(IIconRegister iconRegister) { - } + public void registerBlockIcons(IIconRegister iconRegister) {} @Override public int damageDropped(int meta) { @@ -41,9 +36,8 @@ public int damageDropped(int meta) { @SideOnly(Side.CLIENT) @Override - public void getSubBlocks (Item item, CreativeTabs tabs, List list) { - for (int i = 0; i < NContent.woodTextureNames.length; i++) - list.add(new ItemStack(item, 1, i)); + public void getSubBlocks(Item item, CreativeTabs tabs, List list) { + for (int i = 0; i < NContent.woodTextureNames.length; i++) list.add(new ItemStack(item, 1, i)); } @Override @@ -55,5 +49,4 @@ public boolean canPlaceTorchOnTop(World world, int x, int y, int z) { public int getRenderType() { return FenceRender.model; } - } diff --git a/src/main/java/mods/natura/blocks/overrides/AlternatePressurePlate.java b/src/main/java/mods/natura/blocks/overrides/AlternatePressurePlate.java index 3c6d7c49..d6b8b29e 100644 --- a/src/main/java/mods/natura/blocks/overrides/AlternatePressurePlate.java +++ b/src/main/java/mods/natura/blocks/overrides/AlternatePressurePlate.java @@ -7,5 +7,4 @@ public class AlternatePressurePlate extends BlockPressurePlate { public AlternatePressurePlate(String par1Str, Material material, Sensitivity sensitivity) { super(par1Str, material, sensitivity); } - } diff --git a/src/main/java/mods/natura/blocks/overrides/AlternateWorkbench.java b/src/main/java/mods/natura/blocks/overrides/AlternateWorkbench.java index 7d178d21..c0c73487 100644 --- a/src/main/java/mods/natura/blocks/overrides/AlternateWorkbench.java +++ b/src/main/java/mods/natura/blocks/overrides/AlternateWorkbench.java @@ -1,9 +1,8 @@ package mods.natura.blocks.overrides; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mods.natura.Natura; import mods.natura.common.NContent; import mods.natura.gui.NGuiHandler; @@ -29,15 +28,15 @@ public AlternateWorkbench() { @SideOnly(Side.CLIENT) public IIcon getIcon(int side, int metadata) { switch (side) { - case 0: - return NContent.planks.getIcon(side, metadata); - case 1: - return topIcons[metadata]; - case 2: - case 4: - return faceIcons[metadata]; - default: - return sideIcons[metadata]; + case 0: + return NContent.planks.getIcon(side, metadata); + case 1: + return topIcons[metadata]; + case 2: + case 4: + return faceIcons[metadata]; + default: + return sideIcons[metadata]; } } @@ -63,19 +62,18 @@ public int damageDropped(int meta) { @SideOnly(Side.CLIENT) @Override public void getSubBlocks(Item par1, CreativeTabs tabs, List list) { - for (int i = 0; i < topIcons.length; i++) - list.add(new ItemStack(par1, 1, i)); + for (int i = 0; i < topIcons.length; i++) list.add(new ItemStack(par1, 1, i)); } @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 true; } else { player.openGui(Natura.instance, NGuiHandler.craftingGui, world, x, y, z); - //player.displayGUIWorkbench(par2, par3, par4); + // player.displayGUIWorkbench(par2, par3, par4); return true; } } - } diff --git a/src/main/java/mods/natura/blocks/overrides/NetherLever.java b/src/main/java/mods/natura/blocks/overrides/NetherLever.java index e5378114..a504a3af 100644 --- a/src/main/java/mods/natura/blocks/overrides/NetherLever.java +++ b/src/main/java/mods/natura/blocks/overrides/NetherLever.java @@ -12,5 +12,4 @@ public NetherLever() { public int getRenderType() { return LeverRender.model; } - } diff --git a/src/main/java/mods/natura/blocks/overrides/NetherrackButton.java b/src/main/java/mods/natura/blocks/overrides/NetherrackButton.java index 4f50f0ec..dd4bc70d 100644 --- a/src/main/java/mods/natura/blocks/overrides/NetherrackButton.java +++ b/src/main/java/mods/natura/blocks/overrides/NetherrackButton.java @@ -13,8 +13,7 @@ public NetherrackButton() { @Override @SideOnly(Side.CLIENT) - public IIcon getIcon (int par1, int par2) { + public IIcon getIcon(int par1, int par2) { return Blocks.netherrack.getBlockTextureFromSide(1); } - } diff --git a/src/main/java/mods/natura/blocks/tech/BlazeHopper.java b/src/main/java/mods/natura/blocks/tech/BlazeHopper.java index e288acc2..7f7498ea 100644 --- a/src/main/java/mods/natura/blocks/tech/BlazeHopper.java +++ b/src/main/java/mods/natura/blocks/tech/BlazeHopper.java @@ -8,52 +8,49 @@ import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.util.IIcon; -public class BlazeHopper extends BlockHopper -{ +public class BlazeHopper extends BlockHopper { @SideOnly(Side.CLIENT) private IIcon hopperIcon; + @SideOnly(Side.CLIENT) private IIcon hopperTopIcon; + @SideOnly(Side.CLIENT) private IIcon hopperInsideIcon; - public BlazeHopper() - { + public BlazeHopper() { super(); } @Override - public int getRenderType () - { + public int getRenderType() { return HopperRender.model; } @Override @SideOnly(Side.CLIENT) - public IIcon getIcon (int par1, int par2) - { + public IIcon getIcon(int par1, int par2) { return par1 == 1 ? this.hopperTopIcon : this.hopperIcon; } @SideOnly(Side.CLIENT) @Override - public void registerBlockIcons (IIconRegister par1IconRegister) - { + public void registerBlockIcons(IIconRegister par1IconRegister) { this.hopperIcon = par1IconRegister.registerIcon("natura:nhopper_outside"); this.hopperTopIcon = par1IconRegister.registerIcon("natura:nhopper_top"); this.hopperInsideIcon = par1IconRegister.registerIcon("natura:nhopper_inside"); } @SideOnly(Side.CLIENT) - public static IIcon hopperIcon (String par0Str) - { - return par0Str.equals("hopper_outside") ? NContent.netherHopper.hopperIcon : (par0Str.equals("hopper_inside") ? NContent.netherHopper.hopperInsideIcon : null); + public static IIcon hopperIcon(String par0Str) { + return par0Str.equals("hopper_outside") + ? NContent.netherHopper.hopperIcon + : (par0Str.equals("hopper_inside") ? NContent.netherHopper.hopperInsideIcon : null); } @Override @SideOnly(Side.CLIENT) - public String getItemIconName () - { + public String getItemIconName() { return "natura:nhopper"; } } diff --git a/src/main/java/mods/natura/blocks/tech/BlazeRail.java b/src/main/java/mods/natura/blocks/tech/BlazeRail.java index afde089c..392cacbb 100644 --- a/src/main/java/mods/natura/blocks/tech/BlazeRail.java +++ b/src/main/java/mods/natura/blocks/tech/BlazeRail.java @@ -4,16 +4,13 @@ import net.minecraft.entity.item.EntityMinecart; import net.minecraft.world.World; -public class BlazeRail extends BlockRail -{ - public BlazeRail() - { +public class BlazeRail extends BlockRail { + public BlazeRail() { super(); } @Override - public float getRailMaxSpeed (World world, EntityMinecart cart, int y, int x, int z) - { + public float getRailMaxSpeed(World world, EntityMinecart cart, int y, int x, int z) { return 0.65f; } } diff --git a/src/main/java/mods/natura/blocks/tech/BlazeRailDetector.java b/src/main/java/mods/natura/blocks/tech/BlazeRailDetector.java index 86a99fc6..4e07d3aa 100644 --- a/src/main/java/mods/natura/blocks/tech/BlazeRailDetector.java +++ b/src/main/java/mods/natura/blocks/tech/BlazeRailDetector.java @@ -4,16 +4,13 @@ import net.minecraft.entity.item.EntityMinecart; import net.minecraft.world.World; -public class BlazeRailDetector extends BlockRailDetector -{ - public BlazeRailDetector() - { +public class BlazeRailDetector extends BlockRailDetector { + public BlazeRailDetector() { super(); } @Override - public float getRailMaxSpeed (World world, EntityMinecart cart, int y, int x, int z) - { + public float getRailMaxSpeed(World world, EntityMinecart cart, int y, int x, int z) { return 0.65f; } } diff --git a/src/main/java/mods/natura/blocks/tech/BlazeRailPowered.java b/src/main/java/mods/natura/blocks/tech/BlazeRailPowered.java index b166d609..fb18df10 100644 --- a/src/main/java/mods/natura/blocks/tech/BlazeRailPowered.java +++ b/src/main/java/mods/natura/blocks/tech/BlazeRailPowered.java @@ -4,19 +4,16 @@ import net.minecraft.entity.item.EntityMinecart; import net.minecraft.world.World; -public class BlazeRailPowered extends BlockRailPowered -{ +public class BlazeRailPowered extends BlockRailPowered { boolean activator; - public BlazeRailPowered(boolean activator) - { + public BlazeRailPowered(boolean activator) { super(); this.activator = activator; } @Override - public float getRailMaxSpeed (World world, EntityMinecart cart, int y, int x, int z) - { + public float getRailMaxSpeed(World world, EntityMinecart cart, int y, int x, int z) { return 0.65f; } @@ -30,50 +27,32 @@ public float getRailMaxSpeed (World world, EntityMinecart cart, int y, int x, in * @param z The rail Z coordinate. */ @Override - public void onMinecartPass (World world, EntityMinecart cart, int x, int y, int z) - { + public void onMinecartPass(World world, EntityMinecart cart, int x, int y, int z) { int meta = world.getBlockMetadata(x, y, z); - if (meta >= 8) - { - if (activator) - { + if (meta >= 8) { + if (activator) { - } - else - { - //Start the cart rolling - if (meta == 8) - { + } else { + // Start the cart rolling + if (meta == 8) { double speed = 0f; - if (world.getBlock(x, y, z + 1).isNormalCube()) - speed += 0.2f; - if (world.getBlock(x, y, z - 1).isNormalCube()) - speed -= 0.2f; + if (world.getBlock(x, y, z + 1).isNormalCube()) speed += 0.2f; + if (world.getBlock(x, y, z - 1).isNormalCube()) speed -= 0.2f; cart.motionX += speed; - } - else if (meta == 9) - { + } else if (meta == 9) { double speed = 0f; - if (world.getBlock(x + 1, y, z).isNormalCube()) - speed -= 0.2f; - if (world.getBlock(x - 1, y, z).isNormalCube()) - speed += 0.2f; + if (world.getBlock(x + 1, y, z).isNormalCube()) speed -= 0.2f; + if (world.getBlock(x - 1, y, z).isNormalCube()) speed += 0.2f; cart.motionZ += speed; } - //Then push it along - if (Math.abs(cart.motionX) < 0.2) - cart.motionX *= 1.2; - else - cart.motionX *= 1.05; - if (Math.abs(cart.motionZ) < 0.2) - cart.motionZ *= 1.2; - else - cart.motionZ *= 1.05; + // Then push it along + if (Math.abs(cart.motionX) < 0.2) cart.motionX *= 1.2; + else cart.motionX *= 1.05; + if (Math.abs(cart.motionZ) < 0.2) cart.motionZ *= 1.2; + else cart.motionZ *= 1.05; } - } - else if (!activator) - { + } else if (!activator) { cart.motionX *= 0.5; cart.motionZ *= 0.5; } diff --git a/src/main/java/mods/natura/blocks/tech/NetherPistonBase.java b/src/main/java/mods/natura/blocks/tech/NetherPistonBase.java index c2134948..193f2660 100644 --- a/src/main/java/mods/natura/blocks/tech/NetherPistonBase.java +++ b/src/main/java/mods/natura/blocks/tech/NetherPistonBase.java @@ -1,9 +1,8 @@ package mods.natura.blocks.tech; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mods.natura.common.NContent; import net.minecraft.block.Block; import net.minecraft.block.BlockPistonBase; @@ -25,26 +24,26 @@ import net.minecraft.world.World; // TODO 1.7 make sure this class still works (extending behavior) -public class NetherPistonBase extends BlockPistonBase -{ +public class NetherPistonBase extends BlockPistonBase { @SideOnly(Side.CLIENT) private IIcon iIcon; + @SideOnly(Side.CLIENT) private IIcon bIcon; + @SideOnly(Side.CLIENT) private IIcon tIcon; + private boolean sticky; - public NetherPistonBase(boolean sticky) - { + public NetherPistonBase(boolean sticky) { super(sticky); this.sticky = sticky; } @Override @SideOnly(Side.CLIENT) - public IIcon getPistonExtensionTexture () - { + public IIcon getPistonExtensionTexture() { return this.tIcon; } @@ -54,30 +53,43 @@ public IIcon getPistonExtensionTexture () }*/ @SideOnly(Side.CLIENT) - public static IIcon getBaseIcon (String par0Str) - { - return par0Str == "piston_side" ? NContent.piston.blockIcon : (par0Str == "piston_top_normal" ? NContent.piston.tIcon : (par0Str == "piston_top_sticky" ? NContent.piston.tIcon - : (par0Str == "piston_inner" ? NContent.piston.iIcon : null))); + public static IIcon getBaseIcon(String par0Str) { + return par0Str == "piston_side" + ? NContent.piston.blockIcon + : (par0Str == "piston_top_normal" + ? NContent.piston.tIcon + : (par0Str == "piston_top_sticky" + ? NContent.piston.tIcon + : (par0Str == "piston_inner" ? NContent.piston.iIcon : null))); } @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons (IIconRegister par1IconRegister) - { + public void registerBlockIcons(IIconRegister par1IconRegister) { this.blockIcon = par1IconRegister.registerIcon("natura:piston_side"); - this.tIcon = par1IconRegister.registerIcon(this.sticky ? "natura:piston_top_sticky" : "natura:piston_top_normal"); + this.tIcon = + par1IconRegister.registerIcon(this.sticky ? "natura:piston_top_sticky" : "natura:piston_top_normal"); this.iIcon = par1IconRegister.registerIcon("natura:piston_inner"); this.bIcon = par1IconRegister.registerIcon("natura:piston_bottom"); } @Override @SideOnly(Side.CLIENT) - public IIcon getIcon (int side, int meta) - { + public IIcon getIcon(int side, int meta) { int k = getOrientation(meta); - return k > 5 ? this.tIcon - : (side == k ? (!isExtended(meta) && this.minX <= 0.0D && this.minY <= 0.0D && this.minZ <= 0.0D && this.maxX >= 1.0D && this.maxY >= 1.0D && this.maxZ >= 1.0D ? this.tIcon - : this.iIcon) : (side == Facing.oppositeSide[k] ? this.bIcon : this.blockIcon)); + return k > 5 + ? this.tIcon + : (side == k + ? (!isExtended(meta) + && this.minX <= 0.0D + && this.minY <= 0.0D + && this.minZ <= 0.0D + && this.maxX >= 1.0D + && this.maxY >= 1.0D + && this.maxZ >= 1.0D + ? this.tIcon + : this.iIcon) + : (side == Facing.oppositeSide[k] ? this.bIcon : this.blockIcon)); } /** @@ -85,8 +97,7 @@ public IIcon getIcon (int side, int meta) * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block. */ @Override - public boolean isOpaqueCube () - { + public boolean isOpaqueCube() { return false; } @@ -94,8 +105,16 @@ public boolean isOpaqueCube () * Called upon block activation (right click on the block.) */ @Override - public boolean onBlockActivated (World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) - { + public boolean onBlockActivated( + World par1World, + int par2, + int par3, + int par4, + EntityPlayer par5EntityPlayer, + int par6, + float par7, + float par8, + float par9) { return false; } @@ -103,13 +122,17 @@ public boolean onBlockActivated (World par1World, int par2, int par3, int par4, * Called when the block is placed in the world. */ @Override - public void onBlockPlacedBy (World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) - { + public void onBlockPlacedBy( + World par1World, + int par2, + int par3, + int par4, + EntityLivingBase par5EntityLivingBase, + ItemStack par6ItemStack) { int l = determineOrientation(par1World, par2, par3, par4, par5EntityLivingBase); par1World.setBlockMetadataWithNotify(par2, par3, par4, l, 2); - if (!par1World.isRemote) - { + if (!par1World.isRemote) { this.updatePistonState(par1World, par2, par3, par4); } } @@ -118,10 +141,8 @@ public void onBlockPlacedBy (World par1World, int par2, int par3, int par4, Enti * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are * their own) Args: x, y, z, neighbor blockID */ - public void onNeighborBlockChange (World par1World, int par2, int par3, int par4, int par5) - { - if (!par1World.isRemote) - { + public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5) { + if (!par1World.isRemote) { this.updatePistonState(par1World, par2, par3, par4); } } @@ -130,10 +151,8 @@ public void onNeighborBlockChange (World par1World, int par2, int par3, int par4 * Called whenever the block is added into the world. Args: world, x, y, z */ @Override - public void onBlockAdded (World par1World, int par2, int par3, int par4) - { - if (!par1World.isRemote && par1World.getTileEntity(par2, par3, par4) == null) - { + public void onBlockAdded(World par1World, int par2, int par3, int par4) { + if (!par1World.isRemote && par1World.getTileEntity(par2, par3, par4) == null) { this.updatePistonState(par1World, par2, par3, par4); } } @@ -141,24 +160,18 @@ public void onBlockAdded (World par1World, int par2, int par3, int par4) /** * handles attempts to extend or retract the piston. */ - private void updatePistonState (World par1World, int par2, int par3, int par4) - { + private void updatePistonState(World par1World, int par2, int par3, int par4) { int l = par1World.getBlockMetadata(par2, par3, par4); int i1 = getOrientation(l); - if (i1 != 7) - { + if (i1 != 7) { boolean flag = this.isIndirectlyPowered(par1World, par2, par3, par4, i1); - if (flag && !isExtended(l)) - { - if (canExtend(par1World, par2, par3, par4, i1)) - { + if (flag && !isExtended(l)) { + if (canExtend(par1World, par2, par3, par4, i1)) { par1World.addBlockEvent(par2, par3, par4, this, 0, i1); } - } - else if (!flag && isExtended(l)) - { + } else if (!flag && isExtended(l)) { par1World.setBlockMetadataWithNotify(par2, par3, par4, i1, 2); par1World.addBlockEvent(par2, par3, par4, this, 1, i1); } @@ -168,14 +181,50 @@ else if (!flag && isExtended(l)) /** * checks the block to that side to see if it is indirectly powered. */ - private boolean isIndirectlyPowered (World par1World, int par2, int par3, int par4, int par5) - { - return par5 != 0 && par1World.getIndirectPowerOutput(par2, par3 - 1, par4, 0) ? true : (par5 != 1 && par1World.getIndirectPowerOutput(par2, par3 + 1, par4, 1) ? true : (par5 != 2 - && par1World.getIndirectPowerOutput(par2, par3, par4 - 1, 2) ? true : (par5 != 3 && par1World.getIndirectPowerOutput(par2, par3, par4 + 1, 3) ? true : (par5 != 5 - && par1World.getIndirectPowerOutput(par2 + 1, par3, par4, 5) ? true : (par5 != 4 && par1World.getIndirectPowerOutput(par2 - 1, par3, par4, 4) ? true : (par1World - .getIndirectPowerOutput(par2, par3, par4, 0) ? true : (par1World.getIndirectPowerOutput(par2, par3 + 2, par4, 1) ? true : (par1World - .getIndirectPowerOutput(par2, par3 + 1, par4 - 1, 2) ? true : (par1World.getIndirectPowerOutput(par2, par3 + 1, par4 + 1, 3) ? true : (par1World.getIndirectPowerOutput(par2 - 1, - par3 + 1, par4, 4) ? true : par1World.getIndirectPowerOutput(par2 + 1, par3 + 1, par4, 5))))))))))); + private boolean isIndirectlyPowered(World par1World, int par2, int par3, int par4, int par5) { + return par5 != 0 && par1World.getIndirectPowerOutput(par2, par3 - 1, par4, 0) + ? true + : (par5 != 1 && par1World.getIndirectPowerOutput(par2, par3 + 1, par4, 1) + ? true + : (par5 != 2 && par1World.getIndirectPowerOutput(par2, par3, par4 - 1, 2) + ? true + : (par5 != 3 && par1World.getIndirectPowerOutput(par2, par3, par4 + 1, 3) + ? true + : (par5 != 5 && par1World.getIndirectPowerOutput(par2 + 1, par3, par4, 5) + ? true + : (par5 != 4 + && par1World.getIndirectPowerOutput( + par2 - 1, par3, par4, 4) + ? true + : (par1World.getIndirectPowerOutput(par2, par3, par4, 0) + ? true + : (par1World.getIndirectPowerOutput( + par2, par3 + 2, par4, 1) + ? true + : (par1World.getIndirectPowerOutput( + par2, par3 + 1, par4 - 1, 2) + ? true + : (par1World.getIndirectPowerOutput( + par2, par3 + 1, + par4 + 1, 3) + ? true + : (par1World + .getIndirectPowerOutput( + par2 + - 1, + par3 + + 1, + par4, + 4) + ? true + : par1World + .getIndirectPowerOutput( + par2 + + 1, + par3 + + 1, + par4, + 5))))))))))); } /** @@ -183,48 +232,47 @@ private boolean isIndirectlyPowered (World par1World, int par2, int par3, int pa * entity at this location. Args: world, x, y, z, blockID, EventID, event parameter */ @Override - public boolean onBlockEventReceived (World par1World, int par2, int par3, int par4, int par5, int par6) - { - if (!par1World.isRemote) - { + public boolean onBlockEventReceived(World par1World, int par2, int par3, int par4, int par5, int par6) { + if (!par1World.isRemote) { boolean flag = this.isIndirectlyPowered(par1World, par2, par3, par4, par6); - if (flag && par5 == 1) - { + if (flag && par5 == 1) { par1World.setBlockMetadataWithNotify(par2, par3, par4, par6 | 8, 2); return false; } - if (!flag && par5 == 0) - { + if (!flag && par5 == 0) { return false; } } - if (par5 == 0) - { - if (!this.tryExtend(par1World, par2, par3, par4, par6)) - { + if (par5 == 0) { + if (!this.tryExtend(par1World, par2, par3, par4, par6)) { return false; } par1World.setBlockMetadataWithNotify(par2, par3, par4, par6 | 8, 2); - par1World.playSoundEffect(par2 + 0.5D, par3 + 0.5D, par4 + 0.5D, "tile.piston.out", 0.5F, par1World.rand.nextFloat() * 0.25F + 0.6F); - } - else if (par5 == 1) - { - TileEntity tileentity = par1World.getTileEntity(par2 + Facing.offsetsXForSide[par6], par3 + Facing.offsetsYForSide[par6], par4 + Facing.offsetsZForSide[par6]); - - if (tileentity instanceof TileEntityPiston) - { + par1World.playSoundEffect( + par2 + 0.5D, + par3 + 0.5D, + par4 + 0.5D, + "tile.piston.out", + 0.5F, + par1World.rand.nextFloat() * 0.25F + 0.6F); + } else if (par5 == 1) { + TileEntity tileentity = par1World.getTileEntity( + par2 + Facing.offsetsXForSide[par6], + par3 + Facing.offsetsYForSide[par6], + par4 + Facing.offsetsZForSide[par6]); + + if (tileentity instanceof TileEntityPiston) { ((TileEntityPiston) tileentity).clearPistonTileEntity(); } par1World.setBlock(par2, par3, par4, Blocks.piston, par6, 3); par1World.setTileEntity(par2, par3, par4, BlockPistonMoving.getTileEntity(this, par6, par6, false, true)); - if (this.sticky) - { + if (this.sticky) { int j1 = par2 + Facing.offsetsXForSide[par6] * 2; int k1 = par3 + Facing.offsetsYForSide[par6] * 2; int l1 = par4 + Facing.offsetsZForSide[par6] * 2; @@ -232,16 +280,13 @@ else if (par5 == 1) int j2 = par1World.getBlockMetadata(j1, k1, l1); boolean flag1 = false; - if (i2 == Blocks.piston) - { + if (i2 == Blocks.piston) { TileEntity tileentity1 = par1World.getTileEntity(j1, k1, l1); - if (tileentity1 instanceof TileEntityPiston) - { + if (tileentity1 instanceof TileEntityPiston) { TileEntityPiston tileentitypiston = (TileEntityPiston) tileentity1; - if (tileentitypiston.getPistonOrientation() == par6 && tileentitypiston.isExtending()) - { + if (tileentitypiston.getPistonOrientation() == par6 && tileentitypiston.isExtending()) { tileentitypiston.clearPistonTileEntity(); i2 = tileentitypiston.getStoredBlockID(); j2 = tileentitypiston.getBlockMetadata(); @@ -250,26 +295,37 @@ else if (par5 == 1) } } - if (!flag1 && i2 != null && canPushBlock(i2, par1World, j1, k1, l1, false) && (i2.getMobilityFlag() == 0 || i2 == NContent.piston || i2 == NContent.pistonSticky)) - { + if (!flag1 + && i2 != null + && canPushBlock(i2, par1World, j1, k1, l1, false) + && (i2.getMobilityFlag() == 0 || i2 == NContent.piston || i2 == NContent.pistonSticky)) { par2 += Facing.offsetsXForSide[par6]; par3 += Facing.offsetsYForSide[par6]; par4 += Facing.offsetsZForSide[par6]; par1World.setBlock(par2, par3, par4, Blocks.piston, j2, 3); - par1World.setTileEntity(par2, par3, par4, BlockPistonMoving.getTileEntity(i2, j2, par6, false, false)); + par1World.setTileEntity( + par2, par3, par4, BlockPistonMoving.getTileEntity(i2, j2, par6, false, false)); par1World.setBlockToAir(j1, k1, l1); + } else if (!flag1) { + par1World.setBlockToAir( + par2 + Facing.offsetsXForSide[par6], + par3 + Facing.offsetsYForSide[par6], + par4 + Facing.offsetsZForSide[par6]); } - else if (!flag1) - { - par1World.setBlockToAir(par2 + Facing.offsetsXForSide[par6], par3 + Facing.offsetsYForSide[par6], par4 + Facing.offsetsZForSide[par6]); - } - } - else - { - par1World.setBlockToAir(par2 + Facing.offsetsXForSide[par6], par3 + Facing.offsetsYForSide[par6], par4 + Facing.offsetsZForSide[par6]); + } else { + par1World.setBlockToAir( + par2 + Facing.offsetsXForSide[par6], + par3 + Facing.offsetsYForSide[par6], + par4 + Facing.offsetsZForSide[par6]); } - par1World.playSoundEffect(par2 + 0.5D, par3 + 0.5D, par4 + 0.5D, "tile.piston.in", 0.5F, par1World.rand.nextFloat() * 0.15F + 0.6F); + par1World.playSoundEffect( + par2 + 0.5D, + par3 + 0.5D, + par4 + 0.5D, + "tile.piston.in", + 0.5F, + par1World.rand.nextFloat() * 0.15F + 0.6F); } return true; @@ -279,37 +335,32 @@ else if (!flag1) * Updates the blocks bounds based on its current state. Args: world, x, y, z */ @Override - public void setBlockBoundsBasedOnState (IBlockAccess par1IBlockAccess, int par2, int par3, int par4) - { + public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { int l = par1IBlockAccess.getBlockMetadata(par2, par3, par4); - if (isExtended(l)) - { + if (isExtended(l)) { float f = 0.25F; - switch (getOrientation(l)) - { - case 0: - this.setBlockBounds(0.0F, 0.25F, 0.0F, 1.0F, 1.0F, 1.0F); - break; - case 1: - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.75F, 1.0F); - break; - case 2: - this.setBlockBounds(0.0F, 0.0F, 0.25F, 1.0F, 1.0F, 1.0F); - break; - case 3: - this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.75F); - break; - case 4: - this.setBlockBounds(0.25F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - break; - case 5: - this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.75F, 1.0F, 1.0F); + switch (getOrientation(l)) { + case 0: + this.setBlockBounds(0.0F, 0.25F, 0.0F, 1.0F, 1.0F, 1.0F); + break; + case 1: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.75F, 1.0F); + break; + case 2: + this.setBlockBounds(0.0F, 0.0F, 0.25F, 1.0F, 1.0F, 1.0F); + break; + case 3: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 0.75F); + break; + case 4: + this.setBlockBounds(0.25F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); + break; + case 5: + this.setBlockBounds(0.0F, 0.0F, 0.0F, 0.75F, 1.0F, 1.0F); } - } - else - { + } else { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } } @@ -318,8 +369,7 @@ public void setBlockBoundsBasedOnState (IBlockAccess par1IBlockAccess, int par2, * Sets the block's bounds for rendering it as an item */ @Override - public void setBlockBoundsForItemRender () - { + public void setBlockBoundsForItemRender() { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } @@ -328,8 +378,14 @@ public void setBlockBoundsForItemRender () * mask.) Parameters: World, X, Y, Z, mask, list, colliding entity */ @Override - public void addCollisionBoxesToList (World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) - { + public void addCollisionBoxesToList( + World par1World, + int par2, + int par3, + int par4, + AxisAlignedBB par5AxisAlignedBB, + List par6List, + Entity par7Entity) { this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity); } @@ -339,8 +395,7 @@ public void addCollisionBoxesToList (World par1World, int par2, int par3, int pa * cleared to be reused) */ @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool (World par1World, int par2, int par3, int par4) - { + public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) { this.setBlockBoundsBasedOnState(par1World, par2, par3, par4); return super.getCollisionBoundingBoxFromPool(par1World, par2, par3, par4); } @@ -349,43 +404,38 @@ public AxisAlignedBB getCollisionBoundingBoxFromPool (World par1World, int par2, * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc) */ @Override - public boolean renderAsNormalBlock () - { + public boolean renderAsNormalBlock() { return false; } /** * returns an int which describes the direction the piston faces */ - public static int getOrientation (int par0) - { + public static int getOrientation(int par0) { return par0 & 7; } /** * Determine if the metadata is related to something powered. */ - public static boolean isExtended (int par0) - { + public static boolean isExtended(int par0) { return (par0 & 8) != 0; } /** * gets the way this piston should face for that entity that placed it. */ - public static int determineOrientation (World par0World, int par1, int par2, int par3, EntityLivingBase par4EntityLivingBase) - { - if (MathHelper.abs((float) par4EntityLivingBase.posX - par1) < 2.0F && MathHelper.abs((float) par4EntityLivingBase.posZ - par3) < 2.0F) - { + public static int determineOrientation( + World par0World, int par1, int par2, int par3, EntityLivingBase par4EntityLivingBase) { + if (MathHelper.abs((float) par4EntityLivingBase.posX - par1) < 2.0F + && MathHelper.abs((float) par4EntityLivingBase.posZ - par3) < 2.0F) { double d0 = par4EntityLivingBase.posY + 1.82D - par4EntityLivingBase.yOffset; - if (d0 - par2 > 2.0D) - { + if (d0 - par2 > 2.0D) { return 1; } - if (par2 - d0 > 0.0D) - { + if (par2 - d0 > 0.0D) { return 0; } } @@ -397,38 +447,27 @@ public static int determineOrientation (World par0World, int par1, int par2, int /** * returns true if the piston can push the specified block */ - private static boolean canPushBlock (Block par0, World par1World, int par2, int par3, int par4, boolean par5) - { - if (par0 == Blocks.obsidian) - { + private static boolean canPushBlock(Block par0, World par1World, int par2, int par3, int par4, boolean par5) { + if (par0 == Blocks.obsidian) { return false; - } - else - { - if (par0 != NContent.piston && par0 != NContent.pistonSticky) - { - if (par0.getBlockHardness(par1World, par2, par3, par4) == -1.0F) - { + } else { + if (par0 != NContent.piston && par0 != NContent.pistonSticky) { + if (par0.getBlockHardness(par1World, par2, par3, par4) == -1.0F) { return false; } - if (par0.getMobilityFlag() == 2) - { + if (par0.getMobilityFlag() == 2) { return false; } - if (par0.getMobilityFlag() == 1) - { - if (!par5) - { + if (par0.getMobilityFlag() == 1) { + if (!par5) { return false; } return true; } - } - else if (isExtended(par1World.getBlockMetadata(par2, par3, par4))) - { + } else if (isExtended(par1World.getBlockMetadata(par2, par3, par4))) { return false; } @@ -439,35 +478,27 @@ else if (isExtended(par1World.getBlockMetadata(par2, par3, par4))) /** * checks to see if this piston could push the blocks in front of it. */ - private static boolean canExtend (World par0World, int par1, int par2, int par3, int par4) - { + private static boolean canExtend(World par0World, int par1, int par2, int par3, int par4) { int i1 = par1 + Facing.offsetsXForSide[par4]; int j1 = par2 + Facing.offsetsYForSide[par4]; int k1 = par3 + Facing.offsetsZForSide[par4]; int l1 = 0; - while (true) - { - if (l1 < 13) - { - if (j1 <= 0 || j1 >= par0World.getHeight() - 1) - { + while (true) { + if (l1 < 13) { + if (j1 <= 0 || j1 >= par0World.getHeight() - 1) { return false; } Block i2 = par0World.getBlock(i1, j1, k1); - if (!par0World.isAirBlock(i1, j1, k1)) - { - if (!canPushBlock(i2, par0World, i1, j1, k1, true)) - { + if (!par0World.isAirBlock(i1, j1, k1)) { + if (!canPushBlock(i2, par0World, i1, j1, k1, true)) { return false; } - if (i2.getMobilityFlag() != 1) - { - if (l1 == 12) - { + if (i2.getMobilityFlag() != 1) { + if (l1 == 12) { return false; } @@ -487,37 +518,29 @@ private static boolean canExtend (World par0World, int par1, int par2, int par3, /** * attempts to extend the piston. returns false if impossible. */ - private boolean tryExtend (World par1World, int par2, int par3, int par4, int par5) - { + private boolean tryExtend(World par1World, int par2, int par3, int par4, int par5) { int newX = par2 + Facing.offsetsXForSide[par5]; int newY = par3 + Facing.offsetsYForSide[par5]; int newZ = par4 + Facing.offsetsZForSide[par5]; int l1 = 0; - while (true) - { + while (true) { Block i2; - if (l1 < 13) - { - if (newY <= 0 || newY >= par1World.getHeight() - 1) - { + if (l1 < 13) { + if (newY <= 0 || newY >= par1World.getHeight() - 1) { return false; } i2 = par1World.getBlock(newX, newY, newZ); - if (!par1World.isAirBlock(newX, newY, newZ)) - { - if (!canPushBlock(i2, par1World, newX, newY, newZ, true)) - { + if (!par1World.isAirBlock(newX, newY, newZ)) { + if (!canPushBlock(i2, par1World, newX, newY, newZ, true)) { return false; } - if (i2.getMobilityFlag() != 1) - { - if (l1 == 12) - { + if (i2.getMobilityFlag() != 1) { + if (l1 == 12) { return false; } @@ -528,9 +551,10 @@ private boolean tryExtend (World par1World, int par2, int par3, int par4, int pa continue; } - //With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior. + // With our change to how snowballs are dropped this needs to disallow to mimic vanilla behavior. float chance = (i2 instanceof BlockSnow ? -1.0f : 1.0f); - i2.dropBlockAsItemWithChance(par1World, newX, newY, newZ, par1World.getBlockMetadata(newX, newY, newZ), chance, 0); + i2.dropBlockAsItemWithChance( + par1World, newX, newY, newZ, par1World.getBlockMetadata(newX, newY, newZ), chance, 0); par1World.setBlockToAir(newX, newY, newZ); } } @@ -545,23 +569,25 @@ private boolean tryExtend (World par1World, int par2, int par3, int par4, int pa int i3; int j3; - for (aint = new Block[13]; newX != par2 || newY != par3 || newZ != par4; newZ = j3) - { + for (aint = new Block[13]; newX != par2 || newY != par3 || newZ != par4; newZ = j3) { l2 = newX - Facing.offsetsXForSide[par5]; i3 = newY - Facing.offsetsYForSide[par5]; j3 = newZ - Facing.offsetsZForSide[par5]; Block k3 = par1World.getBlock(l2, i3, j3); int l3 = par1World.getBlockMetadata(l2, i3, j3); - if (k3 == this && l2 == par2 && i3 == par3 && j3 == par4) - { + if (k3 == this && l2 == par2 && i3 == par3 && j3 == par4) { par1World.setBlock(newX, newY, newZ, Blocks.piston, par5 | (this.sticky ? 8 : 0), 4); - par1World.setTileEntity(newX, newY, newZ, BlockPistonMoving.getTileEntity(NContent.pistonExtension, par5 | (this.sticky ? 8 : 0), par5, true, false)); - } - else - { + par1World.setTileEntity( + newX, + newY, + newZ, + BlockPistonMoving.getTileEntity( + NContent.pistonExtension, par5 | (this.sticky ? 8 : 0), par5, true, false)); + } else { par1World.setBlock(newX, newY, newZ, Blocks.piston, l3, 4); - par1World.setTileEntity(newX, newY, newZ, BlockPistonMoving.getTileEntity(k3, l3, par5, true, false)); + par1World.setTileEntity( + newX, newY, newZ, BlockPistonMoving.getTileEntity(k3, l3, par5, true, false)); } aint[k2++] = k3; @@ -573,8 +599,7 @@ private boolean tryExtend (World par1World, int par2, int par3, int par4, int pa i2 = par1World.getBlock(newX, newY, newZ); newZ = j2; - for (k2 = 0; newX != par2 || newY != par3 || newZ != par4; newZ = j3) - { + for (k2 = 0; newX != par2 || newY != par3 || newZ != par4; newZ = j3) { l2 = newX - Facing.offsetsXForSide[par5]; i3 = newY - Facing.offsetsYForSide[par5]; j3 = newZ - Facing.offsetsZForSide[par5]; diff --git a/src/main/java/mods/natura/blocks/tech/NetherPistonExtension.java b/src/main/java/mods/natura/blocks/tech/NetherPistonExtension.java index fe228e17..61cac3c1 100644 --- a/src/main/java/mods/natura/blocks/tech/NetherPistonExtension.java +++ b/src/main/java/mods/natura/blocks/tech/NetherPistonExtension.java @@ -6,28 +6,31 @@ import net.minecraft.util.Facing; import net.minecraft.util.IIcon; -public class NetherPistonExtension extends BlockPistonExtension -{ +public class NetherPistonExtension extends BlockPistonExtension { @SideOnly(Side.CLIENT) private IIcon head; - public NetherPistonExtension() - { + public NetherPistonExtension() { super(); } @SideOnly(Side.CLIENT) - public void setHeadTexture (IIcon par1Icon) - { + public void setHeadTexture(IIcon par1Icon) { this.head = par1Icon; } @Override @SideOnly(Side.CLIENT) - public IIcon getIcon (int par1, int par2) - { + public IIcon getIcon(int par1, int par2) { int k = getDirectionMeta(par2); - return par1 == k ? (this.head != null ? this.head : ((par2 & 8) != 0 ? NetherPistonBase.getBaseIcon("piston_top_sticky") : NetherPistonBase.getBaseIcon("piston_top_normal"))) : (k < 6 - && par1 == Facing.oppositeSide[k] ? NetherPistonBase.getBaseIcon("piston_top_normal") : NetherPistonBase.getBaseIcon("piston_side")); + return par1 == k + ? (this.head != null + ? this.head + : ((par2 & 8) != 0 + ? NetherPistonBase.getBaseIcon("piston_top_sticky") + : NetherPistonBase.getBaseIcon("piston_top_normal"))) + : (k < 6 && par1 == Facing.oppositeSide[k] + ? NetherPistonBase.getBaseIcon("piston_top_normal") + : NetherPistonBase.getBaseIcon("piston_side")); } } diff --git a/src/main/java/mods/natura/blocks/tech/NetherrackFurnaceBlock.java b/src/main/java/mods/natura/blocks/tech/NetherrackFurnaceBlock.java index 8a5215a8..eaa1bc1f 100644 --- a/src/main/java/mods/natura/blocks/tech/NetherrackFurnaceBlock.java +++ b/src/main/java/mods/natura/blocks/tech/NetherrackFurnaceBlock.java @@ -1,9 +1,8 @@ package mods.natura.blocks.tech; -import java.util.Random; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.Random; import mods.natura.Natura; import mods.natura.gui.NGuiHandler; import net.minecraft.block.Block; @@ -27,47 +26,37 @@ * * @author mDiyo */ -public class NetherrackFurnaceBlock extends BlockContainer -{ +public class NetherrackFurnaceBlock extends BlockContainer { protected Random rand = new Random(); - public NetherrackFurnaceBlock() - { + public NetherrackFurnaceBlock() { super(Material.rock); } /* Logic backend */ @Override - public TileEntity createNewTileEntity (World world, int metadata) - { + public TileEntity createNewTileEntity(World world, int metadata) { return new NetherrackFurnaceLogic(); } - public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplayer) - { + public Integer getGui(World world, int x, int y, int z, EntityPlayer entityplayer) { return NGuiHandler.furnaceGui; } - public Object getModInstance () - { + public Object getModInstance() { return Natura.instance; } @Override - public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int side, float clickX, float clickY, float clickZ) - { - if (player.isSneaking()) - return false; + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int side, float clickX, float clickY, float clickZ) { + if (player.isSneaking()) return false; Integer integer = getGui(world, x, y, z, player); - if (integer == null || integer == -1) - { + if (integer == null || integer == -1) { return false; - } - else - { - if (!world.isRemote) - player.openGui(getModInstance(), integer, world, x, y, z); + } else { + if (!world.isRemote) player.openGui(getModInstance(), integer, world, x, y, z); return true; } } @@ -75,38 +64,37 @@ public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer /* Inventory */ @Override - public void breakBlock (World par1World, int x, int y, int z, Block blockID, int meta) - { + public void breakBlock(World par1World, int x, int y, int z, Block blockID, int meta) { TileEntity te = par1World.getTileEntity(x, y, z); - if (te != null && te instanceof NetherrackFurnaceLogic) - { + if (te != null && te instanceof NetherrackFurnaceLogic) { NetherrackFurnaceLogic logic = (NetherrackFurnaceLogic) te; - for (int iter = 0; iter < logic.getSizeInventory(); ++iter) - { + for (int iter = 0; iter < logic.getSizeInventory(); ++iter) { ItemStack stack = logic.getStackInSlot(iter); - if (stack != null) - { + if (stack != null) { float jumpX = rand.nextFloat() * 0.8F + 0.1F; float jumpY = rand.nextFloat() * 0.8F + 0.1F; float jumpZ = rand.nextFloat() * 0.8F + 0.1F; - while (stack.stackSize > 0) - { + while (stack.stackSize > 0) { int itemSize = rand.nextInt(21) + 10; - if (itemSize > stack.stackSize) - { + if (itemSize > stack.stackSize) { itemSize = stack.stackSize; } stack.stackSize -= itemSize; - EntityItem entityitem = new EntityItem(par1World, x + jumpX, y + jumpY, z + jumpZ, new ItemStack(stack.getItem(), itemSize, stack.getItemDamage())); - - if (stack.hasTagCompound()) - { - entityitem.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy()); + EntityItem entityitem = new EntityItem( + par1World, + x + jumpX, + y + jumpY, + z + jumpZ, + new ItemStack(stack.getItem(), itemSize, stack.getItemDamage())); + + if (stack.hasTagCompound()) { + entityitem.getEntityItem().setTagCompound((NBTTagCompound) + stack.getTagCompound().copy()); } float offset = 0.05F; @@ -126,64 +114,51 @@ public void breakBlock (World par1World, int x, int y, int z, Block blockID, int int side = -1; - //This class does not have an actual block placed in the world + // This class does not have an actual block placed in the world @Override - public int onBlockPlaced (World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int meta) - { + public int onBlockPlaced(World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int meta) { this.side = side; return meta; } @Override - public void onBlockPlacedBy (World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack stack) - { + public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityliving, ItemStack stack) { TileEntity logic = world.getTileEntity(x, y, z); - if (logic instanceof NetherrackFurnaceLogic) - { + if (logic instanceof NetherrackFurnaceLogic) { NetherrackFurnaceLogic direction = (NetherrackFurnaceLogic) logic; - if (entityliving == null) - { + if (entityliving == null) { direction.setDirection(0F, 0F, null); - } - else - { + } else { direction.setDirection(entityliving.rotationYaw * 4F, entityliving.rotationPitch, entityliving); } } - if (logic instanceof NetherrackFurnaceLogic) - { + if (logic instanceof NetherrackFurnaceLogic) { NetherrackFurnaceLogic inv = (NetherrackFurnaceLogic) logic; - if (stack.hasDisplayName()) - { + if (stack.hasDisplayName()) { inv.setGuiDisplayName(stack.getDisplayName()); } } } - public static boolean isActive (IBlockAccess world, int x, int y, int z) - { + public static boolean isActive(IBlockAccess world, int x, int y, int z) { TileEntity logic = world.getTileEntity(x, y, z); - if (logic instanceof NetherrackFurnaceLogic) - { + if (logic instanceof NetherrackFurnaceLogic) { return ((NetherrackFurnaceLogic) logic).getActive(); } return false; } @Override - public int damageDropped (int meta) - { + public int damageDropped(int meta) { return meta; } /* Light */ @Override - public int getLightValue (IBlockAccess world, int x, int y, int z) - { + public int getLightValue(IBlockAccess world, int x, int y, int z) { TileEntity te = world.getTileEntity(x, y, z); - if (te instanceof NetherrackFurnaceLogic) - { + if (te instanceof NetherrackFurnaceLogic) { return ((NetherrackFurnaceLogic) te).getActive() ? 15 : 0; } return this.getLightValue(); @@ -191,24 +166,20 @@ public int getLightValue (IBlockAccess world, int x, int y, int z) /* Comparator */ @Override - public boolean hasComparatorInputOverride () - { + public boolean hasComparatorInputOverride() { return true; } @Override - public int getComparatorInputOverride (World par1World, int par2, int par3, int par4, int par5) - { + public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) { return Container.calcRedstoneFromInventory((IInventory) par1World.getTileEntity(par2, par3, par4)); } @Override @SideOnly(Side.CLIENT) - public void randomDisplayTick (World world, int x, int y, int z, Random par5Random) - { + public void randomDisplayTick(World world, int x, int y, int z, Random par5Random) { NetherrackFurnaceLogic logic = (NetherrackFurnaceLogic) world.getTileEntity(x, y, z); - if (logic.getActive()) - { + if (logic.getActive()) { int direction = logic.getRenderDirection(); float f = x + 0.5F; float f1 = y + 0.0F + par5Random.nextFloat() * 6.0F / 16.0F; @@ -216,23 +187,16 @@ public void randomDisplayTick (World world, int x, int y, int z, Random par5Rand float f3 = 0.52F; float f4 = par5Random.nextFloat() * 0.6F - 0.3F; - if (direction == 4) - { + if (direction == 4) { world.spawnParticle("smoke", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D); world.spawnParticle("flame", f - f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D); - } - else if (direction == 5) - { + } else if (direction == 5) { world.spawnParticle("smoke", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D); world.spawnParticle("flame", f + f3, f1, f2 + f4, 0.0D, 0.0D, 0.0D); - } - else if (direction == 2) - { + } else if (direction == 2) { world.spawnParticle("smoke", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D); world.spawnParticle("flame", f + f4, f1, f2 - f3, 0.0D, 0.0D, 0.0D); - } - else if (direction == 3) - { + } else if (direction == 3) { world.spawnParticle("smoke", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D); world.spawnParticle("flame", f + f4, f1, f2 + f3, 0.0D, 0.0D, 0.0D); } @@ -242,41 +206,31 @@ else if (direction == 3) /* Textures */ @Override @SideOnly(Side.CLIENT) - public IIcon getIcon (int side, int meta) - { + public IIcon getIcon(int side, int meta) { return icons[(meta % 8) * 3 + getTextureIndex(side)]; } @SideOnly(Side.CLIENT) - public int getTextureIndex (int side) - { - if (side == 0 || side == 1) - return 3; - if (side == 3) - return 0; + public int getTextureIndex(int side) { + if (side == 0 || side == 1) return 3; + if (side == 3) return 0; return 2; } @Override @SideOnly(Side.CLIENT) - public IIcon getIcon (IBlockAccess world, int x, int y, int z, int side) - { + public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) { TileEntity logic = world.getTileEntity(x, y, z); - int direction = (logic instanceof NetherrackFurnaceLogic) ? ((NetherrackFurnaceLogic) logic).getRenderDirection() : 0; + int direction = + (logic instanceof NetherrackFurnaceLogic) ? ((NetherrackFurnaceLogic) logic).getRenderDirection() : 0; int meta = world.getBlockMetadata(x, y, z) % 8; - if (meta == 0) - { - if (side == direction) - { - if (((NetherrackFurnaceLogic) logic).getActive()) - return icons[1]; - else - return icons[0]; - } - else if (side > 1) - { + if (meta == 0) { + if (side == direction) { + if (((NetherrackFurnaceLogic) logic).getActive()) return icons[1]; + else return icons[0]; + } else if (side > 1) { return icons[2]; } return icons[3]; @@ -288,22 +242,19 @@ else if (side > 1) public IIcon[] icons; @SideOnly(Side.CLIENT) - public String[] getTextureNames () - { - String[] textureNames = { "nfurnace_off", "nfurnace_on", "nfurnace_side", "nfurnace_top" }; + public String[] getTextureNames() { + String[] textureNames = {"nfurnace_off", "nfurnace_on", "nfurnace_side", "nfurnace_top"}; return textureNames; } @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons (IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { String[] textureNames = getTextureNames(); this.icons = new IIcon[textureNames.length]; - for (int i = 0; i < this.icons.length; ++i) - { + for (int i = 0; i < this.icons.length; ++i) { this.icons[i] = iconRegister.registerIcon("natura:" + textureNames[i]); } } diff --git a/src/main/java/mods/natura/blocks/tech/NetherrackFurnaceLogic.java b/src/main/java/mods/natura/blocks/tech/NetherrackFurnaceLogic.java index 691181bd..9db41f68 100644 --- a/src/main/java/mods/natura/blocks/tech/NetherrackFurnaceLogic.java +++ b/src/main/java/mods/natura/blocks/tech/NetherrackFurnaceLogic.java @@ -25,16 +25,16 @@ import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.util.MathHelper; -public class NetherrackFurnaceLogic extends TileEntityFurnace -{ - private static final int[] slots_top = new int[] { 0 }; - private static final int[] slots_bottom = new int[] { 2, 1 }; - private static final int[] slots_sides = new int[] { 1 }; +public class NetherrackFurnaceLogic extends TileEntityFurnace { + private static final int[] slots_top = new int[] {0}; + private static final int[] slots_bottom = new int[] {2, 1}; + private static final int[] slots_sides = new int[] {1}; /** * The ItemStacks that hold the items currently being used in the furnace */ private ItemStack[] inventory = new ItemStack[3]; + private String field_94130_e; byte direction; @@ -44,8 +44,7 @@ public class NetherrackFurnaceLogic extends TileEntityFurnace * Returns the number of slots in the inventory. */ @Override - public int getSizeInventory () - { + public int getSizeInventory() { return this.inventory.length; } @@ -53,8 +52,7 @@ public int getSizeInventory () * Returns the stack in slot i */ @Override - public ItemStack getStackInSlot (int par1) - { + public ItemStack getStackInSlot(int par1) { return this.inventory[par1]; } @@ -63,32 +61,24 @@ public ItemStack getStackInSlot (int par1) * new stack. */ @Override - public ItemStack decrStackSize (int par1, int par2) - { - if (this.inventory[par1] != null) - { + public ItemStack decrStackSize(int par1, int par2) { + if (this.inventory[par1] != null) { ItemStack itemstack; - if (this.inventory[par1].stackSize <= par2) - { + if (this.inventory[par1].stackSize <= par2) { itemstack = this.inventory[par1]; this.inventory[par1] = null; return itemstack; - } - else - { + } else { itemstack = this.inventory[par1].splitStack(par2); - if (this.inventory[par1].stackSize == 0) - { + if (this.inventory[par1].stackSize == 0) { this.inventory[par1] = null; } return itemstack; } - } - else - { + } else { return null; } } @@ -98,16 +88,12 @@ public ItemStack decrStackSize (int par1, int par2) * like when you close a workbench GUI. */ @Override - public ItemStack getStackInSlotOnClosing (int par1) - { - if (this.inventory[par1] != null) - { + public ItemStack getStackInSlotOnClosing(int par1) { + if (this.inventory[par1] != null) { ItemStack itemstack = this.inventory[par1]; this.inventory[par1] = null; return itemstack; - } - else - { + } else { return null; } } @@ -116,12 +102,10 @@ public ItemStack getStackInSlotOnClosing (int par1) * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). */ @Override - public void setInventorySlotContents (int par1, ItemStack par2ItemStack) - { + public void setInventorySlotContents(int par1, ItemStack par2ItemStack) { this.inventory[par1] = par2ItemStack; - if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit()) - { + if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit()) { par2ItemStack.stackSize = this.getInventoryStackLimit(); } } @@ -129,8 +113,7 @@ public void setInventorySlotContents (int par1, ItemStack par2ItemStack) /** * Returns the name of the inventory. */ - public String getInvName () - { + public String getInvName() { return this.isInvNameLocalized() ? this.field_94130_e : "container.furnace"; } @@ -138,16 +121,14 @@ public String getInvName () * If this returns false, the inventory name will be used as an unlocalized name, and translated into the player's * language. Otherwise it will be used directly. */ - public boolean isInvNameLocalized () - { + public boolean isInvNameLocalized() { return this.field_94130_e != null && this.field_94130_e.length() > 0; } /** * Sets the custom display name to use when opening a GUI linked to this tile entity. */ - public void setGuiDisplayName (String par1Str) - { + public void setGuiDisplayName(String par1Str) { this.field_94130_e = par1Str; } @@ -155,19 +136,16 @@ public void setGuiDisplayName (String par1Str) * Reads a tile entity from NBT. */ @Override - public void readFromNBT (NBTTagCompound par1NBTTagCompound) - { + public void readFromNBT(NBTTagCompound par1NBTTagCompound) { super.readFromNBT(par1NBTTagCompound); NBTTagList nbttaglist = par1NBTTagCompound.getTagList("Items", 10); this.inventory = new ItemStack[this.getSizeInventory()]; - for (int i = 0; i < nbttaglist.tagCount(); ++i) - { + for (int i = 0; i < nbttaglist.tagCount(); ++i) { NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i); byte b0 = nbttagcompound1.getByte("Slot"); - if (b0 >= 0 && b0 < this.inventory.length) - { + if (b0 >= 0 && b0 < this.inventory.length) { this.inventory[b0] = ItemStack.loadItemStackFromNBT(nbttagcompound1); } } @@ -176,8 +154,7 @@ public void readFromNBT (NBTTagCompound par1NBTTagCompound) this.furnaceCookTime = par1NBTTagCompound.getShort("CookTime"); this.currentItemBurnTime = getFuelTime(this.inventory[1]) * 2; - if (par1NBTTagCompound.hasKey("CustomName")) - { + if (par1NBTTagCompound.hasKey("CustomName")) { this.field_94130_e = par1NBTTagCompound.getString("CustomName"); } readNetworkNBT(par1NBTTagCompound); @@ -187,17 +164,14 @@ public void readFromNBT (NBTTagCompound par1NBTTagCompound) * Writes a tile entity to NBT. */ @Override - public void writeToNBT (NBTTagCompound par1NBTTagCompound) - { + public void writeToNBT(NBTTagCompound par1NBTTagCompound) { super.writeToNBT(par1NBTTagCompound); par1NBTTagCompound.setShort("BurnTime", (short) this.furnaceBurnTime); par1NBTTagCompound.setShort("CookTime", (short) this.furnaceCookTime); NBTTagList nbttaglist = new NBTTagList(); - for (int i = 0; i < this.inventory.length; ++i) - { - if (this.inventory[i] != null) - { + for (int i = 0; i < this.inventory.length; ++i) { + if (this.inventory[i] != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); nbttagcompound1.setByte("Slot", (byte) i); this.inventory[i].writeToNBT(nbttagcompound1); @@ -207,37 +181,32 @@ public void writeToNBT (NBTTagCompound par1NBTTagCompound) par1NBTTagCompound.setTag("Items", nbttaglist); - if (this.isInvNameLocalized()) - { + if (this.isInvNameLocalized()) { par1NBTTagCompound.setString("CustomName", this.field_94130_e); } writeNetworkNBT(par1NBTTagCompound); } - public void readNetworkNBT (NBTTagCompound tags) - { + public void readNetworkNBT(NBTTagCompound tags) { direction = tags.getByte("Direction"); active = tags.getBoolean("Active"); } - public void writeNetworkNBT (NBTTagCompound tags) - { + public void writeNetworkNBT(NBTTagCompound tags) { tags.setByte("Direction", direction); tags.setBoolean("Active", active); } /* Packets */ @Override - public Packet getDescriptionPacket () - { + public Packet getDescriptionPacket() { NBTTagCompound tag = new NBTTagCompound(); writeNetworkNBT(tag); return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag); } @Override - public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity pkt) - { + public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) { // Probably has deobf now, check on forge 1029 readNetworkNBT(pkt.func_148857_g()); worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); @@ -248,8 +217,7 @@ public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity pkt) * this more of a set than a get?* */ @Override - public int getInventoryStackLimit () - { + public int getInventoryStackLimit() { return 64; } @@ -259,8 +227,7 @@ public int getInventoryStackLimit () * Returns an integer between 0 and the passed value representing how close the current item is to being completely * cooked */ - public int getCookProgressScaled (int par1) - { + public int getCookProgressScaled(int par1) { return this.furnaceCookTime * par1 / 200; } @@ -270,10 +237,8 @@ public int getCookProgressScaled (int par1) * Returns an integer between 0 and the passed value representing how much burn time is left on the current fuel * item, where 0 means that the item is exhausted and the passed value means that the item is fresh */ - public int getBurnTimeRemainingScaled (int par1) - { - if (this.currentItemBurnTime == 0) - { + public int getBurnTimeRemainingScaled(int par1) { + if (this.currentItemBurnTime == 0) { this.currentItemBurnTime = 200; } @@ -284,8 +249,7 @@ public int getBurnTimeRemainingScaled (int par1) * Returns true if the furnace is currently burning */ @Override - public boolean isBurning () - { + public boolean isBurning() { return this.furnaceBurnTime > 0; } @@ -294,75 +258,61 @@ public boolean isBurning () * ticks and creates a new spawn inside its implementation. */ @Override - public void updateEntity () - { + public void updateEntity() { boolean flag = this.furnaceBurnTime > 0; boolean flag1 = false; - if (this.furnaceBurnTime > 0) - { + if (this.furnaceBurnTime > 0) { --this.furnaceBurnTime; } - if (!this.worldObj.isRemote) - { - if (this.furnaceBurnTime == 0 && this.canSmelt()) - { + if (!this.worldObj.isRemote) { + if (this.furnaceBurnTime == 0 && this.canSmelt()) { this.currentItemBurnTime = this.furnaceBurnTime = getFuelTime(this.inventory[1]) * 2; - if (this.furnaceBurnTime > 0) - { + if (this.furnaceBurnTime > 0) { flag1 = true; - if (this.inventory[1] != null) - { + if (this.inventory[1] != null) { --this.inventory[1].stackSize; - if (this.inventory[1].stackSize == 0) - { + if (this.inventory[1].stackSize == 0) { this.inventory[1] = this.inventory[1].getItem().getContainerItem(inventory[1]); } } } } - if (this.isBurning() && this.canSmelt()) - { + if (this.isBurning() && this.canSmelt()) { ++this.furnaceCookTime; - if (this.furnaceCookTime == 200) - { + if (this.furnaceCookTime == 200) { this.furnaceCookTime = 0; this.smeltItem(); - if (!active) - { + if (!active) { this.active = true; worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } flag1 = true; } - } - else - { + } else { this.furnaceCookTime = 0; - if (active) - { + if (active) { this.active = false; worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); } } - if (flag != this.furnaceBurnTime > 0) - { + if (flag != this.furnaceBurnTime > 0) { flag1 = true; this.active = true; worldObj.markBlockForUpdate(xCoord, yCoord, zCoord); - //BlockFurnace.updateFurnaceBlockState(this.furnaceBurnTime > 0, this.worldObj, this.xCoord, this.yCoord, this.zCoord); + // BlockFurnace.updateFurnaceBlockState(this.furnaceBurnTime > 0, this.worldObj, this.xCoord, + // this.yCoord, this.zCoord); } } - if (flag1) - { + if (flag1) { this.markDirty(); } } @@ -370,21 +320,14 @@ public void updateEntity () /** * Returns true if the furnace can smelt an item, i.e. has a source item, destination stack isn't full, etc. */ - private boolean canSmelt () - { - if (this.inventory[0] == null) - { + private boolean canSmelt() { + if (this.inventory[0] == null) { return false; - } - else - { + } else { ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(this.inventory[0]); - if (itemstack == null) - return false; - if (this.inventory[2] == null) - return true; - if (!this.inventory[2].isItemEqual(itemstack)) - return false; + if (itemstack == null) return false; + if (this.inventory[2] == null) return true; + if (!this.inventory[2].isItemEqual(itemstack)) return false; int result = inventory[2].stackSize + itemstack.stackSize; return (result <= getInventoryStackLimit() && result <= itemstack.getMaxStackSize()); } @@ -394,25 +337,19 @@ private boolean canSmelt () * Turn one item from the furnace source stack into the appropriate smelted item in the furnace result stack */ @Override - public void smeltItem () - { - if (this.canSmelt()) - { + public void smeltItem() { + if (this.canSmelt()) { ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(this.inventory[0]); - if (this.inventory[2] == null) - { + if (this.inventory[2] == null) { this.inventory[2] = itemstack.copy(); - } - else if (this.inventory[2].isItemEqual(itemstack)) - { + } else if (this.inventory[2].isItemEqual(itemstack)) { inventory[2].stackSize += itemstack.stackSize; } --this.inventory[0].stackSize; - if (this.inventory[0].stackSize <= 0) - { + if (this.inventory[0].stackSize <= 0) { this.inventory[0] = null; } } @@ -422,57 +359,43 @@ else if (this.inventory[2].isItemEqual(itemstack)) * Returns the number of ticks that the supplied fuel item will keep the furnace burning, or 0 if the item isn't * fuel */ - public static int getFuelTime (ItemStack par0ItemStack) - { - if (par0ItemStack == null) - { + public static int getFuelTime(ItemStack par0ItemStack) { + if (par0ItemStack == null) { return 0; - } - else - { + } else { Item item = par0ItemStack.getItem(); - if (par0ItemStack.getItem() instanceof ItemBlock && item != null) - { + if (par0ItemStack.getItem() instanceof ItemBlock && item != null) { Block block = BlockUtils.getBlockFromItem(item); - if (block == Blocks.wooden_slab) - { + if (block == Blocks.wooden_slab) { return 150; } - if (block instanceof BlockLog) - { + if (block instanceof BlockLog) { return 1200; } - if (block.getMaterial() == Material.wood) - { + if (block.getMaterial() == Material.wood) { return 300; } - if (block == Blocks.coal_block) - { + if (block == Blocks.coal_block) { return 16000; } } - if (item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD")) - return 200; - if (item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD")) - return 200; - if (item instanceof ItemHoe && ((ItemHoe) item).getToolMaterialName().equals("WOOD")) - return 200; - if (item == Items.stick) - return 100; - if (item == Items.coal) - return 1600; - if (item == Items.lava_bucket) - return 20000; - if (BlockUtils.getBlockFromItem(item) == Blocks.sapling) - return 100; - if (item == Items.blaze_rod) - return 2400; + if (item instanceof ItemTool + && ((ItemTool) item).getToolMaterialName().equals("WOOD")) return 200; + if (item instanceof ItemSword + && ((ItemSword) item).getToolMaterialName().equals("WOOD")) return 200; + if (item instanceof ItemHoe + && ((ItemHoe) item).getToolMaterialName().equals("WOOD")) return 200; + if (item == Items.stick) return 100; + if (item == Items.coal) return 1600; + if (item == Items.lava_bucket) return 20000; + if (BlockUtils.getBlockFromItem(item) == Blocks.sapling) return 100; + if (item == Items.blaze_rod) return 2400; return GameRegistry.getFuelValue(par0ItemStack); } } @@ -480,8 +403,7 @@ public static int getFuelTime (ItemStack par0ItemStack) /** * Return true if item is a fuel source (getItemBurnTime() > 0). */ - public static boolean isItemFuel (ItemStack par0ItemStack) - { + public static boolean isItemFuel(ItemStack par0ItemStack) { return getFuelTime(par0ItemStack) > 0; } @@ -489,25 +411,21 @@ public static boolean isItemFuel (ItemStack par0ItemStack) * Do not make give this method the name canInteractWith because it clashes with Container */ @Override - public boolean isUseableByPlayer (EntityPlayer par1EntityPlayer) - { - return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : par1EntityPlayer.getDistanceSq(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D) <= 64.0D; + public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) { + return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this + ? false + : par1EntityPlayer.getDistanceSq(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D) <= 64.0D; } - public void openChest () - { - } + public void openChest() {} - public void closeChest () - { - } + public void closeChest() {} /** * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. */ @Override - public boolean isItemValidForSlot (int par1, ItemStack par2ItemStack) - { + public boolean isItemValidForSlot(int par1, ItemStack par2ItemStack) { return par1 == 2 ? false : (par1 == 1 ? isItemFuel(par2ItemStack) : true); } @@ -516,8 +434,7 @@ public boolean isItemValidForSlot (int par1, ItemStack par2ItemStack) * block. */ @Override - public int[] getAccessibleSlotsFromSide (int par1) - { + public int[] getAccessibleSlotsFromSide(int par1) { return par1 == 0 ? slots_bottom : (par1 == 1 ? slots_top : slots_sides); } @@ -526,8 +443,7 @@ public int[] getAccessibleSlotsFromSide (int par1) * side */ @Override - public boolean canInsertItem (int par1, ItemStack par2ItemStack, int par3) - { + public boolean canInsertItem(int par1, ItemStack par2ItemStack, int par3) { return this.isItemValidForSlot(par1, par2ItemStack); } @@ -536,41 +452,36 @@ public boolean canInsertItem (int par1, ItemStack par2ItemStack, int par3) * side */ @Override - public boolean canExtractItem (int par1, ItemStack par2ItemStack, int par3) - { + public boolean canExtractItem(int par1, ItemStack par2ItemStack, int par3) { return par3 != 0 || par1 != 1 || par2ItemStack.getItem() == Items.bucket; } - public boolean getActive () - { + public boolean getActive() { return active; } - public void setDirection (float yaw, float pitch, Object object) - { + public void setDirection(float yaw, float pitch, Object object) { int facing = MathHelper.floor_double(yaw / 360 + 0.5D) & 3; - switch (facing) - { - case 0: - direction = 2; - break; - - case 1: - direction = 5; - break; - - case 2: - direction = 3; - break; - - case 3: - direction = 4; - break; + switch (facing) { + case 0: + direction = 2; + break; + + case 1: + direction = 5; + break; + + case 2: + direction = 3; + break; + + case 3: + direction = 4; + break; } } - public int getRenderDirection () - { + public int getRenderDirection() { return direction; } } diff --git a/src/main/java/mods/natura/blocks/tech/RespawnObelisk.java b/src/main/java/mods/natura/blocks/tech/RespawnObelisk.java index 5d230aeb..97e82677 100644 --- a/src/main/java/mods/natura/blocks/tech/RespawnObelisk.java +++ b/src/main/java/mods/natura/blocks/tech/RespawnObelisk.java @@ -1,9 +1,8 @@ package mods.natura.blocks.tech; -import java.util.Random; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.Random; import mods.natura.Natura; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -15,54 +14,59 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public class RespawnObelisk extends Block -{ - public RespawnObelisk(Material material) - { +public class RespawnObelisk extends Block { + public RespawnObelisk(Material material) { super(material); } @Override - public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) - { - if (player.isSneaking()) - return false; + public boolean onBlockActivated( + World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { + if (player.isSneaking()) return false; player.setSpawnChunk(new ChunkCoordinates(x, y, z), false, world.provider.dimensionId); - if (!world.isRemote) - player.addChatMessage(player.func_145748_c_().appendText("Spawn point set!")); + if (!world.isRemote) player.addChatMessage(player.func_145748_c_().appendText("Spawn point set!")); world.setBlockMetadataWithNotify(x, y, z, 1, 3); - world.playSound(x + 0.5D, y + 0.5D, z + 0.5D, "portal.portal", 1.0F, Natura.random.nextFloat() * 0.4F + 0.8F, false); + world.playSound( + x + 0.5D, y + 0.5D, z + 0.5D, "portal.portal", 1.0F, Natura.random.nextFloat() * 0.4F + 0.8F, false); return true; } @Override - public boolean isBed (IBlockAccess world, int x, int y, int z, EntityLivingBase player) - { + public boolean isBed(IBlockAccess world, int x, int y, int z, EntityLivingBase player) { return world.getBlockMetadata(x, y, z) != 0; } @Override - public int getLightValue (IBlockAccess world, int x, int y, int z) - { + public int getLightValue(IBlockAccess world, int x, int y, int z) { int meta = world.getBlockMetadata(x, y, z); - if (meta > 0) - return 7; + if (meta > 0) return 7; return this.getLightValue(); } @Override @SideOnly(Side.CLIENT) - public void randomDisplayTick (World world, int x, int y, int z, Random random) - { + public void randomDisplayTick(World world, int x, int y, int z, Random random) { int meta = world.getBlockMetadata(x, y, z); - if (meta > 0) - { - for (int i = 0; i < 2; i++) - { - world.spawnParticle("portal", x + random.nextFloat() * 3 - 1, y + random.nextFloat() * 2, z + random.nextFloat() * 3 - 1, 0, 0, 0); - world.spawnParticle("witchMagic", x + random.nextFloat() * 3 - 1, y + random.nextFloat() * 2, z + random.nextFloat() * 3 - 1, 0, 0, 0); + if (meta > 0) { + for (int i = 0; i < 2; i++) { + world.spawnParticle( + "portal", + x + random.nextFloat() * 3 - 1, + y + random.nextFloat() * 2, + z + random.nextFloat() * 3 - 1, + 0, + 0, + 0); + world.spawnParticle( + "witchMagic", + x + random.nextFloat() * 3 - 1, + y + random.nextFloat() * 2, + z + random.nextFloat() * 3 - 1, + 0, + 0, + 0); } } } @@ -72,16 +76,14 @@ public void randomDisplayTick (World world, int x, int y, int z, Random random) @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons (IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.blockIcon = iconRegister.registerIcon("natura:obelisk"); this.activeTexture = iconRegister.registerIcon("natura:obelisk_active"); } @Override @SideOnly(Side.CLIENT) - public IIcon getIcon (int side, int meta) - { + public IIcon getIcon(int side, int meta) { return meta == 0 ? this.blockIcon : this.activeTexture; } } diff --git a/src/main/java/mods/natura/blocks/trees/DarkTreeBlock.java b/src/main/java/mods/natura/blocks/trees/DarkTreeBlock.java index 89d008bf..b77bc49c 100644 --- a/src/main/java/mods/natura/blocks/trees/DarkTreeBlock.java +++ b/src/main/java/mods/natura/blocks/trees/DarkTreeBlock.java @@ -1,10 +1,9 @@ package mods.natura.blocks.trees; -import java.util.List; -import java.util.Random; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; +import java.util.Random; import mods.natura.common.NaturaTab; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -17,43 +16,37 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public class DarkTreeBlock extends Block -{ +public class DarkTreeBlock extends Block { public IIcon[] icons; - public String[] textureNames = new String[] { "darkwood_bark", "darkwood_heart", "fusewood_bark", "fusewood_heart" }; + public String[] textureNames = new String[] {"darkwood_bark", "darkwood_heart", "fusewood_bark", "fusewood_heart"}; - public DarkTreeBlock() - { + public DarkTreeBlock() { super(Material.wood); this.setHardness(3.5F); this.setResistance(40F); this.setStepSound(Block.soundTypeWood); - //setBurnProperties(this.blockID, 5, 20); + // setBurnProperties(this.blockID, 5, 20); this.setCreativeTab(NaturaTab.tab); } @Override @SideOnly(Side.CLIENT) - public IIcon getIcon (int side, int metadata) - { + public IIcon getIcon(int side, int metadata) { int tex = (metadata % 4) * 2; int orientation = metadata / 4; switch (orientation) - //Ends of logs + // Ends of logs { - case 0: - if (side == 0 || side == 1) - return icons[tex + 1]; - break; - case 1: - if (side == 4 || side == 5) - return icons[tex + 1]; - break; - case 2: - if (side == 2 || side == 3) - return icons[tex + 1]; - break; + case 0: + if (side == 0 || side == 1) return icons[tex + 1]; + break; + case 1: + if (side == 4 || side == 5) return icons[tex + 1]; + break; + case 2: + if (side == 2 || side == 3) return icons[tex + 1]; + break; } return icons[tex]; @@ -61,42 +54,33 @@ public IIcon getIcon (int side, int metadata) @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons (IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.icons = new IIcon[textureNames.length]; - for (int i = 0; i < this.icons.length; ++i) - { + for (int i = 0; i < this.icons.length; ++i) { this.icons[i] = iconRegister.registerIcon("natura:" + textureNames[i]); } } @Override - public Item getItemDropped (int par1, Random par2Random, int par3) - { + public Item getItemDropped(int par1, Random par2Random, int par3) { return Item.getItemFromBlock(this); } /** * ejects contained items into the world, and notifies neighbours of an update, as appropriate */ - public void breakBlock (World par1World, int par2, int par3, int par4, int par5, int par6) - { + public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) { byte b0 = 4; int j1 = b0 + 1; - if (par1World.checkChunksExist(par2 - j1, par3 - j1, par4 - j1, par2 + j1, par3 + j1, par4 + j1)) - { - for (int k1 = -b0; k1 <= b0; ++k1) - { - for (int l1 = -b0; l1 <= b0; ++l1) - { - for (int i2 = -b0; i2 <= b0; ++i2) - { + if (par1World.checkChunksExist(par2 - j1, par3 - j1, par4 - j1, par2 + j1, par3 + j1, par4 + j1)) { + for (int k1 = -b0; k1 <= b0; ++k1) { + for (int l1 = -b0; l1 <= b0; ++l1) { + for (int i2 = -b0; i2 <= b0; ++i2) { Block j2 = par1World.getBlock(par2 + k1, par3 + l1, par4 + i2); - if (j2 != null) - { + if (j2 != null) { j2.beginLeavesDecay(par1World, par2 + k1, par3 + l1, par4 + i2); } } @@ -109,24 +93,23 @@ public void breakBlock (World par1World, int par2, int par3, int par4, int par5, * Called when a block is placed using its ItemBlock. Args: World, X, Y, Z, side, hitX, hitY, hitZ, block metadata */ @Override - public int onBlockPlaced (World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9) - { + public int onBlockPlaced( + World par1World, int par2, int par3, int par4, int par5, float par6, float par7, float par8, int par9) { int j1 = par9 & 3; byte b0 = 0; - switch (par5) - { - case 0: - case 1: - b0 = 0; - break; - case 2: - case 3: - b0 = 8; - break; - case 4: - case 5: - b0 = 4; + switch (par5) { + case 0: + case 1: + b0 = 0; + break; + case 2: + case 3: + b0 = 8; + break; + case 4: + case 5: + b0 = 4; } return j1 | b0; @@ -136,59 +119,47 @@ public int onBlockPlaced (World par1World, int par2, int par3, int par4, int par * Determines the damage on the item the block drops. Used in cloth and wood. */ @Override - public int damageDropped (int par1) - { + public int damageDropped(int par1) { return par1 & 3; } /** * returns a number between 0 and 3 */ - public static int limitToValidMetadata (int par0) - { + public static int limitToValidMetadata(int par0) { return par0 & 3; } @Override - protected ItemStack createStackedBlock (int par1) - { + protected ItemStack createStackedBlock(int par1) { return new ItemStack(this, 1, limitToValidMetadata(par1)); } - public boolean isBlockReplaceable (World world, int x, int y, int z) - { + public boolean isBlockReplaceable(World world, int x, int y, int z) { return false; } @Override - public void onBlockHarvested (World world, int x, int y, int z, int meta, EntityPlayer player) - { - if (meta % 4 == 1) - { - if (world.difficultySetting.getDifficultyId() > 2) - world.createExplosion(null, x, y, z, 1.75f, false); - else - world.createExplosion(null, x, y, z, 2f, false); + public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player) { + if (meta % 4 == 1) { + if (world.difficultySetting.getDifficultyId() > 2) world.createExplosion(null, x, y, z, 1.75f, false); + else world.createExplosion(null, x, y, z, 2f, false); } } @SideOnly(Side.CLIENT) @Override - public void getSubBlocks (Item par1, CreativeTabs par2CreativeTabs, List par3List) - { - for (int i = 0; i < icons.length / 2; i++) - par3List.add(new ItemStack(par1, 1, i)); + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + for (int i = 0; i < icons.length / 2; i++) par3List.add(new ItemStack(par1, 1, i)); } @Override - public boolean canSustainLeaves (IBlockAccess world, int x, int y, int z) - { + public boolean canSustainLeaves(IBlockAccess world, int x, int y, int z) { return true; } @Override - public boolean isWood (IBlockAccess world, int x, int y, int z) - { + public boolean isWood(IBlockAccess world, int x, int y, int z) { return true; } } diff --git a/src/main/java/mods/natura/blocks/trees/FruitTreeBlock.java b/src/main/java/mods/natura/blocks/trees/FruitTreeBlock.java index 082181fc..39c9848d 100644 --- a/src/main/java/mods/natura/blocks/trees/FruitTreeBlock.java +++ b/src/main/java/mods/natura/blocks/trees/FruitTreeBlock.java @@ -1,16 +1,13 @@ package mods.natura.blocks.trees; import java.util.Random; - import mods.natura.common.NaturaTab; import net.minecraft.block.Block; import net.minecraft.block.BlockLog; import net.minecraft.item.Item; -public class FruitTreeBlock extends BlockLog -{ - public FruitTreeBlock() - { +public class FruitTreeBlock extends BlockLog { + public FruitTreeBlock() { super(); this.setHardness(1.5F); this.setResistance(5F); @@ -23,7 +20,7 @@ public FruitTreeBlock() { int tex = blockIndexInTexture + (metadata % 4); int orientation = metadata / 4; - + switch (orientation) //Ends of logs { case 0: @@ -39,19 +36,17 @@ public FruitTreeBlock() return tex + 16; break; } - + return tex; }*/ @Override - public Item getItemDropped (int par1, Random par2Random, int par3) - { + public Item getItemDropped(int par1, Random par2Random, int par3) { return Item.getItemFromBlock(this); } @Override - public int damageDropped (int meta) - { + public int damageDropped(int meta) { return meta % 4; } diff --git a/src/main/java/mods/natura/blocks/trees/LogTwoxTwo.java b/src/main/java/mods/natura/blocks/trees/LogTwoxTwo.java index 760c4f92..df53f485 100644 --- a/src/main/java/mods/natura/blocks/trees/LogTwoxTwo.java +++ b/src/main/java/mods/natura/blocks/trees/LogTwoxTwo.java @@ -1,10 +1,9 @@ package mods.natura.blocks.trees; -import java.util.List; -import java.util.Random; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; +import java.util.Random; import mods.natura.common.NContent; import mods.natura.common.NaturaTab; import net.minecraft.block.Block; @@ -18,16 +17,16 @@ import net.minecraft.world.World; /* - * This class is for a single tree with a 2x2 base and inside textures + * This class is for a single tree with a 2x2 base and inside textures */ -public class LogTwoxTwo extends Block -{ +public class LogTwoxTwo extends Block { public IIcon[] icons; - public String[] textureNames = new String[] { "bark", "heart_small", "upper_left", "upper_right", "side_left", "side_right", "lower_left", "lower_right" }; + public String[] textureNames = new String[] { + "bark", "heart_small", "upper_left", "upper_right", "side_left", "side_right", "lower_left", "lower_right" + }; - public LogTwoxTwo(float hardness, Material material) - { + public LogTwoxTwo(float hardness, Material material) { super(material); this.setHardness(hardness); this.setStepSound(Block.soundTypeMetal); @@ -36,57 +35,44 @@ public LogTwoxTwo(float hardness, Material material) @SideOnly(Side.CLIENT) @Override - public void registerBlockIcons (IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.icons = new IIcon[textureNames.length]; - for (int i = 0; i < this.icons.length; i++) - { + for (int i = 0; i < this.icons.length; i++) { this.icons[i] = iconRegister.registerIcon("natura:bloodwood_" + textureNames[i]); } } @Override - public Item getItemDropped (int par1, Random par2Random, int par3) - { - return Item.getItemFromBlock(NContent.bloodwood);//new ItemStack(NContent.bloodwood).getItem(); + public Item getItemDropped(int par1, Random par2Random, int par3) { + return Item.getItemFromBlock(NContent.bloodwood); // new ItemStack(NContent.bloodwood).getItem(); } @Override - public int damageDropped (int meta) - { - if (meta < 12) - return 0; - else if (meta == 15) - return 15; + public int damageDropped(int meta) { + if (meta < 12) return 0; + else if (meta == 15) return 15; return 12; } - public boolean isBlockReplaceable (World world, int x, int y, int z) - { + public boolean isBlockReplaceable(World world, int x, int y, int z) { return false; } /** * ejects contained items into the world, and notifies neighbours of an update, as appropriate */ - public void breakBlock (World par1World, int par2, int par3, int par4, int par5, int par6) - { + public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) { byte b0 = 4; int j1 = b0 + 1; - if (par1World.checkChunksExist(par2 - j1, par3 - j1, par4 - j1, par2 + j1, par3 + j1, par4 + j1)) - { - for (int k1 = -b0; k1 <= b0; ++k1) - { - for (int l1 = -b0; l1 <= b0; ++l1) - { - for (int i2 = -b0; i2 <= b0; ++i2) - { + if (par1World.checkChunksExist(par2 - j1, par3 - j1, par4 - j1, par2 + j1, par3 + j1, par4 + j1)) { + for (int k1 = -b0; k1 <= b0; ++k1) { + for (int l1 = -b0; l1 <= b0; ++l1) { + for (int i2 = -b0; i2 <= b0; ++i2) { Block j2 = par1World.getBlock(par2 + k1, par3 + l1, par4 + i2); - if (j2 != null) - { + if (j2 != null) { j2.beginLeavesDecay(par1World, par2 + k1, par3 + l1, par4 + i2); } } @@ -99,262 +85,234 @@ public void breakBlock (World par1World, int par2, int par3, int par4, int par5, * The type of render function that is called for this block */ @Override - public int getRenderType () - { + public int getRenderType() { return 31; } @Override - protected ItemStack createStackedBlock (int par1) - { + protected ItemStack createStackedBlock(int par1) { return new ItemStack(this, 1, limitToValidMetadata(par1)); } /** * returns a number between 0 and 3 */ - public static int limitToValidMetadata (int par0) - { + public static int limitToValidMetadata(int par0) { return par0 & 3; } @Override @SideOnly(Side.CLIENT) - public IIcon getIcon (int side, int meta) - { - if (meta == 15) //Fullbark - return icons[0]; + public IIcon getIcon(int side, int meta) { + if (meta == 15) // Fullbark + return icons[0]; - //TODO: Rotating single log for 12, 13, 14 + // TODO: Rotating single log for 12, 13, 14 // Upward facing - if (meta == 0) - { - switch (side) - { - case 0: - return icons[2]; //Bottom - case 1: - return icons[2]; //Top - case 2: - return icons[0]; - case 3: - return icons[4]; - case 4: - return icons[0]; - case 5: - return icons[5]; + if (meta == 0) { + switch (side) { + case 0: + return icons[2]; // Bottom + case 1: + return icons[2]; // Top + case 2: + return icons[0]; + case 3: + return icons[4]; + case 4: + return icons[0]; + case 5: + return icons[5]; } } - if (meta == 1) - { - switch (side) - { - case 0: - return icons[3]; //Bottom - case 1: - return icons[3]; //Top - case 2: - return icons[0]; - case 3: - return icons[5]; - case 4: - return icons[4]; - case 5: - return icons[0]; + if (meta == 1) { + switch (side) { + case 0: + return icons[3]; // Bottom + case 1: + return icons[3]; // Top + case 2: + return icons[0]; + case 3: + return icons[5]; + case 4: + return icons[4]; + case 5: + return icons[0]; } } - if (meta == 2) - { - switch (side) - { - case 0: - return icons[6]; //Bottom - case 1: - return icons[6]; //Top - case 2: - return icons[5]; - case 3: - return icons[0]; - case 4: - return icons[0]; - case 5: - return icons[4]; + if (meta == 2) { + switch (side) { + case 0: + return icons[6]; // Bottom + case 1: + return icons[6]; // Top + case 2: + return icons[5]; + case 3: + return icons[0]; + case 4: + return icons[0]; + case 5: + return icons[4]; } } - if (meta == 3) - { - switch (side) - { - case 0: - return icons[7]; //Bottom - case 1: - return icons[7]; //Top - case 2: - return icons[4]; - case 3: - return icons[0]; - case 4: - return icons[5]; - case 5: - return icons[0]; + if (meta == 3) { + switch (side) { + case 0: + return icons[7]; // Bottom + case 1: + return icons[7]; // Top + case 2: + return icons[4]; + case 3: + return icons[0]; + case 4: + return icons[5]; + case 5: + return icons[0]; } } // East/West - if (meta == 4) - { - switch (side) - { - case 0: - return icons[4]; - case 1: - return icons[0]; - case 2: - return icons[5]; - case 3: - return icons[0]; - case 4: - return icons[3]; - case 5: - return icons[2]; + if (meta == 4) { + switch (side) { + case 0: + return icons[4]; + case 1: + return icons[0]; + case 2: + return icons[5]; + case 3: + return icons[0]; + case 4: + return icons[3]; + case 5: + return icons[2]; } } - if (meta == 5) - { - switch (side) - { - case 0: - return icons[5]; - case 1: - return icons[0]; - case 2: - return icons[0]; - case 3: - return icons[4]; - case 4: - return icons[2]; - case 5: - return icons[3]; + if (meta == 5) { + switch (side) { + case 0: + return icons[5]; + case 1: + return icons[0]; + case 2: + return icons[0]; + case 3: + return icons[4]; + case 4: + return icons[2]; + case 5: + return icons[3]; } } - if (meta == 6) - { - switch (side) - { - case 0: - return icons[0]; //Bottom - case 1: - return icons[5]; //Top - case 2: - return icons[4]; - case 3: - return icons[0]; - case 4: - return icons[7]; - case 5: - return icons[6]; + if (meta == 6) { + switch (side) { + case 0: + return icons[0]; // Bottom + case 1: + return icons[5]; // Top + case 2: + return icons[4]; + case 3: + return icons[0]; + case 4: + return icons[7]; + case 5: + return icons[6]; } } - if (meta == 7) - { - switch (side) - { - case 0: - return icons[0]; //Bottom - case 1: - return icons[4]; //Top - case 2: - return icons[0]; - case 3: - return icons[5]; - case 4: - return icons[6]; - case 5: - return icons[7]; + if (meta == 7) { + switch (side) { + case 0: + return icons[0]; // Bottom + case 1: + return icons[4]; // Top + case 2: + return icons[0]; + case 3: + return icons[5]; + case 4: + return icons[6]; + case 5: + return icons[7]; } } - //North/south - if (meta == 8) - { - switch (side) - { - case 0: - return icons[4]; - case 1: - return icons[0]; - case 2: - return icons[3]; - case 3: - return icons[2]; - case 4: - return icons[0]; - case 5: - return icons[5]; + // North/south + if (meta == 8) { + switch (side) { + case 0: + return icons[4]; + case 1: + return icons[0]; + case 2: + return icons[3]; + case 3: + return icons[2]; + case 4: + return icons[0]; + case 5: + return icons[5]; } } - if (meta == 9) - { - switch (side) - { - case 0: - return icons[5]; - case 1: - return icons[0]; - case 2: - return icons[2]; - case 3: - return icons[3]; - case 4: - return icons[4]; - case 5: - return icons[0]; + if (meta == 9) { + switch (side) { + case 0: + return icons[5]; + case 1: + return icons[0]; + case 2: + return icons[2]; + case 3: + return icons[3]; + case 4: + return icons[4]; + case 5: + return icons[0]; } } - if (meta == 10) - { - switch (side) - { - case 0: - return icons[0]; //Bottom - case 1: - return icons[4]; //Top - case 2: - return icons[7]; - case 3: - return icons[6]; - case 4: - return icons[0]; - case 5: - return icons[4]; + if (meta == 10) { + switch (side) { + case 0: + return icons[0]; // Bottom + case 1: + return icons[4]; // Top + case 2: + return icons[7]; + case 3: + return icons[6]; + case 4: + return icons[0]; + case 5: + return icons[4]; } } - if (meta == 11) - { - switch (side) - { - case 0: - return icons[0]; //Bottom - case 1: - return icons[5]; //Top - case 2: - return icons[6]; - case 3: - return icons[7]; - case 4: - return icons[5]; - case 5: - return icons[0]; + if (meta == 11) { + switch (side) { + case 0: + return icons[0]; // Bottom + case 1: + return icons[5]; // Top + case 2: + return icons[6]; + case 3: + return icons[7]; + case 4: + return icons[5]; + case 5: + return icons[0]; } } @@ -363,39 +321,39 @@ public IIcon getIcon (int side, int meta) /* Combined stair and log placement */ @Override - public int onBlockPlaced (World par1World, int blockX, int blockY, int blockZ, int side, float clickX, float clickY, float clickZ, int metadata) - { - if (metadata >= 12) - return metadata; + public int onBlockPlaced( + World par1World, + int blockX, + int blockY, + int blockZ, + int side, + float clickX, + float clickY, + float clickZ, + int metadata) { + if (metadata >= 12) return metadata; int meta = metadata & 3; byte add = 0; - switch (side) - { - case 0: - case 1: - add = 0; - if (clickX > 0.5f) - add += 1; - if (clickZ > 0.5f) - add += 2; - break; - case 2: - case 3: - add = 8; - if (clickX > 0.5f) - add += 1; - if (clickY < 0.5f) - add += 2; - break; - case 4: - case 5: - add = 4; - if (clickZ < 0.5f) - add += 1; - if (clickY < 0.5f) - add += 2; + switch (side) { + case 0: + case 1: + add = 0; + if (clickX > 0.5f) add += 1; + if (clickZ > 0.5f) add += 2; + break; + case 2: + case 3: + add = 8; + if (clickX > 0.5f) add += 1; + if (clickY < 0.5f) add += 2; + break; + case 4: + case 5: + add = 4; + if (clickZ < 0.5f) add += 1; + if (clickY < 0.5f) add += 2; } return meta | add; @@ -406,22 +364,19 @@ public int onBlockPlaced (World par1World, int blockX, int blockY, int blockZ, i /** * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) */ - public void getSubBlocks (Item par1, CreativeTabs par2CreativeTabs, List par3List) - { + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { par3List.add(new ItemStack(par1, 1, 0)); - //par3List.add(new ItemStack(par1, 1, 12)); + // par3List.add(new ItemStack(par1, 1, 12)); par3List.add(new ItemStack(par1, 1, 15)); } @Override - public boolean canSustainLeaves (IBlockAccess world, int x, int y, int z) - { + public boolean canSustainLeaves(IBlockAccess world, int x, int y, int z) { return true; } @Override - public boolean isWood (IBlockAccess world, int x, int y, int z) - { + public boolean isWood(IBlockAccess world, int x, int y, int z) { return true; } } diff --git a/src/main/java/mods/natura/blocks/trees/NDoor.java b/src/main/java/mods/natura/blocks/trees/NDoor.java index 849dcc76..d4456e8b 100644 --- a/src/main/java/mods/natura/blocks/trees/NDoor.java +++ b/src/main/java/mods/natura/blocks/trees/NDoor.java @@ -1,9 +1,8 @@ package mods.natura.blocks.trees; -import java.util.Random; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.Random; import mods.natura.common.NContent; import net.minecraft.block.Block; import net.minecraft.block.BlockDoor; @@ -18,15 +17,13 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public class NDoor extends BlockDoor -{ +public class NDoor extends BlockDoor { private int meta; public IIcon[] icons; public IIcon[] iconsReverse; public final String doorName; - public NDoor(Material material, int md, String doorName) - { + public NDoor(Material material, int md, String doorName) { super(material); this.doorName = doorName; float f = 0.5F; @@ -39,29 +36,25 @@ public NDoor(Material material, int md, String doorName) } @Override - public Item getItemDropped (int i, Random random, int j) - { + public Item getItemDropped(int i, Random random, int j) { return (i & 8) != 0 ? Item.getItemFromBlock(Blocks.air) : NContent.doorItem; } @Override - public int damageDropped (int par1) - { + public int damageDropped(int par1) { return meta; } @Override - public void registerBlockIcons (IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.icons = new IIcon[2]; this.icons[0] = iconRegister.registerIcon("natura:" + doorName + "_door_bottom"); this.icons[1] = iconRegister.registerIcon("natura:" + doorName + "_door_top"); - + this.iconsReverse = new IIcon[this.icons.length]; - - for (int i = 0; i < this.icons.length; i++) - { + + for (int i = 0; i < this.icons.length; i++) { this.iconsReverse[i] = new IconFlipped(this.icons[i], true, false); } } @@ -71,84 +64,59 @@ public void registerBlockIcons (IIconRegister iconRegister) * Retrieves the block texture to use based on the display side. Args: iBlockAccess, x, y, z, side */ @Override - public IIcon getIcon (IBlockAccess blockAccess, int x, int y, int z, int side) - { - if (side != 1 && side != 0) - { + public IIcon getIcon(IBlockAccess blockAccess, int x, int y, int z, int side) { + if (side != 1 && side != 0) { int i1 = this.func_150012_g(blockAccess, x, y, z); int j1 = i1 & 3; boolean flag = (i1 & 4) != 0; boolean flag1 = false; boolean flag2 = (i1 & 8) != 0; - - if (flag) - { - if (j1 == 0 && side == 2) - { + + if (flag) { + if (j1 == 0 && side == 2) { flag1 = !flag1; - } - else if (j1 == 1 && side == 5) - { + } else if (j1 == 1 && side == 5) { flag1 = !flag1; - } - else if (j1 == 2 && side == 3) - { + } else if (j1 == 2 && side == 3) { flag1 = !flag1; - } - else if (j1 == 3 && side == 4) - { + } else if (j1 == 3 && side == 4) { flag1 = !flag1; } - } - else - { - if (j1 == 0 && side == 5) - { + } else { + if (j1 == 0 && side == 5) { flag1 = !flag1; - } - else if (j1 == 1 && side == 3) - { + } else if (j1 == 1 && side == 3) { flag1 = !flag1; - } - else if (j1 == 2 && side == 4) - { + } else if (j1 == 2 && side == 4) { flag1 = !flag1; - } - else if (j1 == 3 && side == 2) - { + } else if (j1 == 3 && side == 2) { flag1 = !flag1; } - - if ((i1 & 16) != 0) - { + + if ((i1 & 16) != 0) { flag1 = !flag1; } } return flag1 ? this.iconsReverse[(flag2 ? 1 : 0)] : this.icons[(flag2 ? 1 : 0)]; - } - else - { + } else { return this.icons[0]; } } @Override @SideOnly(Side.CLIENT) - public IIcon getIcon (int par1, int par2) - { + public IIcon getIcon(int par1, int par2) { return this.icons[0]; } @Override - public ItemStack getPickBlock (MovingObjectPosition target, World world, int x, int y, int z) - { + public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) { return new ItemStack(NContent.doorItem, 1, meta); } @Override - public int getRenderType () - { + public int getRenderType() { return 7; } } diff --git a/src/main/java/mods/natura/blocks/trees/NLeaves.java b/src/main/java/mods/natura/blocks/trees/NLeaves.java index 29894edb..86f79b00 100644 --- a/src/main/java/mods/natura/blocks/trees/NLeaves.java +++ b/src/main/java/mods/natura/blocks/trees/NLeaves.java @@ -1,11 +1,10 @@ package mods.natura.blocks.trees; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.List; import java.util.Random; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import mods.natura.common.NContent; import mods.natura.common.NaturaTab; import net.minecraft.block.Block; @@ -20,12 +19,10 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -public class NLeaves extends BlockLeaves -{ +public class NLeaves extends BlockLeaves { int[] adjacentTreeBlocks; - public NLeaves() - { + public NLeaves() { super(); this.setTickRandomly(true); this.setHardness(0.2F); @@ -33,37 +30,34 @@ public NLeaves() this.setStepSound(Block.soundTypeGrass); this.setBlockName("floraLeaves"); setCreativeTab(NaturaTab.tab); - //Blocks.fire.setFireInfo(this, 30, 60); + // Blocks.fire.setFireInfo(this, 30, 60); this.setCreativeTab(NaturaTab.tab); } @Override @SideOnly(Side.CLIENT) - public int getBlockColor() - { + public int getBlockColor() { double d0 = 0.5D; double d1 = 1.0D; return ColorizerFoliage.getFoliageColor(d0, d1); } @SideOnly(Side.CLIENT) - public int getRenderColor(int p_149741_1_) - { + public int getRenderColor(int p_149741_1_) { return ColorizerFoliage.getFoliageColorBasic(); } @SideOnly(Side.CLIENT) - public int colorMultiplier(IBlockAccess p_149720_1_, int p_149720_2_, int p_149720_3_, int p_149720_4_) - { + public int colorMultiplier(IBlockAccess p_149720_1_, int p_149720_2_, int p_149720_3_, int p_149720_4_) { int l = 0; int i1 = 0; int j1 = 0; - for (int k1 = -1; k1 <= 1; ++k1) - { - for (int l1 = -1; l1 <= 1; ++l1) - { - int i2 = p_149720_1_.getBiomeGenForCoords(p_149720_2_ + l1, p_149720_4_ + k1).getBiomeFoliageColor(p_149720_2_ + l1, p_149720_3_, p_149720_4_ + k1); + for (int k1 = -1; k1 <= 1; ++k1) { + for (int l1 = -1; l1 <= 1; ++l1) { + int i2 = p_149720_1_ + .getBiomeGenForCoords(p_149720_2_ + l1, p_149720_4_ + k1) + .getBiomeFoliageColor(p_149720_2_ + l1, p_149720_3_, p_149720_4_ + k1); l += (i2 & 16711680) >> 16; i1 += (i2 & 65280) >> 8; j1 += i2 & 255; @@ -74,28 +68,21 @@ public int colorMultiplier(IBlockAccess p_149720_1_, int p_149720_2_, int p_1497 } @Override - public void updateTick (World world, int x, int y, int z, Random random) - { - if (!world.isRemote) - { + public void updateTick(World world, int x, int y, int z, Random random) { + if (!world.isRemote) { int meta = world.getBlockMetadata(x, y, z); - if ((meta & 4) == 0) - { + if ((meta & 4) == 0) { int range = 4; if (world.checkChunksExist(x - range, y - range, z - range, x + range, y + range, z + range)) { // Do not decay leaves if can't check every possible support boolean nearbyTree = false; - for (int posX = x - range; posX <= x + range; posX++) - { - for (int posY = y - range; posY <= y + range; posY++) - { - for (int posZ = z - range; posZ <= z + range; posZ++) - { + for (int posX = x - range; posX <= x + range; posX++) { + for (int posY = y - range; posY <= y + range; posY++) { + for (int posZ = z - range; posZ <= z + range; posZ++) { Block block = world.getBlock(posX, posY, posZ); - if (block != null && block.canSustainLeaves(world, posX, posY, posZ)) - nearbyTree = true; + if (block != null && block.canSustainLeaves(world, posX, posY, posZ)) nearbyTree = true; } } } @@ -108,8 +95,7 @@ public void updateTick (World world, int x, int y, int z, Random random) } } - public void removeLeaves (World world, int x, int y, int z) - { + public void removeLeaves(World world, int x, int y, int z) { this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); world.setBlock(x, y, z, Blocks.air, 0, 7); } @@ -118,8 +104,7 @@ public void removeLeaves (World world, int x, int y, int z) * Returns the quantity of items to drop on block destruction. */ @Override - public int quantityDropped (Random var1) - { + public int quantityDropped(Random var1) { return var1.nextInt(20) == 0 ? 1 : 0; } @@ -127,22 +112,18 @@ public int quantityDropped (Random var1) * Returns the ID of the items to drop on destruction. */ @Override - public Item getItemDropped (int p_149650_1_, Random p_149650_2_, int p_149650_3_) - { + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { return Item.getItemFromBlock(NContent.floraSapling); } @Override - public void dropBlockAsItemWithChance (World par1World, int par2, int par3, int par4, int par5, float par6, int par7) - { - if (!par1World.isRemote) - { + public void dropBlockAsItemWithChance( + World par1World, int par2, int par3, int par4, int par5, float par6, int par7) { + if (!par1World.isRemote) { ArrayList items = getDrops(par1World, par2, par3, par4, par5, par7); - for (ItemStack item : items) - { - if (par1World.rand.nextFloat() <= par6) - { + for (ItemStack item : items) { + if (par1World.rand.nextFloat() <= par6) { this.dropBlockAsItem(par1World, par2, par3, par4, item); } } @@ -153,28 +134,24 @@ public void dropBlockAsItemWithChance (World par1World, int par2, int par3, int public IIcon[] fancyIcons; @Override - public boolean isOpaqueCube () - { + public boolean isOpaqueCube() { return Blocks.leaves.isOpaqueCube(); } @Override @SideOnly(Side.CLIENT) - public IIcon getIcon (int side, int metadata) - { + public IIcon getIcon(int side, int metadata) { return (Blocks.leaves.isOpaqueCube() ? fastIcons : fancyIcons)[metadata % 4]; } @SideOnly(Side.CLIENT) @Override - public void registerBlockIcons (IIconRegister iconRegister) - { - String[] textureNames = new String[] { "redwood", "eucalyptus", "hopseed" }; + public void registerBlockIcons(IIconRegister iconRegister) { + String[] textureNames = new String[] {"redwood", "eucalyptus", "hopseed"}; this.fastIcons = new IIcon[textureNames.length]; this.fancyIcons = new IIcon[textureNames.length]; - for (int i = 0; i < this.fastIcons.length; i++) - { + for (int i = 0; i < this.fastIcons.length; i++) { this.fastIcons[i] = iconRegister.registerIcon("natura:" + textureNames[i] + "_leaves_fast"); this.fancyIcons[i] = iconRegister.registerIcon("natura:" + textureNames[i] + "_leaves_fancy"); } @@ -184,10 +161,8 @@ public void registerBlockIcons (IIconRegister iconRegister) * Returns true if the given side of this block type should be rendered, if the adjacent block is at the given * coordinates. Args: blockAccess, x, y, z, side */ - @Override - public boolean shouldSideBeRendered (IBlockAccess var1, int var2, int var3, int var4, int var5) - { + public boolean shouldSideBeRendered(IBlockAccess var1, int var2, int var3, int var4, int var5) { return this.field_150121_P ? super.shouldSideBeRendered(var1, var2, var3, var4, var5) : true; } @@ -195,32 +170,27 @@ public boolean shouldSideBeRendered (IBlockAccess var1, int var2, int var3, int /** * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks) */ - public void getSubBlocks (Item par1, CreativeTabs par2CreativeTabs, List par3List) - { + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { par3List.add(new ItemStack(par1, 1, 0)); par3List.add(new ItemStack(par1, 1, 1)); par3List.add(new ItemStack(par1, 1, 2)); } - public int getDamageValue (World par1World, int par2, int par3, int par4) - { + public int getDamageValue(World par1World, int par2, int par3, int par4) { return this.damageDropped(par1World.getBlockMetadata(par2, par3, par4)) % 3; } @Override - public int getLightOpacity (IBlockAccess world, int x, int y, int z) - { + public int getLightOpacity(IBlockAccess world, int x, int y, int z) { int meta = world.getBlockMetadata(x, y, z) % 4; - if (meta == 0) - { + if (meta == 0) { return 255; } - return super.getLightOpacity(world, x, y, z);//this.getLightOpacity(world, x, y, z);//lightOpacity[blockID]; + return super.getLightOpacity(world, x, y, z); // this.getLightOpacity(world, x, y, z);//lightOpacity[blockID]; } @Override - public String[] func_150125_e () - { + public String[] func_150125_e() { return null; } } diff --git a/src/main/java/mods/natura/blocks/trees/NLeavesDark.java b/src/main/java/mods/natura/blocks/trees/NLeavesDark.java index a8173099..f6a3c2cc 100644 --- a/src/main/java/mods/natura/blocks/trees/NLeavesDark.java +++ b/src/main/java/mods/natura/blocks/trees/NLeavesDark.java @@ -1,10 +1,9 @@ package mods.natura.blocks.trees; -import java.util.List; -import java.util.Random; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; +import java.util.Random; import mods.natura.common.NContent; import mods.natura.common.NaturaTab; import net.minecraft.client.renderer.texture.IIconRegister; @@ -17,46 +16,39 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class NLeavesDark extends NLeaves -{ - public NLeavesDark() - { +public class NLeavesDark extends NLeaves { + public NLeavesDark() { super(); this.setCreativeTab(NaturaTab.tab); } @SideOnly(Side.CLIENT) @Override - public void registerBlockIcons (IIconRegister iconRegister) - { - String[] textureNames = new String[] { "darkwood", "darkwood_flowering", "darkwood_fruit", "fusewood" }; + public void registerBlockIcons(IIconRegister iconRegister) { + String[] textureNames = new String[] {"darkwood", "darkwood_flowering", "darkwood_fruit", "fusewood"}; this.fastIcons = new IIcon[textureNames.length]; this.fancyIcons = new IIcon[textureNames.length]; - for (int i = 0; i < this.fastIcons.length; i++) - { + for (int i = 0; i < this.fastIcons.length; i++) { this.fastIcons[i] = iconRegister.registerIcon("natura:" + textureNames[i] + "_leaves_fast"); this.fancyIcons[i] = iconRegister.registerIcon("natura:" + textureNames[i] + "_leaves_fancy"); } } @Override - public boolean isOpaqueCube () - { + public boolean isOpaqueCube() { return Blocks.leaves.isOpaqueCube(); } @Override @SideOnly(Side.CLIENT) - public IIcon getIcon (int side, int metadata) - { + public IIcon getIcon(int side, int metadata) { return (Blocks.leaves.isOpaqueCube() ? fastIcons : fancyIcons)[metadata % 4]; } @Override @SideOnly(Side.CLIENT) - public int getBlockColor () - { + public int getBlockColor() { return 16777215; } @@ -65,8 +57,7 @@ public int getBlockColor () /** * Returns the color this block should be rendered. Used by leaves. */ - public int getRenderColor (int par1) - { + public int getRenderColor(int par1) { return 16777215; } @@ -76,50 +67,39 @@ public int getRenderColor (int par1) * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called * when first determining what to render. */ - public int colorMultiplier (IBlockAccess par1IBlockAccess, int par2, int par3, int par4) - { + public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { return 16777215; } - public int getFlammability (IBlockAccess world, int x, int y, int z, int metadata, ForgeDirection face) - { + public int getFlammability(IBlockAccess world, int x, int y, int z, int metadata, ForgeDirection face) { return 0; } - public int getFireSpreadSpeed (World world, int x, int y, int z, int metadata, ForgeDirection face) - { + public int getFireSpreadSpeed(World world, int x, int y, int z, int metadata, ForgeDirection face) { return 0; } @Override - public Item getItemDropped (int metadata, Random random, int fortune) - { - if (metadata % 4 == 2) - return NContent.potashApple; + public Item getItemDropped(int metadata, Random random, int fortune) { + if (metadata % 4 == 2) return NContent.potashApple; return Item.getItemFromBlock(NContent.floraSapling); } @Override - public int damageDropped (int par1) - { - if (par1 % 4 == 2) - return 0; - if (par1 % 4 == 3) - return 7; + public int damageDropped(int par1) { + if (par1 % 4 == 2) return 0; + if (par1 % 4 == 3) return 7; return 6; } @Override - public int quantityDropped (int meta, int fortune, Random random) - { - if (meta % 4 == 2) - return 1; + public int quantityDropped(int meta, int fortune, Random random) { + if (meta % 4 == 2) return 1; return quantityDroppedWithBonus(fortune, random); } @Override - public void getSubBlocks (Item par1, CreativeTabs par2CreativeTabs, List par3List) - { + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { par3List.add(new ItemStack(par1, 1, 0)); par3List.add(new ItemStack(par1, 1, 1)); par3List.add(new ItemStack(par1, 1, 2)); @@ -127,8 +107,7 @@ public void getSubBlocks (Item par1, CreativeTabs par2CreativeTabs, List par3Lis } @Override - public int getLightOpacity (IBlockAccess world, int x, int y, int z) - { + public int getLightOpacity(IBlockAccess world, int x, int y, int z) { return this.getLightOpacity(); } } diff --git a/src/main/java/mods/natura/blocks/trees/NLeavesNocolor.java b/src/main/java/mods/natura/blocks/trees/NLeavesNocolor.java index 233fa37e..365b716b 100644 --- a/src/main/java/mods/natura/blocks/trees/NLeavesNocolor.java +++ b/src/main/java/mods/natura/blocks/trees/NLeavesNocolor.java @@ -1,11 +1,10 @@ package mods.natura.blocks.trees; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.List; import java.util.Random; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import mods.natura.Natura; import mods.natura.common.NContent; import mods.natura.common.NaturaTab; @@ -20,17 +19,14 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class NLeavesNocolor extends NLeaves -{ - public NLeavesNocolor() - { +public class NLeavesNocolor extends NLeaves { + public NLeavesNocolor() { super(); this.setCreativeTab(NaturaTab.tab); } @SideOnly(Side.CLIENT) - public int getBlockColor () - { + public int getBlockColor() { return 16777215; } @@ -38,8 +34,7 @@ public int getBlockColor () /** * Returns the color this block should be rendered. Used by leaves. */ - public int getRenderColor (int par1) - { + public int getRenderColor(int par1) { return 16777215; } @@ -48,92 +43,75 @@ public int getRenderColor (int par1) * Returns a integer with hex for 0xrrggbb with this color multiplied against the blocks color. Note only called * when first determining what to render. */ - public int colorMultiplier (IBlockAccess par1IBlockAccess, int par2, int par3, int par4) - { + public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) { return 16777215; } - public int getFlammability (IBlockAccess world, int x, int y, int z, int metadata, ForgeDirection face) - { + public int getFlammability(IBlockAccess world, int x, int y, int z, int metadata, ForgeDirection face) { return metadata % 4 == 0 ? getFlammability(world, x, y, z, face) : 0; } - public int getFireSpreadSpeed (World world, int x, int y, int z, int metadata, ForgeDirection face) - { + public int getFireSpreadSpeed(World world, int x, int y, int z, int metadata, ForgeDirection face) { return metadata % 4 == 0 ? getFireSpreadSpeed(world, x, y, z, face) : 0; } - public int damageDropped (int meta) - { - if (meta % 4 == 3) - return 4; + public int damageDropped(int meta) { + if (meta % 4 == 3) return 4; return (meta & 3) + 3; } @Override - public Item getItemDropped (int meta, Random random, int fortune) - { - if (meta % 4 == 3) - return Item.getItemFromBlock(NContent.rareSapling); + public Item getItemDropped(int meta, Random random, int fortune) { + if (meta % 4 == 3) return Item.getItemFromBlock(NContent.rareSapling); return Item.getItemFromBlock(NContent.floraSapling); } @Override - public ArrayList getDrops (World world, int x, int y, int z, int metadata, int fortune) - { + public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { ArrayList ret = super.getDrops(world, x, y, z, metadata, fortune); - - if (metadata % 4 == 2) - { - if (fortune > 3 || Natura.random.nextInt(40 - fortune * 10) == 0) - { + + if (metadata % 4 == 2) { + if (fortune > 3 || Natura.random.nextInt(40 - fortune * 10) == 0) { ret.add(new ItemStack(Items.redstone)); } - } - + return ret; } - + @SideOnly(Side.CLIENT) @Override - public void registerBlockIcons (IIconRegister iconRegister) - { - String[] textureNames = new String[] { "sakura", "ghostwood", "bloodwood", "willow" }; + public void registerBlockIcons(IIconRegister iconRegister) { + String[] textureNames = new String[] {"sakura", "ghostwood", "bloodwood", "willow"}; this.fastIcons = new IIcon[textureNames.length]; this.fancyIcons = new IIcon[textureNames.length]; - for (int i = 0; i < this.fastIcons.length; i++) - { + for (int i = 0; i < this.fastIcons.length; i++) { this.fastIcons[i] = iconRegister.registerIcon("natura:" + textureNames[i] + "_leaves_fast"); this.fancyIcons[i] = iconRegister.registerIcon("natura:" + textureNames[i] + "_leaves_fancy"); } } @Override - public boolean isOpaqueCube () - { + public boolean isOpaqueCube() { return Blocks.leaves.isOpaqueCube(); } @Override @SideOnly(Side.CLIENT) - public IIcon getIcon (int side, int metadata) - { + public IIcon getIcon(int side, int metadata) { return (Blocks.leaves.isOpaqueCube() ? fastIcons : fancyIcons)[metadata % 4]; } @Override - public void getSubBlocks (Item par1, CreativeTabs par2CreativeTabs, List par3List) - { + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { par3List.add(new ItemStack(par1, 1, 0)); par3List.add(new ItemStack(par1, 1, 1)); par3List.add(new ItemStack(par1, 1, 2)); par3List.add(new ItemStack(par1, 1, 3)); } - public int getLightOpacity (World world, int x, int y, int z) - { - return super.getLightOpacity(world, x, y, z);//lightOpacity[blockID]; + public int getLightOpacity(World world, int x, int y, int z) { + return super.getLightOpacity(world, x, y, z); // lightOpacity[blockID]; } -} \ No newline at end of file +} diff --git a/src/main/java/mods/natura/blocks/trees/NSaplingBlock.java b/src/main/java/mods/natura/blocks/trees/NSaplingBlock.java index 2e76e4e9..82448233 100644 --- a/src/main/java/mods/natura/blocks/trees/NSaplingBlock.java +++ b/src/main/java/mods/natura/blocks/trees/NSaplingBlock.java @@ -1,10 +1,9 @@ package mods.natura.blocks.trees; -import java.util.List; -import java.util.Random; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; +import java.util.Random; import mods.natura.common.NContent; import mods.natura.common.NaturaTab; import mods.natura.worldgen.BloodTreeLargeGen; @@ -29,13 +28,13 @@ import net.minecraftforge.common.EnumPlantType; import net.minecraftforge.common.util.ForgeDirection; -public class NSaplingBlock extends BlockSapling -{ +public class NSaplingBlock extends BlockSapling { public IIcon[] icons; - public String[] textureNames = new String[] { "redwood", "eucalyptus", "hopseed", "sakura", "ghostwood", "bloodwood", "darkwood", "fusewood" }; + public String[] textureNames = + new String[] {"redwood", "eucalyptus", "hopseed", "sakura", "ghostwood", "bloodwood", "darkwood", "fusewood" + }; - public NSaplingBlock() - { + public NSaplingBlock() { super(); float f = 0.4F; setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f); @@ -46,115 +45,98 @@ public NSaplingBlock() @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons (IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.icons = new IIcon[textureNames.length]; - for (int i = 0; i < this.icons.length; ++i) - { + for (int i = 0; i < this.icons.length; ++i) { this.icons[i] = iconRegister.registerIcon("natura:" + textureNames[i] + "_sapling"); } } @Override - public boolean canPlaceBlockAt (World world, int x, int y, int z) - { + public boolean canPlaceBlockAt(World world, int x, int y, int z) { Block block = world.getBlock(x, y, z); - if (block == null || block.isReplaceable(world, x, y, z)) - { + if (block == null || block.isReplaceable(world, x, y, z)) { Block lowerID = world.getBlock(x, y - 1, z); - //return canThisPlantGrowOnThisBlockID(lowerID); - if (!canThisPlantGrowOnThisBlock(lowerID)) - { + // return canThisPlantGrowOnThisBlockID(lowerID); + if (!canThisPlantGrowOnThisBlock(lowerID)) { Block upperID = world.getBlock(x, y + 1, z); return canThisPlantGrowOnThisBlock(upperID); - } - else - return true; + } else return true; } return false; } - public boolean canThisPlantGrowOnThisBlock (Block id) - { - return id == Blocks.grass || id == Blocks.dirt || id == Blocks.soul_sand || id == Blocks.netherrack || id == NContent.taintedSoil; + public boolean canThisPlantGrowOnThisBlock(Block id) { + return id == Blocks.grass + || id == Blocks.dirt + || id == Blocks.soul_sand + || id == Blocks.netherrack + || id == NContent.taintedSoil; } @Override - public boolean canBlockStay (World world, int x, int y, int z) - { + public boolean canBlockStay(World world, int x, int y, int z) { int meta = world.getBlockMetadata(x, y, z) % 8; - switch (meta) - { - case 0: - case 1: - case 2: - case 3: - Block soil = world.getBlock(x, y - 1, z); - return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) && (soil != null && soil.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, this)); - case 4: - case 6: - case 7: - Block netherSoil = world.getBlock(x, y - 1, z); - return netherSoil != null && (netherSoil == Blocks.netherrack || netherSoil.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, this)); - case 5: - Block nSoil = world.getBlock(x, y + 1, z); - return nSoil != null && (nSoil == Blocks.netherrack || nSoil == Blocks.soul_sand || nSoil == NContent.taintedSoil); - default: - return true; + switch (meta) { + case 0: + case 1: + case 2: + case 3: + Block soil = world.getBlock(x, y - 1, z); + return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) + && (soil != null && soil.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, this)); + case 4: + case 6: + case 7: + Block netherSoil = world.getBlock(x, y - 1, z); + return netherSoil != null + && (netherSoil == Blocks.netherrack + || netherSoil.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, this)); + case 5: + Block nSoil = world.getBlock(x, y + 1, z); + return nSoil != null + && (nSoil == Blocks.netherrack || nSoil == Blocks.soul_sand || nSoil == NContent.taintedSoil); + default: + return true; } } @Override - public EnumPlantType getPlantType (IBlockAccess world, int x, int y, int z) - { + public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z) { int meta = world.getBlockMetadata(x, y, z) % 8; - if (meta <= 3) - return EnumPlantType.Plains; - else - return EnumPlantType.Nether; + if (meta <= 3) return EnumPlantType.Plains; + else return EnumPlantType.Nether; } - + @Override - public void updateTick (World world, int x, int y, int z, Random random) - { - if (world.isRemote) - { + public void updateTick(World world, int x, int y, int z, Random random) { + if (world.isRemote) { return; } super.updateTick(world, x, y, z, random); int md = world.getBlockMetadata(x, y, z); - if (md % 8 == 0) - { - if (world.getBlockLightValue(x, y + 1, z) >= 9 && random.nextInt(120) == 0) - { - if ((md & 8) == 0) - world.setBlockMetadataWithNotify(x, y, z, md | 8, 4); - - else - { + if (md % 8 == 0) { + if (world.getBlockLightValue(x, y + 1, z) >= 9 && random.nextInt(120) == 0) { + if ((md & 8) == 0) world.setBlockMetadataWithNotify(x, y, z, md | 8, 4); + else { int numSaplings = 0; - for (int xPos = -3; xPos <= 3; xPos++) - { - for (int zPos = -3; zPos <= 3; zPos++) - { + for (int xPos = -3; xPos <= 3; xPos++) { + for (int zPos = -3; zPos <= 3; zPos++) { int ecks = x + xPos, zee = z + zPos; - if (world.getBlock(x + xPos, y, z + zPos) == this && world.getBlockMetadata(x + xPos, y, z + zPos) % 8 == 0) - { + if (world.getBlock(x + xPos, y, z + zPos) == this + && world.getBlockMetadata(x + xPos, y, z + zPos) % 8 == 0) { numSaplings++; } } } - if (numSaplings >= 40) - { - for (int xPos = -4; xPos <= 4; xPos++) - { - for (int zPos = -4; zPos <= 4; zPos++) - { + if (numSaplings >= 40) { + for (int xPos = -4; xPos <= 4; xPos++) { + for (int zPos = -4; zPos <= 4; zPos++) { int ecks = x + xPos, zee = z + zPos; - if (world.getBlock(ecks, y, zee) == this && world.getBlockMetadata(ecks, y, zee) % 8 == 0) - { + if (world.getBlock(ecks, y, zee) == this + && world.getBlockMetadata(ecks, y, zee) % 8 == 0) { world.setBlock(ecks, y, zee, Blocks.air, 0, 4); } } @@ -163,110 +145,76 @@ public void updateTick (World world, int x, int y, int z, Random random) } } } - } - else if (md % 8 <= 3) - { - if (random.nextInt(10) == 0 && world.getBlockLightValue(x, y + 1, z) >= 9)//&& random.nextInt(120) == 0) + } else if (md % 8 <= 3) { + if (random.nextInt(10) == 0 && world.getBlockLightValue(x, y + 1, z) >= 9) // && random.nextInt(120) == 0) { - if ((md & 8) == 0) - world.setBlockMetadataWithNotify(x, y, z, md | 8, 4); - - else - func_149879_c(world, x, y, z, random); + if ((md & 8) == 0) world.setBlockMetadataWithNotify(x, y, z, md | 8, 4); + else func_149879_c(world, x, y, z, random); } - } - else if (random.nextInt(10) == 0) - { - if ((md & 8) == 0) - world.setBlockMetadataWithNotify(x, y, z, md | 8, 4); - - else - func_149879_c(world, x, y, z, random); + } else if (random.nextInt(10) == 0) { + if ((md & 8) == 0) world.setBlockMetadataWithNotify(x, y, z, md | 8, 4); + else func_149879_c(world, x, y, z, random); } } - + @Override @SideOnly(Side.CLIENT) - public IIcon getIcon (int side, int meta) - { + public IIcon getIcon(int side, int meta) { return icons[meta % 8]; } - - public void func_149879_c(World p_149879_1_, int p_149879_2_, int p_149879_3_, int p_149879_4_, Random p_149879_5_) - { + + public void func_149879_c( + World p_149879_1_, int p_149879_2_, int p_149879_3_, int p_149879_4_, Random p_149879_5_) { int l = p_149879_1_.getBlockMetadata(p_149879_2_, p_149879_3_, p_149879_4_); - if ((l & 8) == 0) - { + if ((l & 8) == 0) { p_149879_1_.setBlockMetadataWithNotify(p_149879_2_, p_149879_3_, p_149879_4_, l | 8, 4); - } - else - { + } else { this.func_149878_d(p_149879_1_, p_149879_2_, p_149879_3_, p_149879_4_, p_149879_5_); } } - - public void func_149878_d(World world, int x, int y, int z, Random random) - { + + public void func_149878_d(World world, int x, int y, int z, Random random) { if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(world, random, x, y, z)) return; int md = world.getBlockMetadata(x, y, z) % 8; world.setBlock(x, y, z, Blocks.air); WorldGenerator obj = null; - if (md == 1) - obj = new EucalyptusTreeGenShort(0, 1); - - else if (md == 2) - obj = new BushTreeGen(true, 2, 3, 2); + if (md == 1) obj = new EucalyptusTreeGenShort(0, 1); + else if (md == 2) obj = new BushTreeGen(true, 2, 3, 2); + else if (md == 3) obj = new SakuraTreeGen(true, 1, 0); + else if (md == 4) obj = new WhiteTreeGen(true, 2, 1); + else if (md == 5) obj = new BloodTreeLargeGen(3, 2); + else if (md == 6) obj = new DarkwoodGen(true, 3, 0); + else if (md == 7) obj = new FusewoodGen(true, 3, 1); + else obj = new RedwoodTreeGen(true, NContent.redwood); - else if (md == 3) - obj = new SakuraTreeGen(true, 1, 0); - - else if (md == 4) - obj = new WhiteTreeGen(true, 2, 1); - - else if (md == 5) - obj = new BloodTreeLargeGen(3, 2); - - else if (md == 6) - obj = new DarkwoodGen(true, 3, 0); - - else if (md == 7) - obj = new FusewoodGen(true, 3, 1); - - else - obj = new RedwoodTreeGen(true, NContent.redwood); - - if (!(obj.generate(world, random, x, y, z))) - world.setBlock(x, y, z, this, md + 8, 3); + if (!(obj.generate(world, random, x, y, z))) world.setBlock(x, y, z, this, md + 8, 3); } @Override - public int damageDropped (int i) - { + public int damageDropped(int i) { return i % 8; } @SideOnly(Side.CLIENT) @Override - public void getSubBlocks (Item par1, CreativeTabs par2CreativeTabs, List par3List) - { - for (int i = 0; i < 8; i++) - par3List.add(new ItemStack(par1, 1, i)); + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + for (int i = 0; i < 8; i++) par3List.add(new ItemStack(par1, 1, i)); } - - public boolean func_149851_a(World p_149851_1_, int p_149851_2_, int p_149851_3_, int p_149851_4_, boolean p_149851_5_) - { + + public boolean func_149851_a( + World p_149851_1_, int p_149851_2_, int p_149851_3_, int p_149851_4_, boolean p_149851_5_) { return true; } - public boolean func_149852_a(World p_149852_1_, Random p_149852_2_, int p_149852_3_, int p_149852_4_, int p_149852_5_) - { - return (double)p_149852_1_.rand.nextFloat() < 0.45D; + public boolean func_149852_a( + World p_149852_1_, Random p_149852_2_, int p_149852_3_, int p_149852_4_, int p_149852_5_) { + return (double) p_149852_1_.rand.nextFloat() < 0.45D; } - public void func_149853_b(World p_149853_1_, Random p_149853_2_, int p_149853_3_, int p_149853_4_, int p_149853_5_) - { + public void func_149853_b( + World p_149853_1_, Random p_149853_2_, int p_149853_3_, int p_149853_4_, int p_149853_5_) { this.func_149879_c(p_149853_1_, p_149853_3_, p_149853_4_, p_149853_5_, p_149853_2_); } } diff --git a/src/main/java/mods/natura/blocks/trees/OverworldLeaves.java b/src/main/java/mods/natura/blocks/trees/OverworldLeaves.java index 91bfecfc..d1704b3e 100644 --- a/src/main/java/mods/natura/blocks/trees/OverworldLeaves.java +++ b/src/main/java/mods/natura/blocks/trees/OverworldLeaves.java @@ -1,10 +1,9 @@ package mods.natura.blocks.trees; -import java.util.List; -import java.util.Random; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; +import java.util.Random; import mods.natura.common.NContent; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -14,23 +13,19 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; -public class OverworldLeaves extends NLeaves -{ - public OverworldLeaves() - { +public class OverworldLeaves extends NLeaves { + public OverworldLeaves() { super(); } @SideOnly(Side.CLIENT) @Override - public void registerBlockIcons (IIconRegister iconRegister) - { - String[] textureNames = new String[] { "maple", "silverbell", "purpleheart", "tiger" }; + public void registerBlockIcons(IIconRegister iconRegister) { + String[] textureNames = new String[] {"maple", "silverbell", "purpleheart", "tiger"}; this.fastIcons = new IIcon[textureNames.length]; this.fancyIcons = new IIcon[textureNames.length]; - for (int i = 0; i < this.fastIcons.length; i++) - { + for (int i = 0; i < this.fastIcons.length; i++) { this.fastIcons[i] = iconRegister.registerIcon("natura:" + textureNames[i] + "_leaves_fast"); this.fancyIcons[i] = iconRegister.registerIcon("natura:" + textureNames[i] + "_leaves_fancy"); } @@ -38,11 +33,9 @@ public void registerBlockIcons (IIconRegister iconRegister) @SideOnly(Side.CLIENT) @Override - public int colorMultiplier (IBlockAccess world, int x, int y, int z) - { + public int colorMultiplier(IBlockAccess world, int x, int y, int z) { int meta = world.getBlockMetadata(x, y, z) % 4; - if (meta == 0) - { + if (meta == 0) { return 0xcc5718; } @@ -51,16 +44,13 @@ public int colorMultiplier (IBlockAccess world, int x, int y, int z) return 0x451941; }*/ - if (meta == 2) - { + if (meta == 2) { int i1 = 0; int j1 = 0; int k1 = 0; - for (int l1 = -1; l1 <= 1; ++l1) - { - for (int i2 = -1; i2 <= 1; ++i2) - { + for (int l1 = -1; l1 <= 1; ++l1) { + for (int i2 = -1; i2 <= 1; ++i2) { int j2 = world.getBiomeGenForCoords(x + i2, z + l1).getBiomeFoliageColor(x, y, z); i1 += (j2 & 16711680) >> 16; j1 += (j2 & 65280) >> 8; @@ -75,28 +65,24 @@ public int colorMultiplier (IBlockAccess world, int x, int y, int z) } @Override - public boolean isOpaqueCube () - { + public boolean isOpaqueCube() { return Blocks.leaves.isOpaqueCube(); } @Override @SideOnly(Side.CLIENT) - public IIcon getIcon (int side, int metadata) - { + public IIcon getIcon(int side, int metadata) { return (Blocks.leaves.isOpaqueCube() ? fastIcons : fancyIcons)[metadata % 4]; } @Override - public Item getItemDropped (int p_149650_1_, Random p_149650_2_, int p_149650_3_) - { + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { return Item.getItemFromBlock(NContent.rareSapling); } @SideOnly(Side.CLIENT) @Override - public void getSubBlocks (Item par1, CreativeTabs par2CreativeTabs, List par3List) - { + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { par3List.add(new ItemStack(par1, 1, 0)); par3List.add(new ItemStack(par1, 1, 1)); par3List.add(new ItemStack(par1, 1, 2)); @@ -104,8 +90,7 @@ public void getSubBlocks (Item par1, CreativeTabs par2CreativeTabs, List par3Lis } @Override - public int getLightOpacity (IBlockAccess world, int x, int y, int z) - { + public int getLightOpacity(IBlockAccess world, int x, int y, int z) { return this.getLightOpacity(); } } diff --git a/src/main/java/mods/natura/blocks/trees/OverworldSapling.java b/src/main/java/mods/natura/blocks/trees/OverworldSapling.java index b4346da1..97abbe2d 100644 --- a/src/main/java/mods/natura/blocks/trees/OverworldSapling.java +++ b/src/main/java/mods/natura/blocks/trees/OverworldSapling.java @@ -1,10 +1,9 @@ package mods.natura.blocks.trees; -import java.util.List; -import java.util.Random; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; +import java.util.Random; import mods.natura.common.NContent; import mods.natura.common.NaturaTab; import mods.natura.worldgen.RareTreeGen; @@ -23,13 +22,11 @@ import net.minecraftforge.common.EnumPlantType; import net.minecraftforge.common.util.ForgeDirection; -public class OverworldSapling extends BlockSapling -{ +public class OverworldSapling extends BlockSapling { public IIcon[] icons; - public String[] textureNames = new String[] { "maple", "silverbell", "purpleheart", "tiger", "willow" }; + public String[] textureNames = new String[] {"maple", "silverbell", "purpleheart", "tiger", "willow"}; - public OverworldSapling() - { + public OverworldSapling() { super(); float f = 0.4F; setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f); @@ -40,161 +37,134 @@ public OverworldSapling() @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons (IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.icons = new IIcon[textureNames.length]; - for (int i = 0; i < this.icons.length; ++i) - { + for (int i = 0; i < this.icons.length; ++i) { this.icons[i] = iconRegister.registerIcon("natura:" + textureNames[i] + "_sapling"); } } @Override - public boolean canPlaceBlockAt (World world, int x, int y, int z) - { + public boolean canPlaceBlockAt(World world, int x, int y, int z) { Block blockID = world.getBlock(x, y, z); - if (blockID == Blocks.air || blockID.getMaterial().isReplaceable()) - return true; - //return canBlockStay(world, x, y, z); + if (blockID == Blocks.air || blockID.getMaterial().isReplaceable()) return true; + // return canBlockStay(world, x, y, z); return false; } - public boolean canThisPlantGrowOnThisBlock (Block id) - { - return id == Blocks.grass || id == Blocks.dirt || id == Blocks.soul_sand || id == Blocks.netherrack || id == NContent.taintedSoil; + public boolean canThisPlantGrowOnThisBlock(Block id) { + return id == Blocks.grass + || id == Blocks.dirt + || id == Blocks.soul_sand + || id == Blocks.netherrack + || id == NContent.taintedSoil; } @Override - public boolean canBlockStay (World world, int x, int y, int z) - { + public boolean canBlockStay(World world, int x, int y, int z) { int meta = world.getBlockMetadata(x, y, z) % 8; - switch (meta) - { - case 0: - case 1: - case 2: - case 3: - Block soil = world.getBlock(x, y - 1, z); - return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) && (soil != null && soil.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, this)); - /*case 4: - case 6: - int belowID = world.getBlockId(x, y - 1, z); - Block netherSoil = blocksList[belowID]; - return netherSoil != null && (netherSoil == Block.netherrack || netherSoil.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, this)); - case 5: - int aboveID = world.getBlockId(x, y + 1, z); - Block nSoil = blocksList[aboveID]; - return nSoil != null && (nSoil == Block.netherrack || nSoil == Block.slowSand || nSoil == NContent.taintedSoil);*/ - default: - return true; + switch (meta) { + case 0: + case 1: + case 2: + case 3: + Block soil = world.getBlock(x, y - 1, z); + return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) + && (soil != null && soil.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, this)); + /*case 4: + case 6: + int belowID = world.getBlockId(x, y - 1, z); + Block netherSoil = blocksList[belowID]; + return netherSoil != null && (netherSoil == Block.netherrack || netherSoil.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, this)); + case 5: + int aboveID = world.getBlockId(x, y + 1, z); + Block nSoil = blocksList[aboveID]; + return nSoil != null && (nSoil == Block.netherrack || nSoil == Block.slowSand || nSoil == NContent.taintedSoil);*/ + default: + return true; } } @Override - public EnumPlantType getPlantType (IBlockAccess world, int x, int y, int z) - { + public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z) { /*int meta = world.getBlockMetadata(x, y, z) % 8; if (meta <= 3)*/ return EnumPlantType.Plains; /*else - return EnumPlantType.Nether;*/ + return EnumPlantType.Nether;*/ } @Override - public void updateTick (World world, int x, int y, int z, Random random) - { - if (world.isRemote) - { + public void updateTick(World world, int x, int y, int z, Random random) { + if (world.isRemote) { return; } super.updateTick(world, x, y, z, random); int md = world.getBlockMetadata(x, y, z); - if (world.getBlockLightValue(x, y + 1, z) >= 9 && random.nextInt(120) == 0) - { - if ((md & 8) == 0) - world.setBlockMetadataWithNotify(x, y, z, md | 8, 4); - - else - func_149878_d(world, x, y, z, random); + if (world.getBlockLightValue(x, y + 1, z) >= 9 && random.nextInt(120) == 0) { + if ((md & 8) == 0) world.setBlockMetadataWithNotify(x, y, z, md | 8, 4); + else func_149878_d(world, x, y, z, random); } } @Override @SideOnly(Side.CLIENT) - public IIcon getIcon (int side, int meta) - { + public IIcon getIcon(int side, int meta) { return icons[meta % 8 % icons.length]; } - - public void func_149879_c(World p_149879_1_, int p_149879_2_, int p_149879_3_, int p_149879_4_, Random p_149879_5_) - { + + public void func_149879_c( + World p_149879_1_, int p_149879_2_, int p_149879_3_, int p_149879_4_, Random p_149879_5_) { int l = p_149879_1_.getBlockMetadata(p_149879_2_, p_149879_3_, p_149879_4_); - if ((l & 8) == 0) - { + if ((l & 8) == 0) { p_149879_1_.setBlockMetadataWithNotify(p_149879_2_, p_149879_3_, p_149879_4_, l | 8, 4); - } - else - { + } else { this.func_149878_d(p_149879_1_, p_149879_2_, p_149879_3_, p_149879_4_, p_149879_5_); } } - public void func_149878_d (World world, int x, int y, int z, Random random) - { + public void func_149878_d(World world, int x, int y, int z, Random random) { if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(world, random, x, y, z)) return; int md = world.getBlockMetadata(x, y, z) % 8; world.setBlock(x, y, z, Blocks.air); WorldGenerator obj = null; - if (md == 1) - obj = new RareTreeGen(true, 4, 2, 1, 1); - - else if (md == 2) - obj = new RareTreeGen(true, 9, 8, 2, 2); - - else if (md == 3) - obj = new RareTreeGen(true, 6, 4, 3, 3); + if (md == 1) obj = new RareTreeGen(true, 4, 2, 1, 1); + else if (md == 2) obj = new RareTreeGen(true, 9, 8, 2, 2); + else if (md == 3) obj = new RareTreeGen(true, 6, 4, 3, 3); + else if (md == 4) obj = new WillowGen(true); + else obj = new RareTreeGen(true, 4, 2, 0, 0); - else if (md == 4) - obj = new WillowGen(true); - - else - obj = new RareTreeGen(true, 4, 2, 0, 0); - - if (!(obj.generate(world, random, x, y, z))) - world.setBlock(x, y, z, this, md + 8, 3); + if (!(obj.generate(world, random, x, y, z))) world.setBlock(x, y, z, this, md + 8, 3); } @Override - public int damageDropped (int i) - { + public int damageDropped(int i) { return i % 8; } @Override @SideOnly(Side.CLIENT) - public void getSubBlocks (Item id, CreativeTabs tab, List list) - { - for (int iter = 0; iter < icons.length; iter++) - { + public void getSubBlocks(Item id, CreativeTabs tab, List list) { + for (int iter = 0; iter < icons.length; iter++) { list.add(new ItemStack(id, 1, iter)); } } - - public boolean func_149851_a(World p_149851_1_, int p_149851_2_, int p_149851_3_, int p_149851_4_, boolean p_149851_5_) - { + + public boolean func_149851_a( + World p_149851_1_, int p_149851_2_, int p_149851_3_, int p_149851_4_, boolean p_149851_5_) { return true; } - public boolean func_149852_a(World p_149852_1_, Random p_149852_2_, int p_149852_3_, int p_149852_4_, int p_149852_5_) - { - return (double)p_149852_1_.rand.nextFloat() < 0.45D; + public boolean func_149852_a( + World p_149852_1_, Random p_149852_2_, int p_149852_3_, int p_149852_4_, int p_149852_5_) { + return (double) p_149852_1_.rand.nextFloat() < 0.45D; } - public void func_149853_b(World p_149853_1_, Random p_149853_2_, int p_149853_3_, int p_149853_4_, int p_149853_5_) - { + public void func_149853_b( + World p_149853_1_, Random p_149853_2_, int p_149853_3_, int p_149853_4_, int p_149853_5_) { this.func_149879_c(p_149853_1_, p_149853_3_, p_149853_4_, p_149853_5_, p_149853_2_); } } diff --git a/src/main/java/mods/natura/blocks/trees/OverworldTreeBlock.java b/src/main/java/mods/natura/blocks/trees/OverworldTreeBlock.java index 44e18452..48dbd7b4 100644 --- a/src/main/java/mods/natura/blocks/trees/OverworldTreeBlock.java +++ b/src/main/java/mods/natura/blocks/trees/OverworldTreeBlock.java @@ -1,12 +1,10 @@ package mods.natura.blocks.trees; -import java.util.ArrayList; -import java.util.List; - import com.google.common.collect.Lists; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.List; import mods.natura.common.NaturaTab; import net.minecraft.block.Block; import net.minecraft.block.BlockLog; @@ -17,13 +15,20 @@ import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class OverworldTreeBlock extends BlockLog -{ +public class OverworldTreeBlock extends BlockLog { public IIcon[] icons; - public String[] textureNames = new String[] { "maple_bark", "maple_heart", "silverbell_bark", "silverbell_heart", "purpleheart_bark", "purpleheart_heart", "tiger_bark", "tiger_heart" }; + public String[] textureNames = new String[] { + "maple_bark", + "maple_heart", + "silverbell_bark", + "silverbell_heart", + "purpleheart_bark", + "purpleheart_heart", + "tiger_bark", + "tiger_heart" + }; - public OverworldTreeBlock() - { + public OverworldTreeBlock() { super(); this.setHardness(2.0F); this.setStepSound(Block.soundTypeWood); @@ -33,26 +38,22 @@ public OverworldTreeBlock() @Override @SideOnly(Side.CLIENT) - public IIcon getIcon (int side, int metadata) - { + public IIcon getIcon(int side, int metadata) { int tex = (metadata % 4) * 2; int orientation = metadata / 4; switch (orientation) - //Ends of logs + // Ends of logs { - case 0: - if (side == 0 || side == 1) - return icons[tex + 1]; - break; - case 1: - if (side == 4 || side == 5) - return icons[tex + 1]; - break; - case 2: - if (side == 2 || side == 3) - return icons[tex + 1]; - break; + case 0: + if (side == 0 || side == 1) return icons[tex + 1]; + break; + case 1: + if (side == 4 || side == 5) return icons[tex + 1]; + break; + case 2: + if (side == 2 || side == 3) return icons[tex + 1]; + break; } return icons[tex]; @@ -60,31 +61,27 @@ public IIcon getIcon (int side, int metadata) @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons (IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.icons = new IIcon[textureNames.length]; - for (int i = 0; i < this.icons.length; ++i) - { + for (int i = 0; i < this.icons.length; ++i) { this.icons[i] = iconRegister.registerIcon("natura:" + textureNames[i]); } } @Override - public ArrayList getDrops (World world, int x, int y, int z, int metadata, int fortune) - { + public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { ArrayList ret = Lists.newArrayList(); - ret.add(new ItemStack(this,1, metadata % 4)); + ret.add(new ItemStack(this, 1, metadata % 4)); return ret; } @Override - public int damageDropped(int meta) - { + public int damageDropped(int meta) { return meta % 4; } - /* public int getFlammability(IBlockAccess world, int x, int y, int z, int metadata, ForgeDirection face) + /* public int getFlammability(IBlockAccess world, int x, int y, int z, int metadata, ForgeDirection face) { return metadata % 4 != 2 ? blockFlammability[blockID] : 0; } @@ -96,9 +93,7 @@ public int getFireSpreadSpeed(World world, int x, int y, int z, int metadata, Fo @SideOnly(Side.CLIENT) @Override - public void getSubBlocks (Item par1, CreativeTabs par2CreativeTabs, List par3List) - { - for (int i = 0; i < icons.length / 2; i++) - par3List.add(new ItemStack(par1, 1, i)); + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + for (int i = 0; i < icons.length / 2; i++) par3List.add(new ItemStack(par1, 1, i)); } } diff --git a/src/main/java/mods/natura/blocks/trees/Planks.java b/src/main/java/mods/natura/blocks/trees/Planks.java index 0406b4bf..b671d35e 100644 --- a/src/main/java/mods/natura/blocks/trees/Planks.java +++ b/src/main/java/mods/natura/blocks/trees/Planks.java @@ -1,9 +1,8 @@ package mods.natura.blocks.trees; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mods.natura.common.NaturaTab; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -17,14 +16,25 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class Planks extends Block -{ +public class Planks extends Block { public IIcon[] icons; - public static String[] textureNames = new String[] { "eucalyptus", "sakura", "ghostwood", "redwood", "bloodwood", "hopseed", "maple", "silverbell", "purpleheart", "tiger", "willow", "darkwood", - "fusewood" }; + public static String[] textureNames = new String[] { + "eucalyptus", + "sakura", + "ghostwood", + "redwood", + "bloodwood", + "hopseed", + "maple", + "silverbell", + "purpleheart", + "tiger", + "willow", + "darkwood", + "fusewood" + }; - public Planks() - { + public Planks() { super(Material.wood); // TODO 1.7 Where the heck did this go? setBurnProperties(this, 5, 20); this.setHardness(2.0f); @@ -34,21 +44,17 @@ public Planks() @Override @SideOnly(Side.CLIENT) - public IIcon getIcon (int side, int meta) - { - if (meta >= textureNames.length) - return Blocks.lava.getIcon(0, 0); + public IIcon getIcon(int side, int meta) { + if (meta >= textureNames.length) return Blocks.lava.getIcon(0, 0); return icons[meta]; } @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons (IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.icons = new IIcon[textureNames.length]; - for (int i = 0; i < this.icons.length; ++i) - { + for (int i = 0; i < this.icons.length; ++i) { this.icons[i] = iconRegister.registerIcon("natura:" + textureNames[i] + "_planks"); } } @@ -58,31 +64,24 @@ public void registerBlockIcons (IIconRegister iconRegister) return false; }*/ - public int getFlammability (IBlockAccess world, int x, int y, int z, int metadata, ForgeDirection face) - { - if (metadata == 2 || metadata == 4 || metadata > 10) - return 0; + public int getFlammability(IBlockAccess world, int x, int y, int z, int metadata, ForgeDirection face) { + if (metadata == 2 || metadata == 4 || metadata > 10) return 0; return this.getFlammability(world, x, y, z, face); } - public int getFireSpreadSpeed (World world, int x, int y, int z, int metadata, ForgeDirection face) - { - if (metadata == 2 || metadata == 4 || metadata > 10) - return 0; + public int getFireSpreadSpeed(World world, int x, int y, int z, int metadata, ForgeDirection face) { + if (metadata == 2 || metadata == 4 || metadata > 10) return 0; return this.getFireSpreadSpeed(world, x, y, z, face); } @Override - public int damageDropped (int meta) - { + public int damageDropped(int meta) { return meta; } @SideOnly(Side.CLIENT) @Override - public void getSubBlocks (Item par1, CreativeTabs par2CreativeTabs, List par3List) - { - for (int i = 0; i < textureNames.length; i++) - par3List.add(new ItemStack(par1, 1, i)); + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + for (int i = 0; i < textureNames.length; i++) par3List.add(new ItemStack(par1, 1, i)); } } diff --git a/src/main/java/mods/natura/blocks/trees/SaguaroBlock.java b/src/main/java/mods/natura/blocks/trees/SaguaroBlock.java index 56b0c0c4..e0c7ac81 100644 --- a/src/main/java/mods/natura/blocks/trees/SaguaroBlock.java +++ b/src/main/java/mods/natura/blocks/trees/SaguaroBlock.java @@ -1,9 +1,8 @@ package mods.natura.blocks.trees; -import java.util.Random; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.Random; import mods.natura.client.SaguaroRenderer; import mods.natura.common.NContent; import mods.natura.common.NaturaTab; @@ -34,26 +33,25 @@ public SaguaroBlock() { } @Override - public void updateTick (World world, int x, int y, int z, Random random) { + public void updateTick(World world, int x, int y, int z, Random random) { int meta = world.getBlockMetadata(x, y, z); - if (meta == 0 && world.getWorldInfo().isRaining() && random.nextInt(20) == 0 && world.getBlock(x, y + 1, z) == Blocks.air) { + if (meta == 0 + && world.getWorldInfo().isRaining() + && random.nextInt(20) == 0 + && world.getBlock(x, y + 1, z) == Blocks.air) { switch (random.nextInt(4)) { - case 0: - if (world.getBlock(x + 1, y, z) == Blocks.air) - world.setBlock(x + 1, y, z, this, 5, 3); - break; - case 1: - if (world.getBlock(x, y, z + 1) == Blocks.air) - world.setBlock(x, y, z + 1, this, 6, 3); - break; - case 2: - if (world.getBlock(x - 1, y, z) == Blocks.air) - world.setBlock(x - 1, y, z, this, 3, 3); - break; - case 3: - if (world.getBlock(x, y, z - 1) == Blocks.air) - world.setBlock(x, y, z - 1, this, 4, 3); - break; + case 0: + if (world.getBlock(x + 1, y, z) == Blocks.air) world.setBlock(x + 1, y, z, this, 5, 3); + break; + case 1: + if (world.getBlock(x, y, z + 1) == Blocks.air) world.setBlock(x, y, z + 1, this, 6, 3); + break; + case 2: + if (world.getBlock(x - 1, y, z) == Blocks.air) world.setBlock(x - 1, y, z, this, 3, 3); + break; + case 3: + if (world.getBlock(x, y, z - 1) == Blocks.air) world.setBlock(x, y, z - 1, this, 4, 3); + break; } } else if (meta == 2 && random.nextInt(200) == 0) { SaguaroGen gen = new SaguaroGen(NContent.saguaro, 0, true); @@ -62,80 +60,91 @@ public void updateTick (World world, int x, int y, int z, Random random) { world.setBlockMetadataWithNotify(x, y, z, 2, 3); } - //Fruit shouldn't do a thing + // Fruit shouldn't do a thing } @Override - public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z) { + public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) { int meta = world.getBlockMetadata(x, y, z); float offset; - switch(meta) { - case 0: - offset = 0.125F; - return AxisAlignedBB.getBoundingBox(x + offset, y, z + offset, x + 1 - offset, y + 1 - offset, z + 1 - offset); - case 1: - case 2: - offset = 0.325F; - return AxisAlignedBB.getBoundingBox(x + offset, y, z + offset, x + 1 - offset, y + 1 - offset, z + 1 - offset); - case 3: - offset = 0.25F; - return AxisAlignedBB.getBoundingBox(x + 0.625f, y + 0.1875, z + offset, x + 1.125f, y + 0.75, z + 1 - offset); - case 4: - offset = 0.25F; - return AxisAlignedBB.getBoundingBox(x + offset, y + 0.1875, z + 0.625f, x + 1 - offset, y + 0.75, z + 1.125f); - case 5: - offset = 0.25F; - return AxisAlignedBB.getBoundingBox(x - 0.125f, y + 0.1875, z + offset, x + 0.375f, y + 0.75, z + 1 - offset); - case 6: - offset = 0.25F; - return AxisAlignedBB.getBoundingBox(x + offset, y + 0.1875, z - 0.125f, x + 1 - offset, y + 0.75, z + 0.375f); - default: - return null; + switch (meta) { + case 0: + offset = 0.125F; + return AxisAlignedBB.getBoundingBox( + x + offset, y, z + offset, x + 1 - offset, y + 1 - offset, z + 1 - offset); + case 1: + case 2: + offset = 0.325F; + return AxisAlignedBB.getBoundingBox( + x + offset, y, z + offset, x + 1 - offset, y + 1 - offset, z + 1 - offset); + case 3: + offset = 0.25F; + return AxisAlignedBB.getBoundingBox( + x + 0.625f, y + 0.1875, z + offset, x + 1.125f, y + 0.75, z + 1 - offset); + case 4: + offset = 0.25F; + return AxisAlignedBB.getBoundingBox( + x + offset, y + 0.1875, z + 0.625f, x + 1 - offset, y + 0.75, z + 1.125f); + case 5: + offset = 0.25F; + return AxisAlignedBB.getBoundingBox( + x - 0.125f, y + 0.1875, z + offset, x + 0.375f, y + 0.75, z + 1 - offset); + case 6: + offset = 0.25F; + return AxisAlignedBB.getBoundingBox( + x + offset, y + 0.1875, z - 0.125f, x + 1 - offset, y + 0.75, z + 0.375f); + default: + return null; } } @Override - public AxisAlignedBB getSelectedBoundingBoxFromPool (World world, int x, int y, int z) { + public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) { int meta = world.getBlockMetadata(x, y, z); float offset; - switch(meta) { - case 0: - offset = 0.125F; - float height = 0.125F; - float base = 0F; - if (world.getBlock(x, y + 1, z) == this) height = 0F; - Block block = world.getBlock(x, y - 1, z); - if (!block.isOpaqueCube()) base = 0.125F; - - return AxisAlignedBB.getBoundingBox(x + offset, y, z + offset, x + 1 - offset, y + 1 - height, z + 1 - offset); - case 1: - case 2: - offset = 0.325F; - return AxisAlignedBB.getBoundingBox(x + offset, y, z + offset, x + 1 - offset, y + 0.5, z + 1 - offset); - case 3: - offset = 0.25F; - return AxisAlignedBB.getBoundingBox(x + 0.625f, y + 0.1875, z + offset, x + 1.125f, y + 0.75, z + 1 - offset); - case 4: - offset = 0.25F; - return AxisAlignedBB.getBoundingBox(x + offset, y + 0.1875, z + 0.625f, x + 1 - offset, y + 0.75, z + 1.125f); - case 5: - offset = 0.25F; - return AxisAlignedBB.getBoundingBox(x - 0.125f, y + 0.1875, z + offset, x + 0.375f, y + 0.75, z + 1 - offset); - case 6: - offset = 0.25F; - return AxisAlignedBB.getBoundingBox(x + offset, y + 0.1875, z - 0.125f, x + 1 - offset, y + 0.75, z + 0.375f); - default: - return null; + switch (meta) { + case 0: + offset = 0.125F; + float height = 0.125F; + float base = 0F; + if (world.getBlock(x, y + 1, z) == this) height = 0F; + Block block = world.getBlock(x, y - 1, z); + if (!block.isOpaqueCube()) base = 0.125F; + + return AxisAlignedBB.getBoundingBox( + x + offset, y, z + offset, x + 1 - offset, y + 1 - height, z + 1 - offset); + case 1: + case 2: + offset = 0.325F; + return AxisAlignedBB.getBoundingBox(x + offset, y, z + offset, x + 1 - offset, y + 0.5, z + 1 - offset); + case 3: + offset = 0.25F; + return AxisAlignedBB.getBoundingBox( + x + 0.625f, y + 0.1875, z + offset, x + 1.125f, y + 0.75, z + 1 - offset); + case 4: + offset = 0.25F; + return AxisAlignedBB.getBoundingBox( + x + offset, y + 0.1875, z + 0.625f, x + 1 - offset, y + 0.75, z + 1.125f); + case 5: + offset = 0.25F; + return AxisAlignedBB.getBoundingBox( + x - 0.125f, y + 0.1875, z + offset, x + 0.375f, y + 0.75, z + 1 - offset); + case 6: + offset = 0.25F; + return AxisAlignedBB.getBoundingBox( + x + offset, y + 0.1875, z - 0.125f, x + 1 - offset, y + 0.75, z + 0.375f); + default: + return null; } } @Override - public int getRenderType () { + public int getRenderType() { return SaguaroRenderer.model; } @Override - public Item getItemDropped (int meta, Random random, int fortune) { + public Item getItemDropped(int meta, Random random, int fortune) { if (meta == 0) { return Item.getItemFromBlock(this); } else { @@ -144,11 +153,11 @@ public Item getItemDropped (int meta, Random random, int fortune) { } public IIcon[] icons; - public String[] textureNames = new String[] { "saguaro_bottom", "saguaro_top", "saguaro_side", "saguaro_fruit" }; + public String[] textureNames = new String[] {"saguaro_bottom", "saguaro_top", "saguaro_side", "saguaro_fruit"}; @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons (IIconRegister iconRegister) { + public void registerBlockIcons(IIconRegister iconRegister) { this.icons = new IIcon[textureNames.length]; for (int i = 0; i < this.icons.length; ++i) { @@ -158,41 +167,41 @@ public void registerBlockIcons (IIconRegister iconRegister) { @Override @SideOnly(Side.CLIENT) - public IIcon getIcon (int side, int meta) { - switch (meta) { - case 0: - if (side < 2) { - return icons[side]; - } else { - return icons[2]; - } - case 1: - case 2: - return icons[1]; - default: - return icons[3]; - } + public IIcon getIcon(int side, int meta) { + switch (meta) { + case 0: + if (side < 2) { + return icons[side]; + } else { + return icons[2]; + } + case 1: + case 2: + return icons[1]; + default: + return icons[3]; + } } @Override - public boolean renderAsNormalBlock () { + public boolean renderAsNormalBlock() { return false; } @Override - public boolean isOpaqueCube () { + public boolean isOpaqueCube() { return false; } - + @SideOnly(Side.CLIENT) @Override public boolean shouldSideBeRendered(IBlockAccess blockAccess, int x, int y, int z, int side) { - //This could be better. + // This could be better. return !(side == 0 && blockAccess.getBlock(x, y, z).isOpaqueCube()); } @Override - public boolean canPlaceBlockAt (World world, int x, int y, int z) { + public boolean canPlaceBlockAt(World world, int x, int y, int z) { if (!super.canPlaceBlockAt(world, x, y, z)) { return false; } else { @@ -200,7 +209,7 @@ public boolean canPlaceBlockAt (World world, int x, int y, int z) { } } - public void onNeighborBlockChange (World world, int x, int y, int z, int l) { + public void onNeighborBlockChange(World world, int x, int y, int z, int l) { if (!canBlockStay(world, x, y, z)) { dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0); world.setBlockToAir(x, y, z); @@ -208,36 +217,34 @@ public void onNeighborBlockChange (World world, int x, int y, int z, int l) { } @Override - public boolean canBlockStay (World world, int x, int y, int z) { + public boolean canBlockStay(World world, int x, int y, int z) { Block block = world.getBlock(x, y - 1, z); return block == this || block == Blocks.sand || block == null; - } @Override - public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity) { + public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) { if (!(entity instanceof EntityItem)) { entity.attackEntityFrom(DamageSource.cactus, 1); } } - public boolean canConnectSuguaroTo (IBlockAccess world, int x, int y, int z) { - return world.getBlock(x, y, z) == this && world.getBlockMetadata(x, y, z) == 0; + public boolean canConnectSuguaroTo(IBlockAccess world, int x, int y, int z) { + return world.getBlock(x, y, z) == this && world.getBlockMetadata(x, y, z) == 0; } @Override - public EnumPlantType getPlantType (IBlockAccess world, int x, int y, int z) { + public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z) { return EnumPlantType.Desert; } @Override - public Block getPlant (IBlockAccess world, int x, int y, int z) { + public Block getPlant(IBlockAccess world, int x, int y, int z) { return this; } @Override - public int getPlantMetadata (IBlockAccess world, int x, int y, int z) { + public int getPlantMetadata(IBlockAccess world, int x, int y, int z) { return 1; } - } diff --git a/src/main/java/mods/natura/blocks/trees/SimpleLog.java b/src/main/java/mods/natura/blocks/trees/SimpleLog.java index 23e7389a..2ff4fd3f 100644 --- a/src/main/java/mods/natura/blocks/trees/SimpleLog.java +++ b/src/main/java/mods/natura/blocks/trees/SimpleLog.java @@ -1,9 +1,8 @@ package mods.natura.blocks.trees; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mods.natura.common.NaturaTab; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -14,67 +13,55 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class SimpleLog extends Planks -{ - public String[] textureNames = new String[] { "redwood_bark", "redwood_heart", "redwood_root" }; +public class SimpleLog extends Planks { + public String[] textureNames = new String[] {"redwood_bark", "redwood_heart", "redwood_root"}; - public SimpleLog() - { + public SimpleLog() { super(); this.setCreativeTab(NaturaTab.tab); } @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons (IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.icons = new IIcon[textureNames.length]; - for (int i = 0; i < this.icons.length; ++i) - { + for (int i = 0; i < this.icons.length; ++i) { this.icons[i] = iconRegister.registerIcon("natura:" + textureNames[i]); } } @Override - public boolean canSustainLeaves (IBlockAccess world, int x, int y, int z) - { + public boolean canSustainLeaves(IBlockAccess world, int x, int y, int z) { return true; } @Override - public boolean isWood (IBlockAccess world, int x, int y, int z) - { + public boolean isWood(IBlockAccess world, int x, int y, int z) { return true; } @Override - public int getFlammability (IBlockAccess world, int x, int y, int z, int metadata, ForgeDirection face) - { + public int getFlammability(IBlockAccess world, int x, int y, int z, int metadata, ForgeDirection face) { return this.getFlammability(world, x, y, z, face); } @Override - public int getFireSpreadSpeed (World world, int x, int y, int z, int metadata, ForgeDirection face) - { + public int getFireSpreadSpeed(World world, int x, int y, int z, int metadata, ForgeDirection face) { return this.getFireSpreadSpeed(world, x, y, z, face); } @Override @SideOnly(Side.CLIENT) - public IIcon getIcon (int side, int meta) - { + public IIcon getIcon(int side, int meta) { int meat = meta; - if (meat >= textureNames.length) - meat = textureNames.length - 1; + if (meat >= textureNames.length) meat = textureNames.length - 1; return icons[meat]; } @SideOnly(Side.CLIENT) @Override - public void getSubBlocks (Item par1, CreativeTabs par2CreativeTabs, List par3List) - { - for (int i = 0; i < 3; i++) - par3List.add(new ItemStack(par1, 1, i)); + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + for (int i = 0; i < 3; i++) par3List.add(new ItemStack(par1, 1, i)); } } diff --git a/src/main/java/mods/natura/blocks/trees/TreeBlock.java b/src/main/java/mods/natura/blocks/trees/TreeBlock.java index f77e5e95..6bd627f8 100644 --- a/src/main/java/mods/natura/blocks/trees/TreeBlock.java +++ b/src/main/java/mods/natura/blocks/trees/TreeBlock.java @@ -1,10 +1,9 @@ package mods.natura.blocks.trees; -import java.util.List; -import java.util.Random; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; +import java.util.Random; import mods.natura.common.NaturaTab; import net.minecraft.block.Block; import net.minecraft.block.BlockLog; @@ -17,13 +16,20 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class TreeBlock extends BlockLog -{ +public class TreeBlock extends BlockLog { public IIcon[] icons; - public String[] textureNames = new String[] { "eucalyptus_bark", "sakura_bark", "ghostwood_bark", "hopseed_bark", "eucalyptus_heart", "sakura_heart", "ghostwood_heart", "hopseed_heart" }; + public String[] textureNames = new String[] { + "eucalyptus_bark", + "sakura_bark", + "ghostwood_bark", + "hopseed_bark", + "eucalyptus_heart", + "sakura_heart", + "ghostwood_heart", + "hopseed_heart" + }; - public TreeBlock() - { + public TreeBlock() { super(); this.setHardness(1.5F); this.setResistance(5F); @@ -34,26 +40,22 @@ public TreeBlock() @Override @SideOnly(Side.CLIENT) - public IIcon getIcon (int side, int metadata) - { + public IIcon getIcon(int side, int metadata) { int tex = (metadata % 4); int orientation = metadata / 4; switch (orientation) - //Ends of logs + // Ends of logs { - case 0: - if (side == 0 || side == 1) - return icons[tex + 4]; - break; - case 1: - if (side == 4 || side == 5) - return icons[tex + 4]; - break; - case 2: - if (side == 2 || side == 3) - return icons[tex + 4]; - break; + case 0: + if (side == 0 || side == 1) return icons[tex + 4]; + break; + case 1: + if (side == 4 || side == 5) return icons[tex + 4]; + break; + case 2: + if (side == 2 || side == 3) return icons[tex + 4]; + break; } return icons[tex]; @@ -61,43 +63,35 @@ public IIcon getIcon (int side, int metadata) @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons (IIconRegister IIconRegister) - { + public void registerBlockIcons(IIconRegister IIconRegister) { this.icons = new IIcon[textureNames.length]; - for (int i = 0; i < this.icons.length; ++i) - { + for (int i = 0; i < this.icons.length; ++i) { this.icons[i] = IIconRegister.registerIcon("natura:" + textureNames[i]); } } @Override - public Item getItemDropped (int par1, Random par2Random, int par3) - { + public Item getItemDropped(int par1, Random par2Random, int par3) { return Item.getItemFromBlock(this); } @Override - public int damageDropped (int meta) - { + public int damageDropped(int meta) { return meta % 4; } - public int getFlammability (IBlockAccess world, int x, int y, int z, int metadata, ForgeDirection face) - { + public int getFlammability(IBlockAccess world, int x, int y, int z, int metadata, ForgeDirection face) { return metadata % 4 != 2 ? this.getFlammability(world, x, y, z, face) : 0; } - public int getFireSpreadSpeed (World world, int x, int y, int z, int metadata, ForgeDirection face) - { + public int getFireSpreadSpeed(World world, int x, int y, int z, int metadata, ForgeDirection face) { return metadata % 4 != 2 ? this.getFireSpreadSpeed(world, x, y, z, face) : 0; } @SideOnly(Side.CLIENT) @Override - public void getSubBlocks (Item par1, CreativeTabs par2CreativeTabs, List par3List) - { - for (int i = 0; i < 4; i++) - par3List.add(new ItemStack(par1, 1, i)); + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + for (int i = 0; i < 4; i++) par3List.add(new ItemStack(par1, 1, i)); } } diff --git a/src/main/java/mods/natura/blocks/trees/WillowBlock.java b/src/main/java/mods/natura/blocks/trees/WillowBlock.java index fd4bd8eb..78642681 100644 --- a/src/main/java/mods/natura/blocks/trees/WillowBlock.java +++ b/src/main/java/mods/natura/blocks/trees/WillowBlock.java @@ -1,12 +1,10 @@ package mods.natura.blocks.trees; -import java.util.ArrayList; -import java.util.List; - import com.google.common.collect.Lists; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.ArrayList; +import java.util.List; import mods.natura.common.NaturaTab; import net.minecraft.block.Block; import net.minecraft.block.BlockLog; @@ -17,13 +15,11 @@ import net.minecraft.util.IIcon; import net.minecraft.world.World; -public class WillowBlock extends BlockLog -{ +public class WillowBlock extends BlockLog { public IIcon[] icons; - public String[] textureNames = new String[] { "willow_bark", "willow_heart" }; + public String[] textureNames = new String[] {"willow_bark", "willow_heart"}; - public WillowBlock() - { + public WillowBlock() { super(); this.setHardness(2.0F); this.setStepSound(Block.soundTypeWood); @@ -33,26 +29,22 @@ public WillowBlock() @Override @SideOnly(Side.CLIENT) - public IIcon getIcon (int side, int metadata) - { + public IIcon getIcon(int side, int metadata) { int tex = (metadata % 4) * 2; int orientation = metadata / 4; switch (orientation) - //Ends of logs + // Ends of logs { - case 0: - if (side == 0 || side == 1) - return icons[tex + 1]; - break; - case 1: - if (side == 4 || side == 5) - return icons[tex + 1]; - break; - case 2: - if (side == 2 || side == 3) - return icons[tex + 1]; - break; + case 0: + if (side == 0 || side == 1) return icons[tex + 1]; + break; + case 1: + if (side == 4 || side == 5) return icons[tex + 1]; + break; + case 2: + if (side == 2 || side == 3) return icons[tex + 1]; + break; } return icons[tex]; @@ -60,19 +52,16 @@ public IIcon getIcon (int side, int metadata) @Override @SideOnly(Side.CLIENT) - public void registerBlockIcons (IIconRegister iconRegister) - { + public void registerBlockIcons(IIconRegister iconRegister) { this.icons = new IIcon[textureNames.length]; - for (int i = 0; i < this.icons.length; ++i) - { + for (int i = 0; i < this.icons.length; ++i) { this.icons[i] = iconRegister.registerIcon("natura:" + textureNames[i]); } } @Override - public ArrayList getDrops (World world, int x, int y, int z, int metadata, int fortune) - { + public ArrayList getDrops(World world, int x, int y, int z, int metadata, int fortune) { ArrayList i = Lists.newArrayList(); i.add(new ItemStack(this)); return i; @@ -96,9 +85,7 @@ public int getFireSpreadSpeed(World world, int x, int y, int z, int metadata, Fo @SideOnly(Side.CLIENT) @Override - public void getSubBlocks (Item par1, CreativeTabs par2CreativeTabs, List par3List) - { - for (int i = 0; i < icons.length / 2; i++) - par3List.add(new ItemStack(par1, 1, i)); + public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + for (int i = 0; i < icons.length / 2; i++) par3List.add(new ItemStack(par1, 1, i)); } } diff --git a/src/main/java/mods/natura/client/BerryRender.java b/src/main/java/mods/natura/client/BerryRender.java index 44754370..049f0c1b 100644 --- a/src/main/java/mods/natura/client/BerryRender.java +++ b/src/main/java/mods/natura/client/BerryRender.java @@ -7,29 +7,22 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.world.IBlockAccess; -public class BerryRender implements ISimpleBlockRenderingHandler -{ +public class BerryRender implements ISimpleBlockRenderingHandler { public static int berryModel = RenderingRegistry.getNextAvailableRenderId(); @Override - public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) - { + public boolean renderWorldBlock( + IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - if (modelId == berryModel) - { + if (modelId == berryModel) { int md = world.getBlockMetadata(x, y, z); - if (md < 4) - { + if (md < 4) { renderer.setRenderBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F); renderer.renderStandardBlock(block, x, y, z); - } - else if (md < 8) - { + } else if (md < 8) { renderer.setRenderBounds(0.125F, 0.0F, 0.125F, 0.875F, 0.75F, 0.875F); renderer.renderStandardBlock(block, x, y, z); - } - else - { + } else { renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); renderer.renderStandardBlock(block, x, y, z); } @@ -38,10 +31,8 @@ else if (md < 8) } @Override - public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer) - { - if (modelID == berryModel) - { + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + if (modelID == berryModel) { Tessellator tessellator = Tessellator.instance; renderer.setRenderBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F); NProxyClient.renderStandardInvBlock(renderer, block, metadata); @@ -49,14 +40,12 @@ public void renderInventoryBlock (Block block, int metadata, int modelID, Render } @Override - public boolean shouldRender3DInInventory (int id) - { + public boolean shouldRender3DInInventory(int id) { return true; } @Override - public int getRenderId () - { + public int getRenderId() { return berryModel; } } diff --git a/src/main/java/mods/natura/client/CropRender.java b/src/main/java/mods/natura/client/CropRender.java index 523a82b6..16917d6c 100644 --- a/src/main/java/mods/natura/client/CropRender.java +++ b/src/main/java/mods/natura/client/CropRender.java @@ -6,39 +6,32 @@ import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.world.IBlockAccess; -public class CropRender implements ISimpleBlockRenderingHandler -{ +public class CropRender implements ISimpleBlockRenderingHandler { public static int model = RenderingRegistry.getNextAvailableRenderId(); @Override - public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer) - { - //Doesn't have an inventory sprite + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + // Doesn't have an inventory sprite } @Override - public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) - { - if (modelId == CropRender.model) - { + public boolean renderWorldBlock( + IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + if (modelId == CropRender.model) { int meta = world.getBlockMetadata(x, y, z); - if (meta < 4) - return renderer.renderBlockCrops(block, x, y, z); - else - return renderer.renderCrossedSquares(block, x, y, z); + if (meta < 4) return renderer.renderBlockCrops(block, x, y, z); + else return renderer.renderCrossedSquares(block, x, y, z); } return true; } @Override - public boolean shouldRender3DInInventory (int id) - { + public boolean shouldRender3DInInventory(int id) { return false; } @Override - public int getRenderId () - { + public int getRenderId() { return model; } } diff --git a/src/main/java/mods/natura/client/FenceRender.java b/src/main/java/mods/natura/client/FenceRender.java index 0e8e330c..6d6c2ae1 100644 --- a/src/main/java/mods/natura/client/FenceRender.java +++ b/src/main/java/mods/natura/client/FenceRender.java @@ -1,7 +1,5 @@ package mods.natura.client; -import org.lwjgl.opengl.GL11; - import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler; import cpw.mods.fml.client.registry.RenderingRegistry; import net.minecraft.block.Block; @@ -9,79 +7,79 @@ import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.world.IBlockAccess; +import org.lwjgl.opengl.GL11; -public class FenceRender implements ISimpleBlockRenderingHandler -{ +public class FenceRender implements ISimpleBlockRenderingHandler { public static int model = RenderingRegistry.getNextAvailableRenderId(); @Override - public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) - { + public boolean renderWorldBlock( + IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { - if (modelId == model) - { + if (modelId == model) { return renderer.renderBlockFence((BlockFence) block, x, y, z); } return true; } @Override - public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer) - { - if (modelID == model) - { + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + if (modelID == model) { Tessellator tessellator = Tessellator.instance; - for (int k = 0; k < 4; ++k) - { + for (int k = 0; k < 4; ++k) { float f2 = 0.125F; - if (k == 0) - { + if (k == 0) { renderer.setRenderBounds(0.5F - f2, 0.0D, 0.0D, 0.5F + f2, 1.0D, f2 * 2.0F); } - if (k == 1) - { + if (k == 1) { renderer.setRenderBounds(0.5F - f2, 0.0D, 1.0F - f2 * 2.0F, 0.5F + f2, 1.0D, 1.0D); } f2 = 0.0625F; - if (k == 2) - { - renderer.setRenderBounds(0.5F - f2, 1.0F - f2 * 3.0F, -f2 * 2.0F, 0.5F + f2, 1.0F - f2, 1.0F + f2 * 2.0F); + if (k == 2) { + renderer.setRenderBounds( + 0.5F - f2, 1.0F - f2 * 3.0F, -f2 * 2.0F, 0.5F + f2, 1.0F - f2, 1.0F + f2 * 2.0F); } - if (k == 3) - { - renderer.setRenderBounds(0.5F - f2, 0.5F - f2 * 3.0F, -f2 * 2.0F, 0.5F + f2, 0.5F - f2, 1.0F + f2 * 2.0F); + if (k == 3) { + renderer.setRenderBounds( + 0.5F - f2, 0.5F - f2 * 3.0F, -f2 * 2.0F, 0.5F + f2, 0.5F - f2, 1.0F + f2 * 2.0F); } GL11.glTranslatef(-0.5F, -0.5F, -0.5F); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, -1.0F, 0.0F); - renderer.renderFaceYNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 0, metadata)); + renderer.renderFaceYNeg( + block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 0, metadata)); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 1.0F, 0.0F); - renderer.renderFaceYPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 1, metadata)); + renderer.renderFaceYPos( + block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 1, metadata)); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, -1.0F); - renderer.renderFaceZNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 2, metadata)); + renderer.renderFaceZNeg( + block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 2, metadata)); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, 1.0F); - renderer.renderFaceZPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 3, metadata)); + renderer.renderFaceZPos( + block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 3, metadata)); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(-1.0F, 0.0F, 0.0F); - renderer.renderFaceXNeg(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 4, metadata)); + renderer.renderFaceXNeg( + block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 4, metadata)); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(1.0F, 0.0F, 0.0F); - renderer.renderFaceXPos(block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 5, metadata)); + renderer.renderFaceXPos( + block, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(block, 5, metadata)); tessellator.draw(); GL11.glTranslatef(0.5F, 0.5F, 0.5F); } @@ -91,14 +89,12 @@ public void renderInventoryBlock (Block block, int metadata, int modelID, Render } @Override - public boolean shouldRender3DInInventory (int id) - { + public boolean shouldRender3DInInventory(int id) { return true; } @Override - public int getRenderId () - { + public int getRenderId() { return model; } } diff --git a/src/main/java/mods/natura/client/GrassColorizerAlternate.java b/src/main/java/mods/natura/client/GrassColorizerAlternate.java index 56caea28..2b687df2 100644 --- a/src/main/java/mods/natura/client/GrassColorizerAlternate.java +++ b/src/main/java/mods/natura/client/GrassColorizerAlternate.java @@ -5,46 +5,40 @@ import mods.natura.Natura; @SideOnly(Side.CLIENT) -public class GrassColorizerAlternate -{ +public class GrassColorizerAlternate { /** Color buffer for grass */ private static int[] blueGrassBuffer = new int[65536]; + private static int[] orangeGrassBuffer = new int[65536]; - public static void setBlueGrassBiomeColorizer (int[] par0ArrayOfInteger) - { - if (par0ArrayOfInteger.length == 65536) - { + public static void setBlueGrassBiomeColorizer(int[] par0ArrayOfInteger) { + if (par0ArrayOfInteger.length == 65536) { blueGrassBuffer = par0ArrayOfInteger; - } - else - { - Natura.logger.warn("Invalid texture for blue grass biome colors: expected 256x256 (65536) pixels, got {}!", par0ArrayOfInteger.length); + } else { + Natura.logger.warn( + "Invalid texture for blue grass biome colors: expected 256x256 (65536) pixels, got {}!", + par0ArrayOfInteger.length); } } - public static int getBlueGrassColor (double temperature, double humidity) - { + public static int getBlueGrassColor(double temperature, double humidity) { humidity *= temperature; int i = (int) ((1.0D - temperature) * 255.0D); int j = (int) ((1.0D - humidity) * 255.0D); return blueGrassBuffer[j << 8 | i]; } - public static void setOrangeGrassBiomeColorizer (int[] par0ArrayOfInteger) - { - if (par0ArrayOfInteger.length == 65536) - { + public static void setOrangeGrassBiomeColorizer(int[] par0ArrayOfInteger) { + if (par0ArrayOfInteger.length == 65536) { orangeGrassBuffer = par0ArrayOfInteger; - } - else - { - Natura.logger.warn("Invalid texture for orange grass biome colors: expected 256x256 (65536) pixels, got {}!", par0ArrayOfInteger.length); + } else { + Natura.logger.warn( + "Invalid texture for orange grass biome colors: expected 256x256 (65536) pixels, got {}!", + par0ArrayOfInteger.length); } } - public static int getOrangeGrassColor (double temperature, double humidity) - { + public static int getOrangeGrassColor(double temperature, double humidity) { humidity *= temperature; int i = (int) ((1.0D - temperature) * 255.0D); int j = (int) ((1.0D - humidity) * 255.0D); diff --git a/src/main/java/mods/natura/client/HopperRender.java b/src/main/java/mods/natura/client/HopperRender.java index fd419015..fab16aca 100644 --- a/src/main/java/mods/natura/client/HopperRender.java +++ b/src/main/java/mods/natura/client/HopperRender.java @@ -11,33 +11,28 @@ import net.minecraft.util.IIcon; import net.minecraft.world.IBlockAccess; -public class HopperRender implements ISimpleBlockRenderingHandler -{ +public class HopperRender implements ISimpleBlockRenderingHandler { public static int model = RenderingRegistry.getNextAvailableRenderId(); @Override - public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) - { - if (modelId == model) - { + public boolean renderWorldBlock( + IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer) { + if (modelId == model) { return renderBlockHopper((BlazeHopper) block, x, y, z, renderer); } return true; } @Override - public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer) - { - if (modelID == model) - { + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + if (modelID == model) { Tessellator tessellator = Tessellator.instance; renderer.setRenderBounds(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F); NProxyClient.renderStandardInvBlock(renderer, block, metadata); } } - public boolean renderBlockHopper (BlazeHopper par1BlockHopper, int par2, int par3, int par4, RenderBlocks renderer) - { + public boolean renderBlockHopper(BlazeHopper par1BlockHopper, int par2, int par3, int par4, RenderBlocks renderer) { Tessellator tessellator = Tessellator.instance; tessellator.setBrightness(par1BlockHopper.getMixedBrightnessForBlock(renderer.blockAccess, par2, par3, par4)); float f = 1.0F; @@ -46,8 +41,7 @@ public boolean renderBlockHopper (BlazeHopper par1BlockHopper, int par2, int par float f2 = (l >> 8 & 255) / 255.0F; float f3 = (l & 255) / 255.0F; - if (EntityRenderer.anaglyphEnable) - { + if (EntityRenderer.anaglyphEnable) { float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F; float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F; float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F; @@ -57,61 +51,94 @@ public boolean renderBlockHopper (BlazeHopper par1BlockHopper, int par2, int par } tessellator.setColorOpaque_F(f * f1, f * f2, f * f3); - return this.renderBlockHopperMetadata(par1BlockHopper, par2, par3, par4, renderer.blockAccess.getBlockMetadata(par2, par3, par4), false, renderer); + return this.renderBlockHopperMetadata( + par1BlockHopper, + par2, + par3, + par4, + renderer.blockAccess.getBlockMetadata(par2, par3, par4), + false, + renderer); } - public boolean renderBlockHopperMetadata (BlazeHopper par1BlockHopper, int par2, int par3, int par4, int par5, boolean par6, RenderBlocks renderer) - { + public boolean renderBlockHopperMetadata( + BlazeHopper par1BlockHopper, int par2, int par3, int par4, int par5, boolean par6, RenderBlocks renderer) { Tessellator tessellator = Tessellator.instance; int i1 = BlockHopper.getDirectionFromMetadata(par5); double d0 = 0.625D; renderer.setRenderBounds(0.0D, d0, 0.0D, 1.0D, 1.0D, 1.0D); - if (par6) - { + if (par6) { tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, -1.0F, 0.0F); - renderer.renderFaceYNeg(par1BlockHopper, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(par1BlockHopper, 0, par5)); + renderer.renderFaceYNeg( + par1BlockHopper, + 0.0D, + 0.0D, + 0.0D, + renderer.getBlockIconFromSideAndMetadata(par1BlockHopper, 0, par5)); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 1.0F, 0.0F); - renderer.renderFaceYPos(par1BlockHopper, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(par1BlockHopper, 1, par5)); + renderer.renderFaceYPos( + par1BlockHopper, + 0.0D, + 0.0D, + 0.0D, + renderer.getBlockIconFromSideAndMetadata(par1BlockHopper, 1, par5)); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, -1.0F); - renderer.renderFaceZNeg(par1BlockHopper, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(par1BlockHopper, 2, par5)); + renderer.renderFaceZNeg( + par1BlockHopper, + 0.0D, + 0.0D, + 0.0D, + renderer.getBlockIconFromSideAndMetadata(par1BlockHopper, 2, par5)); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 0.0F, 1.0F); - renderer.renderFaceZPos(par1BlockHopper, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(par1BlockHopper, 3, par5)); + renderer.renderFaceZPos( + par1BlockHopper, + 0.0D, + 0.0D, + 0.0D, + renderer.getBlockIconFromSideAndMetadata(par1BlockHopper, 3, par5)); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(-1.0F, 0.0F, 0.0F); - renderer.renderFaceXNeg(par1BlockHopper, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(par1BlockHopper, 4, par5)); + renderer.renderFaceXNeg( + par1BlockHopper, + 0.0D, + 0.0D, + 0.0D, + renderer.getBlockIconFromSideAndMetadata(par1BlockHopper, 4, par5)); tessellator.draw(); tessellator.startDrawingQuads(); tessellator.setNormal(1.0F, 0.0F, 0.0F); - renderer.renderFaceXPos(par1BlockHopper, 0.0D, 0.0D, 0.0D, renderer.getBlockIconFromSideAndMetadata(par1BlockHopper, 5, par5)); + renderer.renderFaceXPos( + par1BlockHopper, + 0.0D, + 0.0D, + 0.0D, + renderer.getBlockIconFromSideAndMetadata(par1BlockHopper, 5, par5)); tessellator.draw(); - } - else - { + } else { renderer.renderStandardBlock(par1BlockHopper, par2, par3, par4); } float f; - if (!par6) - { - tessellator.setBrightness(par1BlockHopper.getMixedBrightnessForBlock(renderer.blockAccess, par2, par3, par4)); + if (!par6) { + tessellator.setBrightness( + par1BlockHopper.getMixedBrightnessForBlock(renderer.blockAccess, par2, par3, par4)); float f1 = 1.0F; int j1 = par1BlockHopper.colorMultiplier(renderer.blockAccess, par2, par3, par4); f = (j1 >> 16 & 255) / 255.0F; float f2 = (j1 >> 8 & 255) / 255.0F; float f3 = (j1 & 255) / 255.0F; - if (EntityRenderer.anaglyphEnable) - { + if (EntityRenderer.anaglyphEnable) { float f4 = (f * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F; float f5 = (f * 30.0F + f2 * 70.0F) / 100.0F; float f6 = (f * 30.0F + f3 * 70.0F) / 100.0F; @@ -127,8 +154,7 @@ public boolean renderBlockHopperMetadata (BlazeHopper par1BlockHopper, int par2, IIcon icon1 = BlazeHopper.hopperIcon("hopper_inside"); f = 0.125F; - if (par6) - { + if (par6) { tessellator.startDrawingQuads(); tessellator.setNormal(1.0F, 0.0F, 0.0F); renderer.renderFaceXPos(par1BlockHopper, -1.0F + f, 0.0D, 0.0D, icon); @@ -149,9 +175,7 @@ public boolean renderBlockHopperMetadata (BlazeHopper par1BlockHopper, int par2, tessellator.setNormal(0.0F, 1.0F, 0.0F); renderer.renderFaceYPos(par1BlockHopper, 0.0D, -1.0D + d0, 0.0D, icon1); tessellator.draw(); - } - else - { + } else { renderer.renderFaceXPos(par1BlockHopper, par2 - 1.0F + f, par3, par4, icon); renderer.renderFaceXNeg(par1BlockHopper, par2 + 1.0F - f, par3, par4, icon); renderer.renderFaceZPos(par1BlockHopper, par2, par3, par4 - 1.0F + f, icon); @@ -164,8 +188,7 @@ public boolean renderBlockHopperMetadata (BlazeHopper par1BlockHopper, int par2, double d2 = 0.25D; renderer.setRenderBounds(d1, d2, d1, 1.0D - d1, d0 - 0.002D, 1.0D - d1); - if (par6) - { + if (par6) { tessellator.startDrawingQuads(); tessellator.setNormal(1.0F, 0.0F, 0.0F); renderer.renderFaceXPos(par1BlockHopper, 0.0D, 0.0D, 0.0D, icon); @@ -190,44 +213,36 @@ public boolean renderBlockHopperMetadata (BlazeHopper par1BlockHopper, int par2, tessellator.setNormal(0.0F, -1.0F, 0.0F); renderer.renderFaceYNeg(par1BlockHopper, 0.0D, 0.0D, 0.0D, icon); tessellator.draw(); - } - else - { + } else { renderer.renderStandardBlock(par1BlockHopper, par2, par3, par4); } - if (!par6) - { + if (!par6) { double d3 = 0.375D; double d4 = 0.25D; renderer.setOverrideBlockTexture(icon); - if (i1 == 0) - { + if (i1 == 0) { renderer.setRenderBounds(d3, 0.0D, d3, 1.0D - d3, 0.25D, 1.0D - d3); renderer.renderStandardBlock(par1BlockHopper, par2, par3, par4); } - if (i1 == 2) - { + if (i1 == 2) { renderer.setRenderBounds(d3, d2, 0.0D, 1.0D - d3, d2 + d4, d1); renderer.renderStandardBlock(par1BlockHopper, par2, par3, par4); } - if (i1 == 3) - { + if (i1 == 3) { renderer.setRenderBounds(d3, d2, 1.0D - d1, 1.0D - d3, d2 + d4, 1.0D); renderer.renderStandardBlock(par1BlockHopper, par2, par3, par4); } - if (i1 == 4) - { + if (i1 == 4) { renderer.setRenderBounds(0.0D, d2, d3, d1, d2 + d4, 1.0D - d3); renderer.renderStandardBlock(par1BlockHopper, par2, par3, par4); } - if (i1 == 5) - { + if (i1 == 5) { renderer.setRenderBounds(1.0D - d1, d2, d3, 1.0D, d2 + d4, 1.0D - d3); renderer.renderStandardBlock(par1BlockHopper, par2, par3, par4); } @@ -238,14 +253,12 @@ public boolean renderBlockHopperMetadata (BlazeHopper par1BlockHopper, int par2, } @Override - public boolean shouldRender3DInInventory (int id) - { + public boolean shouldRender3DInInventory(int id) { return true; } @Override - public int getRenderId () - { + public int getRenderId() { return model; } } diff --git a/src/main/java/mods/natura/client/LeverRender.java b/src/main/java/mods/natura/client/LeverRender.java index 348231e0..87e0148e 100644 --- a/src/main/java/mods/natura/client/LeverRender.java +++ b/src/main/java/mods/natura/client/LeverRender.java @@ -10,23 +10,20 @@ import net.minecraft.util.Vec3; import net.minecraft.world.IBlockAccess; -public class LeverRender implements ISimpleBlockRenderingHandler -{ +public class LeverRender implements ISimpleBlockRenderingHandler { public static int model = RenderingRegistry.getNextAvailableRenderId(); @Override - public boolean renderWorldBlock (IBlockAccess world, int par2, int par3, int par4, Block par1Block, int modelId, RenderBlocks renderer) - { - if (modelId == model) - { + public boolean renderWorldBlock( + IBlockAccess world, int par2, int par3, int par4, Block par1Block, int modelId, RenderBlocks renderer) { + if (modelId == model) { int l = renderer.blockAccess.getBlockMetadata(par2, par3, par4); int i1 = l & 7; boolean flag = (l & 8) > 0; Tessellator tessellator = Tessellator.instance; boolean flag1 = renderer.hasOverrideBlockTexture(); - if (!flag1) - { + if (!flag1) { renderer.setOverrideBlockTexture(renderer.getBlockIcon(Blocks.netherrack)); } @@ -34,59 +31,41 @@ public boolean renderWorldBlock (IBlockAccess world, int par2, int par3, int par float f1 = 0.1875F; float f2 = 0.1875F; - if (i1 == 5) - { + if (i1 == 5) { renderer.setRenderBounds(0.5F - f1, 0.0D, 0.5F - f, 0.5F + f1, f2, 0.5F + f); - } - else if (i1 == 6) - { + } else if (i1 == 6) { renderer.setRenderBounds(0.5F - f, 0.0D, 0.5F - f1, 0.5F + f, f2, 0.5F + f1); - } - else if (i1 == 4) - { + } else if (i1 == 4) { renderer.setRenderBounds(0.5F - f1, 0.5F - f, 1.0F - f2, 0.5F + f1, 0.5F + f, 1.0D); - } - else if (i1 == 3) - { + } else if (i1 == 3) { renderer.setRenderBounds(0.5F - f1, 0.5F - f, 0.0D, 0.5F + f1, 0.5F + f, f2); - } - else if (i1 == 2) - { + } else if (i1 == 2) { renderer.setRenderBounds(1.0F - f2, 0.5F - f, 0.5F - f1, 1.0D, 0.5F + f, 0.5F + f1); - } - else if (i1 == 1) - { + } else if (i1 == 1) { renderer.setRenderBounds(0.0D, 0.5F - f, 0.5F - f1, f2, 0.5F + f, 0.5F + f1); - } - else if (i1 == 0) - { + } else if (i1 == 0) { renderer.setRenderBounds(0.5F - f, 1.0F - f2, 0.5F - f1, 0.5F + f, 1.0D, 0.5F + f1); - } - else if (i1 == 7) - { + } else if (i1 == 7) { renderer.setRenderBounds(0.5F - f1, 1.0F - f2, 0.5F - f, 0.5F + f1, 1.0D, 0.5F + f); } renderer.renderStandardBlock(par1Block, par2, par3, par4); - if (!flag1) - { + if (!flag1) { renderer.clearOverrideBlockTexture(); } tessellator.setBrightness(par1Block.getMixedBrightnessForBlock(renderer.blockAccess, par2, par3, par4)); float f3 = 1.0F; - if (par1Block.getLightValue() > 0) - { + if (par1Block.getLightValue() > 0) { f3 = 1.0F; } tessellator.setColorOpaque_F(f3, f3, f3); IIcon icon = renderer.getBlockIconFromSide(par1Block, 0); - if (renderer.hasOverrideBlockTexture()) - { + if (renderer.hasOverrideBlockTexture()) { icon = renderer.overrideBlockTexture; } @@ -107,66 +86,51 @@ else if (i1 == 7) avec3[6] = Vec3.createVectorHelper(f4, f6, f5); avec3[7] = Vec3.createVectorHelper((-f4), f6, f5); - for (int j1 = 0; j1 < 8; ++j1) - { - if (flag) - { + for (int j1 = 0; j1 < 8; ++j1) { + if (flag) { avec3[j1].zCoord -= 0.0625D; avec3[j1].rotateAroundX(((float) Math.PI * 2F / 9F)); - } - else - { + } else { avec3[j1].zCoord += 0.0625D; avec3[j1].rotateAroundX(-((float) Math.PI * 2F / 9F)); } - if (i1 == 0 || i1 == 7) - { + if (i1 == 0 || i1 == 7) { avec3[j1].rotateAroundZ((float) Math.PI); } - if (i1 == 6 || i1 == 0) - { + if (i1 == 6 || i1 == 0) { avec3[j1].rotateAroundY(((float) Math.PI / 2F)); } - if (i1 > 0 && i1 < 5) - { + if (i1 > 0 && i1 < 5) { avec3[j1].yCoord -= 0.375D; avec3[j1].rotateAroundX(((float) Math.PI / 2F)); - if (i1 == 4) - { + if (i1 == 4) { avec3[j1].rotateAroundY(0.0F); } - if (i1 == 3) - { + if (i1 == 3) { avec3[j1].rotateAroundY((float) Math.PI); } - if (i1 == 2) - { + if (i1 == 2) { avec3[j1].rotateAroundY(((float) Math.PI / 2F)); } - if (i1 == 1) - { + if (i1 == 1) { avec3[j1].rotateAroundY(-((float) Math.PI / 2F)); } avec3[j1].xCoord += par2 + 0.5D; avec3[j1].yCoord += par3 + 0.5F; avec3[j1].zCoord += par4 + 0.5D; - } - else if (i1 != 0 && i1 != 7) - { + } else if (i1 != 0 && i1 != 7) { avec3[j1].xCoord += par2 + 0.5D; avec3[j1].yCoord += par3 + 0.125F; avec3[j1].zCoord += par4 + 0.5D; - } - else - { + } else { avec3[j1].xCoord += par2 + 0.5D; avec3[j1].yCoord += par3 + 0.875F; avec3[j1].zCoord += par4 + 0.5D; @@ -178,60 +142,45 @@ else if (i1 != 0 && i1 != 7) Vec3 vec32 = null; Vec3 vec33 = null; - for (int k1 = 0; k1 < 6; ++k1) - { - if (k1 == 0) - { + for (int k1 = 0; k1 < 6; ++k1) { + if (k1 == 0) { d0 = icon.getInterpolatedU(7.0D); d1 = icon.getInterpolatedV(6.0D); d2 = icon.getInterpolatedU(9.0D); d3 = icon.getInterpolatedV(8.0D); - } - else if (k1 == 2) - { + } else if (k1 == 2) { d0 = icon.getInterpolatedU(7.0D); d1 = icon.getInterpolatedV(6.0D); d2 = icon.getInterpolatedU(9.0D); d3 = icon.getMaxV(); } - if (k1 == 0) - { + if (k1 == 0) { vec3 = avec3[0]; vec31 = avec3[1]; vec32 = avec3[2]; vec33 = avec3[3]; - } - else if (k1 == 1) - { + } else if (k1 == 1) { vec3 = avec3[7]; vec31 = avec3[6]; vec32 = avec3[5]; vec33 = avec3[4]; - } - else if (k1 == 2) - { + } else if (k1 == 2) { vec3 = avec3[1]; vec31 = avec3[0]; vec32 = avec3[4]; vec33 = avec3[5]; - } - else if (k1 == 3) - { + } else if (k1 == 3) { vec3 = avec3[2]; vec31 = avec3[1]; vec32 = avec3[5]; vec33 = avec3[6]; - } - else if (k1 == 4) - { + } else if (k1 == 4) { vec3 = avec3[3]; vec31 = avec3[2]; vec32 = avec3[6]; vec33 = avec3[7]; - } - else if (k1 == 5) - { + } else if (k1 == 5) { vec3 = avec3[0]; vec31 = avec3[3]; vec32 = avec3[7]; @@ -248,20 +197,17 @@ else if (k1 == 5) } @Override - public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer) - { - //Nope! + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + // Nope! } @Override - public int getRenderId () - { + public int getRenderId() { return model; } @Override - public boolean shouldRender3DInInventory (int modelId) - { + public boolean shouldRender3DInInventory(int modelId) { return false; } } diff --git a/src/main/java/mods/natura/client/NProxyClient.java b/src/main/java/mods/natura/client/NProxyClient.java index 2ef6410c..36c16c38 100644 --- a/src/main/java/mods/natura/client/NProxyClient.java +++ b/src/main/java/mods/natura/client/NProxyClient.java @@ -1,7 +1,5 @@ package mods.natura.client; -import org.lwjgl.opengl.GL11; - import cpw.mods.fml.client.registry.RenderingRegistry; import mods.natura.client.entity.FlameSpiderBabyRender; import mods.natura.client.entity.FlameSpiderRender; @@ -21,6 +19,7 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.texture.TextureUtil; import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; public class NProxyClient extends NProxyCommon { @Override @@ -40,15 +39,19 @@ public void registerRenderer() { Minecraft mc = Minecraft.getMinecraft(); try { - GrassColorizerAlternate.setBlueGrassBiomeColorizer(TextureUtil.readImageData(mc.getResourceManager(), bluegrass)); - GrassColorizerAlternate.setOrangeGrassBiomeColorizer(TextureUtil.readImageData(mc.getResourceManager(), orangegrass)); + GrassColorizerAlternate.setBlueGrassBiomeColorizer( + TextureUtil.readImageData(mc.getResourceManager(), bluegrass)); + GrassColorizerAlternate.setOrangeGrassBiomeColorizer( + TextureUtil.readImageData(mc.getResourceManager(), orangegrass)); } catch (Exception e) { e.printStackTrace(); } } - private static final ResourceLocation bluegrass = new ResourceLocation("natura", "textures/misc/bluegrasscolor.png"); - private static final ResourceLocation orangegrass = new ResourceLocation("natura", "textures/misc/orangegrasscolor.png"); + private static final ResourceLocation bluegrass = + new ResourceLocation("natura", "textures/misc/bluegrasscolor.png"); + private static final ResourceLocation orangegrass = + new ResourceLocation("natura", "textures/misc/orangegrasscolor.png"); public static void renderStandardInvBlock(RenderBlocks renderblocks, Block block, int meta) { Tessellator tessellator = Tessellator.instance; @@ -79,5 +82,4 @@ public static void renderStandardInvBlock(RenderBlocks renderblocks, Block block tessellator.draw(); GL11.glTranslatef(0.5F, 0.5F, 0.5F); } - } diff --git a/src/main/java/mods/natura/client/SaguaroRenderer.java b/src/main/java/mods/natura/client/SaguaroRenderer.java index 0d14c352..5cb6a0c7 100644 --- a/src/main/java/mods/natura/client/SaguaroRenderer.java +++ b/src/main/java/mods/natura/client/SaguaroRenderer.java @@ -16,41 +16,42 @@ public class SaguaroRenderer implements ISimpleBlockRenderingHandler { public static int model = RenderingRegistry.getNextAvailableRenderId(); @Override - public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer) { - if (modelID == model) - NProxyClient.renderStandardInvBlock(renderer, block, metadata); + public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) { + if (modelID == model) NProxyClient.renderStandardInvBlock(renderer, block, metadata); } @Override - public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer) { + public boolean renderWorldBlock( + IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer) { if (modelID == model) { int meta = world.getBlockMetadata(x, y, z); - switch(meta) { - case 0: - return renderCactus(renderer, world, x, y, z, (SaguaroBlock) block); - case 1: - case 2: - return renderSmall(renderer, world, x, y, z, block); - case 3: - return renderFruit((SaguaroBlock) block, x, y, z, world, meta); - } + switch (meta) { + case 0: + return renderCactus(renderer, world, x, y, z, (SaguaroBlock) block); + case 1: + case 2: + return renderSmall(renderer, world, x, y, z, block); + case 3: + return renderFruit((SaguaroBlock) block, x, y, z, world, meta); + } } return true; } @Override - public boolean shouldRender3DInInventory (int id) { + public boolean shouldRender3DInInventory(int id) { return true; } @Override - public int getRenderId () { + public int getRenderId() { return model; } /* Render methods, used for saguaro */ - boolean renderCactus (RenderBlocks renderblocks, IBlockAccess iblockaccess, int x, int y, int z, SaguaroBlock cactus) { + boolean renderCactus( + RenderBlocks renderblocks, IBlockAccess iblockaccess, int x, int y, int z, SaguaroBlock cactus) { float offset = 0.125F; float botX = offset; @@ -63,10 +64,8 @@ boolean renderCactus (RenderBlocks renderblocks, IBlockAccess iblockaccess, int Block airBelow = iblockaccess.getBlock(x, y - 1, z); Block cactusAbove = iblockaccess.getBlock(x, y + 1, z); - if (airBelow == Blocks.air) - botY = offset; - if (cactusAbove == cactus) - topY = 1.0F; + if (airBelow == Blocks.air) botY = offset; + if (cactusAbove == cactus) topY = 1.0F; renderblocks.setRenderBounds(botX, botY, botZ, topX, topY, topZ); renderblocks.renderStandardBlock(cactus, x, y, z); @@ -74,14 +73,16 @@ boolean renderCactus (RenderBlocks renderblocks, IBlockAccess iblockaccess, int botY = offset; topY = 1.0F - offset; - if (cactus.canConnectSuguaroTo(iblockaccess, x + 1, y, z) && (airBelow == Blocks.air || iblockaccess.getBlock(x + 1, y - 1, z) == Blocks.air)) { + if (cactus.canConnectSuguaroTo(iblockaccess, x + 1, y, z) + && (airBelow == Blocks.air || iblockaccess.getBlock(x + 1, y - 1, z) == Blocks.air)) { botX = 1F - offset; topX = 1F; renderblocks.setRenderBounds(botX, botY, botZ, topX, topY, topZ); renderblocks.renderStandardBlock(cactus, x, y, z); } - if (cactus.canConnectSuguaroTo(iblockaccess, x - 1, y, z) && (airBelow == Blocks.air || iblockaccess.getBlock(x - 1, y - 1, z) == Blocks.air)) { + if (cactus.canConnectSuguaroTo(iblockaccess, x - 1, y, z) + && (airBelow == Blocks.air || iblockaccess.getBlock(x - 1, y - 1, z) == Blocks.air)) { botX = 0F; topX = offset; renderblocks.setRenderBounds(botX, botY, botZ, topX, topY, topZ); @@ -91,14 +92,16 @@ boolean renderCactus (RenderBlocks renderblocks, IBlockAccess iblockaccess, int botX = offset; topX = 1.0F - offset; - if (cactus.canConnectSuguaroTo(iblockaccess, x, y, z + 1) && (airBelow == Blocks.air || iblockaccess.getBlock(x, y - 1, z + 1) == Blocks.air)) { + if (cactus.canConnectSuguaroTo(iblockaccess, x, y, z + 1) + && (airBelow == Blocks.air || iblockaccess.getBlock(x, y - 1, z + 1) == Blocks.air)) { botZ = 1F - offset; topZ = 1F; renderblocks.setRenderBounds(botX, botY, botZ, topX, topY, topZ); renderblocks.renderStandardBlock(cactus, x, y, z); } - if (cactus.canConnectSuguaroTo(iblockaccess, x, y, z - 1) && (airBelow == Blocks.air || iblockaccess.getBlock(x, y - 1, z - 1) == Blocks.air)) { + if (cactus.canConnectSuguaroTo(iblockaccess, x, y, z - 1) + && (airBelow == Blocks.air || iblockaccess.getBlock(x, y - 1, z - 1) == Blocks.air)) { botZ = 0F; topZ = offset; renderblocks.setRenderBounds(botX, botY, botZ, topX, topY, topZ); @@ -107,7 +110,7 @@ boolean renderCactus (RenderBlocks renderblocks, IBlockAccess iblockaccess, int return true; } - public boolean renderFruit (SaguaroBlock block, int x, int y, int z, IBlockAccess world, int meta) { + public boolean renderFruit(SaguaroBlock block, int x, int y, int z, IBlockAccess world, int meta) { Tessellator tessellator = Tessellator.instance; tessellator.setBrightness(block.getMixedBrightnessForBlock(world, x, y, z)); tessellator.setColorOpaque_F(1.0F, 1.0F, 1.0F); @@ -131,22 +134,22 @@ public boolean renderFruit (SaguaroBlock block, int x, int y, int z, IBlockAcces double d9 = 0.0D; switch (direction) { - case 0: - d8 = 8.0D - offsetX / 2; - d9 = 18.0D - offsetX; - break; - case 1: - d8 = -2.0D; - d9 = 8.0D - offsetX / 2; - break; - case 2: - d8 = 8.0D - offsetX / 2; - d9 = -2.0D; - break; - case 3: - d8 = 18.0D - offsetX; - d9 = 8.0D - offsetX / 2; - /*case 4: + case 0: + d8 = 8.0D - offsetX / 2; + d9 = 18.0D - offsetX; + break; + case 1: + d8 = -2.0D; + d9 = 8.0D - offsetX / 2; + break; + case 2: + d8 = 8.0D - offsetX / 2; + d9 = -2.0D; + break; + case 3: + d8 = 18.0D - offsetX; + d9 = 8.0D - offsetX / 2; + /*case 4: d8 = 11.0D - (double)offsetX; d9 = 8.0D - (double)(offsetX / 2);*/ } @@ -200,27 +203,27 @@ public boolean renderFruit (SaguaroBlock block, int x, int y, int z, IBlockAcces double d16; switch (direction) { - case 0: - d8 = 8.0D; - d9 = 12.0D; - d16 = d4; - d4 = d5; - d5 = d16; - break; - case 1: - d8 = 0.0D; - d9 = 8.0D; - break; - case 2: - d8 = 8.0D; - d9 = 0.0D; - break; - case 3: - d8 = 12.0D; - d9 = 8.0D; - d16 = d4; - d4 = d5; - d5 = d16; + case 0: + d8 = 8.0D; + d9 = 12.0D; + d16 = d4; + d4 = d5; + d5 = d16; + break; + case 1: + d8 = 0.0D; + d9 = 8.0D; + break; + case 2: + d8 = 8.0D; + d9 = 0.0D; + break; + case 3: + d8 = 12.0D; + d9 = 8.0D; + d16 = d4; + d4 = d5; + d5 = d16; } d10 = x + d8 / 16.0D; @@ -259,10 +262,9 @@ public boolean renderFruit (SaguaroBlock block, int x, int y, int z, IBlockAcces return true; } - boolean renderSmall (RenderBlocks renderer, IBlockAccess iblockaccess, int x, int y, int z, Block block) { + boolean renderSmall(RenderBlocks renderer, IBlockAccess iblockaccess, int x, int y, int z, Block block) { renderer.setRenderBounds(0.325F, 0.0F, 0.325F, 0.675F, 0.5F, 0.675F); renderer.renderStandardBlock(block, x, y, z); return true; } - } diff --git a/src/main/java/mods/natura/client/entity/FlameSpiderBabyRender.java b/src/main/java/mods/natura/client/entity/FlameSpiderBabyRender.java index 3f4b6620..be632165 100644 --- a/src/main/java/mods/natura/client/entity/FlameSpiderBabyRender.java +++ b/src/main/java/mods/natura/client/entity/FlameSpiderBabyRender.java @@ -1,38 +1,31 @@ package mods.natura.client.entity; -import org.lwjgl.opengl.GL11; - import mods.natura.entity.BabyHeatscarSpider; import net.minecraft.client.renderer.entity.RenderSpider; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; -public class FlameSpiderBabyRender extends RenderSpider -{ +public class FlameSpiderBabyRender extends RenderSpider { - public FlameSpiderBabyRender() - { + public FlameSpiderBabyRender() { super(); } @Override - protected ResourceLocation getEntityTexture (Entity par1Entity) - { + protected ResourceLocation getEntityTexture(Entity par1Entity) { return texture; } - protected void scaleSpider (BabyHeatscarSpider par1EntityCaveSpider, float par2) - { + protected void scaleSpider(BabyHeatscarSpider par1EntityCaveSpider, float par2) { GL11.glScalef(0.85f, 0.85f, 0.85f); } @Override - protected void preRenderCallback (EntityLivingBase par1EntityLivingBase, float par2) - { + protected void preRenderCallback(EntityLivingBase par1EntityLivingBase, float par2) { this.scaleSpider((BabyHeatscarSpider) par1EntityLivingBase, par2); } static final ResourceLocation texture = new ResourceLocation("natura", "textures/mob/flamespider.png"); - } diff --git a/src/main/java/mods/natura/client/entity/FlameSpiderRender.java b/src/main/java/mods/natura/client/entity/FlameSpiderRender.java index bb0e78c2..2b8ed95c 100644 --- a/src/main/java/mods/natura/client/entity/FlameSpiderRender.java +++ b/src/main/java/mods/natura/client/entity/FlameSpiderRender.java @@ -1,38 +1,31 @@ package mods.natura.client.entity; -import org.lwjgl.opengl.GL11; - import mods.natura.entity.HeatscarSpider; import net.minecraft.client.renderer.entity.RenderSpider; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; -public class FlameSpiderRender extends RenderSpider -{ +public class FlameSpiderRender extends RenderSpider { - public FlameSpiderRender() - { + public FlameSpiderRender() { super(); } @Override - protected ResourceLocation getEntityTexture (Entity par1Entity) - { + protected ResourceLocation getEntityTexture(Entity par1Entity) { return texture; } - protected void scaleSpider (HeatscarSpider par1EntityCaveSpider, float par2) - { + protected void scaleSpider(HeatscarSpider par1EntityCaveSpider, float par2) { GL11.glScalef(2.0F, 2.0F, 2.0F); } @Override - protected void preRenderCallback (EntityLivingBase par1EntityLivingBase, float par2) - { + protected void preRenderCallback(EntityLivingBase par1EntityLivingBase, float par2) { this.scaleSpider((HeatscarSpider) par1EntityLivingBase, par2); } static final ResourceLocation texture = new ResourceLocation("natura", "textures/mob/flamespider.png"); - } diff --git a/src/main/java/mods/natura/client/entity/FusewoodArrowRender.java b/src/main/java/mods/natura/client/entity/FusewoodArrowRender.java index 911aabb6..298275e6 100644 --- a/src/main/java/mods/natura/client/entity/FusewoodArrowRender.java +++ b/src/main/java/mods/natura/client/entity/FusewoodArrowRender.java @@ -1,8 +1,5 @@ package mods.natura.client.entity; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL12; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import mods.natura.entity.FusewoodArrow; @@ -11,19 +8,31 @@ import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL12; @SideOnly(Side.CLIENT) -public class FusewoodArrowRender extends Render -{ +public class FusewoodArrowRender extends Render { private static final ResourceLocation field_110780_a = new ResourceLocation("textures/entity/arrow.png"); - public void renderArrow (FusewoodArrow par1EntityArrow, double par2, double par4, double par6, float par8, float par9) - { + public void renderArrow( + FusewoodArrow par1EntityArrow, double par2, double par4, double par6, float par8, float par9) { this.bindEntityTexture(par1EntityArrow); GL11.glPushMatrix(); GL11.glTranslatef((float) par2, (float) par4, (float) par6); - GL11.glRotatef(par1EntityArrow.prevRotationYaw + (par1EntityArrow.rotationYaw - par1EntityArrow.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F); - GL11.glRotatef(par1EntityArrow.prevRotationPitch + (par1EntityArrow.rotationPitch - par1EntityArrow.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F); + GL11.glRotatef( + par1EntityArrow.prevRotationYaw + + (par1EntityArrow.rotationYaw - par1EntityArrow.prevRotationYaw) * par9 + - 90.0F, + 0.0F, + 1.0F, + 0.0F); + GL11.glRotatef( + par1EntityArrow.prevRotationPitch + + (par1EntityArrow.rotationPitch - par1EntityArrow.prevRotationPitch) * par9, + 0.0F, + 0.0F, + 1.0F); Tessellator tessellator = Tessellator.instance; byte b0 = 0; float f2 = 0.0F; @@ -38,8 +47,7 @@ public void renderArrow (FusewoodArrow par1EntityArrow, double par2, double par4 GL11.glEnable(GL12.GL_RESCALE_NORMAL); float f11 = par1EntityArrow.arrowShake - par9; - if (f11 > 0.0F) - { + if (f11 > 0.0F) { float f12 = -MathHelper.sin(f11 * 3.0F) * f11; GL11.glRotatef(f12, 0.0F, 0.0F, 1.0F); } @@ -62,8 +70,7 @@ public void renderArrow (FusewoodArrow par1EntityArrow, double par2, double par4 tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, f6, f9); tessellator.draw(); - for (int i = 0; i < 4; ++i) - { + for (int i = 0; i < 4; ++i) { GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); GL11.glNormal3f(0.0F, 0.0F, f10); tessellator.startDrawingQuads(); @@ -78,14 +85,12 @@ public void renderArrow (FusewoodArrow par1EntityArrow, double par2, double par4 GL11.glPopMatrix(); } - protected ResourceLocation func_110779_a (FusewoodArrow par1EntityArrow) - { + protected ResourceLocation func_110779_a(FusewoodArrow par1EntityArrow) { return field_110780_a; } @Override - protected ResourceLocation getEntityTexture (Entity par1Entity) - { + protected ResourceLocation getEntityTexture(Entity par1Entity) { return this.func_110779_a((FusewoodArrow) par1Entity); } @@ -96,8 +101,7 @@ protected ResourceLocation getEntityTexture (Entity par1Entity) * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. */ @Override - public void doRender (Entity par1Entity, double par2, double par4, double par6, float par8, float par9) - { + public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) { this.renderArrow((FusewoodArrow) par1Entity, par2, par4, par6, par8, par9); } } diff --git a/src/main/java/mods/natura/client/entity/ImpModel.java b/src/main/java/mods/natura/client/entity/ImpModel.java index 8b9be8cd..64536181 100644 --- a/src/main/java/mods/natura/client/entity/ImpModel.java +++ b/src/main/java/mods/natura/client/entity/ImpModel.java @@ -5,12 +5,10 @@ import net.minecraft.entity.Entity; import net.minecraft.util.MathHelper; -public class ImpModel extends ModelBase -{ +public class ImpModel extends ModelBase { public ModelRenderer impParts[]; - public ImpModel() - { + public ImpModel() { impParts = new ModelRenderer[6]; impParts[0] = new ModelRenderer(this, 16, 16); impParts[0].addBox(-5F, 0.0F, -18.5F, 10, 5, 9, 0.0F); @@ -33,8 +31,7 @@ public ImpModel() } @Override - public void render (Entity entity, float f, float f1, float f2, float f3, float f4, float f5) - { + public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { setRotationAngles(f, f1, f2, f3, f4, f5); impParts[0].render(f5); impParts[1].render(f5); @@ -44,8 +41,7 @@ public void render (Entity entity, float f, float f1, float f2, float f3, float impParts[5].render(f5); } - public void setRotationAngles (float f, float f1, float f2, float f3, float f4, float f5) - { + public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5) { impParts[0].rotateAngleX = 1.570796F; impParts[1].rotateAngleX = f4 / -57.29578F; impParts[1].rotateAngleY = f3 / 57.29578F; diff --git a/src/main/java/mods/natura/client/entity/ImpRender.java b/src/main/java/mods/natura/client/entity/ImpRender.java index af7f3a08..45651d08 100644 --- a/src/main/java/mods/natura/client/entity/ImpRender.java +++ b/src/main/java/mods/natura/client/entity/ImpRender.java @@ -5,20 +5,16 @@ import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; -public class ImpRender extends RenderLiving -{ +public class ImpRender extends RenderLiving { - public ImpRender(ModelBase par1ModelBase, float par2) - { + public ImpRender(ModelBase par1ModelBase, float par2) { super(par1ModelBase, par2); } @Override - protected ResourceLocation getEntityTexture (Entity par1Entity) - { + protected ResourceLocation getEntityTexture(Entity par1Entity) { return texture; } static final ResourceLocation texture = new ResourceLocation("natura", "textures/mob/imp.png"); - } diff --git a/src/main/java/mods/natura/client/entity/NitroCreeperRender.java b/src/main/java/mods/natura/client/entity/NitroCreeperRender.java index 20d8bcc8..9400e183 100644 --- a/src/main/java/mods/natura/client/entity/NitroCreeperRender.java +++ b/src/main/java/mods/natura/client/entity/NitroCreeperRender.java @@ -4,20 +4,16 @@ import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; -public class NitroCreeperRender extends RenderCreeper -{ +public class NitroCreeperRender extends RenderCreeper { - public NitroCreeperRender() - { + public NitroCreeperRender() { super(); } @Override - protected ResourceLocation getEntityTexture (Entity par1Entity) - { + protected ResourceLocation getEntityTexture(Entity par1Entity) { return texture; } static final ResourceLocation texture = new ResourceLocation("natura", "textures/mob/creeperunstable.png"); - } diff --git a/src/main/java/mods/natura/common/NContent.java b/src/main/java/mods/natura/common/NContent.java index 0c762d84..3b618566 100644 --- a/src/main/java/mods/natura/common/NContent.java +++ b/src/main/java/mods/natura/common/NContent.java @@ -1,12 +1,11 @@ package mods.natura.common; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - import cpw.mods.fml.common.IFuelHandler; import cpw.mods.fml.common.registry.EntityRegistry; import cpw.mods.fml.common.registry.GameRegistry; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; import mods.natura.Natura; import mods.natura.blocks.CloudBlock; import mods.natura.blocks.GrassBlock; @@ -142,41 +141,65 @@ public class NContent implements IFuelHandler { public void preInit() { - //Vanilla + // Vanilla Blocks.netherrack.setResistance(4f); - //Nether blocks + // Nether blocks /*infernalStone = new NBlock(PHNatura.infernalStone, Material.rock, 1.5f, new String[] { "infernal_stone" }).setBlockName("infernalStone"); GameRegistry.registerBlock(infernalStone, "infernalStone");*/ taintedSoil = new TaintedSoil().setBlockName("TaintedSoil"); taintedSoil.setHarvestLevel("shovel", 0); GameRegistry.registerBlock(taintedSoil, "soil.tainted"); - heatSand = new HeatSand().setBlockName("HeatSand");//.setLightLevel(0.375f); + heatSand = new HeatSand().setBlockName("HeatSand"); // .setLightLevel(0.375f); heatSand.setHarvestLevel("shovel", 0); GameRegistry.registerBlock(heatSand, "heatsand"); if (PHNatura.enableNetherFurnaces) { - netherrackFurnace = new NetherrackFurnaceBlock().setHardness(3.5F).setCreativeTab(NaturaTab.tab).setBlockName("furnace.netherrack"); + netherrackFurnace = new NetherrackFurnaceBlock() + .setHardness(3.5F) + .setCreativeTab(NaturaTab.tab) + .setBlockName("furnace.netherrack"); GameRegistry.registerBlock(netherrackFurnace, "NetherFurnace"); GameRegistry.registerTileEntity(NetherrackFurnaceLogic.class, "netherrackFurnace"); } if (PHNatura.enableObelisks) { - respawnObelisk = new RespawnObelisk(Material.wood).setHardness(1.0F).setResistance(1000000F).setCreativeTab(NaturaTab.tab).setBlockName("nether.obelisk"); + respawnObelisk = new RespawnObelisk(Material.wood) + .setHardness(1.0F) + .setResistance(1000000F) + .setCreativeTab(NaturaTab.tab) + .setBlockName("nether.obelisk"); GameRegistry.registerBlock(respawnObelisk, "Obelisk"); } if (PHNatura.enableNetherGlass) { - netherGlass = (NetherGlass) new NetherGlass().setHardness(1.0F).setResistance(3000F).setStepSound(Block.soundTypeGlass).setCreativeTab(NaturaTab.tab).setBlockName("nether.glass"); + netherGlass = (NetherGlass) new NetherGlass() + .setHardness(1.0F) + .setResistance(3000F) + .setStepSound(Block.soundTypeGlass) + .setCreativeTab(NaturaTab.tab) + .setBlockName("nether.glass"); GameRegistry.registerBlock(netherGlass, NetherGlassItem.class, "NetherGlass"); } - //Blaze Rails + // Blaze Rails if (PHNatura.enableBlazeRails) { - brailPowered = new BlazeRailPowered(false).setHardness(0.7F).setBlockName("blazerail.powered").setBlockTextureName("natura:brail_golden"); + brailPowered = new BlazeRailPowered(false) + .setHardness(0.7F) + .setBlockName("blazerail.powered") + .setBlockTextureName("natura:brail_golden"); GameRegistry.registerBlock(brailPowered, "BrailPowered"); - brailDetector = new BlazeRailDetector().setHardness(0.7F).setBlockName("blazerail.detector").setBlockTextureName("natura:brail_detector"); + brailDetector = new BlazeRailDetector() + .setHardness(0.7F) + .setBlockName("blazerail.detector") + .setBlockTextureName("natura:brail_detector"); GameRegistry.registerBlock(brailDetector, "BrailDetector"); - brail = new BlazeRail().setHardness(0.7F).setBlockName("blazerail").setBlockTextureName("natura:brail_normal"); + brail = new BlazeRail() + .setHardness(0.7F) + .setBlockName("blazerail") + .setBlockTextureName("natura:brail_normal"); GameRegistry.registerBlock(brail, "Blazerail"); - brailActivator = new BlazeRailPowered(true).setHardness(0.7F).setBlockName("blazerail.activator").setBlockTextureName("natura:brail_activator"); + brailActivator = new BlazeRailPowered(true) + .setHardness(0.7F) + .setBlockName("blazerail.activator") + .setBlockTextureName("natura:brail_activator"); GameRegistry.registerBlock(brailActivator, "BrailActivator"); } @@ -187,35 +210,55 @@ public void preInit() { pistonExtension = new NetherPistonExtension(PHNatura.pistonExtension); GameRegistry.registerBlock(pistonExtension, "natura.piston.extension");*/ if (PHNatura.enableBlazeHoppers) { - netherHopper = (BlazeHopper) new BlazeHopper().setHardness(3.0F).setResistance(8.0F).setCreativeTab(NaturaTab.tab).setBlockName("nether.hopper"); + netherHopper = (BlazeHopper) new BlazeHopper() + .setHardness(3.0F) + .setResistance(8.0F) + .setCreativeTab(NaturaTab.tab) + .setBlockName("nether.hopper"); GameRegistry.registerBlock(netherHopper, "NetherHopper"); } if (PHNatura.enableNetherPressurePlates) { - netherPressurePlate = new AlternatePressurePlate("netherrack", Material.rock, Sensitivity.mobs).setHardness(0.5F).setStepSound(Block.soundTypeStone).setBlockName("pressurePlate"); + netherPressurePlate = new AlternatePressurePlate("netherrack", Material.rock, Sensitivity.mobs) + .setHardness(0.5F) + .setStepSound(Block.soundTypeStone) + .setBlockName("pressurePlate"); GameRegistry.registerBlock(netherPressurePlate, "NetherPressurePlate"); } if (PHNatura.enableNetherButtons) { - netherButton = new NetherrackButton().setHardness(0.5F).setStepSound(Block.soundTypeStone).setBlockName("button"); + netherButton = new NetherrackButton() + .setHardness(0.5F) + .setStepSound(Block.soundTypeStone) + .setBlockName("button"); GameRegistry.registerBlock(netherButton, "NetherButton"); } if (PHNatura.enableNetherLevers) { - netherLever = new NetherLever().setHardness(0.5F).setStepSound(Block.soundTypeWood).setBlockName("lever").setBlockTextureName("natura:nlever"); + netherLever = new NetherLever() + .setHardness(0.5F) + .setStepSound(Block.soundTypeWood) + .setBlockName("lever") + .setBlockTextureName("natura:nlever"); GameRegistry.registerBlock(netherLever, "NetherLever"); } - //Nether plants + // Nether plants thornVines = new ThornVines().setBlockName("Thornvines").setLightLevel(0.625f); GameRegistry.registerBlock(thornVines, "Thornvines"); glowshroom = (Glowshroom) new Glowshroom().setBlockName("Glowshroom").setLightLevel(0.625f); GameRegistry.registerBlock(glowshroom, GlowshroomItem.class, "Glowshroom"); - glowshroomGreen = new LargeGlowshroom(Material.wood, "green").setBlockName("greenGlowshroom").setLightLevel(0.5f); + glowshroomGreen = new LargeGlowshroom(Material.wood, "green") + .setBlockName("greenGlowshroom") + .setLightLevel(0.5f); GameRegistry.registerBlock(glowshroomGreen, "greenGlowshroom"); - glowshroomPurple = new LargeGlowshroom(Material.wood, "purple").setBlockName("purpleGlowshroom").setLightLevel(0.5f); + glowshroomPurple = new LargeGlowshroom(Material.wood, "purple") + .setBlockName("purpleGlowshroom") + .setLightLevel(0.5f); GameRegistry.registerBlock(glowshroomPurple, "purpleGlowshroom"); - glowshroomBlue = new LargeGlowshroom(Material.wood, "blue").setBlockName("blueGlowshroom").setLightLevel(0.625f); + glowshroomBlue = new LargeGlowshroom(Material.wood, "blue") + .setBlockName("blueGlowshroom") + .setLightLevel(0.625f); GameRegistry.registerBlock(glowshroomBlue, "blueGlowshroom"); - //Berry bushes + // Berry bushes if (PHNatura.enableNetherBerryBushes) { netherBerryBush = new NetherBerryBush(); GameRegistry.registerBlock(netherBerryBush, NetherBerryBushItem.class, "NetherBerryBush"); @@ -225,17 +268,17 @@ public void preInit() { GameRegistry.registerBlock(berryBush, BerryBushItem.class, "BerryBush"); } - //Overworld plants + // Overworld plants crops = (CropBlock) new CropBlock().setBlockName("natura.crops"); - GameRegistry.registerBlock(crops, "N Crops");//TODO 1.8 RENAME + GameRegistry.registerBlock(crops, "N Crops"); // TODO 1.8 RENAME saguaro = new SaguaroBlock().setBlockName("saguaro.block"); GameRegistry.registerBlock(saguaro, SaguaroItem.class, "Saguaro"); bluebells = (FlowerBlock) new FlowerBlock().setBlockName("bluebells"); GameRegistry.registerBlock(bluebells, "Bluebells"); - //TODO 1.7 apparently this isn't so simple anymore - //MinecraftForge.addGrassPlant(bluebells, 0, 18); + // TODO 1.7 apparently this isn't so simple anymore + // MinecraftForge.addGrassPlant(bluebells, 0, 18); - //Full grass blocks and slabs + // Full grass blocks and slabs grassBlock = new GrassBlock().setBlockName("GrassBlock"); grassBlock.stepSound = Block.soundTypeGrass; GameRegistry.registerBlock(grassBlock, GrassBlockItem.class, "GrassBlock"); @@ -243,17 +286,17 @@ public void preInit() { grassSlab.stepSound = Block.soundTypeGrass; GameRegistry.registerBlock(grassSlab, GrassSlabItem.class, "GrassSlab"); - //Clouds + // Clouds cloud = new CloudBlock(); GameRegistry.registerBlock(cloud, CloudItem.class, "Cloud"); - //Saplings + // Saplings rareSapling = (OverworldSapling) new OverworldSapling().setBlockName("RareSapling"); GameRegistry.registerBlock(rareSapling, OverworldSaplingItem.class, "Rare Sapling"); floraSapling = (NSaplingBlock) new NSaplingBlock().setBlockName("natura.sapling"); GameRegistry.registerBlock(floraSapling, NSaplingItem.class, "florasapling"); - //Logs + // Logs tree = new TreeBlock().setBlockName("natura.treeblock"); GameRegistry.registerBlock(tree, TreeItem.class, "tree"); redwood = new SimpleLog().setBlockName("natura.redwood"); @@ -272,7 +315,7 @@ public void preInit() { darkTree.setHarvestLevel("axe", 1, 1); darkTree.setHarvestLevel("axe", -1, 0); - //Leaves + // Leaves floraLeaves = (NLeaves) new NLeaves().setBlockName("natura.leaves"); GameRegistry.registerBlock(floraLeaves, NLeavesItem.class, "floraleaves"); floraLeavesNoColor = (NLeaves) new NLeavesNocolor().setBlockName("natura.leavesnocolor"); @@ -282,319 +325,437 @@ public void preInit() { darkLeaves = (NLeaves) new NLeavesDark().setBlockName("Darkleaves"); GameRegistry.registerBlock(darkLeaves, NLeavesDarkItem.class, "Dark Leaves"); - //Wooden Planks + // Wooden Planks planks = new Planks().setBlockName("natura.planks"); GameRegistry.registerBlock(planks, PlanksItem.class, "planks"); - //Wooden Workbenches + // Wooden Workbenches if (PHNatura.enableWoodenWorkbenches) { - alternateWorkbench = new AlternateWorkbench().setHardness(2.5F).setStepSound(Block.soundTypeWood).setBlockName("workbench").setCreativeTab(NaturaTab.tab); + alternateWorkbench = new AlternateWorkbench() + .setHardness(2.5F) + .setStepSound(Block.soundTypeWood) + .setBlockName("workbench") + .setCreativeTab(NaturaTab.tab); GameRegistry.registerBlock(alternateWorkbench, NAlternateItem.class, "Natura.workbench"); } - //Wooden Bookshelves + // Wooden Bookshelves if (PHNatura.enableWoodenBookshelves) { - alternateBookshelf = new AlternateBookshelf().setHardness(1.5F).setStepSound(Block.soundTypeWood).setBlockName("bookshelf").setCreativeTab(NaturaTab.tab); + alternateBookshelf = new AlternateBookshelf() + .setHardness(1.5F) + .setStepSound(Block.soundTypeWood) + .setBlockName("bookshelf") + .setCreativeTab(NaturaTab.tab); GameRegistry.registerBlock(alternateBookshelf, NAlternateItem.class, "Natura.bookshelf"); } - //Wooden Stairs + // Wooden Stairs if (PHNatura.enableWoodenStairs) { - //Eucalyptus + // Eucalyptus stairEucalyptus = new NStairs(planks, 0).setBlockName("stair.eucalyptus"); stairEucalyptus.stepSound = Block.soundTypeWood; GameRegistry.registerBlock(stairEucalyptus, "stair.eucalyptus"); - //Sakura + // Sakura stairSakura = new NStairs(planks, 1).setBlockName("stair.sakura"); stairSakura.stepSound = Block.soundTypeWood; GameRegistry.registerBlock(stairSakura, "stair.sakura"); - //Ghostwood + // Ghostwood stairGhostwood = new NStairs(planks, 2).setBlockName("stair.ghostwood"); stairGhostwood.stepSound = Block.soundTypeWood; GameRegistry.registerBlock(stairGhostwood, "stair.ghostwood"); - //Redwood + // Redwood stairRedwood = new NStairs(planks, 3).setBlockName("stair.redwood"); stairRedwood.stepSound = Block.soundTypeWood; GameRegistry.registerBlock(stairRedwood, "stair.redwood"); - //Bloodwood + // Bloodwood stairBloodwood = new NStairs(planks, 4).setBlockName("stair.bloodwood"); stairBloodwood.stepSound = Block.soundTypeWood; GameRegistry.registerBlock(stairBloodwood, "stair.bloodwood"); - //Hopseed + // Hopseed stairHopseed = new NStairs(planks, 5).setBlockName("stair.hopseed"); stairHopseed.stepSound = Block.soundTypeWood; GameRegistry.registerBlock(stairHopseed, "stair.hopseed"); - //Maple + // Maple stairMaple = new NStairs(planks, 6).setBlockName("stair.maple"); stairMaple.stepSound = Block.soundTypeWood; GameRegistry.registerBlock(stairMaple, "stair.maple"); - //Silverbell + // Silverbell stairSilverbell = new NStairs(planks, 7).setBlockName("stair.silverbell"); stairSilverbell.stepSound = Block.soundTypeWood; GameRegistry.registerBlock(stairSilverbell, "stair.silverbell"); - //Amaranth + // Amaranth stairAmaranth = new NStairs(planks, 8).setBlockName("stair.amaranth"); stairAmaranth.stepSound = Block.soundTypeWood; GameRegistry.registerBlock(stairAmaranth, "stair.amaranth"); - //Tiger + // Tiger stairTiger = new NStairs(planks, 9).setBlockName("stair.tiger"); stairTiger.stepSound = Block.soundTypeWood; GameRegistry.registerBlock(stairTiger, "stair.tiger"); - //Willow + // Willow stairWillow = new NStairs(planks, 10).setBlockName("stair.willow"); stairWillow.stepSound = Block.soundTypeWood; GameRegistry.registerBlock(stairWillow, "stair.willow"); - //Darkwood + // Darkwood stairDarkwood = new NStairs(planks, 11).setBlockName("stair.darkwood"); stairDarkwood.stepSound = Block.soundTypeWood; GameRegistry.registerBlock(stairDarkwood, "stair.darkwood"); - //Fusewood + // Fusewood stairFusewood = new NStairs(planks, 12).setBlockName("stair.fusewood"); stairFusewood.stepSound = Block.soundTypeWood; - GameRegistry.registerBlock(stairFusewood, "stair.fusewood"); + GameRegistry.registerBlock(stairFusewood, "stair.fusewood"); } - //Wooden Slabs + // Wooden Slabs if (PHNatura.enableWoodenSlabs) { - plankSlab1 = new NSlabBase(Material.wood, planks, 0, 8).setHardness(2.0f).setBlockName("plankSlab1"); + plankSlab1 = + new NSlabBase(Material.wood, planks, 0, 8).setHardness(2.0f).setBlockName("plankSlab1"); plankSlab1.stepSound = Block.soundTypeWood; GameRegistry.registerBlock(plankSlab1, PlankSlab1Item.class, "plankSlab1"); - plankSlab2 = new NSlabBase(Material.wood, planks, 8, 5).setHardness(2.0f).setBlockName("plankSlab2"); + plankSlab2 = + new NSlabBase(Material.wood, planks, 8, 5).setHardness(2.0f).setBlockName("plankSlab2"); plankSlab2.stepSound = Block.soundTypeWood; GameRegistry.registerBlock(plankSlab2, PlankSlab2Item.class, "plankSlab2"); } - //Wooden Trapdoors + // Wooden Trapdoors if (PHNatura.enableWoodenTrapdoors) { - //Eucalyptus + // Eucalyptus trapdoorEucalyptus = new NTrapdoor(Material.wood, "eucalyptus_trapdoor"); - trapdoorEucalyptus.setHardness(3.0F).setStepSound(Block.soundTypeWood).setBlockName("trapdoor.eucalyptus"); + trapdoorEucalyptus + .setHardness(3.0F) + .setStepSound(Block.soundTypeWood) + .setBlockName("trapdoor.eucalyptus"); GameRegistry.registerBlock(trapdoorEucalyptus, "trapdoor.eucalyptus"); - //Sakura + // Sakura trapdoorSakura = new NTrapdoor(Material.wood, "sakura_trapdoor"); trapdoorSakura.setHardness(3.0F).setStepSound(Block.soundTypeWood).setBlockName("trapdoor.sakura"); GameRegistry.registerBlock(trapdoorSakura, "trapdoor.sakura"); - //Ghostwood + // Ghostwood trapdoorGhostwood = new NTrapdoor(Material.wood, "ghostwood_trapdoor"); - trapdoorGhostwood.setHardness(3.0F).setStepSound(Block.soundTypeWood).setBlockName("trapdoor.ghostwood"); + trapdoorGhostwood + .setHardness(3.0F) + .setStepSound(Block.soundTypeWood) + .setBlockName("trapdoor.ghostwood"); GameRegistry.registerBlock(trapdoorGhostwood, "trapdoor.ghostwood"); - //Redwood + // Redwood trapdoorRedwood = new NTrapdoor(Material.wood, "redwood_trapdoor"); trapdoorRedwood.setHardness(3.0F).setStepSound(Block.soundTypeWood).setBlockName("trapdoor.redwood"); GameRegistry.registerBlock(trapdoorRedwood, "trapdoor.redwood"); - //Bloodwood + // Bloodwood trapdoorBloodwood = new NTrapdoor(Material.wood, "bloodwood_trapdoor"); - trapdoorBloodwood.setHardness(3.0F).setStepSound(Block.soundTypeWood).setBlockName("trapdoor.bloodwood"); + trapdoorBloodwood + .setHardness(3.0F) + .setStepSound(Block.soundTypeWood) + .setBlockName("trapdoor.bloodwood"); GameRegistry.registerBlock(trapdoorBloodwood, "trapdoor.bloodwood"); - //Hopseed + // Hopseed trapdoorHopseed = new NTrapdoor(Material.wood, "hopseed_trapdoor"); trapdoorHopseed.setHardness(3.0F).setStepSound(Block.soundTypeWood).setBlockName("trapdoor.hopseed"); GameRegistry.registerBlock(trapdoorHopseed, "trapdoor.hopseed"); - //Maple + // Maple trapdoorMaple = new NTrapdoor(Material.wood, "maple_trapdoor"); trapdoorMaple.setHardness(3.0F).setStepSound(Block.soundTypeWood).setBlockName("trapdoor.maple"); GameRegistry.registerBlock(trapdoorMaple, "trapdoor.maple"); - //Amaranth + // Amaranth trapdoorAmaranth = new NTrapdoor(Material.wood, "purpleheart_trapdoor"); trapdoorAmaranth.setHardness(3.0F).setStepSound(Block.soundTypeWood).setBlockName("trapdoor.amaranth"); GameRegistry.registerBlock(trapdoorAmaranth, "trapdoor.amaranth"); - //Silverbell + // Silverbell trapdoorSilverbell = new NTrapdoor(Material.wood, "silverbell_trapdoor"); - trapdoorSilverbell.setHardness(3.0F).setStepSound(Block.soundTypeWood).setBlockName("trapdoor.silverbell"); + trapdoorSilverbell + .setHardness(3.0F) + .setStepSound(Block.soundTypeWood) + .setBlockName("trapdoor.silverbell"); GameRegistry.registerBlock(trapdoorSilverbell, "trapdoor.silverbell"); - //Tigerwood + // Tigerwood trapdoorTiger = new NTrapdoor(Material.wood, "tiger_trapdoor"); trapdoorTiger.setHardness(3.0F).setStepSound(Block.soundTypeWood).setBlockName("trapdoor.tiger"); GameRegistry.registerBlock(trapdoorTiger, "trapdoor.tiger"); - //Willow + // Willow trapdoorWillow = new NTrapdoor(Material.wood, "willow_trapdoor"); trapdoorWillow.setHardness(3.0F).setStepSound(Block.soundTypeWood).setBlockName("trapdoor.willow"); GameRegistry.registerBlock(trapdoorWillow, "trapdoor.willow"); - //Darkwood + // Darkwood trapdoorDarkwood = new NTrapdoor(Material.wood, "darkwood_trapdoor"); trapdoorDarkwood.setHardness(3.0F).setStepSound(Block.soundTypeWood).setBlockName("trapdoor.darkwood"); GameRegistry.registerBlock(trapdoorDarkwood, "trapdoor.darkwood"); - //Fusewood + // Fusewood trapdoorFusewood = new NTrapdoor(Material.wood, "fusewood_trapdoor"); trapdoorFusewood.setHardness(3.0F).setStepSound(Block.soundTypeWood).setBlockName("trapdoor.fusewood"); GameRegistry.registerBlock(trapdoorFusewood, "trapdoor.fusewood"); } - //Wooden Fences + // Wooden Fences if (PHNatura.enableWoodenFences) { - alternateFence = new AlternateFence(Material.wood).setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("fence").setCreativeTab(NaturaTab.tab); + alternateFence = new AlternateFence(Material.wood) + .setHardness(2.0F) + .setResistance(5.0F) + .setStepSound(Block.soundTypeWood) + .setBlockName("fence") + .setCreativeTab(NaturaTab.tab); GameRegistry.registerBlock(alternateFence, FenceItem.class, "Natura.fence"); } - //Wooden Fence Gates + // Wooden Fence Gates if (PHNatura.enableWoodenFenceGates) { - //Eucalyptus + // Eucalyptus fenceGateEucalyptus = new NFenceGate(planks, 0); - fenceGateEucalyptus.setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("fenceGate.eucalyptus"); + fenceGateEucalyptus + .setHardness(2.0F) + .setResistance(5.0F) + .setStepSound(Block.soundTypeWood) + .setBlockName("fenceGate.eucalyptus"); GameRegistry.registerBlock(fenceGateEucalyptus, "fenceGate.eucalyptus"); - //Sakura + // Sakura fenceGateSakura = new NFenceGate(planks, 1); - fenceGateSakura.setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("fenceGate.sakura"); + fenceGateSakura + .setHardness(2.0F) + .setResistance(5.0F) + .setStepSound(Block.soundTypeWood) + .setBlockName("fenceGate.sakura"); GameRegistry.registerBlock(fenceGateSakura, "fenceGate.sakura"); - //Ghostwood + // Ghostwood fenceGateGhostwood = new NFenceGate(planks, 2); - fenceGateGhostwood.setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("fenceGate.ghostwood"); + fenceGateGhostwood + .setHardness(2.0F) + .setResistance(5.0F) + .setStepSound(Block.soundTypeWood) + .setBlockName("fenceGate.ghostwood"); GameRegistry.registerBlock(fenceGateGhostwood, "fenceGate.ghostwood"); - //Redwood + // Redwood fenceGateRedwood = new NFenceGate(planks, 3); - fenceGateRedwood.setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("fenceGate.redwood"); + fenceGateRedwood + .setHardness(2.0F) + .setResistance(5.0F) + .setStepSound(Block.soundTypeWood) + .setBlockName("fenceGate.redwood"); GameRegistry.registerBlock(fenceGateRedwood, "fenceGate.redwood"); - //Bloodwood + // Bloodwood fenceGateBloodwood = new NFenceGate(planks, 4); - fenceGateBloodwood.setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("fenceGate.bloodwood"); + fenceGateBloodwood + .setHardness(2.0F) + .setResistance(5.0F) + .setStepSound(Block.soundTypeWood) + .setBlockName("fenceGate.bloodwood"); GameRegistry.registerBlock(fenceGateBloodwood, "fenceGate.bloodwood"); - //Hopseed + // Hopseed fenceGateHopseed = new NFenceGate(planks, 5); - fenceGateHopseed.setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("fenceGate.hopseed"); + fenceGateHopseed + .setHardness(2.0F) + .setResistance(5.0F) + .setStepSound(Block.soundTypeWood) + .setBlockName("fenceGate.hopseed"); GameRegistry.registerBlock(fenceGateHopseed, "fenceGate.hopseed"); - //Maple + // Maple fenceGateMaple = new NFenceGate(planks, 6); - fenceGateMaple.setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("fenceGate.maple"); + fenceGateMaple + .setHardness(2.0F) + .setResistance(5.0F) + .setStepSound(Block.soundTypeWood) + .setBlockName("fenceGate.maple"); GameRegistry.registerBlock(fenceGateMaple, "fenceGate.maple"); - //Amaranth + // Amaranth fenceGateAmaranth = new NFenceGate(planks, 8); - fenceGateAmaranth.setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("fenceGate.amaranth"); + fenceGateAmaranth + .setHardness(2.0F) + .setResistance(5.0F) + .setStepSound(Block.soundTypeWood) + .setBlockName("fenceGate.amaranth"); GameRegistry.registerBlock(fenceGateAmaranth, "fenceGate.amaranth"); - //Silverbell + // Silverbell fenceGateSilverbell = new NFenceGate(planks, 7); - fenceGateSilverbell.setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("fenceGate.silverbell"); + fenceGateSilverbell + .setHardness(2.0F) + .setResistance(5.0F) + .setStepSound(Block.soundTypeWood) + .setBlockName("fenceGate.silverbell"); GameRegistry.registerBlock(fenceGateSilverbell, "fenceGate.silverbell"); - //Tigerwood + // Tigerwood fenceGateTiger = new NFenceGate(planks, 9); - fenceGateTiger.setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("fenceGate.tiger"); + fenceGateTiger + .setHardness(2.0F) + .setResistance(5.0F) + .setStepSound(Block.soundTypeWood) + .setBlockName("fenceGate.tiger"); GameRegistry.registerBlock(fenceGateTiger, "fenceGate.tiger"); - //Willow + // Willow fenceGateWillow = new NFenceGate(planks, 10); - fenceGateWillow.setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("fenceGate.willow"); + fenceGateWillow + .setHardness(2.0F) + .setResistance(5.0F) + .setStepSound(Block.soundTypeWood) + .setBlockName("fenceGate.willow"); GameRegistry.registerBlock(fenceGateWillow, "fenceGate.willow"); - //Darkwood + // Darkwood fenceGateDarkwood = new NFenceGate(planks, 11); - fenceGateDarkwood.setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("fenceGate.darkwood"); + fenceGateDarkwood + .setHardness(2.0F) + .setResistance(5.0F) + .setStepSound(Block.soundTypeWood) + .setBlockName("fenceGate.darkwood"); GameRegistry.registerBlock(fenceGateDarkwood, "fenceGate.darkwood"); - //Fusewood + // Fusewood fenceGateFusewood = new NFenceGate(planks, 12); - fenceGateFusewood.setHardness(2.0F).setResistance(5.0F).setStepSound(Block.soundTypeWood).setBlockName("fenceGate.fusewood"); + fenceGateFusewood + .setHardness(2.0F) + .setResistance(5.0F) + .setStepSound(Block.soundTypeWood) + .setBlockName("fenceGate.fusewood"); GameRegistry.registerBlock(fenceGateFusewood, "fenceGate.fusewood"); } - //Wooden Pressure Plates + // Wooden Pressure Plates if (PHNatura.enableWoodenPressurePlates) { - //Eucalyptus + // Eucalyptus pressurePlateEucalyptus = new NPressurePlate(Material.wood, Sensitivity.everything, planks, 0); - pressurePlateEucalyptus.setHardness(0.5F).setStepSound(Block.soundTypeWood).setBlockName("pressureplate.eucalyptus"); + pressurePlateEucalyptus + .setHardness(0.5F) + .setStepSound(Block.soundTypeWood) + .setBlockName("pressureplate.eucalyptus"); GameRegistry.registerBlock(pressurePlateEucalyptus, "pressureplate.eucalyptus"); - //Sakura + // Sakura pressurePlateSakura = new NPressurePlate(Material.wood, Sensitivity.everything, planks, 1); - pressurePlateSakura.setHardness(0.5F).setStepSound(Block.soundTypeWood).setBlockName("pressureplate.sakura"); + pressurePlateSakura + .setHardness(0.5F) + .setStepSound(Block.soundTypeWood) + .setBlockName("pressureplate.sakura"); GameRegistry.registerBlock(pressurePlateSakura, "pressureplate.sakura"); - //Ghostwood + // Ghostwood pressurePlateGhostwood = new NPressurePlate(Material.wood, Sensitivity.everything, planks, 2); - pressurePlateGhostwood.setHardness(0.5F).setStepSound(Block.soundTypeWood).setBlockName("pressureplate.ghostwood"); + pressurePlateGhostwood + .setHardness(0.5F) + .setStepSound(Block.soundTypeWood) + .setBlockName("pressureplate.ghostwood"); GameRegistry.registerBlock(pressurePlateGhostwood, "pressureplate.ghostwood"); - //Redwood + // Redwood pressurePlateRedwood = new NPressurePlate(Material.wood, Sensitivity.everything, planks, 3); - pressurePlateRedwood.setHardness(0.5F).setStepSound(Block.soundTypeWood).setBlockName("pressureplate.redwood"); + pressurePlateRedwood + .setHardness(0.5F) + .setStepSound(Block.soundTypeWood) + .setBlockName("pressureplate.redwood"); GameRegistry.registerBlock(pressurePlateRedwood, "pressureplate.redwood"); - //Bloodwood + // Bloodwood pressurePlateBloodwood = new NPressurePlate(Material.wood, Sensitivity.everything, planks, 4); - pressurePlateBloodwood.setHardness(0.5F).setStepSound(Block.soundTypeWood).setBlockName("pressureplate.bloodwood"); + pressurePlateBloodwood + .setHardness(0.5F) + .setStepSound(Block.soundTypeWood) + .setBlockName("pressureplate.bloodwood"); GameRegistry.registerBlock(pressurePlateBloodwood, "pressureplate.bloodwood"); - //Hopseed + // Hopseed pressurePlateHopseed = new NPressurePlate(Material.wood, Sensitivity.everything, planks, 5); - pressurePlateHopseed.setHardness(0.5F).setStepSound(Block.soundTypeWood).setBlockName("pressureplate.hopseed"); + pressurePlateHopseed + .setHardness(0.5F) + .setStepSound(Block.soundTypeWood) + .setBlockName("pressureplate.hopseed"); GameRegistry.registerBlock(pressurePlateHopseed, "pressureplate.hopseed"); - //Maple + // Maple pressurePlateMaple = new NPressurePlate(Material.wood, Sensitivity.everything, planks, 6); - pressurePlateMaple.setHardness(0.5F).setStepSound(Block.soundTypeWood).setBlockName("pressureplate.maple"); + pressurePlateMaple + .setHardness(0.5F) + .setStepSound(Block.soundTypeWood) + .setBlockName("pressureplate.maple"); GameRegistry.registerBlock(pressurePlateMaple, "pressureplate.maple"); - //Amaranth + // Amaranth pressurePlateAmaranth = new NPressurePlate(Material.wood, Sensitivity.everything, planks, 8); - pressurePlateAmaranth.setHardness(0.5F).setStepSound(Block.soundTypeWood).setBlockName("pressureplate.amaranth"); + pressurePlateAmaranth + .setHardness(0.5F) + .setStepSound(Block.soundTypeWood) + .setBlockName("pressureplate.amaranth"); GameRegistry.registerBlock(pressurePlateAmaranth, "pressureplate.amaranth"); - //Silverbell + // Silverbell pressurePlateSilverbell = new NPressurePlate(Material.wood, Sensitivity.everything, planks, 7); - pressurePlateSilverbell.setHardness(0.5F).setStepSound(Block.soundTypeWood).setBlockName("pressureplate.silverbell"); + pressurePlateSilverbell + .setHardness(0.5F) + .setStepSound(Block.soundTypeWood) + .setBlockName("pressureplate.silverbell"); GameRegistry.registerBlock(pressurePlateSilverbell, "pressureplate.silverbell"); - //Tigerwood + // Tigerwood pressurePlateTiger = new NPressurePlate(Material.wood, Sensitivity.everything, planks, 9); - pressurePlateTiger.setHardness(0.5F).setStepSound(Block.soundTypeWood).setBlockName("pressureplate.tiger"); + pressurePlateTiger + .setHardness(0.5F) + .setStepSound(Block.soundTypeWood) + .setBlockName("pressureplate.tiger"); GameRegistry.registerBlock(pressurePlateTiger, "pressureplate.tiger"); - //Willow + // Willow pressurePlateWillow = new NPressurePlate(Material.wood, Sensitivity.everything, planks, 10); - pressurePlateWillow.setHardness(0.5F).setStepSound(Block.soundTypeWood).setBlockName("pressureplate.willow"); + pressurePlateWillow + .setHardness(0.5F) + .setStepSound(Block.soundTypeWood) + .setBlockName("pressureplate.willow"); GameRegistry.registerBlock(pressurePlateWillow, "pressureplate.willow"); - //Darkwood + // Darkwood pressurePlateDarkwood = new NPressurePlate(Material.wood, Sensitivity.everything, planks, 11); - pressurePlateDarkwood.setHardness(0.5F).setStepSound(Block.soundTypeWood).setBlockName("pressureplate.darkwood"); + pressurePlateDarkwood + .setHardness(0.5F) + .setStepSound(Block.soundTypeWood) + .setBlockName("pressureplate.darkwood"); GameRegistry.registerBlock(pressurePlateDarkwood, "pressureplate.darkwood"); - //Fusewood + // Fusewood pressurePlateFusewood = new NPressurePlate(Material.wood, Sensitivity.everything, planks, 12); - pressurePlateFusewood.setHardness(0.5F).setStepSound(Block.soundTypeWood).setBlockName("pressureplate.fusewood"); + pressurePlateFusewood + .setHardness(0.5F) + .setStepSound(Block.soundTypeWood) + .setBlockName("pressureplate.fusewood"); GameRegistry.registerBlock(pressurePlateFusewood, "pressureplate.fusewood"); } - //Wooden Buttons + // Wooden Buttons if (PHNatura.enableWoodenButtons) { - //Eucalyptus + // Eucalyptus buttonEucalyptus = new NButton(planks, 0); buttonEucalyptus.setHardness(0.5F).setStepSound(Block.soundTypeWood).setBlockName("button.eucalyptus"); GameRegistry.registerBlock(buttonEucalyptus, "button.eucalyptus"); - //Sakura + // Sakura buttonSakura = new NButton(planks, 1); buttonSakura.setHardness(0.5F).setStepSound(Block.soundTypeWood).setBlockName("button.sakura"); GameRegistry.registerBlock(buttonSakura, "button.sakura"); - //Ghostwood + // Ghostwood buttonGhostwood = new NButton(planks, 2); buttonGhostwood.setHardness(0.5F).setStepSound(Block.soundTypeWood).setBlockName("button.ghostwood"); GameRegistry.registerBlock(buttonGhostwood, "button.ghostwood"); - //Redwood + // Redwood buttonRedwood = new NButton(planks, 3); buttonRedwood.setHardness(0.5F).setStepSound(Block.soundTypeWood).setBlockName("button.redwood"); GameRegistry.registerBlock(buttonRedwood, "button.redwood"); - //Bloodwood + // Bloodwood buttonBloodwood = new NButton(planks, 4); buttonBloodwood.setHardness(0.5F).setStepSound(Block.soundTypeWood).setBlockName("button.bloodwood"); GameRegistry.registerBlock(buttonBloodwood, "button.bloodwood"); - //Hopseed + // Hopseed buttonHopseed = new NButton(planks, 5); buttonHopseed.setHardness(0.5F).setStepSound(Block.soundTypeWood).setBlockName("button.hopseed"); GameRegistry.registerBlock(buttonHopseed, "button.hopseed"); - //Maple + // Maple buttonMaple = new NButton(planks, 6); buttonMaple.setHardness(0.5F).setStepSound(Block.soundTypeWood).setBlockName("button.maple"); GameRegistry.registerBlock(buttonMaple, "button.maple"); - //Amaranth + // Amaranth buttonAmaranth = new NButton(planks, 8); buttonAmaranth.setHardness(0.5F).setStepSound(Block.soundTypeWood).setBlockName("button.amaranth"); GameRegistry.registerBlock(buttonAmaranth, "button.amaranth"); - //Silverbell + // Silverbell buttonSilverbell = new NButton(planks, 7); buttonSilverbell.setHardness(0.5F).setStepSound(Block.soundTypeWood).setBlockName("button.silverbell"); GameRegistry.registerBlock(buttonSilverbell, "button.silverbell"); - //Tigerwood + // Tigerwood buttonTiger = new NButton(planks, 9); buttonTiger.setHardness(0.5F).setStepSound(Block.soundTypeWood).setBlockName("button.tiger"); GameRegistry.registerBlock(buttonTiger, "button.tiger"); - //Willow + // Willow buttonWillow = new NButton(planks, 10); buttonWillow.setHardness(0.5F).setStepSound(Block.soundTypeWood).setBlockName("button.willow"); GameRegistry.registerBlock(buttonWillow, "button.willow"); - //Darkwood + // Darkwood buttonDarkwood = new NButton(planks, 11); buttonDarkwood.setHardness(0.5F).setStepSound(Block.soundTypeWood).setBlockName("button.darkwood"); GameRegistry.registerBlock(buttonDarkwood, "button.darkwood"); - //Fusewood + // Fusewood buttonFusewood = new NButton(planks, 12); buttonFusewood.setHardness(0.5F).setStepSound(Block.soundTypeWood).setBlockName("button.fusewood"); GameRegistry.registerBlock(buttonFusewood, "button.fusewood"); } - //Wooden Doors + // Wooden Doors if (PHNatura.enableWoodenDoors) { redwoodDoor = new NDoor(Material.wood, 0, "redwood").setBlockName("door.redwood"); GameRegistry.registerBlock(redwoodDoor, "door.redwood"); @@ -615,17 +776,16 @@ public void preInit() { GameRegistry.registerItem(doorItem, "redwoodDoorItem"); } - //Other items + // Other items plantItem = new PlantItem().setUnlocalizedName("barleyFood"); GameRegistry.registerItem(plantItem, "barleyFood"); if (PHNatura.enableCactusJuice) { waterDrop = new CactusJuice(false).setUnlocalizedName("waterdrop"); GameRegistry.registerItem(waterDrop, "waterdrop"); } - //floraBoat = new NBoat(PHNatura.boatItemID).setIconCoord(0, 3).setBlockName("floraBoat"); - + // floraBoat = new NBoat(PHNatura.boatItemID).setIconCoord(0, 3).setBlockName("floraBoat"); - //Seed Bags + // Seed Bags if (PHNatura.enableSeedBags) { wheatBag = new SeedBag(Blocks.wheat, 0, "wheat").setUnlocalizedName("wheatBag"); GameRegistry.registerItem(wheatBag, "wheatBag"); @@ -646,22 +806,22 @@ public void preInit() { boneBag = new BoneBag("bone").setUnlocalizedName("boneBag"); GameRegistry.registerItem(boneBag, "boneBag"); } - - //Seeds + + // Seeds seeds = new NaturaSeeds(crops, Blocks.farmland).setUnlocalizedName("barley.seed"); GameRegistry.registerItem(seeds, "barley.seed"); GameRegistry.registerCustomItemStack("seedBarley", new ItemStack(seeds, 1, 0)); GameRegistry.registerCustomItemStack("seedCotton", new ItemStack(seeds, 1, 1)); seedFood = new SeedFood(3, 0.3f, saguaro).setUnlocalizedName("saguaro.fruit"); GameRegistry.registerItem(seedFood, "saguaro.fruit"); - if(PHNatura.dropBarley) { + if (PHNatura.dropBarley) { MinecraftForge.addGrassSeed(new ItemStack(seeds, 1, 0), 3); } - if(PHNatura.dropCotton) { + if (PHNatura.dropCotton) { MinecraftForge.addGrassSeed(new ItemStack(seeds, 1, 1), 3); } - - //Berries + + // Berries if (PHNatura.enableBerryBushes) { berryItem = new BerryItem(1).setUnlocalizedName("berry"); GameRegistry.registerItem(berryItem, "berry"); @@ -683,7 +843,7 @@ public void preInit() { GameRegistry.registerItem(berryMedley, "berryMedley"); } - //Nether items + // Nether items potashApple = new NetherFoodItem().setUnlocalizedName("Natura.netherfood"); GameRegistry.registerItem(potashApple, "Natura.netherfood"); bowlStew = new BowlStew().setUnlocalizedName("natura.stewbowl"); @@ -691,39 +851,45 @@ public void preInit() { bowlEmpty = new BowlEmpty().setUnlocalizedName("natura.emptybowl"); GameRegistry.registerItem(bowlEmpty, "natura.emptybowl"); if (PHNatura.enableFlintAndBlaze) { - flintAndBlaze = new FlintAndBlaze().setUnlocalizedName("flintandblaze").setTextureName("natura:flint_and_blaze"); + flintAndBlaze = + new FlintAndBlaze().setUnlocalizedName("flintandblaze").setTextureName("natura:flint_and_blaze"); GameRegistry.registerItem(flintAndBlaze, "natura.flintandblaze"); } - //Imp items + // Imp items if (PHNatura.enableImps) { impMeat = new ImpMeat().setUnlocalizedName("impmeat"); GameRegistry.registerItem(impMeat, "impmeat"); GameRegistry.registerCustomItemStack("rawImphide", new ItemStack(impMeat, 1, 0)); GameRegistry.registerCustomItemStack("cookedImphide", new ItemStack(impMeat, 1, 1)); - ArmorMaterial Imp = EnumHelper.addArmorMaterial("Imp", 33, new int[] { 1, 3, 2, 1 }, 15); + ArmorMaterial Imp = EnumHelper.addArmorMaterial("Imp", 33, new int[] {1, 3, 2, 1}, 15); impHelmet = new NaturaArmor(Imp, 1, 0, "imp_helmet", "imp").setUnlocalizedName("natura.armor.imphelmet"); GameRegistry.registerItem(impHelmet, "natura.armor.imphelmet"); impJerkin = new NaturaArmor(Imp, 1, 1, "imp_body", "imp").setUnlocalizedName("natura.armor.impjerkin"); GameRegistry.registerItem(impJerkin, "natura.armor.impjerkin"); - impLeggings = new NaturaArmor(Imp, 1, 2, "imp_leggings", "imp").setUnlocalizedName("natura.armor.impleggings"); + impLeggings = + new NaturaArmor(Imp, 1, 2, "imp_leggings", "imp").setUnlocalizedName("natura.armor.impleggings"); GameRegistry.registerItem(impLeggings, "natura.armor.impleggings"); impBoots = new NaturaArmor(Imp, 1, 3, "imp_boots", "imp").setUnlocalizedName("natura.armor.impboots"); GameRegistry.registerItem(impBoots, "natura.armor.impboots"); } - //Wooden Sticks - stickItem = (new StickItem()).setFull3D().setUnlocalizedName("natura.stick").setCreativeTab(NaturaTab.tab); + // Wooden Sticks + stickItem = + (new StickItem()).setFull3D().setUnlocalizedName("natura.stick").setCreativeTab(NaturaTab.tab); GameRegistry.registerItem(stickItem, "natura.stick"); - //Nether Tools - if(PHNatura.enableNetherWoodTools) { - ghostwoodSword = new NaturaSword(ToolMaterial.WOOD, "ghostwood").setUnlocalizedName("natura.sword.ghostwood"); + // Nether Tools + if (PHNatura.enableNetherWoodTools) { + ghostwoodSword = + new NaturaSword(ToolMaterial.WOOD, "ghostwood").setUnlocalizedName("natura.sword.ghostwood"); GameRegistry.registerItem(ghostwoodSword, "natura.sword.ghostwood"); - ghostwoodPickaxe = new NaturaPickaxe(ToolMaterial.WOOD, "ghostwood").setUnlocalizedName("natura.pickaxe.ghostwood"); + ghostwoodPickaxe = + new NaturaPickaxe(ToolMaterial.WOOD, "ghostwood").setUnlocalizedName("natura.pickaxe.ghostwood"); GameRegistry.registerItem(ghostwoodPickaxe, "natura.pickaxe.ghostwood"); - ghostwoodShovel = new NaturaShovel(ToolMaterial.WOOD, "ghostwood").setUnlocalizedName("natura.shovel.ghostwood"); + ghostwoodShovel = + new NaturaShovel(ToolMaterial.WOOD, "ghostwood").setUnlocalizedName("natura.shovel.ghostwood"); GameRegistry.registerItem(ghostwoodShovel, "natura.shovel.ghostwood"); ghostwoodAxe = new NaturaHatchet(ToolMaterial.WOOD, "ghostwood").setUnlocalizedName("natura.axe.ghostwood"); GameRegistry.registerItem(ghostwoodAxe, "natura.axe.ghostwood"); @@ -754,9 +920,11 @@ public void preInit() { darkwoodSword = new NaturaSword(ToolMaterial.STONE, "darkwood").setUnlocalizedName("natura.sword.darkwood"); GameRegistry.registerItem(darkwoodSword, "natura.sword.darkwood"); - darkwoodPickaxe = new NaturaPickaxe(ToolMaterial.STONE, "darkwood").setUnlocalizedName("natura.pickaxe.darkwood"); + darkwoodPickaxe = + new NaturaPickaxe(ToolMaterial.STONE, "darkwood").setUnlocalizedName("natura.pickaxe.darkwood"); GameRegistry.registerItem(darkwoodPickaxe, "natura.pickaxe.darkwood"); - darkwoodShovel = new NaturaShovel(ToolMaterial.STONE, "darkwood").setUnlocalizedName("natura.shovel.darkwood"); + darkwoodShovel = + new NaturaShovel(ToolMaterial.STONE, "darkwood").setUnlocalizedName("natura.shovel.darkwood"); GameRegistry.registerItem(darkwoodShovel, "natura.shovel.darkwood"); darkwoodAxe = new NaturaHatchet(ToolMaterial.STONE, "darkwood").setUnlocalizedName("natura.axe.darkwood"); GameRegistry.registerItem(darkwoodAxe, "natura.axe.darkwood"); @@ -770,9 +938,11 @@ public void preInit() { fusewoodSword = new NaturaSword(ToolMaterial.IRON, "fusewood").setUnlocalizedName("natura.sword.fusewood"); GameRegistry.registerItem(fusewoodSword, "natura.sword.fusewood"); - fusewoodPickaxe = new NaturaPickaxe(ToolMaterial.IRON, "fusewood").setUnlocalizedName("natura.pickaxe.fusewood"); + fusewoodPickaxe = + new NaturaPickaxe(ToolMaterial.IRON, "fusewood").setUnlocalizedName("natura.pickaxe.fusewood"); GameRegistry.registerItem(fusewoodPickaxe, "natura.pickaxe.fusewood"); - fusewoodShovel = new NaturaShovel(ToolMaterial.IRON, "fusewood").setUnlocalizedName("natura.shovel.fusewood"); + fusewoodShovel = + new NaturaShovel(ToolMaterial.IRON, "fusewood").setUnlocalizedName("natura.shovel.fusewood"); GameRegistry.registerItem(fusewoodShovel, "natura.shovel.fusewood"); fusewoodAxe = new NaturaHatchet(ToolMaterial.IRON, "fusewood").setUnlocalizedName("natura.axe.fusewood"); GameRegistry.registerItem(fusewoodAxe, "natura.axe.fusewood"); @@ -783,26 +953,30 @@ public void preInit() { fusewoodPickaxe.setHarvestLevel("pickaxe", 2); fusewoodShovel.setHarvestLevel("shovel", 2); fusewoodAxe.setHarvestLevel("axe", 2); - } - if(PHNatura.enableQuartzTools) { - netherquartzSword = new NaturaSword(ToolMaterial.STONE, "netherquartz").setUnlocalizedName("natura.sword.netherquartz"); + if (PHNatura.enableQuartzTools) { + netherquartzSword = + new NaturaSword(ToolMaterial.STONE, "netherquartz").setUnlocalizedName("natura.sword.netherquartz"); GameRegistry.registerItem(netherquartzSword, "natura.sword.netherquartz"); - netherquartzPickaxe = new NaturaPickaxe(ToolMaterial.STONE, "netherquartz").setUnlocalizedName("natura.pickaxe.netherquartz"); + netherquartzPickaxe = new NaturaPickaxe(ToolMaterial.STONE, "netherquartz") + .setUnlocalizedName("natura.pickaxe.netherquartz"); GameRegistry.registerItem(netherquartzPickaxe, "natura.pickaxe.netherquartz"); - netherquartzShovel = new NaturaShovel(ToolMaterial.STONE, "netherquartz").setUnlocalizedName("natura.shovel.netherquartz"); + netherquartzShovel = new NaturaShovel(ToolMaterial.STONE, "netherquartz") + .setUnlocalizedName("natura.shovel.netherquartz"); GameRegistry.registerItem(netherquartzShovel, "natura.shovel.netherquartz"); - netherquartzAxe = new NaturaHatchet(ToolMaterial.STONE, "netherquartz").setUnlocalizedName("natura.axe.netherquartz"); + netherquartzAxe = + new NaturaHatchet(ToolMaterial.STONE, "netherquartz").setUnlocalizedName("natura.axe.netherquartz"); GameRegistry.registerItem(netherquartzAxe, "natura.axe.netherquartz"); - netherquartzKama = new NaturaKama(ToolMaterial.STONE, "netherquartz").setUnlocalizedName("natura.kama.netherquartz"); + netherquartzKama = + new NaturaKama(ToolMaterial.STONE, "netherquartz").setUnlocalizedName("natura.kama.netherquartz"); GameRegistry.registerItem(netherquartzKama, "natura.kama.netherquartz"); netherquartzPickaxe.setHarvestLevel("pickaxe", 1); netherquartzShovel.setHarvestLevel("shovel", 1); netherquartzAxe.setHarvestLevel("axe", 1); } - //Spawn eggs + // Spawn eggs if (PHNatura.anyMobsEnabled) { spawnEgg = new SpawnEgg().setUnlocalizedName("natura.spawnegg"); GameRegistry.registerItem(spawnEgg, "natura.spawnegg"); @@ -819,7 +993,7 @@ public void addRecipes() { ItemStack stackSingleBluegrass = new ItemStack(grassBlock, 1, 1); ItemStack stackSingleAutumnalGrass = new ItemStack(grassBlock, 1, 2); - //Nether blocks + // Nether blocks GameRegistry.addShapelessRecipe(new ItemStack(Blocks.soul_sand, 1, 0), heatSand, taintedSoil); if (PHNatura.enableNetherFurnaces) { @@ -829,24 +1003,75 @@ public void addRecipes() { GameRegistry.addRecipe(new ItemStack(respawnObelisk), "###", "# #", "###", '#', new ItemStack(tree, 1, 2)); } if (PHNatura.enableNetherGlass) { - FurnaceRecipes.smelting().func_151394_a(new ItemStack(Blocks.soul_sand, 1, 0), new ItemStack(netherGlass, 1, 0), 0.3f); - FurnaceRecipes.smelting().func_151394_a(new ItemStack(heatSand, 1, 0), new ItemStack(netherGlass, 1, 1), 0.3f); + FurnaceRecipes.smelting() + .func_151394_a(new ItemStack(Blocks.soul_sand, 1, 0), new ItemStack(netherGlass, 1, 0), 0.3f); + FurnaceRecipes.smelting() + .func_151394_a(new ItemStack(heatSand, 1, 0), new ItemStack(netherGlass, 1, 1), 0.3f); } - //Blaze Rails + // Blaze Rails if (PHNatura.enableBlazeRails) { - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(brailPowered, 6), "X X", "X#X", "XRX", 'X', Items.blaze_rod, 'R', "dustRedstone", '#', new ItemStack(darkTree, 1, 1))); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(brailActivator, 6), "XSX", "X#X", "XSX", 'X', Items.blaze_rod, '#', Blocks.redstone_torch, 'S', "stickWood")); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(brail, 16), "X X", "X#X", "X X", 'X', Items.blaze_rod, '#', "stickWood")); + GameRegistry.addRecipe(new ShapedOreRecipe( + new ItemStack(brailPowered, 6), + "X X", + "X#X", + "XRX", + 'X', + Items.blaze_rod, + 'R', + "dustRedstone", + '#', + new ItemStack(darkTree, 1, 1))); + GameRegistry.addRecipe(new ShapedOreRecipe( + new ItemStack(brailActivator, 6), + "XSX", + "X#X", + "XSX", + 'X', + Items.blaze_rod, + '#', + Blocks.redstone_torch, + 'S', + "stickWood")); + GameRegistry.addRecipe(new ShapedOreRecipe( + new ItemStack(brail, 16), "X X", "X#X", "X X", 'X', Items.blaze_rod, '#', "stickWood")); if (PHNatura.enableNetherPressurePlates) { - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(brailDetector, 6), "X X", "X#X", "XRX", 'X', Items.blaze_rod, 'R', "dustRedstone", '#', netherPressurePlate)); + GameRegistry.addRecipe(new ShapedOreRecipe( + new ItemStack(brailDetector, 6), + "X X", + "X#X", + "XRX", + 'X', + Items.blaze_rod, + 'R', + "dustRedstone", + '#', + netherPressurePlate)); } else { - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(brailDetector, 6), "X X", "X#X", "XRX", 'X', Items.blaze_rod, 'R', "dustRedstone", '#', Blocks.stone_pressure_plate)); + GameRegistry.addRecipe(new ShapedOreRecipe( + new ItemStack(brailDetector, 6), + "X X", + "X#X", + "XRX", + 'X', + Items.blaze_rod, + 'R', + "dustRedstone", + '#', + Blocks.stone_pressure_plate)); } } if (PHNatura.enableBlazeHoppers) { - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(netherHopper), "# #", "#C#", " # ", '#', new ItemStack(Items.blaze_rod), 'C', "chestWood")); + GameRegistry.addRecipe(new ShapedOreRecipe( + new ItemStack(netherHopper), + "# #", + "#C#", + " # ", + '#', + new ItemStack(Items.blaze_rod), + 'C', + "chestWood")); } if (PHNatura.enableFlintAndBlaze) { GameRegistry.addShapelessRecipe(new ItemStack(flintAndBlaze), Items.flint, Items.blaze_rod); @@ -858,27 +1083,37 @@ public void addRecipes() { GameRegistry.addRecipe(new ItemStack(netherButton), "#", '#', stackSingleNetherrack); } if (PHNatura.enableNetherLevers) { - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(netherLever), "S", "#", '#', stackSingleNetherrack, 'S', "stickWood")); + GameRegistry.addRecipe(new ShapedOreRecipe( + new ItemStack(netherLever), "S", "#", '#', stackSingleNetherrack, 'S', "stickWood")); } - //Overworld plants + // Overworld plants FurnaceRecipes.smelting().func_151394_a(new ItemStack(saguaro, 1, 0), new ItemStack(Items.dye, 1, 2), 0.2F); GameRegistry.addRecipe(new ItemStack(plantItem, 2, 8), "X", 'X', new ItemStack(bluebells)); - //Full grass blocks and slabs - GameRegistry.addRecipe(stackSingleTopiaryGrass, " s ", "s#s", " s ", 's', new ItemStack(Items.wheat_seeds), '#', new ItemStack(Blocks.dirt)); + // Full grass blocks and slabs + GameRegistry.addRecipe( + stackSingleTopiaryGrass, + " s ", + "s#s", + " s ", + 's', + new ItemStack(Items.wheat_seeds), + '#', + new ItemStack(Blocks.dirt)); GameRegistry.addRecipe(new ShapelessOreRecipe(stackSingleBluegrass, stackSingleTopiaryGrass, "dyeBlue")); GameRegistry.addRecipe(new ShapelessOreRecipe(stackSingleAutumnalGrass, stackSingleTopiaryGrass, "dyeRed")); GameRegistry.addRecipe(new ItemStack(grassSlab, 6, 0), "bbb", 'b', stackSingleTopiaryGrass); GameRegistry.addRecipe(new ItemStack(grassSlab, 6, 1), "bbb", 'b', stackSingleBluegrass); GameRegistry.addRecipe(new ItemStack(grassSlab, 6, 2), "bbb", 'b', stackSingleAutumnalGrass); - //Clouds + // Clouds GameRegistry.addRecipe(stackSingleCharcoal, "ccc", "ccc", "ccc", 'c', new ItemStack(cloud, 1, 2)); GameRegistry.addRecipe(new ItemStack(plantItem, 1, 4), "cc", "cc", 'c', new ItemStack(cloud, 1, 3)); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.gunpowder, 1, 0), "cc", "cc", 'c', "dustSulfur")); - - //Logs + GameRegistry.addRecipe( + new ShapedOreRecipe(new ItemStack(Items.gunpowder, 1, 0), "cc", "cc", 'c', "dustSulfur")); + + // Logs FurnaceRecipes.smelting().func_151394_a(new ItemStack(tree, 1, 0), stackSingleCharcoal, 0.15f); FurnaceRecipes.smelting().func_151394_a(new ItemStack(tree, 1, 1), stackSingleCharcoal, 0.15f); FurnaceRecipes.smelting().func_151394_a(new ItemStack(tree, 1, 2), stackSingleCharcoal, 0.15f); @@ -887,12 +1122,13 @@ public void addRecipes() { FurnaceRecipes.smelting().func_151394_a(new ItemStack(redwood, 1, 1), stackSingleCharcoal, 0.15f); FurnaceRecipes.smelting().func_151394_a(new ItemStack(redwood, 1, 2), stackSingleCharcoal, 0.15f); - //Planks + // Planks GameRegistry.addRecipe(new ItemStack(planks, 4, 0), "w", 'w', new ItemStack(tree, 1, 0)); GameRegistry.addRecipe(new ItemStack(planks, 4, 1), "w", 'w', new ItemStack(tree, 1, 1)); GameRegistry.addRecipe(new ItemStack(planks, 4, 2), "w", 'w', new ItemStack(tree, 1, 2)); GameRegistry.addRecipe(new ItemStack(planks, 4, 3), "w", 'w', new ItemStack(redwood, 1, 1)); - GameRegistry.addRecipe(new ItemStack(planks, 4, 4), "w", 'w', new ItemStack(bloodwood, 1, OreDictionary.WILDCARD_VALUE)); + GameRegistry.addRecipe( + new ItemStack(planks, 4, 4), "w", 'w', new ItemStack(bloodwood, 1, OreDictionary.WILDCARD_VALUE)); GameRegistry.addRecipe(new ItemStack(planks, 4, 5), "w", 'w', new ItemStack(tree, 1, 3)); GameRegistry.addRecipe(new ItemStack(planks, 4, 6), "w", 'w', new ItemStack(rareTree, 1, 0)); GameRegistry.addRecipe(new ItemStack(planks, 4, 7), "w", 'w', new ItemStack(rareTree, 1, 1)); @@ -902,99 +1138,209 @@ public void addRecipes() { GameRegistry.addRecipe(new ItemStack(planks, 4, 11), "w", 'w', new ItemStack(darkTree, 1, 0)); GameRegistry.addRecipe(new ItemStack(planks, 4, 12), "w", 'w', new ItemStack(darkTree, 1, 1)); - //Wooden Workbenches + // Wooden Workbenches if (PHNatura.enableWoodenWorkbenches) { for (int i = 0; i < woodTextureNames.length; i++) { - addShapedRecipeFirst(recipes, new ItemStack(alternateWorkbench, 1, i), "##", "##", '#', new ItemStack(planks, 1, i)); - + addShapedRecipeFirst( + recipes, new ItemStack(alternateWorkbench, 1, i), "##", "##", '#', new ItemStack(planks, 1, i)); } } - //Wooden Bookshelves + // Wooden Bookshelves if (PHNatura.enableWoodenBookshelves) { for (int i = 0; i < woodTextureNames.length; i++) { - addShapedRecipeFirst(recipes, new ItemStack(alternateBookshelf, 1, i), "###", "bbb", "###", '#', new ItemStack(planks, 1, i), 'b', Items.book); + addShapedRecipeFirst( + recipes, + new ItemStack(alternateBookshelf, 1, i), + "###", + "bbb", + "###", + '#', + new ItemStack(planks, 1, i), + 'b', + Items.book); } } - //Wooden Stairs + // Wooden Stairs if (PHNatura.enableWoodenStairs) { - Block[] stairs = new Block[] { stairEucalyptus, stairSakura, stairGhostwood, stairRedwood, stairBloodwood, stairHopseed, stairMaple, stairSilverbell, - stairAmaranth, stairTiger, stairWillow, stairDarkwood, stairFusewood }; + Block[] stairs = new Block[] { + stairEucalyptus, + stairSakura, + stairGhostwood, + stairRedwood, + stairBloodwood, + stairHopseed, + stairMaple, + stairSilverbell, + stairAmaranth, + stairTiger, + stairWillow, + stairDarkwood, + stairFusewood + }; for (int i = 0; i < 13; i++) { - addShapedRecipeFirst(recipes, new ItemStack(stairs[i], 4), "# ", "## ", "###", '#', new ItemStack(planks, 1, i)); + addShapedRecipeFirst( + recipes, new ItemStack(stairs[i], 4), "# ", "## ", "###", '#', new ItemStack(planks, 1, i)); } } - //Wooden Slab - if(PHNatura.enableWoodenSlabs) { + // Wooden Slab + if (PHNatura.enableWoodenSlabs) { for (int i = 0; i < 8; i++) addShapedRecipeFirst(recipes, new ItemStack(plankSlab1, 6, i), "###", '#', new ItemStack(planks, 1, i)); for (int i = 0; i < 5; i++) - addShapedRecipeFirst(recipes, new ItemStack(plankSlab2, 6, i), "###", '#', new ItemStack(planks, 1, 8 + i)); + addShapedRecipeFirst( + recipes, new ItemStack(plankSlab2, 6, i), "###", '#', new ItemStack(planks, 1, 8 + i)); } - //Wooden Trapdoors + // Wooden Trapdoors if (PHNatura.enableWoodenTrapdoors) { - Block[] trapdoors = new Block[] { trapdoorEucalyptus, trapdoorSakura, trapdoorGhostwood, trapdoorRedwood, trapdoorBloodwood, trapdoorHopseed, trapdoorMaple, trapdoorSilverbell, - trapdoorAmaranth, trapdoorTiger, trapdoorWillow, trapdoorDarkwood, trapdoorFusewood }; + Block[] trapdoors = new Block[] { + trapdoorEucalyptus, + trapdoorSakura, + trapdoorGhostwood, + trapdoorRedwood, + trapdoorBloodwood, + trapdoorHopseed, + trapdoorMaple, + trapdoorSilverbell, + trapdoorAmaranth, + trapdoorTiger, + trapdoorWillow, + trapdoorDarkwood, + trapdoorFusewood + }; for (int i = 0; i < 13; i++) { - addShapedRecipeFirst(recipes, new ItemStack(trapdoors[i], 2), "###", "###", '#', new ItemStack(planks, 1, i)); + addShapedRecipeFirst( + recipes, new ItemStack(trapdoors[i], 2), "###", "###", '#', new ItemStack(planks, 1, i)); } } - //Wooden Fences + // Wooden Fences if (PHNatura.enableWoodenFences) { for (int i = 0; i < woodTextureNames.length; i++) { - addShapedRecipeFirst(recipes, new ItemStack(alternateFence, 2, i), "###", "###", '#', new ItemStack(stickItem, 1, i)); + addShapedRecipeFirst( + recipes, + new ItemStack(alternateFence, 2, i), + "###", + "###", + '#', + new ItemStack(stickItem, 1, i)); } } - //Wooden Fence Gates + // Wooden Fence Gates if (PHNatura.enableWoodenFenceGates) { - Block[] fenceGates = new Block[] { fenceGateEucalyptus, fenceGateSakura, fenceGateGhostwood, fenceGateRedwood, fenceGateBloodwood, fenceGateHopseed, fenceGateMaple, fenceGateSilverbell, - fenceGateAmaranth, fenceGateTiger, fenceGateWillow, fenceGateDarkwood, fenceGateFusewood }; + Block[] fenceGates = new Block[] { + fenceGateEucalyptus, + fenceGateSakura, + fenceGateGhostwood, + fenceGateRedwood, + fenceGateBloodwood, + fenceGateHopseed, + fenceGateMaple, + fenceGateSilverbell, + fenceGateAmaranth, + fenceGateTiger, + fenceGateWillow, + fenceGateDarkwood, + fenceGateFusewood + }; for (int i = 0; i < 13; i++) { - addShapedRecipeFirst(recipes, new ItemStack(fenceGates[i], 1), "s#s", "s#s", '#', new ItemStack(planks, 1, i), 's', new ItemStack(stickItem, 1, i)); + addShapedRecipeFirst( + recipes, + new ItemStack(fenceGates[i], 1), + "s#s", + "s#s", + '#', + new ItemStack(planks, 1, i), + 's', + new ItemStack(stickItem, 1, i)); } } - //Wooden Pressure Plates + // Wooden Pressure Plates if (PHNatura.enableWoodenPressurePlates) { - Block[] pressurePlates = new Block[] { pressurePlateEucalyptus, pressurePlateSakura, pressurePlateGhostwood, pressurePlateRedwood, pressurePlateBloodwood, pressurePlateHopseed, - pressurePlateMaple, pressurePlateSilverbell, pressurePlateAmaranth, pressurePlateTiger, pressurePlateWillow, pressurePlateDarkwood, pressurePlateFusewood }; + Block[] pressurePlates = new Block[] { + pressurePlateEucalyptus, + pressurePlateSakura, + pressurePlateGhostwood, + pressurePlateRedwood, + pressurePlateBloodwood, + pressurePlateHopseed, + pressurePlateMaple, + pressurePlateSilverbell, + pressurePlateAmaranth, + pressurePlateTiger, + pressurePlateWillow, + pressurePlateDarkwood, + pressurePlateFusewood + }; for (int i = 0; i < 13; i++) { - addShapedRecipeFirst(recipes, new ItemStack(pressurePlates[i], 1), "##", '#', new ItemStack(planks, 1, i)); + addShapedRecipeFirst( + recipes, new ItemStack(pressurePlates[i], 1), "##", '#', new ItemStack(planks, 1, i)); } } - //Wooden Buttons + // Wooden Buttons if (PHNatura.enableWoodenButtons) { - Block[] buttons = new Block[] { buttonEucalyptus, buttonSakura, buttonGhostwood, buttonRedwood, buttonBloodwood, buttonHopseed, buttonMaple, buttonSilverbell, buttonAmaranth, buttonTiger, - buttonWillow, buttonDarkwood, buttonFusewood }; + Block[] buttons = new Block[] { + buttonEucalyptus, + buttonSakura, + buttonGhostwood, + buttonRedwood, + buttonBloodwood, + buttonHopseed, + buttonMaple, + buttonSilverbell, + buttonAmaranth, + buttonTiger, + buttonWillow, + buttonDarkwood, + buttonFusewood + }; for (int i = 0; i < 13; i++) { addShapedRecipeFirst(recipes, new ItemStack(buttons[i], 1), "#", '#', new ItemStack(planks, 1, i)); } } if (PHNatura.enableWoodenDoors) { - addShapedRecipeFirst(recipes, new ItemStack(doorItem, 1, 0), "##", "##", "##", '#', new ItemStack(planks, 1, 3)); - addShapedRecipeFirst(recipes, new ItemStack(doorItem, 1, 1), "##", "##", "##", '#', new ItemStack(planks, 1, 0)); - addShapedRecipeFirst(recipes, new ItemStack(doorItem, 1, 2), "##", "##", "##", '#', new ItemStack(planks, 1, 5)); - addShapedRecipeFirst(recipes, new ItemStack(doorItem, 1, 3), "##", "##", "##", '#', new ItemStack(planks, 1, 1)); - addShapedRecipeFirst(recipes, new ItemStack(doorItem, 1, 4), "##", "##", "##", '#', new ItemStack(planks, 1, 2)); - addShapedRecipeFirst(recipes, new ItemStack(doorItem, 1, 5), "##", "##", "##", '#', new ItemStack(planks, 1, 4)); - addShapedRecipeFirst(recipes, new ItemStack(doorItem, 1, 6), "##", "##", "##", '#', new ItemStack(redwood, 1, 0)); - } - - //Other items + addShapedRecipeFirst( + recipes, new ItemStack(doorItem, 1, 0), "##", "##", "##", '#', new ItemStack(planks, 1, 3)); + addShapedRecipeFirst( + recipes, new ItemStack(doorItem, 1, 1), "##", "##", "##", '#', new ItemStack(planks, 1, 0)); + addShapedRecipeFirst( + recipes, new ItemStack(doorItem, 1, 2), "##", "##", "##", '#', new ItemStack(planks, 1, 5)); + addShapedRecipeFirst( + recipes, new ItemStack(doorItem, 1, 3), "##", "##", "##", '#', new ItemStack(planks, 1, 1)); + addShapedRecipeFirst( + recipes, new ItemStack(doorItem, 1, 4), "##", "##", "##", '#', new ItemStack(planks, 1, 2)); + addShapedRecipeFirst( + recipes, new ItemStack(doorItem, 1, 5), "##", "##", "##", '#', new ItemStack(planks, 1, 4)); + addShapedRecipeFirst( + recipes, new ItemStack(doorItem, 1, 6), "##", "##", "##", '#', new ItemStack(redwood, 1, 0)); + } + + // Other items GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.glass_bottle, 3), "# #", " # ", '#', "glass")); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Blocks.daylight_detector), "GGG", "QQQ", "WWW", 'G', "glass", 'Q', "gemQuartz", 'W', "slabWood")); + GameRegistry.addRecipe(new ShapedOreRecipe( + new ItemStack(Blocks.daylight_detector), + "GGG", + "QQQ", + "WWW", + 'G', + "glass", + 'Q', + "gemQuartz", + 'W', + "slabWood")); if (PHNatura.enableCactusJuice) { GameRegistry.addRecipe(new ItemStack(waterDrop, 1), "X", 'X', Blocks.cactus); - GameRegistry.addRecipe(new ItemStack(Items.water_bucket, 1), "www", "wBw", "www", 'w', waterDrop, 'B', Items.bucket); + GameRegistry.addRecipe( + new ItemStack(Items.water_bucket, 1), "www", "wBw", "www", 'w', waterDrop, 'B', Items.bucket); } GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.string), "sss", 's', "cropCotton")); @@ -1008,25 +1354,70 @@ public void addRecipes() { GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(plantItem, 1, 2), "X", 'X', "cropWheat")); for (int i = 1; i <= 2; i++) { - FurnaceRecipes.smelting().func_151394_a(new ItemStack(plantItem, 1, i), new ItemStack(Items.bread, 1), 0.5f); - GameRegistry.addRecipe(new ItemStack(Items.cake, 1), "AAA", "BEB", " C ", 'A', Items.milk_bucket, 'B', Items.sugar, 'C', new ItemStack(plantItem, 1, i), 'E', Items.egg); - } - - GameRegistry.addRecipe(new ItemStack(plantItem, 1, 5), " s ", "#s#", "#s#", 's', new ItemStack(stickItem, 1, 2), '#', new ItemStack(floraLeavesNoColor, 1, 1)); - GameRegistry.addRecipe(new ItemStack(Items.arrow, 4, 0), " f ", "#s#", " # ", 's', new ItemStack(stickItem, 1, OreDictionary.WILDCARD_VALUE), '#', new ItemStack(plantItem, 1, 5), 'f', Items.flint); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Items.arrow, 4, 0), " f ", "#s#", " # ", 's', "stickWood", '#', new ItemStack(plantItem, 1, 5), 'f', Items.flint)); + FurnaceRecipes.smelting() + .func_151394_a(new ItemStack(plantItem, 1, i), new ItemStack(Items.bread, 1), 0.5f); + GameRegistry.addRecipe( + new ItemStack(Items.cake, 1), + "AAA", + "BEB", + " C ", + 'A', + Items.milk_bucket, + 'B', + Items.sugar, + 'C', + new ItemStack(plantItem, 1, i), + 'E', + Items.egg); + } + + GameRegistry.addRecipe( + new ItemStack(plantItem, 1, 5), + " s ", + "#s#", + "#s#", + 's', + new ItemStack(stickItem, 1, 2), + '#', + new ItemStack(floraLeavesNoColor, 1, 1)); + GameRegistry.addRecipe( + new ItemStack(Items.arrow, 4, 0), + " f ", + "#s#", + " # ", + 's', + new ItemStack(stickItem, 1, OreDictionary.WILDCARD_VALUE), + '#', + new ItemStack(plantItem, 1, 5), + 'f', + Items.flint); + GameRegistry.addRecipe(new ShapedOreRecipe( + new ItemStack(Items.arrow, 4, 0), + " f ", + "#s#", + " # ", + 's', + "stickWood", + '#', + new ItemStack(plantItem, 1, 5), + 'f', + Items.flint)); /*GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(toolStationWood, 1, 1), "p", "w", 'p', new ItemStack(blankPattern, 1, 0), 'w', "logWood")); GameRegistry.addShapelessRecipe(new ItemStack(plantItem, 1, 2), new ItemStack(plantItem, 1, 1), Item.bucketWater ); GameRegistry.addShapelessRecipe(new ItemStack(plantItem, 2, 2), new ItemStack(plantItem, 1, 1), Item.egg );*/ - //Seed Bags + // Seed Bags if (PHNatura.enableSeedBags) { GameRegistry.addRecipe(new ItemStack(wheatBag, 1, 0), "sss", "sss", "sss", 's', Items.wheat_seeds); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(carrotBag, 1, 0), "sss", "sss", "sss", 's', "cropCarrot")); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(potatoBag, 1, 0), "sss", "sss", "sss", 's', "cropPotato")); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(barleyBag, 1, 0), "sss", "sss", "sss", 's', "seedBarley")); - GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(cottonBag, 1, 0), "sss", "sss", "sss", 's', "seedCotton")); + GameRegistry.addRecipe( + new ShapedOreRecipe(new ItemStack(carrotBag, 1, 0), "sss", "sss", "sss", 's', "cropCarrot")); + GameRegistry.addRecipe( + new ShapedOreRecipe(new ItemStack(potatoBag, 1, 0), "sss", "sss", "sss", 's', "cropPotato")); + GameRegistry.addRecipe( + new ShapedOreRecipe(new ItemStack(barleyBag, 1, 0), "sss", "sss", "sss", 's', "seedBarley")); + GameRegistry.addRecipe( + new ShapedOreRecipe(new ItemStack(cottonBag, 1, 0), "sss", "sss", "sss", 's', "seedCotton")); GameRegistry.addRecipe(new ItemStack(Items.wheat_seeds, 9, 0), "s", 's', wheatBag); GameRegistry.addRecipe(new ItemStack(Items.carrot, 9, 0), "s", 's', carrotBag); GameRegistry.addRecipe(new ItemStack(Items.potato, 9, 0), "s", 's', potatoBag); @@ -1038,24 +1429,39 @@ public void addRecipes() { GameRegistry.addRecipe(new ItemStack(Items.nether_wart, 9, 0), "s", 's', netherWartBag); } if (PHNatura.enableBonemealBags) { - GameRegistry.addRecipe(new ItemStack(boneBag, 1, 0), "sss", "sss", "sss", 's', new ItemStack(Items.dye, 1, 15)); + GameRegistry.addRecipe( + new ItemStack(boneBag, 1, 0), "sss", "sss", "sss", 's', new ItemStack(Items.dye, 1, 15)); GameRegistry.addRecipe(new ItemStack(Items.dye, 9, 15), "s", 's', boneBag); } - //Berries + // Berries if (PHNatura.enableBerryBushes) { - String[] berryTypes = new String[] { "cropRaspberry", "cropBlueberry", "cropBlackberry", "cropMaloberry", "cropStrawberry", "cropCranberry" }; + String[] berryTypes = new String[] { + "cropRaspberry", "cropBlueberry", "cropBlackberry", "cropMaloberry", "cropStrawberry", "cropCranberry" + }; for (int iter1 = 0; iter1 < berryTypes.length - 2; iter1++) for (int iter2 = iter1 + 1; iter2 < berryTypes.length - 1; iter2++) for (int iter3 = iter2 + 1; iter3 < berryTypes.length; iter3++) - GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(berryMedley, 1, 0), "bowlWood", berryTypes[iter1], berryTypes[iter2], berryTypes[iter3])); + GameRegistry.addRecipe(new ShapelessOreRecipe( + new ItemStack(berryMedley, 1, 0), + "bowlWood", + berryTypes[iter1], + berryTypes[iter2], + berryTypes[iter3])); for (int iter1 = 0; iter1 < berryTypes.length - 3; iter1++) - for (int iter2 = iter1 + 1; iter2 < berryTypes.length - 2; iter2++) - for (int iter3 = iter2 + 1; iter3 < berryTypes.length - 1; iter3++) - for (int iter4 = iter3 + 1; iter4 < berryTypes.length; iter4++) - GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(berryMedley, 2, 0), "bowlWood", "bowlWood", berryTypes[iter1], berryTypes[iter2], berryTypes[iter3], berryTypes[iter4])); + for (int iter2 = iter1 + 1; iter2 < berryTypes.length - 2; iter2++) + for (int iter3 = iter2 + 1; iter3 < berryTypes.length - 1; iter3++) + for (int iter4 = iter3 + 1; iter4 < berryTypes.length; iter4++) + GameRegistry.addRecipe(new ShapelessOreRecipe( + new ItemStack(berryMedley, 2, 0), + "bowlWood", + "bowlWood", + berryTypes[iter1], + berryTypes[iter2], + berryTypes[iter3], + berryTypes[iter4])); /*GameRegistry.addShapelessRecipe(new ItemStack(berryMedley, 1), new ItemStack(berryItem, 1, 0), new ItemStack(berryItem, 1, 1), new ItemStack(berryItem, 1, 2), new ItemStack(Item.bowlEmpty)); GameRegistry.addShapelessRecipe(new ItemStack(berryMedley, 1), new ItemStack(berryItem, 1, 0), new ItemStack(berryItem, 1, 1), new ItemStack(berryItem, 1, 3), new ItemStack(Item.bowlEmpty)); @@ -1064,23 +1470,44 @@ public void addRecipes() { GameRegistry.addShapelessRecipe(new ItemStack(berryMedley, 2), new ItemStack(berryItem, 1, 0), new ItemStack(berryItem, 1, 1), new ItemStack(berryItem, 1, 2), new ItemStack(berryItem, 1, 3), new ItemStack(Item.bowlEmpty), new ItemStack(Item.bowlEmpty));*/ } - //Nether items - addShapelessRecipeFirst(recipes, new ItemStack(bowlStew, 1, 0), new ItemStack(Blocks.brown_mushroom), new ItemStack(Blocks.red_mushroom), new ItemStack(Items.bowl)); - GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(bowlStew, 1, 14), new ItemStack(glowshroom, 1, 0), new ItemStack(glowshroom, 1, 1), new ItemStack(glowshroom, 1, 2), "bowlWood")); + // Nether items + addShapelessRecipeFirst( + recipes, + new ItemStack(bowlStew, 1, 0), + new ItemStack(Blocks.brown_mushroom), + new ItemStack(Blocks.red_mushroom), + new ItemStack(Items.bowl)); + GameRegistry.addRecipe(new ShapelessOreRecipe( + new ItemStack(bowlStew, 1, 14), + new ItemStack(glowshroom, 1, 0), + new ItemStack(glowshroom, 1, 1), + new ItemStack(glowshroom, 1, 2), + "bowlWood")); for (int i = 0; i < BowlEmpty.textureNames.length; i++) { if (!(BowlEmpty.textureNames[i].equals(""))) { if (FluidRegistry.isFluidRegistered("mushroomsoup")) - FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluid("mushroomsoup"), new ItemStack(this.bowlStew, 1, i)); - addShapedRecipeFirst(recipes, new ItemStack(bowlEmpty, 4, i), "# #", " # ", '#', new ItemStack(planks, 1, i)); - GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(bowlStew, 1, i + 1), "bowlWood", new ItemStack(Blocks.brown_mushroom), new ItemStack(Blocks.red_mushroom_block))); - GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(bowlStew, 1, i + 15), "bowlWood", new ItemStack(glowshroom, 1, 0), new ItemStack(glowshroom, 1, 1), new ItemStack(glowshroom, 1, 2))); + FluidContainerRegistry.registerFluidContainer( + FluidRegistry.getFluid("mushroomsoup"), new ItemStack(this.bowlStew, 1, i)); + addShapedRecipeFirst( + recipes, new ItemStack(bowlEmpty, 4, i), "# #", " # ", '#', new ItemStack(planks, 1, i)); + GameRegistry.addRecipe(new ShapelessOreRecipe( + new ItemStack(bowlStew, 1, i + 1), + "bowlWood", + new ItemStack(Blocks.brown_mushroom), + new ItemStack(Blocks.red_mushroom_block))); + GameRegistry.addRecipe(new ShapelessOreRecipe( + new ItemStack(bowlStew, 1, i + 15), + "bowlWood", + new ItemStack(glowshroom, 1, 0), + new ItemStack(glowshroom, 1, 1), + new ItemStack(glowshroom, 1, 2))); } } /*bowlEmpty = new BowlEmpty(PHNatura.bowlEmpty).setUnlocalizedName("natura.emptybowl"); bowlStew = new BowlStew(PHNatura.bowlStew).setUnlocalizedName("natura.stewbowl");*/ - //Imp items + // Imp items if (PHNatura.enableImps) { ItemStack stackSingleImpLeather = new ItemStack(plantItem, 1, 6); @@ -1109,43 +1536,138 @@ public void addRecipes() { GameRegistry.addRecipe(impBootsStack.copy(), "# #", "# #", '#', stackSingleImpLeather); } - //Wooden Sticks + // Wooden Sticks if (PHNatura.enableWoodenFences) { for (int i = 0; i < woodTextureNames.length; i++) { - addShapedRecipeFirst(recipes, new ItemStack(stickItem, 4, i), "#", "#", '#', new ItemStack(planks, 1, i)); + addShapedRecipeFirst( + recipes, new ItemStack(stickItem, 4, i), "#", "#", '#', new ItemStack(planks, 1, i)); } } - //Nether Tools - if(PHNatura.enableNetherWoodTools) { - int[] toolMeta = { 2, 4, 11, 12 }; + // Nether Tools + if (PHNatura.enableNetherWoodTools) { + int[] toolMeta = {2, 4, 11, 12}; Item[][] tools = { - { ghostwoodSword, ghostwoodPickaxe, ghostwoodShovel, ghostwoodAxe, ghostwoodKama, ghostwoodBow }, - { bloodwoodSword, bloodwoodPickaxe, bloodwoodShovel, bloodwoodAxe, bloodwoodKama, bloodwoodBow }, - { darkwoodSword, darkwoodPickaxe, darkwoodShovel, darkwoodAxe, darkwoodKama, darkwoodBow }, - { fusewoodSword, fusewoodPickaxe, fusewoodShovel, fusewoodAxe, fusewoodKama, fusewoodBow } - }; + {ghostwoodSword, ghostwoodPickaxe, ghostwoodShovel, ghostwoodAxe, ghostwoodKama, ghostwoodBow}, + {bloodwoodSword, bloodwoodPickaxe, bloodwoodShovel, bloodwoodAxe, bloodwoodKama, bloodwoodBow}, + {darkwoodSword, darkwoodPickaxe, darkwoodShovel, darkwoodAxe, darkwoodKama, darkwoodBow}, + {fusewoodSword, fusewoodPickaxe, fusewoodShovel, fusewoodAxe, fusewoodKama, fusewoodBow} + }; for (int i = 0; i < toolMeta.length; i++) { - addShapedRecipeFirst(recipes, new ItemStack(tools[i][0], 1, 0), "#", "#", "s", '#', new ItemStack(planks, 1, toolMeta[i]), 's', new ItemStack(stickItem, 1, toolMeta[i])); - addShapedRecipeFirst(recipes, new ItemStack(tools[i][1], 1, 0), "###", " s ", " s ", '#', new ItemStack(planks, 1, toolMeta[i]), 's', new ItemStack(stickItem, 1, toolMeta[i])); - addShapedRecipeFirst(recipes, new ItemStack(tools[i][2], 1, 0), "#", "s", "s", '#', new ItemStack(planks, 1, toolMeta[i]), 's', new ItemStack(stickItem, 1, toolMeta[i])); - addShapedRecipeFirst(recipes, new ItemStack(tools[i][3], 1, 0), "##", "#s", " s", '#', new ItemStack(planks, 1, toolMeta[i]), 's', new ItemStack(stickItem, 1, toolMeta[i])); - addShapedRecipeFirst(recipes, new ItemStack(tools[i][4], 1, 0), "##", " s", " s", '#', new ItemStack(planks, 1, toolMeta[i]), 's', new ItemStack(stickItem, 1, toolMeta[i])); - addShapedRecipeFirst(recipes, new ItemStack(tools[i][5], 1, 0), " s#", "s #", " s#", '#', new ItemStack(plantItem, 1, 7), 's', new ItemStack(stickItem, 1, toolMeta[i])); + addShapedRecipeFirst( + recipes, + new ItemStack(tools[i][0], 1, 0), + "#", + "#", + "s", + '#', + new ItemStack(planks, 1, toolMeta[i]), + 's', + new ItemStack(stickItem, 1, toolMeta[i])); + addShapedRecipeFirst( + recipes, + new ItemStack(tools[i][1], 1, 0), + "###", + " s ", + " s ", + '#', + new ItemStack(planks, 1, toolMeta[i]), + 's', + new ItemStack(stickItem, 1, toolMeta[i])); + addShapedRecipeFirst( + recipes, + new ItemStack(tools[i][2], 1, 0), + "#", + "s", + "s", + '#', + new ItemStack(planks, 1, toolMeta[i]), + 's', + new ItemStack(stickItem, 1, toolMeta[i])); + addShapedRecipeFirst( + recipes, + new ItemStack(tools[i][3], 1, 0), + "##", + "#s", + " s", + '#', + new ItemStack(planks, 1, toolMeta[i]), + 's', + new ItemStack(stickItem, 1, toolMeta[i])); + addShapedRecipeFirst( + recipes, + new ItemStack(tools[i][4], 1, 0), + "##", + " s", + " s", + '#', + new ItemStack(planks, 1, toolMeta[i]), + 's', + new ItemStack(stickItem, 1, toolMeta[i])); + addShapedRecipeFirst( + recipes, + new ItemStack(tools[i][5], 1, 0), + " s#", + "s #", + " s#", + '#', + new ItemStack(plantItem, 1, 7), + 's', + new ItemStack(stickItem, 1, toolMeta[i])); } } - if(PHNatura.enableQuartzTools) { - GameRegistry.addRecipe(new ItemStack(netherquartzSword, 1, 0), "#", "#", "s", '#', new ItemStack(Blocks.quartz_block, 1, OreDictionary.WILDCARD_VALUE), 's', new ItemStack(stickItem, 1, 2)); - GameRegistry.addRecipe(new ItemStack(netherquartzPickaxe, 1, 0), "###", " s ", " s ", '#', new ItemStack(Blocks.quartz_block, 1, OreDictionary.WILDCARD_VALUE), 's', new ItemStack(stickItem, 1, 2)); - GameRegistry.addRecipe(new ItemStack(netherquartzShovel, 1, 0), "#", "s", "s", '#', new ItemStack(Blocks.quartz_block, 1, OreDictionary.WILDCARD_VALUE), 's', new ItemStack(stickItem, 1, 2)); - GameRegistry.addRecipe(new ItemStack(netherquartzAxe, 1, 0), "##", "#s", " s", '#', new ItemStack(Blocks.quartz_block, 1, OreDictionary.WILDCARD_VALUE), 's', new ItemStack(stickItem, 1, 2)); - GameRegistry.addRecipe(new ItemStack(netherquartzKama, 1, 0), "##", " s", " s", '#', new ItemStack(Blocks.quartz_block, 1, OreDictionary.WILDCARD_VALUE), 's', new ItemStack(stickItem, 1, 2)); + if (PHNatura.enableQuartzTools) { + GameRegistry.addRecipe( + new ItemStack(netherquartzSword, 1, 0), + "#", + "#", + "s", + '#', + new ItemStack(Blocks.quartz_block, 1, OreDictionary.WILDCARD_VALUE), + 's', + new ItemStack(stickItem, 1, 2)); + GameRegistry.addRecipe( + new ItemStack(netherquartzPickaxe, 1, 0), + "###", + " s ", + " s ", + '#', + new ItemStack(Blocks.quartz_block, 1, OreDictionary.WILDCARD_VALUE), + 's', + new ItemStack(stickItem, 1, 2)); + GameRegistry.addRecipe( + new ItemStack(netherquartzShovel, 1, 0), + "#", + "s", + "s", + '#', + new ItemStack(Blocks.quartz_block, 1, OreDictionary.WILDCARD_VALUE), + 's', + new ItemStack(stickItem, 1, 2)); + GameRegistry.addRecipe( + new ItemStack(netherquartzAxe, 1, 0), + "##", + "#s", + " s", + '#', + new ItemStack(Blocks.quartz_block, 1, OreDictionary.WILDCARD_VALUE), + 's', + new ItemStack(stickItem, 1, 2)); + GameRegistry.addRecipe( + new ItemStack(netherquartzKama, 1, 0), + "##", + " s", + " s", + '#', + new ItemStack(Blocks.quartz_block, 1, OreDictionary.WILDCARD_VALUE), + 's', + new ItemStack(stickItem, 1, 2)); } } - public void addShapedRecipeFirst (List recipeList, ItemStack itemstack, Object... objArray) { + public void addShapedRecipeFirst(List recipeList, ItemStack itemstack, Object... objArray) { String var3 = ""; int var4 = 0; int var5 = 0; @@ -1202,7 +1724,7 @@ public void addShapedRecipeFirst (List recipeList, ItemStack itemstack, Object.. recipeList.add(0, var17); } - public void addShapelessRecipeFirst (List recipeList, ItemStack par1ItemStack, Object... par2ArrayOfObj) { + public void addShapelessRecipeFirst(List recipeList, ItemStack par1ItemStack, Object... par2ArrayOfObj) { ArrayList arraylist = new ArrayList(); Object[] aobject = par2ArrayOfObj; int i = par2ArrayOfObj.length; @@ -1230,12 +1752,12 @@ public void addShapelessRecipeFirst (List recipeList, ItemStack par1ItemStack, O //ChestGenHooks.getInfo(ChestGenHooks.BONUS_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(VanityBlocksStorage.StorageBlock,0,0),3,5,6)); }*/ - public void addOredictSupport () { - //Vanilla + public void addOredictSupport() { + // Vanilla OreDictionary.registerOre("chestWood", new ItemStack(Blocks.chest, 1)); OreDictionary.registerOre("bowlWood", new ItemStack(Items.bowl, 1)); - //Nether blocks + // Nether blocks OreDictionary.registerOre("taintedSoil", new ItemStack(taintedSoil, 1)); if (PHNatura.enableNetherGlass) { OreDictionary.registerOre("glassSoul", new ItemStack(netherGlass, 1, 0)); @@ -1243,11 +1765,11 @@ public void addOredictSupport () { OreDictionary.registerOre("glass", new ItemStack(netherGlass, 1, 1)); } - //Saplings + // Saplings OreDictionary.registerOre("treeSapling", new ItemStack(rareSapling, 1, OreDictionary.WILDCARD_VALUE)); OreDictionary.registerOre("treeSapling", new ItemStack(floraSapling, 1, OreDictionary.WILDCARD_VALUE)); - //Logs + // Logs OreDictionary.registerOre("logWood", new ItemStack(tree, 1, OreDictionary.WILDCARD_VALUE)); OreDictionary.registerOre("logWood", new ItemStack(redwood, 1, OreDictionary.WILDCARD_VALUE)); OreDictionary.registerOre("logWood", new ItemStack(willow, 1, OreDictionary.WILDCARD_VALUE)); @@ -1255,27 +1777,30 @@ public void addOredictSupport () { OreDictionary.registerOre("logWood", new ItemStack(rareTree, 1, OreDictionary.WILDCARD_VALUE)); OreDictionary.registerOre("logWood", new ItemStack(darkTree, 1, OreDictionary.WILDCARD_VALUE)); - //Leaves + // Leaves OreDictionary.registerOre("treeLeaves", new ItemStack(floraLeaves, 1, OreDictionary.WILDCARD_VALUE)); OreDictionary.registerOre("treeLeaves", new ItemStack(floraLeavesNoColor, 1, OreDictionary.WILDCARD_VALUE)); OreDictionary.registerOre("treeLeaves", new ItemStack(rareLeaves, 1, OreDictionary.WILDCARD_VALUE)); OreDictionary.registerOre("treeLeaves", new ItemStack(darkLeaves, 1, OreDictionary.WILDCARD_VALUE)); - //Wooden Planks + // Wooden Planks OreDictionary.registerOre("plankWood", new ItemStack(planks, 1, OreDictionary.WILDCARD_VALUE)); - //Wooden Workbenches + // Wooden Workbenches if (PHNatura.enableWoodenWorkbenches) { - OreDictionary.registerOre("crafterWood", new ItemStack(alternateWorkbench, 1, OreDictionary.WILDCARD_VALUE)); - OreDictionary.registerOre("craftingTableWood", new ItemStack(alternateWorkbench, 1, OreDictionary.WILDCARD_VALUE)); + OreDictionary.registerOre( + "crafterWood", new ItemStack(alternateWorkbench, 1, OreDictionary.WILDCARD_VALUE)); + OreDictionary.registerOre( + "craftingTableWood", new ItemStack(alternateWorkbench, 1, OreDictionary.WILDCARD_VALUE)); } - //Wooden Bookshelves + // Wooden Bookshelves if (PHNatura.enableWoodenBookshelves) { - OreDictionary.registerOre("bookshelfWood", new ItemStack(alternateBookshelf, 1, OreDictionary.WILDCARD_VALUE)); + OreDictionary.registerOre( + "bookshelfWood", new ItemStack(alternateBookshelf, 1, OreDictionary.WILDCARD_VALUE)); } - //Wooden Stairs + // Wooden Stairs if (PHNatura.enableWoodenStairs) { OreDictionary.registerOre("stairWood", new ItemStack(stairEucalyptus, 1)); OreDictionary.registerOre("stairWood", new ItemStack(stairSakura, 1)); @@ -1292,13 +1817,13 @@ public void addOredictSupport () { OreDictionary.registerOre("stairWood", new ItemStack(stairFusewood, 1)); } - //Wooden Slabs + // Wooden Slabs if (PHNatura.enableWoodenSlabs) { OreDictionary.registerOre("slabWood", new ItemStack(plankSlab1, 1, OreDictionary.WILDCARD_VALUE)); OreDictionary.registerOre("slabWood", new ItemStack(plankSlab2, 1, OreDictionary.WILDCARD_VALUE)); } - //Wooden Trapdoors + // Wooden Trapdoors if (PHNatura.enableWoodenTrapdoors) { OreDictionary.registerOre("trapdoorWood", new ItemStack(trapdoorEucalyptus, 1)); OreDictionary.registerOre("trapdoorWood", new ItemStack(trapdoorSakura, 1)); @@ -1315,12 +1840,12 @@ public void addOredictSupport () { OreDictionary.registerOre("trapdoorWood", new ItemStack(trapdoorFusewood, 1)); } - //Wooden Fences + // Wooden Fences if (PHNatura.enableWoodenFences) { OreDictionary.registerOre("fenceWood", new ItemStack(alternateFence, 1, OreDictionary.WILDCARD_VALUE)); } - //Wooden Fence Gates + // Wooden Fence Gates if (PHNatura.enableWoodenFenceGates) { OreDictionary.registerOre("fenceGateWood", new ItemStack(fenceGateEucalyptus, 1)); OreDictionary.registerOre("fenceGateWood", new ItemStack(fenceGateSakura, 1)); @@ -1337,7 +1862,7 @@ public void addOredictSupport () { OreDictionary.registerOre("fenceGateWood", new ItemStack(fenceGateFusewood, 1)); } - //Wooden Pressure Plates + // Wooden Pressure Plates if (PHNatura.enableWoodenPressurePlates) { OreDictionary.registerOre("pressurePlateWood", new ItemStack(pressurePlateEucalyptus, 1)); OreDictionary.registerOre("pressurePlateWood", new ItemStack(pressurePlateSakura, 1)); @@ -1354,7 +1879,7 @@ public void addOredictSupport () { OreDictionary.registerOre("pressurePlateWood", new ItemStack(pressurePlateFusewood, 1)); } - //Wooden Buttons + // Wooden Buttons if (PHNatura.enableWoodenButtons) { OreDictionary.registerOre("buttonWood", new ItemStack(buttonEucalyptus, 1)); OreDictionary.registerOre("buttonWood", new ItemStack(buttonSakura, 1)); @@ -1371,12 +1896,12 @@ public void addOredictSupport () { OreDictionary.registerOre("buttonWood", new ItemStack(buttonFusewood, 1)); } - //Wooden Doors + // Wooden Doors if (PHNatura.enableWoodenDoors) { OreDictionary.registerOre("doorWood", new ItemStack(doorItem, 1, OreDictionary.WILDCARD_VALUE)); } - //Other items + // Other items OreDictionary.registerOre("cropBarley", new ItemStack(plantItem, 1, 0)); OreDictionary.registerOre("cropCotton", new ItemStack(plantItem, 1, 3)); @@ -1392,9 +1917,9 @@ public void addOredictSupport () { OreDictionary.registerOre("dyeBlue", new ItemStack(plantItem, 1, 8)); - //Seed Bags + // Seed Bags - //Seeds + // Seeds OreDictionary.registerOre("listAllseed", new ItemStack(seeds, 1, 0)); OreDictionary.registerOre("listAllseed", new ItemStack(seeds, 1, 1)); @@ -1403,7 +1928,7 @@ public void addOredictSupport () { OreDictionary.registerOre("cropCactusfruit", new ItemStack(seedFood, 1, 0)); - //Berries + // Berries if (PHNatura.enableBerryBushes) { OreDictionary.registerOre("listAllfruit", new ItemStack(berryItem, 1, OreDictionary.WILDCARD_VALUE)); OreDictionary.registerOre("listAllberry", new ItemStack(berryItem, 1, OreDictionary.WILDCARD_VALUE)); @@ -1422,10 +1947,10 @@ public void addOredictSupport () { OreDictionary.registerOre("cropStingberry", new ItemStack(netherBerryItem, 1, 3)); } - //Nether items + // Nether items OreDictionary.registerOre("bowlWood", new ItemStack(bowlEmpty, 1, 0)); - //Wooden Sticks + // Wooden Sticks OreDictionary.registerOre("stickWood", new ItemStack(stickItem, 1, OreDictionary.WILDCARD_VALUE)); } @@ -1439,7 +1964,8 @@ public void createEntities() { } if (PHNatura.enableHeatscarSpiders) { EntityRegistry.registerModEntity(HeatscarSpider.class, "FlameSpider", 1, Natura.instance, 32, 5, true); - EntityRegistry.registerModEntity(BabyHeatscarSpider.class, "FlameSpiderBaby", 4, Natura.instance, 32, 5, true); + EntityRegistry.registerModEntity( + BabyHeatscarSpider.class, "FlameSpiderBaby", 4, Natura.instance, 32, 5, true); EntityRegistry.addSpawn(HeatscarSpider.class, 10, 4, 4, EnumCreatureType.monster, nether); EntityRegistry.addSpawn(BabyHeatscarSpider.class, 7, 4, 4, EnumCreatureType.monster, nether); } @@ -1467,15 +1993,29 @@ public void modIntegration() { @Override public int getBurnTime(ItemStack fuel) { - if (fuel.getItem() == new ItemStack(floraSapling).getItem() || fuel.getItem() == new ItemStack(rareSapling).getItem()) - return 100; + if (fuel.getItem() == new ItemStack(floraSapling).getItem() + || fuel.getItem() == new ItemStack(rareSapling).getItem()) return 100; return 0; } - public static final String woodTextureNames[] = { "eucalyptus", "sakura", "ghostwood", "redwood", "bloodwood", "hopseed", "maple", "silverbell", "purpleheart", "tiger", "willow", "darkwood", "fusewood" }; - - //Nether blocks - //public static Block infernalStone; + public static final String woodTextureNames[] = { + "eucalyptus", + "sakura", + "ghostwood", + "redwood", + "bloodwood", + "hopseed", + "maple", + "silverbell", + "purpleheart", + "tiger", + "willow", + "darkwood", + "fusewood" + }; + + // Nether blocks + // public static Block infernalStone; public static Block taintedSoil; public static Block heatSand; @@ -1483,50 +2023,50 @@ public int getBurnTime(ItemStack fuel) { public static Block respawnObelisk; public static NetherGlass netherGlass; - //Blaze Rails + // Blaze Rails public static Block brailPowered; public static Block brailDetector; public static Block brail; public static Block brailActivator; - //public static Block netherDropper; - //public static Block netherDispenser; - public static NetherPistonBase piston;//Not fully implemented - public static NetherPistonBase pistonSticky;//Not fully implemented - public static NetherPistonExtension pistonExtension;//Not fully implemented + // public static Block netherDropper; + // public static Block netherDispenser; + public static NetherPistonBase piston; // Not fully implemented + public static NetherPistonBase pistonSticky; // Not fully implemented + public static NetherPistonExtension pistonExtension; // Not fully implemented public static BlazeHopper netherHopper; public static Block netherPressurePlate; public static Block netherButton; public static Block netherLever; - //Nether plants + // Nether plants public static Block thornVines; public static Glowshroom glowshroom; public static Block glowshroomGreen; public static Block glowshroomPurple; public static Block glowshroomBlue; - //Berry Bushes + // Berry Bushes public static NetherBerryBush netherBerryBush; public static BerryBush berryBush; - //Overworld plants + // Overworld plants public static CropBlock crops; public static Block saguaro; public static FlowerBlock bluebells; - //Full grass blocks and slabs + // Full grass blocks and slabs public static Block grassBlock; public static Block grassSlab; - //Clouds + // Clouds public static Block cloud; - //Saplings + // Saplings public static OverworldSapling rareSapling; public static NSaplingBlock floraSapling; - //Logs + // Logs public static Block planks; public static Block tree; public static Block redwood; @@ -1535,19 +2075,19 @@ public int getBurnTime(ItemStack fuel) { public static Block rareTree; public static Block darkTree; - //Leaves + // Leaves public static NLeaves floraLeaves; public static NLeaves floraLeavesNoColor; public static NLeaves rareLeaves; public static NLeaves darkLeaves; - //Wooden Workbenches + // Wooden Workbenches public static Block alternateWorkbench; - //Wooden Bookshelves + // Wooden Bookshelves public static Block alternateBookshelf; - //Wooden Stairs + // Wooden Stairs public static Block stairEucalyptus; public static Block stairSakura; public static Block stairGhostwood; @@ -1562,11 +2102,11 @@ public int getBurnTime(ItemStack fuel) { public static Block stairDarkwood; public static Block stairFusewood; - //Wooden Slabs + // Wooden Slabs public static Block plankSlab1; public static Block plankSlab2; - //Wooden Trapdoors + // Wooden Trapdoors public static Block trapdoorEucalyptus; public static Block trapdoorSakura; public static Block trapdoorGhostwood; @@ -1581,10 +2121,10 @@ public int getBurnTime(ItemStack fuel) { public static Block trapdoorDarkwood; public static Block trapdoorFusewood; - //Wooden Fences + // Wooden Fences public static Block alternateFence; - //Wooden Fence Gates + // Wooden Fence Gates public static Block fenceGateEucalyptus; public static Block fenceGateSakura; public static Block fenceGateGhostwood; @@ -1599,7 +2139,7 @@ public int getBurnTime(ItemStack fuel) { public static Block fenceGateDarkwood; public static Block fenceGateFusewood; - //Wooden Pressure Plates + // Wooden Pressure Plates public static Block pressurePlateEucalyptus; public static Block pressurePlateSakura; public static Block pressurePlateGhostwood; @@ -1614,7 +2154,7 @@ public int getBurnTime(ItemStack fuel) { public static Block pressurePlateDarkwood; public static Block pressurePlateFusewood; - //Wooden buttons + // Wooden buttons public static Block buttonEucalyptus; public static Block buttonSakura; public static Block buttonGhostwood; @@ -1629,7 +2169,7 @@ public int getBurnTime(ItemStack fuel) { public static Block buttonDarkwood; public static Block buttonFusewood; - //Wooden Doors + // Wooden Doors public static Block redwoodDoor; public static Block eucalyptusDoor; public static Block hopseedDoor; @@ -1640,12 +2180,12 @@ public int getBurnTime(ItemStack fuel) { public static Item doorItem; - //Other items + // Other items public static Item plantItem; public static Item waterDrop; - //public static Item floraBoat; + // public static Item floraBoat; - //Seed Bags + // Seed Bags public static Item wheatBag; public static Item carrotBag; public static Item potatoBag; @@ -1654,22 +2194,22 @@ public int getBurnTime(ItemStack fuel) { public static Item netherWartBag; public static Item boneBag; - //Seeds + // Seeds public static Item seeds; public static Item seedFood; - //Berries + // Berries public static Item berryItem; public static Item netherBerryItem; public static Item berryMedley; - //Nether items + // Nether items public static Item potashApple; public static Item bowlStew; public static Item bowlEmpty; public static Item flintAndBlaze; - //Imp Items + // Imp Items public static Item impMeat; public static Item impHelmet; @@ -1682,10 +2222,10 @@ public int getBurnTime(ItemStack fuel) { public static ItemStack impLeggingsStack; public static ItemStack impBootsStack; - //Wooden Sticks + // Wooden Sticks public static Item stickItem; - //Nether tools + // Nether tools public static Item ghostwoodSword; public static Item ghostwoodPickaxe; public static Item ghostwoodShovel; diff --git a/src/main/java/mods/natura/common/NCraftingItem.java b/src/main/java/mods/natura/common/NCraftingItem.java index 45d3b829..f29f40b8 100644 --- a/src/main/java/mods/natura/common/NCraftingItem.java +++ b/src/main/java/mods/natura/common/NCraftingItem.java @@ -1,9 +1,8 @@ package mods.natura.common; -import java.util.List; - 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; @@ -49,8 +48,6 @@ public String getUnlocalizedName(ItemStack stack) { @Override public void getSubItems(Item id, CreativeTabs tab, List list) { - for (int i = 0; i < unlocalizedNames.length; i++) - list.add(new ItemStack(id, 1, i)); + for (int i = 0; i < unlocalizedNames.length; i++) list.add(new ItemStack(id, 1, i)); } - } diff --git a/src/main/java/mods/natura/common/NProxyCommon.java b/src/main/java/mods/natura/common/NProxyCommon.java index 44671040..72f65579 100644 --- a/src/main/java/mods/natura/common/NProxyCommon.java +++ b/src/main/java/mods/natura/common/NProxyCommon.java @@ -1,8 +1,5 @@ package mods.natura.common; public class NProxyCommon { - public void registerRenderer() { - - } - + public void registerRenderer() {} } diff --git a/src/main/java/mods/natura/common/NaturaTab.java b/src/main/java/mods/natura/common/NaturaTab.java index 385bb0b9..59768ebb 100644 --- a/src/main/java/mods/natura/common/NaturaTab.java +++ b/src/main/java/mods/natura/common/NaturaTab.java @@ -4,5 +4,4 @@ public class NaturaTab { public static TabTools tab; - } diff --git a/src/main/java/mods/natura/common/PHNatura.java b/src/main/java/mods/natura/common/PHNatura.java index b1a63a53..c2b49e27 100644 --- a/src/main/java/mods/natura/common/PHNatura.java +++ b/src/main/java/mods/natura/common/PHNatura.java @@ -1,15 +1,14 @@ package mods.natura.common; -import java.io.File; - import cpw.mods.fml.common.Loader; +import java.io.File; import mods.natura.Natura; import net.minecraftforge.common.config.Configuration; public class PHNatura { - public static void initProps (File confFile) { - //Category names + public static void initProps(File confFile) { + // Category names final String catDisabler = "disabler"; final String catWorldgen = "worldgen"; final String catMobChanges = "mob changes"; @@ -24,108 +23,160 @@ public static void initProps (File confFile) { /* Load the configuration file */ config.load(); - Natura.retrogen = config.get("Retrogen", "Retroactive Generation", false).getBoolean(false); + Natura.retrogen = + config.get("Retrogen", "Retroactive Generation", false).getBoolean(false); boolean BoP = false; - if(Loader.isModLoaded("BiomesOPlenty")) { + if (Loader.isModLoaded("BiomesOPlenty")) { BoP = true; } - babyHeatscarMinimum = config.get(catMobChanges, "Minimum Baby Heatscar Spiders on Spider Death", 2).getInt(2); - if (babyHeatscarMinimum < 0) - babyHeatscarMinimum = 0; - babyHeatscarMaximum = config.get(catMobChanges, "Maximum Baby Heatscar Spiders on Spider Death", 4).getInt(4); - if (babyHeatscarMaximum < 0) - babyHeatscarMaximum = 0; + babyHeatscarMinimum = config.get(catMobChanges, "Minimum Baby Heatscar Spiders on Spider Death", 2) + .getInt(2); + if (babyHeatscarMinimum < 0) babyHeatscarMinimum = 0; + babyHeatscarMaximum = config.get(catMobChanges, "Maximum Baby Heatscar Spiders on Spider Death", 4) + .getInt(4); + if (babyHeatscarMaximum < 0) babyHeatscarMaximum = 0; overrideNether = config.get(catDisabler, "Override Nether", !BoP).getBoolean(!BoP); - canRespawnInNether = config.get(catDisabler, "Obelisks let players respawn in the Nether", true).getBoolean(true); + canRespawnInNether = config.get(catDisabler, "Obelisks let players respawn in the Nether", true) + .getBoolean(true); - generateRedwood = config.get(catDisabler, "Generate Redwood Trees", true).getBoolean(true); + generateRedwood = + config.get(catDisabler, "Generate Redwood Trees", true).getBoolean(true); generateSakura = config.get(catDisabler, "Generate Sakura Trees", true).getBoolean(true); - generateSmallEucalyptus = config.get(catDisabler, "Generate Small Eucalyptus Trees", true).getBoolean(true); + generateSmallEucalyptus = + config.get(catDisabler, "Generate Small Eucalyptus Trees", true).getBoolean(true); generateBush = config.get(catDisabler, "Generate Hopseed Trees", true).getBoolean(true); - generateBloodwood = config.get(catDisabler, "Generate Bloodwood Trees", true).getBoolean(true); + generateBloodwood = + config.get(catDisabler, "Generate Bloodwood Trees", true).getBoolean(true); generateGhost = config.get(catDisabler, "Generate Ghost Trees", true).getBoolean(true); - generateSaguaro = config.get(catDisabler, "Generate Saguaro Cactus", true).getBoolean(true); + generateSaguaro = + config.get(catDisabler, "Generate Saguaro Cactus", true).getBoolean(true); - generateOverworldClouds = config.get(catDisabler, "Generate Overworld Clouds", true).getBoolean(true); - generateSulfurClouds = config.get(catDisabler, "Generate Sulfur Clouds", true).getBoolean(true); + generateOverworldClouds = + config.get(catDisabler, "Generate Overworld Clouds", true).getBoolean(true); + generateSulfurClouds = + config.get(catDisabler, "Generate Sulfur Clouds", true).getBoolean(true); generateAshClouds = config.get(catDisabler, "Generate Ash Clouds", true).getBoolean(true); - generateDarkClouds = config.get(catDisabler, "Generate Dark Clouds", true).getBoolean(true); + generateDarkClouds = + config.get(catDisabler, "Generate Dark Clouds", true).getBoolean(true); - generatePurpleheart = config.get(catDisabler, "Generate Amaranth Trees", true).getBoolean(true); + generatePurpleheart = + config.get(catDisabler, "Generate Amaranth Trees", true).getBoolean(true); generateWillow = config.get(catDisabler, "Generate Willow Trees", true).getBoolean(true); - generateTiger = config.get(catDisabler, "Generate Tigerwood Trees", true).getBoolean(true); - generateSilverbell = config.get(catDisabler, "Generate Silverbell Trees", true).getBoolean(true); + generateTiger = + config.get(catDisabler, "Generate Tigerwood Trees", true).getBoolean(true); + generateSilverbell = + config.get(catDisabler, "Generate Silverbell Trees", true).getBoolean(true); generateMaple = config.get(catDisabler, "Generate Maple Trees", true).getBoolean(true); - generateDarkwood = config.get(catDisabler, "Generate Darkwood Trees", true).getBoolean(true); - generateFusewood = config.get(catDisabler, "Generate Fusewood Trees", true).getBoolean(true); - generateThornvines = config.get(catDisabler, "Generate Thornvines", true).getBoolean(true); + generateDarkwood = + config.get(catDisabler, "Generate Darkwood Trees", true).getBoolean(true); + generateFusewood = + config.get(catDisabler, "Generate Fusewood Trees", true).getBoolean(true); + generateThornvines = + config.get(catDisabler, "Generate Thornvines", true).getBoolean(true); generateBarley = config.get(catDisabler, "Generate Barley Crops", true).getBoolean(true); generateCotton = config.get(catDisabler, "Generate Cotton Crops", true).getBoolean(true); - generateBluebells = config.get(catDisabler, "Generate Bluebell Flowers", true).getBoolean(true); - - generateBlueberries = config.get(catDisabler, "Generate Blueberry Bushes", true).getBoolean(true); - generateBlackberries = config.get(catDisabler, "Generate Blackberry Bushes", true).getBoolean(true); - generateRaspberries = config.get(catDisabler, "Generate Raspberry Bushes", true).getBoolean(true); - generateMaloberries = config.get(catDisabler, "Generate Maloberry Bushes", true).getBoolean(true); - - generateBlightberries = config.get(catDisabler, "Generate Blightberry Bushes", true).getBoolean(true); - generateDuskberries = config.get(catDisabler, "Generate Duskberry Bushes", true).getBoolean(true); - generateSkyberries = config.get(catDisabler, "Generate Skyberry Bushes", true).getBoolean(true); - generateStingberries = config.get(catDisabler, "Generate Stingberry Bushes", true).getBoolean(true); - - generateGreenglowshroom = config.get(catDisabler, "Generate Green Glowshroom", true).getBoolean(true); - generatePurpleglowshroom = config.get(catDisabler, "Generate Purple Glowshroom", true).getBoolean(true); - generateBlueglowshroom = config.get(catDisabler, "Generate Blue Glowshroom", true).getBoolean(true); - generateGlowshroomtree = config.get(catDisabler, "Generate Glowshroom Trees", true).getBoolean(true); - dropCotton = config.get(catDisabler, "Drop cotton seeds from grass", true).getBoolean(true); - dropBarley = config.get(catDisabler, "Drop barley seeds from grass", true).getBoolean(true); - - enableNitroCreepers = config.get(catDisabler, "Enable Nitro Creepers", true).getBoolean(true); + generateBluebells = + config.get(catDisabler, "Generate Bluebell Flowers", true).getBoolean(true); + + generateBlueberries = + config.get(catDisabler, "Generate Blueberry Bushes", true).getBoolean(true); + generateBlackberries = + config.get(catDisabler, "Generate Blackberry Bushes", true).getBoolean(true); + generateRaspberries = + config.get(catDisabler, "Generate Raspberry Bushes", true).getBoolean(true); + generateMaloberries = + config.get(catDisabler, "Generate Maloberry Bushes", true).getBoolean(true); + + generateBlightberries = + config.get(catDisabler, "Generate Blightberry Bushes", true).getBoolean(true); + generateDuskberries = + config.get(catDisabler, "Generate Duskberry Bushes", true).getBoolean(true); + generateSkyberries = + config.get(catDisabler, "Generate Skyberry Bushes", true).getBoolean(true); + generateStingberries = + config.get(catDisabler, "Generate Stingberry Bushes", true).getBoolean(true); + + generateGreenglowshroom = + config.get(catDisabler, "Generate Green Glowshroom", true).getBoolean(true); + generatePurpleglowshroom = + config.get(catDisabler, "Generate Purple Glowshroom", true).getBoolean(true); + generateBlueglowshroom = + config.get(catDisabler, "Generate Blue Glowshroom", true).getBoolean(true); + generateGlowshroomtree = + config.get(catDisabler, "Generate Glowshroom Trees", true).getBoolean(true); + dropCotton = + config.get(catDisabler, "Drop cotton seeds from grass", true).getBoolean(true); + dropBarley = + config.get(catDisabler, "Drop barley seeds from grass", true).getBoolean(true); + + enableNitroCreepers = + config.get(catDisabler, "Enable Nitro Creepers", true).getBoolean(true); enableImps = config.get(catDisabler, "Enable Imps", true).getBoolean(true); - enableHeatscarSpiders = config.get(catDisabler, "Enable Heatscar Spiders", true).getBoolean(true); + enableHeatscarSpiders = + config.get(catDisabler, "Enable Heatscar Spiders", true).getBoolean(true); if (enableNitroCreepers | enableImps | enableHeatscarSpiders) anyMobsEnabled = true; try { Class.forName("chococraft.common.ModChocoCraft"); - enableWheatRecipe = config.get(catDisabler, "Enable wheat to flour recipe", false).getBoolean(false); + enableWheatRecipe = config.get(catDisabler, "Enable wheat to flour recipe", false) + .getBoolean(false); } catch (Exception e) { - enableWheatRecipe = config.get(catDisabler, "Enable wheat to flour recipe", true).getBoolean(true); + enableWheatRecipe = config.get(catDisabler, "Enable wheat to flour recipe", true) + .getBoolean(true); } - redwoodSpawnRarity = config.get(catWorldgen, "Redwood Tree Spawn Rarity", 150).getInt(150); - bloodSpawnRarity = config.get(catWorldgen, "Blood Tree Spawn Rarity", 14).getInt(14); - eucalyptusShortSpawnRarity = config.get(catWorldgen, "Small Eucalyptus Tree Spawn Rarity", 25).getInt(25); - eucalyptusShortSpawnRange = config.get(catWorldgen, "Small Eucalyptus Tree Spawn Range", 32).getInt(32); - sakuraSpawnRarity = config.get(catWorldgen, "Sakura Tree Spawn Rarity", 10).getInt(10); - sakuraSpawnRange = config.get(catWorldgen, "Sakura Tree Spawn Range", 32).getInt(32); - ghostSpawnRarity = config.get(catWorldgen, "Ghostwood Tree Spawn Rarity", 10).getInt(10); + redwoodSpawnRarity = + config.get(catWorldgen, "Redwood Tree Spawn Rarity", 150).getInt(150); + bloodSpawnRarity = + config.get(catWorldgen, "Blood Tree Spawn Rarity", 14).getInt(14); + eucalyptusShortSpawnRarity = config.get(catWorldgen, "Small Eucalyptus Tree Spawn Rarity", 25) + .getInt(25); + eucalyptusShortSpawnRange = + config.get(catWorldgen, "Small Eucalyptus Tree Spawn Range", 32).getInt(32); + sakuraSpawnRarity = + config.get(catWorldgen, "Sakura Tree Spawn Rarity", 10).getInt(10); + sakuraSpawnRange = + config.get(catWorldgen, "Sakura Tree Spawn Range", 32).getInt(32); + ghostSpawnRarity = + config.get(catWorldgen, "Ghostwood Tree Spawn Rarity", 10).getInt(10); bushSpawnRarity = config.get(catWorldgen, "Bush Tree Spawn Rarity", 10).getInt(10); bushSpawnRange = config.get(catWorldgen, "Bush Tree Spawn Range", 20).getInt(20); willowRarity = config.get(catWorldgen, "Willow Tree Spawn Rarity", 10).getInt(10); - purpleheartRarity = config.get(catWorldgen, "Amaranth Tree Spawn Rarity", 1).getInt(1); + purpleheartRarity = + config.get(catWorldgen, "Amaranth Tree Spawn Rarity", 1).getInt(1); mapleRarity = config.get(catWorldgen, "Maple Tree Spawn Rarity", 34).getInt(34); tigerRarity = config.get(catWorldgen, "Tigerwood Tree Spawn Rarity", 30).getInt(30); - silverbellRarity = config.get(catWorldgen, "Silverbell Tree Spawn Rarity", 70).getInt(70); + silverbellRarity = + config.get(catWorldgen, "Silverbell Tree Spawn Rarity", 70).getInt(70); - darkSpawnRarity = config.get(catWorldgen, "Darkwood Tree Spawn Rarity", 10).getInt(10); - fuseSpawnRarity = config.get(catWorldgen, "Fusewood Tree Spawn Rarity", 50).getInt(50); + darkSpawnRarity = + config.get(catWorldgen, "Darkwood Tree Spawn Rarity", 10).getInt(10); + fuseSpawnRarity = + config.get(catWorldgen, "Fusewood Tree Spawn Rarity", 50).getInt(50); - saguaroSpawnRarity = config.get(catWorldgen, "Saguaro Cactus Spawn Rarity", 5).getInt(5); + saguaroSpawnRarity = + config.get(catWorldgen, "Saguaro Cactus Spawn Rarity", 5).getInt(5); cloudSpawnRarity = config.get(catWorldgen, "Cloud Spawn Rarity", 10).getInt(10); cloudSpawnHeight = config.get(catWorldgen, "Cloud Spawn Height", 192).getInt(192); cloudSpawnRange = config.get(catWorldgen, "Cloud Spawn Range", 48).getInt(48); - darkCloudSpawnRarity = config.get(catWorldgen, "Dark Cloud Spawn Density", 10).getInt(10); - darkCloudSpawnHeight = config.get(catWorldgen, "Dark Cloud Spawn MinX", 0).getInt(64); - darkCloudSpawnRange = config.get(catWorldgen, "Dark Cloud Spawn Range", 256).getInt(256); - sulfurSpawnRarity = config.get(catWorldgen, "Sulfur Cloud Spawn Rarity", 8).getInt(8); - sulfurSpawnHeight = config.get(catWorldgen, "Sulfur Cloud Spawn Height", 40).getInt(40); - sulfurSpawnRange = config.get(catWorldgen, "Sulfur Cloud Spawn Range", 78).getInt(78); + darkCloudSpawnRarity = + config.get(catWorldgen, "Dark Cloud Spawn Density", 10).getInt(10); + darkCloudSpawnHeight = + config.get(catWorldgen, "Dark Cloud Spawn MinX", 0).getInt(64); + darkCloudSpawnRange = + config.get(catWorldgen, "Dark Cloud Spawn Range", 256).getInt(256); + sulfurSpawnRarity = + config.get(catWorldgen, "Sulfur Cloud Spawn Rarity", 8).getInt(8); + sulfurSpawnHeight = + config.get(catWorldgen, "Sulfur Cloud Spawn Height", 40).getInt(40); + sulfurSpawnRange = + config.get(catWorldgen, "Sulfur Cloud Spawn Range", 78).getInt(78); ashSpawnRarity = config.get(catWorldgen, "Ash Cloud Spawn Rarity", 8).getInt(8); ashSpawnHeight = config.get(catWorldgen, "Ash Cloud Spawn Height", 40).getInt(40); ashSpawnRange = config.get(catWorldgen, "Ash Cloud Spawn Range", 78).getInt(78); @@ -134,60 +185,93 @@ public static void initProps (File confFile) { raspSpawnRange = config.get(catWorldgen, "Raspberry Spawn Range", 64).getInt(64); blueSpawnRarity = config.get(catWorldgen, "Blueberry Spawn Rarity", 34).getInt(34); blueSpawnRange = config.get(catWorldgen, "Blueberry Spawn Range", 64).getInt(64); - blackSpawnRarity = config.get(catWorldgen, "Blackberry Spawn Rarity", 48).getInt(48); + blackSpawnRarity = + config.get(catWorldgen, "Blackberry Spawn Rarity", 48).getInt(48); blackSpawnRange = config.get(catWorldgen, "Blackberry Spawn Range", 64).getInt(64); geoSpawnRarity = config.get(catWorldgen, "Maloberry Spawn Rarity", 40).getInt(40); geoSpawnRange = config.get(catWorldgen, "Maloberry Spawn Range", 64).getInt(64); - blightSpawnRarity = config.get(catWorldgen, "Blightberry Spawn Rarity", 18).getInt(18); - blightSpawnRange = config.get(catWorldgen, "Blightberry Spawn Range", 100).getInt(100); + blightSpawnRarity = + config.get(catWorldgen, "Blightberry Spawn Rarity", 18).getInt(18); + blightSpawnRange = + config.get(catWorldgen, "Blightberry Spawn Range", 100).getInt(100); duskSpawnRarity = config.get(catWorldgen, "Duskberry Spawn Rarity", 18).getInt(18); duskSpawnRange = config.get(catWorldgen, "Duskberry Spawn Range", 100).getInt(100); skySpawnRarity = config.get(catWorldgen, "Skyberry Spawn Rarity", 18).getInt(18); skySpawnRange = config.get(catWorldgen, "Skyberry Spawn Range", 100).getInt(100); - stingSpawnRarity = config.get(catWorldgen, "Stingberry Spawn Rarity", 18).getInt(18); + stingSpawnRarity = + config.get(catWorldgen, "Stingberry Spawn Rarity", 18).getInt(18); stingSpawnRange = config.get(catWorldgen, "Stingberry Spawn Range", 100).getInt(100); - thornSpawnRarity = config.get(catWorldgen, "Thornvines Spawn Rarity", 40).getInt(40); - darkCloudBlacklist = config.get(catWorldgen,"dimension blacklist(dark clouds)", new int[]{}).getIntList(); - cloudBlacklist = config.get(catWorldgen,"dimension blacklist(clouds)", new int[]{}).getIntList(); - sulfurCloudBlacklist = config.get(catWorldgen,"dimension blacklist(sulfur clouds)", new int[]{}).getIntList(); - - enableWoodenBookshelves = config.get(catWoodProducts, "Enable Wooden Bookshevles", true).getBoolean(true); - enableWoodenButtons = config.get(catWoodProducts, "Enable Wooden Buttons", true).getBoolean(true); - enableWoodenDoors = config.get(catWoodProducts, "Enable Wooden Doors", true).getBoolean(true); - enableWoodenFenceGates = config.get(catWoodProducts, "Enable Wooden Fence Gates", true).getBoolean(true); - enableWoodenFences = config.get(catWoodProducts, "Enable Wooden Fences", true).getBoolean(true); - enableWoodenPressurePlates = config.get(catWoodProducts, "Enable Wooden Pressure Plates", true).getBoolean(true); - enableWoodenSlabs = config.get(catWoodProducts, "Enable Wooden Slabs", true).getBoolean(true); - enableWoodenStairs = config.get(catWoodProducts, "Enable Wooden Stairs", true).getBoolean(true); - enableWoodenTrapdoors = config.get(catWoodProducts, "Enable Wooden Trapdoors", true).getBoolean(true); - enableWoodenWorkbenches = config.get(catWoodProducts, "Enable Wooden Workbenches", true).getBoolean(true); - - enableBerryBushes = config.get(catOverworldProducts, "Enable Berries and Berry Bushes", true).getBoolean(true); - enableBonemealBags = config.get(catOverworldProducts, "Enable Bonemeal Bags", true).getBoolean(true); - enableCactusJuice = config.get(catOverworldProducts, "Enable Cactus Juice", true).getBoolean(true); - enableSeedBags = config.get(catOverworldProducts, "Enable Seed Bags", true).getBoolean(true); - - enableBlazeHoppers = config.get(catNetherProducts, "Enable Blaze Hoppers", true).getBoolean(true); - enableBlazeRails = config.get(catNetherProducts, "Enable Blaze Rails", true).getBoolean(true); - enableFlintAndBlaze = config.get(catNetherProducts, "Enable Flint And Blaze", true).getBoolean(true); - enableNetherBerryBushes = config.get(catNetherProducts, "Enable Nether Berries and Berry Bushes", true).getBoolean(true); - enableNetherButtons = config.get(catNetherProducts, "Enable Netherack Buttons", true).getBoolean(true); - enableNetherFurnaces = config.get(catNetherProducts, "Enable Netherack Furnaces", true).getBoolean(true); - enableNetherGlass = config.get(catNetherProducts, "Enable Nether Glass", true).getBoolean(true); - enableNetherWoodTools = config.get(catNetherProducts, "Enable Nether Wood Tools", true).getBoolean(true); - enableNetherLevers = config.get(catNetherProducts, "Enable Netherack Levers", true).getBoolean(true); - enableNetherPressurePlates = config.get(catNetherProducts, "Enable Netherack Pressure Plates", true).getBoolean(true); - enableNetherWartBags = config.get(catNetherProducts, "Enable Nether Wart Bags", true).getBoolean(true); + thornSpawnRarity = + config.get(catWorldgen, "Thornvines Spawn Rarity", 40).getInt(40); + darkCloudBlacklist = config.get(catWorldgen, "dimension blacklist(dark clouds)", new int[] {}) + .getIntList(); + cloudBlacklist = config.get(catWorldgen, "dimension blacklist(clouds)", new int[] {}) + .getIntList(); + sulfurCloudBlacklist = config.get(catWorldgen, "dimension blacklist(sulfur clouds)", new int[] {}) + .getIntList(); + + enableWoodenBookshelves = + config.get(catWoodProducts, "Enable Wooden Bookshevles", true).getBoolean(true); + enableWoodenButtons = + config.get(catWoodProducts, "Enable Wooden Buttons", true).getBoolean(true); + enableWoodenDoors = + config.get(catWoodProducts, "Enable Wooden Doors", true).getBoolean(true); + enableWoodenFenceGates = + config.get(catWoodProducts, "Enable Wooden Fence Gates", true).getBoolean(true); + enableWoodenFences = + config.get(catWoodProducts, "Enable Wooden Fences", true).getBoolean(true); + enableWoodenPressurePlates = config.get(catWoodProducts, "Enable Wooden Pressure Plates", true) + .getBoolean(true); + enableWoodenSlabs = + config.get(catWoodProducts, "Enable Wooden Slabs", true).getBoolean(true); + enableWoodenStairs = + config.get(catWoodProducts, "Enable Wooden Stairs", true).getBoolean(true); + enableWoodenTrapdoors = + config.get(catWoodProducts, "Enable Wooden Trapdoors", true).getBoolean(true); + enableWoodenWorkbenches = + config.get(catWoodProducts, "Enable Wooden Workbenches", true).getBoolean(true); + + enableBerryBushes = config.get(catOverworldProducts, "Enable Berries and Berry Bushes", true) + .getBoolean(true); + enableBonemealBags = + config.get(catOverworldProducts, "Enable Bonemeal Bags", true).getBoolean(true); + enableCactusJuice = + config.get(catOverworldProducts, "Enable Cactus Juice", true).getBoolean(true); + enableSeedBags = + config.get(catOverworldProducts, "Enable Seed Bags", true).getBoolean(true); + + enableBlazeHoppers = + config.get(catNetherProducts, "Enable Blaze Hoppers", true).getBoolean(true); + enableBlazeRails = + config.get(catNetherProducts, "Enable Blaze Rails", true).getBoolean(true); + enableFlintAndBlaze = + config.get(catNetherProducts, "Enable Flint And Blaze", true).getBoolean(true); + enableNetherBerryBushes = config.get(catNetherProducts, "Enable Nether Berries and Berry Bushes", true) + .getBoolean(true); + enableNetherButtons = + config.get(catNetherProducts, "Enable Netherack Buttons", true).getBoolean(true); + enableNetherFurnaces = + config.get(catNetherProducts, "Enable Netherack Furnaces", true).getBoolean(true); + enableNetherGlass = + config.get(catNetherProducts, "Enable Nether Glass", true).getBoolean(true); + enableNetherWoodTools = + config.get(catNetherProducts, "Enable Nether Wood Tools", true).getBoolean(true); + enableNetherLevers = + config.get(catNetherProducts, "Enable Netherack Levers", true).getBoolean(true); + enableNetherPressurePlates = config.get(catNetherProducts, "Enable Netherack Pressure Plates", true) + .getBoolean(true); + enableNetherWartBags = + config.get(catNetherProducts, "Enable Nether Wart Bags", true).getBoolean(true); enableObelisks = config.get(catNetherProducts, "Enable Obelisks", true).getBoolean(true); - enableQuartzTools = config.get(catNetherProducts, "Enable Quartz Tools", true).getBoolean(true); + enableQuartzTools = + config.get(catNetherProducts, "Enable Quartz Tools", true).getBoolean(true); seaLevel = config.get(catGeneral, "Sea level", 64).getInt(64); /* Save the configuration file */ - if(config.hasChanged()) - config.save(); + if (config.hasChanged()) config.save(); } public static int[] darkCloudBlacklist; @@ -197,7 +281,7 @@ public static void initProps (File confFile) { public static int seaLevel; - //Overworld + // Overworld public static boolean generateBarley; public static boolean generateCotton; @@ -239,7 +323,7 @@ public static void initProps (File confFile) { public static int thornSpawnRarity; - //Clouds + // Clouds public static int cloudSpawnRarity; public static int cloudSpawnHeight; @@ -254,7 +338,7 @@ public static void initProps (File confFile) { public static int ashSpawnHeight; public static int ashSpawnRange; - //Trees + // Trees public static boolean generateRedwood; public static boolean generateSakura; @@ -303,7 +387,7 @@ public static void initProps (File confFile) { public static int tigerRarity; public static int silverbellRarity; - //Mobs + // Mobs public static int babyHeatscarMinimum; public static int babyHeatscarMaximum; @@ -313,7 +397,7 @@ public static void initProps (File confFile) { public static boolean enableHeatscarSpiders; public static boolean anyMobsEnabled = false; - //Wood products + // Wood products public static boolean enableWoodenBookshelves; public static boolean enableWoodenButtons; @@ -325,15 +409,15 @@ public static void initProps (File confFile) { public static boolean enableWoodenStairs; public static boolean enableWoodenTrapdoors; public static boolean enableWoodenWorkbenches; - - //Overworld products + + // Overworld products public static boolean enableBerryBushes; public static boolean enableBonemealBags; public static boolean enableCactusJuice; public static boolean enableSeedBags; - //Nether products + // Nether products public static boolean enableBlazeHoppers; public static boolean enableBlazeRails; @@ -348,5 +432,4 @@ public static void initProps (File confFile) { public static boolean enableNetherWartBags; public static boolean enableObelisks; public static boolean enableQuartzTools; - } diff --git a/src/main/java/mods/natura/dimension/FireGen.java b/src/main/java/mods/natura/dimension/FireGen.java index 88aa9e57..6f618d25 100644 --- a/src/main/java/mods/natura/dimension/FireGen.java +++ b/src/main/java/mods/natura/dimension/FireGen.java @@ -1,7 +1,6 @@ package mods.natura.dimension; import java.util.Random; - import mods.natura.common.NContent; import net.minecraft.block.Block; import net.minecraft.init.Blocks; @@ -25,5 +24,4 @@ public boolean generate(World world, Random random, int x, int y, int z) { return true; } - } diff --git a/src/main/java/mods/natura/dimension/NetheriteChunk.java b/src/main/java/mods/natura/dimension/NetheriteChunk.java index 7f85ea7e..626fd387 100644 --- a/src/main/java/mods/natura/dimension/NetheriteChunk.java +++ b/src/main/java/mods/natura/dimension/NetheriteChunk.java @@ -49,5 +49,4 @@ public NetheriteChunk(World world, Block[] lowerIDs, int chunkX, int chunkZ) { } }*/ } - } diff --git a/src/main/java/mods/natura/dimension/NetheriteChunkManager.java b/src/main/java/mods/natura/dimension/NetheriteChunkManager.java index 7677d475..4e8fd023 100644 --- a/src/main/java/mods/natura/dimension/NetheriteChunkManager.java +++ b/src/main/java/mods/natura/dimension/NetheriteChunkManager.java @@ -3,22 +3,20 @@ import java.util.Arrays; import java.util.List; import java.util.Random; - import net.minecraft.world.ChunkPosition; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.WorldChunkManager; -public class NetheriteChunkManager extends WorldChunkManager -{ +public class NetheriteChunkManager extends WorldChunkManager { /** The biome generator object. */ private BiomeGenBase biomeGenerator; + private float hellTemperature; /** The rainfall in the world */ private float rainfall; - public NetheriteChunkManager(BiomeGenBase par1BiomeGenBase, float par2, float par3) - { + public NetheriteChunkManager(BiomeGenBase par1BiomeGenBase, float par2, float par3) { this.biomeGenerator = par1BiomeGenBase; this.hellTemperature = par2; this.rainfall = par3; @@ -28,8 +26,7 @@ public NetheriteChunkManager(BiomeGenBase par1BiomeGenBase, float par2, float pa * Returns the BiomeGenBase related to the x, z position on the world. */ @Override - public BiomeGenBase getBiomeGenAt (int par1, int par2) - { + public BiomeGenBase getBiomeGenAt(int par1, int par2) { return this.biomeGenerator; } @@ -37,10 +34,9 @@ public BiomeGenBase getBiomeGenAt (int par1, int par2) * Returns an array of biomes for the location input. */ @Override - public BiomeGenBase[] getBiomesForGeneration (BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) - { - if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5) - { + public BiomeGenBase[] getBiomesForGeneration( + BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) { + if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5) { par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5]; } @@ -51,10 +47,8 @@ public BiomeGenBase[] getBiomesForGeneration (BiomeGenBase[] par1ArrayOfBiomeGen /** * Returns a list of temperatures to use for the specified blocks. Args: listToReuse, x, y, width, length */ - public float[] getTemperatures (float[] par1ArrayOfFloat, int par2, int par3, int par4, int par5) - { - if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5) - { + public float[] getTemperatures(float[] par1ArrayOfFloat, int par2, int par3, int par4, int par5) { + if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5) { par1ArrayOfFloat = new float[par4 * par5]; } @@ -66,10 +60,8 @@ public float[] getTemperatures (float[] par1ArrayOfFloat, int par2, int par3, in * Returns a list of rainfall values for the specified blocks. Args: listToReuse, x, z, width, length. */ @Override - public float[] getRainfall (float[] par1ArrayOfFloat, int par2, int par3, int par4, int par5) - { - if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5) - { + public float[] getRainfall(float[] par1ArrayOfFloat, int par2, int par3, int par4, int par5) { + if (par1ArrayOfFloat == null || par1ArrayOfFloat.length < par4 * par5) { par1ArrayOfFloat = new float[par4 * par5]; } @@ -82,10 +74,9 @@ public float[] getRainfall (float[] par1ArrayOfFloat, int par2, int par3, int pa * WorldChunkManager Args: oldBiomeList, x, z, width, depth */ @Override - public BiomeGenBase[] loadBlockGeneratorData (BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) - { - if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5) - { + public BiomeGenBase[] loadBlockGeneratorData( + BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5) { + if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < par4 * par5) { par1ArrayOfBiomeGenBase = new BiomeGenBase[par4 * par5]; } @@ -98,8 +89,8 @@ public BiomeGenBase[] loadBlockGeneratorData (BiomeGenBase[] par1ArrayOfBiomeGen * don't check biomeCache to avoid infinite loop in BiomeCacheBlock) */ @Override - public BiomeGenBase[] getBiomeGenAt (BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5, boolean par6) - { + public BiomeGenBase[] getBiomeGenAt( + BiomeGenBase[] par1ArrayOfBiomeGenBase, int par2, int par3, int par4, int par5, boolean par6) { return this.loadBlockGeneratorData(par1ArrayOfBiomeGenBase, par2, par3, par4, par5); } @@ -108,17 +99,20 @@ public BiomeGenBase[] getBiomeGenAt (BiomeGenBase[] par1ArrayOfBiomeGenBase, int * Strongly favors positive y positions. */ @Override - public ChunkPosition findBiomePosition (int par1, int par2, int par3, List par4List, Random par5Random) - { - return par4List.contains(this.biomeGenerator) ? new ChunkPosition(par1 - par3 + par5Random.nextInt(par3 * 2 + 1), 0, par2 - par3 + par5Random.nextInt(par3 * 2 + 1)) : null; + public ChunkPosition findBiomePosition(int par1, int par2, int par3, List par4List, Random par5Random) { + return par4List.contains(this.biomeGenerator) + ? new ChunkPosition( + par1 - par3 + par5Random.nextInt(par3 * 2 + 1), + 0, + par2 - par3 + par5Random.nextInt(par3 * 2 + 1)) + : null; } /** * checks given Chunk's Biomes against List of allowed ones */ @Override - public boolean areBiomesViable (int par1, int par2, int par3, List par4List) - { + public boolean areBiomesViable(int par1, int par2, int par3, List par4List) { return par4List.contains(this.biomeGenerator); } } diff --git a/src/main/java/mods/natura/dimension/NetheriteChunkProvider.java b/src/main/java/mods/natura/dimension/NetheriteChunkProvider.java index ef34dd42..4e02bcec 100644 --- a/src/main/java/mods/natura/dimension/NetheriteChunkProvider.java +++ b/src/main/java/mods/natura/dimension/NetheriteChunkProvider.java @@ -7,10 +7,9 @@ import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.GLOWSTONE; import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.NETHER_LAVA; +import cpw.mods.fml.common.eventhandler.Event.Result; import java.util.List; import java.util.Random; - -import cpw.mods.fml.common.eventhandler.Event.Result; import mods.natura.common.NContent; import mods.natura.common.PHNatura; import mods.natura.worldgen.FlowerGen; @@ -39,12 +38,12 @@ import net.minecraftforge.event.terraingen.PopulateChunkEvent; import net.minecraftforge.event.terraingen.TerrainGen; -public class NetheriteChunkProvider implements IChunkProvider -{ +public class NetheriteChunkProvider implements IChunkProvider { private Random hellRNG; /** A NoiseGeneratorOctaves used in generating nether terrain */ private NoiseGeneratorOctaves netherNoiseGen1; + private NoiseGeneratorOctaves netherNoiseGen2; private NoiseGeneratorOctaves netherNoiseGen3; @@ -55,11 +54,13 @@ public class NetheriteChunkProvider implements IChunkProvider * Determines whether something other than nettherack can be generated at a location */ private NoiseGeneratorOctaves netherrackExculsivityNoiseGen; + public NoiseGeneratorOctaves netherNoiseGen4; public NoiseGeneratorOctaves netherNoiseGen5; /** Is the world that the nether is getting generated. */ private World worldObj; + private double[] noiseField; private double[] secondNoiseField; public MapGenNetherBridge genNetherBridge = new MapGenNetherBridge(); @@ -68,12 +69,14 @@ public class NetheriteChunkProvider implements IChunkProvider * Holds the noise used to determine whether slowsand can be generated at a location */ private double[] slowsandNoise = new double[256]; + private double[] gravelNoise = new double[256]; /** * Holds the noise used to determine whether something other than netherrack can be generated at a location */ private double[] netherrackExclusivityNoise = new double[256]; + private MapGenBase netherCaveGenerator = new MapGenCavesHell(); double[] noiseData1; double[] noiseData2; @@ -92,8 +95,7 @@ public class NetheriteChunkProvider implements IChunkProvider netherCaveGenerator = TerrainGen.getModdedMapGen(netherCaveGenerator, NETHER_CAVE); } - public NetheriteChunkProvider(World par1World, long par2) - { + public NetheriteChunkProvider(World par1World, long par2) { this.worldObj = par1World; this.hellRNG = new Random(par2); this.netherNoiseGen1 = new NoiseGeneratorOctaves(this.hellRNG, 16); @@ -105,7 +107,15 @@ public NetheriteChunkProvider(World par1World, long par2) this.netherNoiseGen5 = new NoiseGeneratorOctaves(this.hellRNG, 16); // TODO 1.7 check these casts somehow - NoiseGenerator[] noiseGens = { netherNoiseGen1, netherNoiseGen2, netherNoiseGen3, slowsandGravelNoiseGen, netherrackExculsivityNoiseGen, netherNoiseGen4, netherNoiseGen5 }; + NoiseGenerator[] noiseGens = { + netherNoiseGen1, + netherNoiseGen2, + netherNoiseGen3, + slowsandGravelNoiseGen, + netherrackExculsivityNoiseGen, + netherNoiseGen4, + netherNoiseGen5 + }; noiseGens = TerrainGen.getModdedNoiseGenerators(par1World, this.hellRNG, noiseGens); this.netherNoiseGen1 = (NoiseGeneratorOctaves) noiseGens[0]; this.netherNoiseGen2 = (NoiseGeneratorOctaves) noiseGens[1]; @@ -119,21 +129,18 @@ public NetheriteChunkProvider(World par1World, long par2) /** * Generates the shape of the terrain in the nether. */ - public void generateNetherTerrain (int chunkX, int chunkZ, Block[] lowerIDs) - { + public void generateNetherTerrain(int chunkX, int chunkZ, Block[] lowerIDs) { byte noiseInit = 4; byte b1 = 32; int k = noiseInit + 1; byte b2 = 17; int l = noiseInit + 1; - this.noiseField = this.initializeNoiseField(this.noiseField, chunkX * noiseInit, 0, chunkZ * noiseInit, k, b2, l); + this.noiseField = + this.initializeNoiseField(this.noiseField, chunkX * noiseInit, 0, chunkZ * noiseInit, k, b2, l); - for (int iterX = 0; iterX < noiseInit; ++iterX) - { - for (int iterZ = 0; iterZ < noiseInit; ++iterZ) - { - for (int iterY = 0; iterY < 16; ++iterY) - { + for (int iterX = 0; iterX < noiseInit; ++iterX) { + for (int iterZ = 0; iterZ < noiseInit; ++iterZ) { + for (int iterY = 0; iterY < 16; ++iterY) { double noiseOffset = 0.125D; double n1 = this.noiseField[((iterX + 0) * l + iterZ + 0) * b2 + iterY + 0]; double n2 = this.noiseField[((iterX + 0) * l + iterZ + 1) * b2 + iterY + 0]; @@ -144,38 +151,32 @@ public void generateNetherTerrain (int chunkX, int chunkZ, Block[] lowerIDs) double n7 = (this.noiseField[((iterX + 1) * l + iterZ + 0) * b2 + iterY + 1] - n3) * noiseOffset; double n8 = (this.noiseField[((iterX + 1) * l + iterZ + 1) * b2 + iterY + 1] - n4) * noiseOffset; - for (int offsetY = 0; offsetY < 8; ++offsetY) - { + for (int offsetY = 0; offsetY < 8; ++offsetY) { double d9 = 0.25D; double d10 = n1; double d11 = n2; double d12 = (n3 - n1) * d9; double d13 = (n4 - n2) * d9; - for (int offsetX = 0; offsetX < 4; ++offsetX) - { + for (int offsetX = 0; offsetX < 4; ++offsetX) { int layerPos = offsetX + iterX * 4 << 11 | 0 + iterZ * 4 << 7 | iterY * 8 + offsetY; short amountPerLayer = 128; double d14 = 0.25D; double lValue = d10; double lOffset = (d11 - d10) * d14; - for (int k2 = 0; k2 < 4; ++k2) - { + for (int k2 = 0; k2 < 4; ++k2) { Block blockID = Blocks.air; - if (iterY * 8 + offsetY < b1) - { + if (iterY * 8 + offsetY < b1) { blockID = Blocks.lava; } - if (lValue > 0.0D) - { + if (lValue > 0.0D) { blockID = Blocks.netherrack; } - if (lValue > 56.0D) - { + if (lValue > 56.0D) { blockID = NContent.taintedSoil; } @@ -198,99 +199,81 @@ public void generateNetherTerrain (int chunkX, int chunkZ, Block[] lowerIDs) } } - // TODO 1.7 probably wrong. Gotta do something with the Block[]. This may or may not leave giant empty holes in the terain - public void replaceBlocksForBiome (int par1, int par2, Block[] blocks, Block[] lowerIDs) - { - //Lower nether + // TODO 1.7 probably wrong. Gotta do something with the Block[]. This may or may not leave giant empty holes in the + // terain + public void replaceBlocksForBiome(int par1, int par2, Block[] blocks, Block[] lowerIDs) { + // Lower nether byte seaLevel = 64; double d0 = 0.03125D; - this.slowsandNoise = this.slowsandGravelNoiseGen.generateNoiseOctaves(this.slowsandNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, d0, d0, 1.0D); - this.gravelNoise = this.slowsandGravelNoiseGen.generateNoiseOctaves(this.gravelNoise, par1 * 16, 109, par2 * 16, 16, 1, 16, d0, 1.0D, d0); - this.netherrackExclusivityNoise = this.netherrackExculsivityNoiseGen.generateNoiseOctaves(this.netherrackExclusivityNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, d0 * 2.0D, d0 * 2.0D, d0 * 2.0D); - - for (int iterX = 0; iterX < 16; ++iterX) - { - for (int iterZ = 0; iterZ < 16; ++iterZ) - { + this.slowsandNoise = this.slowsandGravelNoiseGen.generateNoiseOctaves( + this.slowsandNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, d0, d0, 1.0D); + this.gravelNoise = this.slowsandGravelNoiseGen.generateNoiseOctaves( + this.gravelNoise, par1 * 16, 109, par2 * 16, 16, 1, 16, d0, 1.0D, d0); + this.netherrackExclusivityNoise = this.netherrackExculsivityNoiseGen.generateNoiseOctaves( + this.netherrackExclusivityNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, d0 * 2.0D, d0 * 2.0D, d0 * 2.0D); + + for (int iterX = 0; iterX < 16; ++iterX) { + for (int iterZ = 0; iterZ < 16; ++iterZ) { boolean flag = this.slowsandNoise[iterX + iterZ * 16] + this.hellRNG.nextDouble() * 0.2D > 0.0D; boolean flag1 = this.gravelNoise[iterX + iterZ * 16] + this.hellRNG.nextDouble() * 0.2D > 0.0D; - int i1 = (int) (this.netherrackExclusivityNoise[iterX + iterZ * 16] / 3.0D + 3.0D + this.hellRNG.nextDouble() * 0.25D); + int i1 = (int) (this.netherrackExclusivityNoise[iterX + iterZ * 16] / 3.0D + + 3.0D + + this.hellRNG.nextDouble() * 0.25D); int j1 = -1; Block b1 = Blocks.netherrack; Block b2 = NContent.taintedSoil; - for (int k1 = 127; k1 >= 0; --k1) - { + for (int k1 = 127; k1 >= 0; --k1) { int l1 = (iterZ * 16 + iterX) * 128 + k1; - if (k1 < 127 - this.hellRNG.nextInt(5) && k1 > 0 + this.hellRNG.nextInt(5)) - { + if (k1 < 127 - this.hellRNG.nextInt(5) && k1 > 0 + this.hellRNG.nextInt(5)) { Block b3 = lowerIDs[l1]; - if (b3 == null || b3 == Blocks.air) - { + if (b3 == null || b3 == Blocks.air) { j1 = -1; - } - else if (b3 == Blocks.netherrack) - { - if (j1 == -1) - { - if (i1 <= 0) - { + } else if (b3 == Blocks.netherrack) { + if (j1 == -1) { + if (i1 <= 0) { b1 = null; b2 = Blocks.netherrack; - } - else if (k1 >= seaLevel - 4 && k1 <= seaLevel + 1) - { + } else if (k1 >= seaLevel - 4 && k1 <= seaLevel + 1) { b1 = Blocks.netherrack; b2 = NContent.taintedSoil; - if (flag1) - { + if (flag1) { b1 = Blocks.gravel; } - if (flag1) - { + if (flag1) { b2 = Blocks.netherrack; } - if (flag) - { + if (flag) { b1 = Blocks.soul_sand; } - if (flag) - { + if (flag) { b2 = NContent.heatSand; } } - if (k1 < seaLevel && b1 == null || b1 == Blocks.air) - { + if (k1 < seaLevel && b1 == null || b1 == Blocks.air) { b1 = Blocks.lava; } j1 = i1; - if (k1 >= seaLevel - 1) - { + if (k1 >= seaLevel - 1) { lowerIDs[l1] = b1; - } - else - { + } else { lowerIDs[l1] = b2; } - } - else if (j1 > 0) - { + } else if (j1 > 0) { --j1; lowerIDs[l1] = b2; } } - } - else - { + } else { lowerIDs[l1] = Blocks.bedrock; } } @@ -302,8 +285,7 @@ else if (j1 > 0) * loads or generates the chunk at the chunk location specified */ @Override - public Chunk loadChunk (int par1, int par2) - { + public Chunk loadChunk(int par1, int par2) { return this.provideChunk(par1, par2); } @@ -312,22 +294,22 @@ public Chunk loadChunk (int par1, int par2) * specified chunk from the map seed and chunk seed */ @Override - public Chunk provideChunk (int chunkX, int chunkZ) - { + public Chunk provideChunk(int chunkX, int chunkZ) { this.hellRNG.setSeed(chunkX * 341873128712L + chunkZ * 132897987541L); Block[] lowerArray = new Block[32768]; Block[] aBlock = new Block[32768]; - //byte[] upperArray = new byte[32768]; + // byte[] upperArray = new byte[32768]; this.generateNetherTerrain(chunkX, chunkZ, lowerArray); this.replaceBlocksForBiome(chunkX, chunkZ, aBlock, lowerArray); this.netherCaveGenerator.func_151539_a(this, this.worldObj, chunkX, chunkZ, aBlock); this.genNetherBridge.func_151539_a(this, this.worldObj, chunkX, chunkZ, aBlock); Chunk chunk = new NetheriteChunk(this.worldObj, lowerArray, chunkX, chunkZ); - BiomeGenBase[] abiomegenbase = this.worldObj.getWorldChunkManager().loadBlockGeneratorData((BiomeGenBase[]) null, chunkX * 16, chunkZ * 16, 16, 16); + BiomeGenBase[] abiomegenbase = this.worldObj + .getWorldChunkManager() + .loadBlockGeneratorData((BiomeGenBase[]) null, chunkX * 16, chunkZ * 16, 16, 16); byte[] abyte1 = chunk.getBiomeArray(); - for (int k = 0; k < abyte1.length; ++k) - { + for (int k = 0; k < abyte1.length; ++k) { abyte1[k] = (byte) abiomegenbase[k].biomeID; } @@ -339,85 +321,77 @@ public Chunk provideChunk (int chunkX, int chunkZ) * generates a subset of the level's terrain data. Takes 7 arguments: the [empty] noise array, the position, and the * size. */ - private double[] initializeNoiseField (double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7) - { - ChunkProviderEvent.InitNoiseField event = new ChunkProviderEvent.InitNoiseField(this, par1ArrayOfDouble, par2, par3, par4, par5, par6, par7); + private double[] initializeNoiseField( + double[] par1ArrayOfDouble, int par2, int par3, int par4, int par5, int par6, int par7) { + ChunkProviderEvent.InitNoiseField event = + new ChunkProviderEvent.InitNoiseField(this, par1ArrayOfDouble, par2, par3, par4, par5, par6, par7); MinecraftForge.EVENT_BUS.post(event); event.getResult(); - if (event.getResult() == Result.DENY) - return event.noisefield; - if (par1ArrayOfDouble == null) - { + if (event.getResult() == Result.DENY) return event.noisefield; + if (par1ArrayOfDouble == null) { par1ArrayOfDouble = new double[par5 * par6 * par7]; } double d0 = 684.412D; double d1 = 2053.236D; - this.noiseData4 = this.netherNoiseGen4.generateNoiseOctaves(this.noiseData4, par2, par3, par4, par5, 1, par7, 1.0D, 0.0D, 1.0D); - this.noiseData5 = this.netherNoiseGen5.generateNoiseOctaves(this.noiseData5, par2, par3, par4, par5, 1, par7, 100.0D, 0.0D, 100.0D); - this.noiseData1 = this.netherNoiseGen3.generateNoiseOctaves(this.noiseData1, par2, par3, par4, par5, par6, par7, d0 / 80.0D, d1 / 60.0D, d0 / 80.0D); - this.noiseData2 = this.netherNoiseGen1.generateNoiseOctaves(this.noiseData2, par2, par3, par4, par5, par6, par7, d0, d1, d0); - this.noiseData3 = this.netherNoiseGen2.generateNoiseOctaves(this.noiseData3, par2, par3, par4, par5, par6, par7, d0, d1, d0); + this.noiseData4 = this.netherNoiseGen4.generateNoiseOctaves( + this.noiseData4, par2, par3, par4, par5, 1, par7, 1.0D, 0.0D, 1.0D); + this.noiseData5 = this.netherNoiseGen5.generateNoiseOctaves( + this.noiseData5, par2, par3, par4, par5, 1, par7, 100.0D, 0.0D, 100.0D); + this.noiseData1 = this.netherNoiseGen3.generateNoiseOctaves( + this.noiseData1, par2, par3, par4, par5, par6, par7, d0 / 80.0D, d1 / 60.0D, d0 / 80.0D); + this.noiseData2 = this.netherNoiseGen1.generateNoiseOctaves( + this.noiseData2, par2, par3, par4, par5, par6, par7, d0, d1, d0); + this.noiseData3 = this.netherNoiseGen2.generateNoiseOctaves( + this.noiseData3, par2, par3, par4, par5, par6, par7, d0, d1, d0); int k1 = 0; int l1 = 0; double[] adouble1 = new double[par6]; int i2; - for (i2 = 0; i2 < par6; ++i2) - { + for (i2 = 0; i2 < par6; ++i2) { adouble1[i2] = Math.cos(i2 * Math.PI * 6.0D / par6) * 2.0D; double d2 = i2; - if (i2 > par6 / 2) - { + if (i2 > par6 / 2) { d2 = par6 - 1 - i2; } - if (d2 < 4.0D) - { + if (d2 < 4.0D) { d2 = 4.0D - d2; adouble1[i2] -= d2 * d2 * d2 * 10.0D; } } - for (i2 = 0; i2 < par5; ++i2) - { - for (int j2 = 0; j2 < par7; ++j2) - { + for (i2 = 0; i2 < par5; ++i2) { + for (int j2 = 0; j2 < par7; ++j2) { double d3 = (this.noiseData4[l1] + 256.0D) / 512.0D; - if (d3 > 1.0D) - { + if (d3 > 1.0D) { d3 = 1.0D; } double d4 = 0.0D; double d5 = this.noiseData5[l1] / 8000.0D; - if (d5 < 0.0D) - { + if (d5 < 0.0D) { d5 = -d5; } d5 = d5 * 3.0D - 3.0D; - if (d5 < 0.0D) - { + if (d5 < 0.0D) { d5 /= 2.0D; - if (d5 < -1.0D) - { + if (d5 < -1.0D) { d5 = -1.0D; } d5 /= 1.4D; d5 /= 2.0D; d3 = 0.0D; - } - else - { - if (d5 > 1.0D) - { + } else { + if (d5 > 1.0D) { d5 = 1.0D; } @@ -428,47 +402,37 @@ private double[] initializeNoiseField (double[] par1ArrayOfDouble, int par2, int d5 = d5 * par6 / 16.0D; ++l1; - for (int k2 = 0; k2 < par6; ++k2) - { + for (int k2 = 0; k2 < par6; ++k2) { double d6 = 0.0D; double d7 = adouble1[k2]; double d8 = this.noiseData2[k1] / 512.0D; double d9 = this.noiseData3[k1] / 512.0D; double d10 = (this.noiseData1[k1] / 10.0D + 1.0D) / 2.0D; - if (d10 < 0.0D) - { + if (d10 < 0.0D) { d6 = d8; - } - else if (d10 > 1.0D) - { + } else if (d10 > 1.0D) { d6 = d9; - } - else - { + } else { d6 = d8 + (d9 - d8) * d10; } d6 -= d7; double d11; - if (k2 > par6 - 4) - { + if (k2 > par6 - 4) { d11 = (k2 - (par6 - 4)) / 3.0F; d6 = d6 * (1.0D - d11) + -10.0D * d11; } - if (k2 < d4) - { + if (k2 < d4) { d11 = (d4 - k2) / 4.0D; - if (d11 < 0.0D) - { + if (d11 < 0.0D) { d11 = 0.0D; } - if (d11 > 1.0D) - { + if (d11 > 1.0D) { d11 = 1.0D; } @@ -488,8 +452,7 @@ else if (d10 > 1.0D) * Checks to see if a chunk exists at x, y */ @Override - public boolean chunkExists (int par1, int par2) - { + public boolean chunkExists(int par1, int par2) { return true; } @@ -497,11 +460,11 @@ public boolean chunkExists (int par1, int par2) * Populates chunk with ores etc etc */ @Override - public void populate (IChunkProvider par1IChunkProvider, int par2, int par3) - { + public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) { BlockFalling.fallInstantly = true; - MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider, worldObj, hellRNG, par2, par3, false)); + MinecraftForge.EVENT_BUS.post( + new PopulateChunkEvent.Pre(par1IChunkProvider, worldObj, hellRNG, par2, par3, false)); int blockX = par2 * 16; int blockZ = par3 * 16; @@ -512,8 +475,7 @@ public void populate (IChunkProvider par1IChunkProvider, int par2, int par3) int zPos; boolean doGen = TerrainGen.populate(par1IChunkProvider, worldObj, hellRNG, par2, par3, false, NETHER_LAVA); - for (i1 = 0; doGen && i1 < 8; ++i1) - { + for (i1 = 0; doGen && i1 < 8; ++i1) { xPos = blockX + this.hellRNG.nextInt(16) + 8; yPos = this.hellRNG.nextInt(120) + 4; zPos = blockZ + this.hellRNG.nextInt(16) + 8; @@ -524,8 +486,7 @@ public void populate (IChunkProvider par1IChunkProvider, int par2, int par3) int i2; doGen = TerrainGen.populate(par1IChunkProvider, worldObj, hellRNG, par2, par3, false, FIRE); - for (xPos = 0; doGen && xPos < i1; ++xPos) - { + for (xPos = 0; doGen && xPos < i1; ++xPos) { yPos = blockX + this.hellRNG.nextInt(16) + 8; zPos = this.hellRNG.nextInt(120) + 4; i2 = blockZ + this.hellRNG.nextInt(16) + 8; @@ -535,16 +496,14 @@ public void populate (IChunkProvider par1IChunkProvider, int par2, int par3) i1 = this.hellRNG.nextInt(this.hellRNG.nextInt(10) + 1); doGen = TerrainGen.populate(par1IChunkProvider, worldObj, hellRNG, par2, par3, false, GLOWSTONE); - for (xPos = 0; doGen && xPos < i1; ++xPos) - { + for (xPos = 0; doGen && xPos < i1; ++xPos) { yPos = blockX + this.hellRNG.nextInt(16) + 8; zPos = this.hellRNG.nextInt(120) + 4; i2 = blockZ + this.hellRNG.nextInt(16) + 8; (new WorldGenGlowStone1()).generate(this.worldObj, this.hellRNG, yPos, zPos, i2); } - for (xPos = 0; doGen && xPos < 10; ++xPos) - { + for (xPos = 0; doGen && xPos < 10; ++xPos) { yPos = blockX + this.hellRNG.nextInt(16) + 8; zPos = this.hellRNG.nextInt(128); i2 = blockZ + this.hellRNG.nextInt(16) + 8; @@ -554,16 +513,14 @@ public void populate (IChunkProvider par1IChunkProvider, int par2, int par3) WorldGenMinable worldgenminable = new WorldGenMinable(Blocks.quartz_ore, 13, Blocks.netherrack); int j2; - for (yPos = 0; yPos < 16; ++yPos) - { + for (yPos = 0; yPos < 16; ++yPos) { zPos = blockX + this.hellRNG.nextInt(16); i2 = this.hellRNG.nextInt(108) + 10; j2 = blockZ + this.hellRNG.nextInt(16); worldgenminable.generate(this.worldObj, this.hellRNG, zPos, i2, j2); } - for (yPos = 0; yPos < 16; ++yPos) - { + for (yPos = 0; yPos < 16; ++yPos) { zPos = blockX + this.hellRNG.nextInt(16); i2 = this.hellRNG.nextInt(108) + 10; j2 = blockZ + this.hellRNG.nextInt(16); @@ -588,22 +545,19 @@ public void populate (IChunkProvider par1IChunkProvider, int par2, int par3) (new WorldGenFlowers(Block.mushroomRed.blockID)).generate(this.worldObj, this.hellRNG, xPos, yPos, zPos); }*/ - if (PHNatura.generateGreenglowshroom && doGen && hellRNG.nextInt(7) == 0) - { + if (PHNatura.generateGreenglowshroom && doGen && hellRNG.nextInt(7) == 0) { int l2 = blockX + hellRNG.nextInt(16) + 8; int k4 = hellRNG.nextInt(128); int j6 = blockZ + hellRNG.nextInt(16) + 8; (new FlowerGen(NContent.glowshroom, 0)).generate(worldObj, hellRNG, l2, k4, j6); } - if (PHNatura.generatePurpleglowshroom && doGen && hellRNG.nextInt(8) == 0) - { + if (PHNatura.generatePurpleglowshroom && doGen && hellRNG.nextInt(8) == 0) { int i3 = blockX + hellRNG.nextInt(16) + 8; int l4 = hellRNG.nextInt(128); int k6 = blockZ + hellRNG.nextInt(16) + 8; (new FlowerGen(NContent.glowshroom, 1)).generate(worldObj, hellRNG, i3, l4, k6); } - if (PHNatura.generateBlueglowshroom && doGen && hellRNG.nextInt(9) == 0) - { + if (PHNatura.generateBlueglowshroom && doGen && hellRNG.nextInt(9) == 0) { int i3 = blockX + hellRNG.nextInt(16) + 8; int l4 = hellRNG.nextInt(128); int k6 = blockZ + hellRNG.nextInt(16) + 8; @@ -611,7 +565,8 @@ public void populate (IChunkProvider par1IChunkProvider, int par2, int par3) } MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Post(worldObj, hellRNG, blockX, blockZ)); - MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, hellRNG, par2, par3, false)); + MinecraftForge.EVENT_BUS.post( + new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, hellRNG, par2, par3, false)); BlockFalling.fallInstantly = false; } @@ -621,8 +576,7 @@ public void populate (IChunkProvider par1IChunkProvider, int par2, int par3) * Return true if all chunks have been saved. */ @Override - public boolean saveChunks (boolean par1, IProgressUpdate par2IProgressUpdate) - { + public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate) { return true; } @@ -630,8 +584,7 @@ public boolean saveChunks (boolean par1, IProgressUpdate par2IProgressUpdate) * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk. */ @Override - public boolean unloadQueuedChunks () - { + public boolean unloadQueuedChunks() { return false; } @@ -639,8 +592,7 @@ public boolean unloadQueuedChunks () * Returns if the IChunkProvider supports saving. */ @Override - public boolean canSave () - { + public boolean canSave() { return true; } @@ -648,8 +600,7 @@ public boolean canSave () * Converts the instance data to a readable string. */ @Override - public String makeString () - { + public String makeString() { return "HellRandomLevelSource"; } @@ -657,14 +608,10 @@ public String makeString () * Returns a list of creatures of the specified type that can spawn at the given location. */ @Override - public List getPossibleCreatures (EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4) - { - if (par1EnumCreatureType == EnumCreatureType.monster && this.genNetherBridge.hasStructureAt(par2, par3, par4)) - { + public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4) { + if (par1EnumCreatureType == EnumCreatureType.monster && this.genNetherBridge.hasStructureAt(par2, par3, par4)) { return this.genNetherBridge.getSpawnList(); - } - else - { + } else { BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(par2, par4); return biomegenbase == null ? null : biomegenbase.getSpawnableList(par1EnumCreatureType); } @@ -674,26 +621,22 @@ public List getPossibleCreatures (EnumCreatureType par1EnumCreatureType, int par * Returns the location of the closest structure of the specified type. If not found returns null. */ @Override - public ChunkPosition func_147416_a (World par1World, String par2Str, int par3, int par4, int par5) - { + public ChunkPosition func_147416_a(World par1World, String par2Str, int par3, int par4, int par5) { return null; } @Override - public int getLoadedChunkCount () - { + public int getLoadedChunkCount() { return 0; } @Override - public void recreateStructures (int par1, int par2) - { + public void recreateStructures(int par1, int par2) { genNetherBridge.func_151539_a(this, this.worldObj, par1, par2, null); } @Override - public void saveExtraData () - { + public void saveExtraData() { // NYI } } diff --git a/src/main/java/mods/natura/dimension/NetheriteWorldProvider.java b/src/main/java/mods/natura/dimension/NetheriteWorldProvider.java index 132d8b89..bdc06873 100644 --- a/src/main/java/mods/natura/dimension/NetheriteWorldProvider.java +++ b/src/main/java/mods/natura/dimension/NetheriteWorldProvider.java @@ -7,14 +7,12 @@ import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.chunk.IChunkProvider; -public class NetheriteWorldProvider extends WorldProviderHell -{ +public class NetheriteWorldProvider extends WorldProviderHell { /** * creates a new world chunk manager for WorldProvider */ @Override - public void registerWorldChunkManager () - { + public void registerWorldChunkManager() { this.worldChunkMgr = new NetheriteChunkManager(BiomeGenBase.hell, 1.0F, 0.0F); this.isHellWorld = true; this.hasNoSky = true; @@ -22,31 +20,25 @@ public void registerWorldChunkManager () } @Override - public IChunkProvider createChunkGenerator () - { + public IChunkProvider createChunkGenerator() { return new NetheriteChunkProvider(this.worldObj, this.worldObj.getSeed()); } @Override - public boolean canRespawnHere () - { + public boolean canRespawnHere() { return false; } @Override - public boolean doesXZShowFog (int par1, int par2) - { + public boolean doesXZShowFog(int par1, int par2) { return false; } @Override - public int getRespawnDimension (EntityPlayerMP player) - { - if (PHNatura.canRespawnInNether) - { + public int getRespawnDimension(EntityPlayerMP player) { + if (PHNatura.canRespawnInNether) { ChunkCoordinates coords = player.getBedLocation(-1); - if (coords != null) - return -1; + if (coords != null) return -1; } return 0; } diff --git a/src/main/java/mods/natura/entity/BabyHeatscarSpider.java b/src/main/java/mods/natura/entity/BabyHeatscarSpider.java index 8cf0fc6d..111b074c 100644 --- a/src/main/java/mods/natura/entity/BabyHeatscarSpider.java +++ b/src/main/java/mods/natura/entity/BabyHeatscarSpider.java @@ -16,27 +16,21 @@ import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; -public class BabyHeatscarSpider extends EntitySpider -{ - public BabyHeatscarSpider(World par1World) - { +public class BabyHeatscarSpider extends EntitySpider { + public BabyHeatscarSpider(World par1World) { super(par1World); this.setSize(1.2F, 0.8F); this.isImmuneToFire = true; } - public float spiderScaleAmount () - { + public float spiderScaleAmount() { return 0.85F; } @Override - protected void attackEntity (Entity par1Entity, float par2) - { - if (par2 > 2.0F && par2 < 6.0F && this.rand.nextInt(10) == 0) - { - if (this.onGround) - { + protected void attackEntity(Entity par1Entity, float par2) { + if (par2 > 2.0F && par2 < 6.0F && this.rand.nextInt(10) == 0) { + if (this.onGround) { double d0 = par1Entity.posX - this.posX; double d1 = par1Entity.posZ - this.posZ; float f2 = MathHelper.sqrt_double(d0 * d0 + d1 * d1); @@ -44,26 +38,20 @@ protected void attackEntity (Entity par1Entity, float par2) this.motionZ = d1 / f2 * 0.5D + this.motionZ * 0.20000000298023224D; this.motionY = 0.62D; } - } - else - { + } else { super.attackEntity(par1Entity, par2); } - } @Override - public void jump () - { + public void jump() { this.motionY = 0.62D; - if (this.isPotionActive(Potion.jump)) - { + if (this.isPotionActive(Potion.jump)) { this.motionY += (this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F; } - if (this.isSprinting()) - { + if (this.isSprinting()) { float f = this.rotationYaw * 0.017453292F; this.motionX -= MathHelper.sin(f) * 0.2F; this.motionZ += MathHelper.cos(f) * 0.2F; @@ -74,33 +62,29 @@ public void jump () } @Override - protected void fall (float par1) - { + protected void fall(float par1) { par1 = ForgeHooks.onLivingFall(this, par1); - if (par1 <= 0) - { + if (par1 <= 0) { return; } super.fall(par1); int i = MathHelper.ceiling_float_int(par1 - 5.0F); - if (i > 0) - { - if (i > 4) - { + if (i > 0) { + if (i > 4) { this.playSound("damage.fallbig", 1.0F, 1.0F); - } - else - { + } else { this.playSound("damage.fallsmall", 1.0F, 1.0F); } this.attackEntityFrom(DamageSource.fall, i); - Block j = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY - 0.20000000298023224D - this.yOffset), MathHelper.floor_double(this.posZ)); + Block j = this.worldObj.getBlock( + MathHelper.floor_double(this.posX), + MathHelper.floor_double(this.posY - 0.20000000298023224D - this.yOffset), + MathHelper.floor_double(this.posZ)); - if (j != null) - { + if (j != null) { SoundType stepsound = j.stepSound; this.playSound(stepsound.soundName, stepsound.getVolume() * 0.5F, stepsound.getPitch() * 0.75F); } @@ -108,83 +92,69 @@ protected void fall (float par1) } @Override - public boolean attackEntityAsMob (Entity par1Entity) - { - if (super.attackEntityAsMob(par1Entity)) - { - if (par1Entity instanceof EntityLiving) - { + public boolean attackEntityAsMob(Entity par1Entity) { + if (super.attackEntityAsMob(par1Entity)) { + if (par1Entity instanceof EntityLiving) { byte b0 = 0; - if (this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL) - { - if (this.worldObj.difficultySetting == EnumDifficulty.NORMAL) - { + if (this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL) { + if (this.worldObj.difficultySetting == EnumDifficulty.NORMAL) { b0 = 5; - } - else if (this.worldObj.difficultySetting == EnumDifficulty.HARD) - { + } else if (this.worldObj.difficultySetting == EnumDifficulty.HARD) { b0 = 10; } } - if (b0 > 0) - { + if (b0 > 0) { par1Entity.setFire(b0); } } return true; - } - else - { + } else { return false; } } - public int getAttackStrength (Entity par1Entity) - { + public int getAttackStrength(Entity par1Entity) { return 4; } @Override - protected Item getDropItem () - { + protected Item getDropItem() { return NContent.plantItem; } @Override // dropItemWithOffset - public EntityItem func_145778_a (Item item, int par2, float offset) - { + public EntityItem func_145778_a(Item item, int par2, float offset) { return this.entityDropItem(new ItemStack(item, par2, 7), offset); } @Override - protected void dropFewItems (boolean par1, int par2) - { + protected void dropFewItems(boolean par1, int par2) { Item j = this.getDropItem(); - if (Item.getIdFromItem(j) > 0) - { + if (Item.getIdFromItem(j) > 0) { int k = this.rand.nextInt(3) + 2; - if (par2 > 0) - { + if (par2 > 0) { k += this.rand.nextInt(par2 + 1); } - for (int l = 0; l < k; ++l) - { + for (int l = 0; l < k; ++l) { this.dropItem(j, 1); } } } @Override - public boolean getCanSpawnHere () - { - return this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL && this.worldObj.checkNoEntityCollision(this.boundingBox) - && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(this.boundingBox); + public boolean getCanSpawnHere() { + return this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL + && this.worldObj.checkNoEntityCollision(this.boundingBox) + && this.worldObj + .getCollidingBoundingBoxes(this, this.boundingBox) + .isEmpty() + && !this.worldObj.isAnyLiquid(this.boundingBox); } } diff --git a/src/main/java/mods/natura/entity/FusewoodArrow.java b/src/main/java/mods/natura/entity/FusewoodArrow.java index d9545ef1..5e4f75c3 100644 --- a/src/main/java/mods/natura/entity/FusewoodArrow.java +++ b/src/main/java/mods/natura/entity/FusewoodArrow.java @@ -1,9 +1,8 @@ package mods.natura.entity; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.enchantment.Enchantment; import net.minecraft.entity.Entity; @@ -23,8 +22,7 @@ import net.minecraft.util.Vec3; import net.minecraft.world.World; -public class FusewoodArrow extends EntityArrow -{ +public class FusewoodArrow extends EntityArrow { private int xTile = -1; private int yTile = -1; private int zTile = -1; @@ -40,6 +38,7 @@ public class FusewoodArrow extends EntityArrow /** The owner of this arrow. */ public Entity shootingEntity; + private int ticksInGround; private int ticksInAir = 0; private double damage = 2.0D; @@ -47,15 +46,13 @@ public class FusewoodArrow extends EntityArrow /** The amount of knockback an arrow applies when it hits a mob. */ private int knockbackStrength; - public FusewoodArrow(World par1World) - { + public FusewoodArrow(World par1World) { super(par1World); this.renderDistanceWeight = 10.0D; this.setSize(0.5F, 0.5F); } - public FusewoodArrow(World par1World, double par2, double par4, double par6) - { + public FusewoodArrow(World par1World, double par2, double par4, double par6) { super(par1World); this.renderDistanceWeight = 10.0D; this.setSize(0.5F, 0.5F); @@ -63,14 +60,17 @@ public FusewoodArrow(World par1World, double par2, double par4, double par6) this.yOffset = 0.0F; } - public FusewoodArrow(World par1World, EntityLivingBase par2EntityLiving, EntityLivingBase par3EntityLiving, float par4, float par5) - { + public FusewoodArrow( + World par1World, + EntityLivingBase par2EntityLiving, + EntityLivingBase par3EntityLiving, + float par4, + float par5) { super(par1World); this.renderDistanceWeight = 10.0D; this.shootingEntity = par2EntityLiving; - if (par2EntityLiving instanceof EntityPlayer) - { + if (par2EntityLiving instanceof EntityPlayer) { this.canBePickedUp = 1; } @@ -80,8 +80,7 @@ public FusewoodArrow(World par1World, EntityLivingBase par2EntityLiving, EntityL double d2 = par3EntityLiving.posZ - par2EntityLiving.posZ; double d3 = MathHelper.sqrt_double(d0 * d0 + d2 * d2); - if (d3 >= 1.0E-7D) - { + if (d3 >= 1.0E-7D) { float f2 = (float) (Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F; float f3 = (float) (-(Math.atan2(d1, d3) * 180.0D / Math.PI)); double d4 = d0 / d3; @@ -93,33 +92,37 @@ public FusewoodArrow(World par1World, EntityLivingBase par2EntityLiving, EntityL } } - public FusewoodArrow(World par1World, EntityLivingBase par2EntityLiving, float par3) - { + public FusewoodArrow(World par1World, EntityLivingBase par2EntityLiving, float par3) { super(par1World); this.renderDistanceWeight = 10.0D; this.shootingEntity = par2EntityLiving; - if (par2EntityLiving instanceof EntityPlayer) - { + if (par2EntityLiving instanceof EntityPlayer) { this.canBePickedUp = 1; } this.setSize(0.5F, 0.5F); - this.setLocationAndAngles(par2EntityLiving.posX, par2EntityLiving.posY + par2EntityLiving.getEyeHeight(), par2EntityLiving.posZ, par2EntityLiving.rotationYaw, par2EntityLiving.rotationPitch); + this.setLocationAndAngles( + par2EntityLiving.posX, + par2EntityLiving.posY + par2EntityLiving.getEyeHeight(), + par2EntityLiving.posZ, + par2EntityLiving.rotationYaw, + par2EntityLiving.rotationPitch); this.posX -= MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F; this.posY -= 0.10000000149011612D; this.posZ -= MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F; this.setPosition(this.posX, this.posY, this.posZ); this.yOffset = 0.0F; - this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI); - this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI); + this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) + * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI); + this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) + * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI); this.motionY = (-MathHelper.sin(this.rotationPitch / 180.0F * (float) Math.PI)); this.setThrowableHeading(this.motionX, this.motionY, this.motionZ, par3 * 1.5F, 1.0F); } @Override - public void entityInit () - { + public void entityInit() { this.dataWatcher.addObject(16, Byte.valueOf((byte) 0)); } @@ -127,8 +130,7 @@ public void entityInit () * Similar to setArrowHeading, it's point the throwable entity to a x, y, z direction. */ @Override - public void setThrowableHeading (double par1, double par3, double par5, float par7, float par8) - { + public void setThrowableHeading(double par1, double par3, double par5, float par7, float par8) { float f2 = MathHelper.sqrt_double(par1 * par1 + par3 * par3 + par5 * par5); par1 /= f2; par3 /= f2; @@ -154,8 +156,7 @@ public void setThrowableHeading (double par1, double par3, double par5, float pa * Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX, * posY, posZ, yaw, pitch */ - public void setPositionAndRotation2 (double par1, double par3, double par5, float par7, float par8, int par9) - { + public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) { this.setPosition(par1, par3, par5); this.setRotation(par7, par8); } @@ -165,14 +166,12 @@ public void setPositionAndRotation2 (double par1, double par3, double par5, floa /** * Sets the velocity to the args. Args: x, y, z */ - public void setVelocity (double par1, double par3, double par5) - { + public void setVelocity(double par1, double par3, double par5) { this.motionX = par1; this.motionY = par3; this.motionZ = par5; - if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) - { + if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { float f = MathHelper.sqrt_double(par1 * par1 + par5 * par5); this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI); this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(par3, f) * 180.0D / Math.PI); @@ -187,51 +186,44 @@ public void setVelocity (double par1, double par3, double par5) * Called to update the entity's position/logic. */ @Override - public void onUpdate () - { + public void onUpdate() { super.onUpdate(); - if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) - { + if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) { float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); - this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); + this.prevRotationYaw = + this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(this.motionY, f) * 180.0D / Math.PI); } Block i = this.worldObj.getBlock(this.xTile, this.yTile, this.zTile); - if (i != null) - { + if (i != null) { i.setBlockBoundsBasedOnState(this.worldObj, this.xTile, this.yTile, this.zTile); - AxisAlignedBB axisalignedbb = i.getCollisionBoundingBoxFromPool(this.worldObj, this.xTile, this.yTile, this.zTile); + AxisAlignedBB axisalignedbb = + i.getCollisionBoundingBoxFromPool(this.worldObj, this.xTile, this.yTile, this.zTile); - if (axisalignedbb != null && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ))) - { + if (axisalignedbb != null + && axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ))) { this.inGround = true; } } - if (this.arrowShake > 0) - { + if (this.arrowShake > 0) { --this.arrowShake; } - if (this.inGround) - { + if (this.inGround) { Block j = this.worldObj.getBlock(this.xTile, this.yTile, this.zTile); int k = this.worldObj.getBlockMetadata(this.xTile, this.yTile, this.zTile); - if (j == this.inTile && k == this.inData) - { + if (j == this.inTile && k == this.inData) { ++this.ticksInGround; - if (this.ticksInGround == 1200) - { + if (this.ticksInGround == 1200) { this.setDead(); } - } - else - { + } else { this.inGround = false; this.motionX *= this.rand.nextFloat() * 0.2F; this.motionY *= this.rand.nextFloat() * 0.2F; @@ -239,44 +231,46 @@ public void onUpdate () this.ticksInGround = 0; this.ticksInAir = 0; } - } - else - { + } else { ++this.ticksInAir; Vec3 vec3 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); - Vec3 vec31 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + Vec3 vec31 = Vec3.createVectorHelper( + this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); // TODO 1.7 May need to call overload with extra params MovingObjectPosition movingobjectposition = this.worldObj.rayTraceBlocks(vec3, vec31, false); vec3 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ); - vec31 = Vec3.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); - - if (movingobjectposition != null) - { - vec31 = Vec3.createVectorHelper(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord); + vec31 = Vec3.createVectorHelper( + this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ); + + if (movingobjectposition != null) { + vec31 = Vec3.createVectorHelper( + movingobjectposition.hitVec.xCoord, + movingobjectposition.hitVec.yCoord, + movingobjectposition.hitVec.zCoord); } Entity entity = null; - List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(this, this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D)); + List list = this.worldObj.getEntitiesWithinAABBExcludingEntity( + this, + this.boundingBox + .addCoord(this.motionX, this.motionY, this.motionZ) + .expand(1.0D, 1.0D, 1.0D)); double d0 = 0.0D; int l; float f1; - for (l = 0; l < list.size(); ++l) - { + for (l = 0; l < list.size(); ++l) { Entity entity1 = (Entity) list.get(l); - if (entity1.canBeCollidedWith() && (entity1 != this.shootingEntity || this.ticksInAir >= 5)) - { + if (entity1.canBeCollidedWith() && (entity1 != this.shootingEntity || this.ticksInAir >= 5)) { f1 = 0.3F; AxisAlignedBB axisalignedbb1 = entity1.boundingBox.expand(f1, f1, f1); MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(vec3, vec31); - if (movingobjectposition1 != null) - { + if (movingobjectposition1 != null) { double d1 = vec3.distanceTo(movingobjectposition1.hitVec); - if (d1 < d0 || d0 == 0.0D) - { + if (d1 < d0 || d0 == 0.0D) { entity = entity1; d0 = d1; } @@ -284,17 +278,18 @@ public void onUpdate () } } - if (entity != null) - { + if (entity != null) { movingobjectposition = new MovingObjectPosition(entity); } - if (movingobjectposition != null && movingobjectposition.entityHit != null && movingobjectposition.entityHit instanceof EntityPlayer) - { + if (movingobjectposition != null + && movingobjectposition.entityHit != null + && movingobjectposition.entityHit instanceof EntityPlayer) { EntityPlayer entityplayer = (EntityPlayer) movingobjectposition.entityHit; - if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer && !((EntityPlayer) this.shootingEntity).canAttackPlayer(entityplayer)) - { + if (entityplayer.capabilities.disableDamage + || this.shootingEntity instanceof EntityPlayer + && !((EntityPlayer) this.shootingEntity).canAttackPlayer(entityplayer)) { movingobjectposition = null; } } @@ -302,82 +297,79 @@ public void onUpdate () float f2; float f3; - if (movingobjectposition != null) - { - if (movingobjectposition.entityHit != null)// && movingobjectposition.entityHit != shootingEntity) + if (movingobjectposition != null) { + if (movingobjectposition.entityHit != null) // && movingobjectposition.entityHit != shootingEntity) { - if (movingobjectposition.entityHit != shootingEntity) - { - f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); + if (movingobjectposition.entityHit != shootingEntity) { + f2 = MathHelper.sqrt_double(this.motionX * this.motionX + + this.motionY * this.motionY + + this.motionZ * this.motionZ); int i1 = MathHelper.ceiling_double_int(f2 * this.damage); - if (this.getIsCritical()) - { + if (this.getIsCritical()) { i1 += this.rand.nextInt(i1 / 2 + 2); } DamageSource damagesource = null; - if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman)) - { + if (this.isBurning() && !(movingobjectposition.entityHit instanceof EntityEnderman)) { movingobjectposition.entityHit.setFire(5); } - if (this.shootingEntity == null) - { - damagesource = DamageSource.setExplosionSource(this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 1.5f, true)); - } - else - { - damagesource = DamageSource.setExplosionSource(this.worldObj.createExplosion(this.shootingEntity, this.posX, this.posY, this.posZ, 1.5f, true)); + if (this.shootingEntity == null) { + damagesource = DamageSource.setExplosionSource( + this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 1.5f, true)); + } else { + damagesource = DamageSource.setExplosionSource(this.worldObj.createExplosion( + this.shootingEntity, this.posX, this.posY, this.posZ, 1.5f, true)); } - //this.kill(); + // this.kill(); - if (movingobjectposition.entityHit.attackEntityFrom(damagesource, i1)) - { - if (movingobjectposition.entityHit instanceof EntityLivingBase) - { + if (movingobjectposition.entityHit.attackEntityFrom(damagesource, i1)) { + if (movingobjectposition.entityHit instanceof EntityLivingBase) { Entity entityliving = movingobjectposition.entityHit; - if (!this.worldObj.isRemote) - { - ((EntityLivingBase) entityliving).setArrowCountInEntity(((EntityLivingBase) entityliving).getArrowCountInEntity() + 1); + if (!this.worldObj.isRemote) { + ((EntityLivingBase) entityliving) + .setArrowCountInEntity( + ((EntityLivingBase) entityliving).getArrowCountInEntity() + 1); } - if (this.knockbackStrength > 0) - { - f3 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); + if (this.knockbackStrength > 0) { + f3 = MathHelper.sqrt_double( + this.motionX * this.motionX + this.motionZ * this.motionZ); - if (f3 > 0.0F) - { - movingobjectposition.entityHit.addVelocity(this.motionX * this.knockbackStrength * 0.6000000238418579D / f3, 0.1D, this.motionZ * this.knockbackStrength - * 0.6000000238418579D / f3); + if (f3 > 0.0F) { + movingobjectposition.entityHit.addVelocity( + this.motionX * this.knockbackStrength * 0.6000000238418579D / f3, + 0.1D, + this.motionZ * this.knockbackStrength * 0.6000000238418579D / f3); } } - if (this.shootingEntity != null) - { + if (this.shootingEntity != null) { // TODO 1.7 last arg is level of enchant (I think), confirm this is correct - Enchantment.thorns.func_151367_b((EntityLivingBase) this.shootingEntity, entityliving, 1); + Enchantment.thorns.func_151367_b( + (EntityLivingBase) this.shootingEntity, entityliving, 1); } - if (this.shootingEntity != null && movingobjectposition.entityHit != this.shootingEntity && movingobjectposition.entityHit instanceof EntityPlayer - && this.shootingEntity instanceof EntityPlayerMP) - { - // TODO 1.7 What is Packet70 now? ((EntityPlayerMP) this.shootingEntity).playerNetServerHandler.sendPacketToPlayer(new Packet70GameEvent(6, 0)); + if (this.shootingEntity != null + && movingobjectposition.entityHit != this.shootingEntity + && movingobjectposition.entityHit instanceof EntityPlayer + && this.shootingEntity instanceof EntityPlayerMP) { + // TODO 1.7 What is Packet70 now? ((EntityPlayerMP) + // this.shootingEntity).playerNetServerHandler.sendPacketToPlayer(new + // Packet70GameEvent(6, 0)); } } this.playSound("random.bowhit", 1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F)); - if (!(movingobjectposition.entityHit instanceof EntityEnderman)) - { + if (!(movingobjectposition.entityHit instanceof EntityEnderman)) { this.setDead(); } - } - else - { + } else { this.motionX *= -0.10000000149011612D; this.motionY *= -0.10000000149011612D; this.motionZ *= -0.10000000149011612D; @@ -386,9 +378,7 @@ public void onUpdate () this.ticksInAir = 0; } } - } - else - { + } else { this.xTile = movingobjectposition.blockX; this.yTile = movingobjectposition.blockY; this.zTile = movingobjectposition.blockZ; @@ -397,7 +387,8 @@ public void onUpdate () this.motionX = ((float) (movingobjectposition.hitVec.xCoord - this.posX)); this.motionY = ((float) (movingobjectposition.hitVec.yCoord - this.posY)); this.motionZ = ((float) (movingobjectposition.hitVec.zCoord - this.posZ)); - f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); + f2 = MathHelper.sqrt_double( + this.motionX * this.motionX + this.motionY * this.motionY + this.motionZ * this.motionZ); this.posX -= this.motionX / f2 * 0.05000000074505806D; this.posY -= this.motionY / f2 * 0.05000000074505806D; this.posZ -= this.motionZ / f2 * 0.05000000074505806D; @@ -406,19 +397,22 @@ public void onUpdate () this.arrowShake = 7; this.setIsCritical(false); - if (this.inTile != null) - { + if (this.inTile != null) { this.inTile.onEntityCollidedWithBlock(this.worldObj, this.xTile, this.yTile, this.zTile, this); } } } - if (this.getIsCritical()) - { - for (l = 0; l < 4; ++l) - { - this.worldObj.spawnParticle("crit", this.posX + this.motionX * l / 4.0D, this.posY + this.motionY * l / 4.0D, this.posZ + this.motionZ * l / 4.0D, -this.motionX, - -this.motionY + 0.2D, -this.motionZ); + if (this.getIsCritical()) { + for (l = 0; l < 4; ++l) { + this.worldObj.spawnParticle( + "crit", + this.posX + this.motionX * l / 4.0D, + this.posY + this.motionY * l / 4.0D, + this.posZ + this.motionZ * l / 4.0D, + -this.motionX, + -this.motionY + 0.2D, + -this.motionZ); } } @@ -428,23 +422,21 @@ public void onUpdate () f2 = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ); this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI); - for (this.rotationPitch = (float) (Math.atan2(this.motionY, f2) * 180.0D / Math.PI); this.rotationPitch - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F) - { + for (this.rotationPitch = (float) (Math.atan2(this.motionY, f2) * 180.0D / Math.PI); + this.rotationPitch - this.prevRotationPitch < -180.0F; + this.prevRotationPitch -= 360.0F) { ; } - while (this.rotationPitch - this.prevRotationPitch >= 180.0F) - { + while (this.rotationPitch - this.prevRotationPitch >= 180.0F) { this.prevRotationPitch += 360.0F; } - while (this.rotationYaw - this.prevRotationYaw < -180.0F) - { + while (this.rotationYaw - this.prevRotationYaw < -180.0F) { this.prevRotationYaw -= 360.0F; } - while (this.rotationYaw - this.prevRotationYaw >= 180.0F) - { + while (this.rotationYaw - this.prevRotationYaw >= 180.0F) { this.prevRotationYaw += 360.0F; } @@ -453,12 +445,17 @@ public void onUpdate () float f4 = 0.99F; f1 = 0.05F; - if (this.isInWater()) - { - for (int j1 = 0; j1 < 4; ++j1) - { + if (this.isInWater()) { + for (int j1 = 0; j1 < 4; ++j1) { f3 = 0.25F; - this.worldObj.spawnParticle("bubble", this.posX - this.motionX * f3, this.posY - this.motionY * f3, this.posZ - this.motionZ * f3, this.motionX, this.motionY, this.motionZ); + this.worldObj.spawnParticle( + "bubble", + this.posX - this.motionX * f3, + this.posY - this.motionY * f3, + this.posZ - this.motionZ * f3, + this.motionX, + this.motionY, + this.motionZ); } f4 = 0.8F; @@ -477,8 +474,7 @@ public void onUpdate () * (abstract) Protected helper method to write subclass entity data to NBT. */ @Override - public void writeEntityToNBT (NBTTagCompound par1NBTTagCompound) - { + public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) { par1NBTTagCompound.setShort("xTile", (short) this.xTile); par1NBTTagCompound.setShort("yTile", (short) this.yTile); par1NBTTagCompound.setShort("zTile", (short) this.zTile); @@ -494,8 +490,7 @@ public void writeEntityToNBT (NBTTagCompound par1NBTTagCompound) * (abstract) Protected helper method to read subclass entity data from NBT. */ @Override - public void readEntityFromNBT (NBTTagCompound par1NBTTagCompound) - { + public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { this.xTile = par1NBTTagCompound.getShort("xTile"); this.yTile = par1NBTTagCompound.getShort("yTile"); this.zTile = par1NBTTagCompound.getShort("zTile"); @@ -504,17 +499,13 @@ public void readEntityFromNBT (NBTTagCompound par1NBTTagCompound) this.arrowShake = par1NBTTagCompound.getByte("shake") & 255; this.inGround = par1NBTTagCompound.getByte("inGround") == 1; - if (par1NBTTagCompound.hasKey("damage")) - { + if (par1NBTTagCompound.hasKey("damage")) { this.damage = par1NBTTagCompound.getDouble("damage"); } - if (par1NBTTagCompound.hasKey("pickup")) - { + if (par1NBTTagCompound.hasKey("pickup")) { this.canBePickedUp = par1NBTTagCompound.getByte("pickup"); - } - else if (par1NBTTagCompound.hasKey("player")) - { + } else if (par1NBTTagCompound.hasKey("player")) { this.canBePickedUp = par1NBTTagCompound.getBoolean("player") ? 1 : 0; } } @@ -523,20 +514,19 @@ else if (par1NBTTagCompound.hasKey("player")) * Called by a player entity when they collide with an entity */ @Override - public void onCollideWithPlayer (EntityPlayer par1EntityPlayer) - { - if (!this.worldObj.isRemote && this.inGround && this.arrowShake <= 0) - { - boolean flag = this.canBePickedUp == 1 || this.canBePickedUp == 2 && par1EntityPlayer.capabilities.isCreativeMode; - - if (this.canBePickedUp == 1 && !par1EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Items.arrow, 1))) - { + public void onCollideWithPlayer(EntityPlayer par1EntityPlayer) { + if (!this.worldObj.isRemote && this.inGround && this.arrowShake <= 0) { + boolean flag = + this.canBePickedUp == 1 || this.canBePickedUp == 2 && par1EntityPlayer.capabilities.isCreativeMode; + + if (this.canBePickedUp == 1 + && !par1EntityPlayer.inventory.addItemStackToInventory(new ItemStack(Items.arrow, 1))) { flag = false; } - if (flag) - { - this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); + if (flag) { + this.playSound( + "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F); par1EntityPlayer.onItemPickup(this, 1); this.setDead(); } @@ -548,27 +538,23 @@ public void onCollideWithPlayer (EntityPlayer par1EntityPlayer) * prevent them from trampling crops */ @Override - public boolean canTriggerWalking () - { + public boolean canTriggerWalking() { return false; } @Override @SideOnly(Side.CLIENT) - public float getShadowSize () - { + public float getShadowSize() { return 0.0F; } @Override - public void setDamage (double par1) - { + public void setDamage(double par1) { this.damage = par1; } @Override - public double getDamage () - { + public double getDamage() { return this.damage; } @@ -576,8 +562,7 @@ public double getDamage () * Sets the amount of knockback the arrow applies when it hits a mob. */ @Override - public void setKnockbackStrength (int par1) - { + public void setKnockbackStrength(int par1) { this.knockbackStrength = par1; } @@ -585,8 +570,7 @@ public void setKnockbackStrength (int par1) * If returns false, the item will not inflict any damage against entities. */ @Override - public boolean canAttackWithItem () - { + public boolean canAttackWithItem() { return false; } @@ -594,16 +578,12 @@ public boolean canAttackWithItem () * Whether the arrow has a stream of critical hit particles flying behind it. */ @Override - public void setIsCritical (boolean par1) - { + public void setIsCritical(boolean par1) { byte b0 = this.dataWatcher.getWatchableObjectByte(16); - if (par1) - { + if (par1) { this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 | 1))); - } - else - { + } else { this.dataWatcher.updateObject(16, Byte.valueOf((byte) (b0 & -2))); } } @@ -612,8 +592,7 @@ public void setIsCritical (boolean par1) * Whether the arrow has a stream of critical hit particles flying behind it. */ @Override - public boolean getIsCritical () - { + public boolean getIsCritical() { byte b0 = this.dataWatcher.getWatchableObjectByte(16); return (b0 & 1) != 0; } diff --git a/src/main/java/mods/natura/entity/HeatscarSpider.java b/src/main/java/mods/natura/entity/HeatscarSpider.java index d155d4b7..a6ad9b21 100644 --- a/src/main/java/mods/natura/entity/HeatscarSpider.java +++ b/src/main/java/mods/natura/entity/HeatscarSpider.java @@ -20,10 +20,8 @@ import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; -public class HeatscarSpider extends EntitySpider -{ - public HeatscarSpider(World par1World) - { +public class HeatscarSpider extends EntitySpider { + public HeatscarSpider(World par1World) { super(par1World); this.setSize(2.7F, 1.9F); this.isImmuneToFire = true; @@ -31,28 +29,23 @@ public HeatscarSpider(World par1World) } @SideOnly(Side.CLIENT) - public float spiderScaleAmount () - { + public float spiderScaleAmount() { return 2.0F; } @Override - protected void applyEntityAttributes () - { + protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(50.0D); //Health - this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(24D); //Detection range - this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.35); //Movespeed - this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(4.0); //Base damage + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(50.0D); // Health + this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(24D); // Detection range + this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1.35); // Movespeed + this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(4.0); // Base damage } @Override - protected void attackEntity (Entity par1Entity, float par2) - { - if (par2 > 2.0F && par2 < 6.0F && this.rand.nextInt(10) == 0) - { - if (this.onGround) - { + protected void attackEntity(Entity par1Entity, float par2) { + if (par2 > 2.0F && par2 < 6.0F && this.rand.nextInt(10) == 0) { + if (this.onGround) { double d0 = par1Entity.posX - this.posX; double d1 = par1Entity.posZ - this.posZ; float f2 = MathHelper.sqrt_double(d0 * d0 + d1 * d1); @@ -60,26 +53,20 @@ protected void attackEntity (Entity par1Entity, float par2) this.motionZ = d1 / f2 * 0.5D + this.motionZ * 0.20000000298023224D; this.motionY = 0.62D; } - } - else - { + } else { super.attackEntity(par1Entity, par2); } - } @Override - public void jump () - { + public void jump() { this.motionY = 0.62D; - if (this.isPotionActive(Potion.jump)) - { + if (this.isPotionActive(Potion.jump)) { this.motionY += (this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F; } - if (this.isSprinting()) - { + if (this.isSprinting()) { float f = this.rotationYaw * 0.017453292F; this.motionX -= MathHelper.sin(f) * 0.2F; this.motionZ += MathHelper.cos(f) * 0.2F; @@ -90,33 +77,29 @@ public void jump () } @Override - protected void fall (float par1) - { + protected void fall(float par1) { par1 = ForgeHooks.onLivingFall(this, par1); - if (par1 <= 0) - { + if (par1 <= 0) { return; } super.fall(par1); int i = MathHelper.ceiling_float_int(par1 - 5.0F); - if (i > 0) - { - if (i > 4) - { + if (i > 0) { + if (i > 4) { this.playSound("damage.fallbig", 1.0F, 1.0F); - } - else - { + } else { this.playSound("damage.fallsmall", 1.0F, 1.0F); } this.attackEntityFrom(DamageSource.fall, i); - Block j = this.worldObj.getBlock(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY - 0.20000000298023224D - this.yOffset), MathHelper.floor_double(this.posZ)); + Block j = this.worldObj.getBlock( + MathHelper.floor_double(this.posX), + MathHelper.floor_double(this.posY - 0.20000000298023224D - this.yOffset), + MathHelper.floor_double(this.posZ)); - if (j != null) - { + if (j != null) { SoundType stepsound = j.stepSound; this.playSound(stepsound.func_150496_b(), stepsound.getVolume() * 0.5F, stepsound.getPitch() * 0.75F); } @@ -124,104 +107,87 @@ protected void fall (float par1) } @Override - public boolean attackEntityAsMob (Entity par1Entity) - { - if (super.attackEntityAsMob(par1Entity)) - { - if (par1Entity instanceof EntityLiving) - { + public boolean attackEntityAsMob(Entity par1Entity) { + if (super.attackEntityAsMob(par1Entity)) { + if (par1Entity instanceof EntityLiving) { byte b0 = 0; - if (this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL) - { - if (this.worldObj.difficultySetting == EnumDifficulty.NORMAL) - { + if (this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL) { + if (this.worldObj.difficultySetting == EnumDifficulty.NORMAL) { b0 = 5; - } - else if (this.worldObj.difficultySetting == EnumDifficulty.HARD) - { + } else if (this.worldObj.difficultySetting == EnumDifficulty.HARD) { b0 = 10; } } - if (b0 > 0) - { + if (b0 > 0) { par1Entity.setFire(b0); } } return true; - } - else - { + } else { return false; } } - public int getAttackStrength (Entity par1Entity) - { + public int getAttackStrength(Entity par1Entity) { return 4; } @Override - protected Item getDropItem () - { + protected Item getDropItem() { return NContent.plantItem; } @Override - public EntityItem func_145778_a (Item par1, int par2, float par3) - { + public EntityItem func_145778_a(Item par1, int par2, float par3) { return this.entityDropItem(new ItemStack(par1, par2, 7), par3); } @Override - protected void dropFewItems (boolean par1, int par2) - { + protected void dropFewItems(boolean par1, int par2) { Item j = this.getDropItem(); - if (j != null) - { + if (j != null) { int k = this.rand.nextInt(3) + 2; - if (par2 > 0) - { + if (par2 > 0) { k += this.rand.nextInt(par2 + 1); } - for (int l = 0; l < k; ++l) - { + for (int l = 0; l < k; ++l) { this.dropItem(j, 1); } } } @Override - public boolean getCanSpawnHere () - { - return this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL && this.worldObj.checkNoEntityCollision(this.boundingBox) - && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(this.boundingBox); + public boolean getCanSpawnHere() { + return this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL + && this.worldObj.checkNoEntityCollision(this.boundingBox) + && this.worldObj + .getCollidingBoundingBoxes(this, this.boundingBox) + .isEmpty() + && !this.worldObj.isAnyLiquid(this.boundingBox); } - protected BabyHeatscarSpider createBabyInstance () - { + protected BabyHeatscarSpider createBabyInstance() { return new BabyHeatscarSpider(this.worldObj); } @Override - public void setDead () - { + public void setDead() { - if (!this.worldObj.isRemote) - { + if (!this.worldObj.isRemote) { int num = PHNatura.babyHeatscarMaximum - PHNatura.babyHeatscarMinimum + 1; int amount = rand.nextInt(num) + PHNatura.babyHeatscarMinimum; - for (int i = 0; i < amount; i++) - { + for (int i = 0; i < amount; i++) { double f = rand.nextDouble() * 2; double f1 = rand.nextDouble() * 2; BabyHeatscarSpider babyspider = this.createBabyInstance(); - babyspider.setLocationAndAngles(this.posX + f, this.posY + 0.5D, this.posZ + f1, this.rand.nextFloat() * 360.0F, 0.0F); + babyspider.setLocationAndAngles( + this.posX + f, this.posY + 0.5D, this.posZ + f1, this.rand.nextFloat() * 360.0F, 0.0F); this.worldObj.spawnEntityInWorld(babyspider); } } diff --git a/src/main/java/mods/natura/entity/ImpEntity.java b/src/main/java/mods/natura/entity/ImpEntity.java index 777373b9..5bc67f51 100644 --- a/src/main/java/mods/natura/entity/ImpEntity.java +++ b/src/main/java/mods/natura/entity/ImpEntity.java @@ -19,12 +19,10 @@ import net.minecraft.world.World; import net.minecraft.world.WorldProviderHell; -public class ImpEntity extends EntityAnimal -{ - public ImpEntity(World par1World) - { +public class ImpEntity extends EntityAnimal { + public ImpEntity(World par1World) { super(par1World); - //this.texture = "/mods/natura/textures/mob/imp.png"; + // this.texture = "/mods/natura/textures/mob/imp.png"; this.setSize(0.9F, 0.9F); this.getNavigator().setAvoidsWater(true); this.isImmuneToFire = true; @@ -44,21 +42,18 @@ public ImpEntity(World par1World) * Returns true if the newer Entity AI code should be run */ @Override - public boolean isAIEnabled () - { + public boolean isAIEnabled() { return true; } @Override - protected void applyEntityAttributes () - { + protected void applyEntityAttributes() { super.applyEntityAttributes(); - this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(40.0D); //Health + this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(40.0D); // Health } @Override - protected void updateAITasks () - { + protected void updateAITasks() { super.updateAITasks(); } @@ -66,8 +61,7 @@ protected void updateAITasks () * Returns the sound this mob makes while it's alive. */ @Override - protected String getLivingSound () - { + protected String getLivingSound() { return "mob.pig.say"; } @@ -75,8 +69,7 @@ protected String getLivingSound () * Returns the sound this mob makes when it is hurt. */ @Override - protected String getHurtSound () - { + protected String getHurtSound() { return "mob.pig.say"; } @@ -84,16 +77,14 @@ protected String getHurtSound () * Returns the sound this mob makes on death. */ @Override - protected String getDeathSound () - { + protected String getDeathSound() { return "mob.pig.death"; } /** * Plays step sound at given x, y, z for the entity */ - protected void playStepSound (int par1, int par2, int par3, int par4) - { + protected void playStepSound(int par1, int par2, int par3, int par4) { this.playSound("mob.pig.step", 0.15F, 1.0F); } @@ -101,8 +92,7 @@ protected void playStepSound (int par1, int par2, int par3, int par4) * Returns the item ID for the item the mob drops on death. */ @Override - protected Item getDropItem () - { + protected Item getDropItem() { return NContent.impMeat; } @@ -111,18 +101,15 @@ protected Item getDropItem () * par2 - Level of Looting used to kill this mob. */ @Override - protected void dropFewItems (boolean par1, int par2) - { + protected void dropFewItems(boolean par1, int par2) { int amount = this.rand.nextInt(3) + 1 + this.rand.nextInt(1 + par2); - for (int iter = 0; iter < amount; ++iter) - { + for (int iter = 0; iter < amount; ++iter) { this.dropItem(NContent.impMeat, 1); } amount = this.rand.nextInt(5) + 2 + this.rand.nextInt(1 + par2 * 2); - for (int iter = 0; iter < amount; ++iter) - { + for (int iter = 0; iter < amount; ++iter) { this.entityDropItem(new ItemStack(NContent.plantItem, 1, 6), 0f); } } @@ -130,8 +117,7 @@ protected void dropFewItems (boolean par1, int par2) /** * This function is used when two same-species animals in 'love mode' breed to generate the new baby animal. */ - public ImpEntity spawnBabyAnimal (EntityAgeable par1EntityAgeable) - { + public ImpEntity spawnBabyAnimal(EntityAgeable par1EntityAgeable) { return new ImpEntity(this.worldObj); } @@ -140,22 +126,25 @@ public ImpEntity spawnBabyAnimal (EntityAgeable par1EntityAgeable) * the animal type) */ @Override - public boolean isBreedingItem (ItemStack par1ItemStack) - { - return par1ItemStack != null && par1ItemStack.getItem() == NContent.bowlStew && par1ItemStack.getItemDamage() >= 13; + public boolean isBreedingItem(ItemStack par1ItemStack) { + return par1ItemStack != null + && par1ItemStack.getItem() == NContent.bowlStew + && par1ItemStack.getItemDamage() >= 13; } @Override - public EntityAgeable createChild (EntityAgeable par1EntityAgeable) - { + public EntityAgeable createChild(EntityAgeable par1EntityAgeable) { return this.spawnBabyAnimal(par1EntityAgeable); } @Override - public boolean getCanSpawnHere () - { - //return true; - return this.worldObj.provider instanceof WorldProviderHell && this.worldObj.checkNoEntityCollision(this.boundingBox) - && this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(this.boundingBox); + public boolean getCanSpawnHere() { + // return true; + return this.worldObj.provider instanceof WorldProviderHell + && this.worldObj.checkNoEntityCollision(this.boundingBox) + && this.worldObj + .getCollidingBoundingBoxes(this, this.boundingBox) + .isEmpty() + && !this.worldObj.isAnyLiquid(this.boundingBox); } } diff --git a/src/main/java/mods/natura/entity/NitroCreeper.java b/src/main/java/mods/natura/entity/NitroCreeper.java index c32495de..58873bab 100644 --- a/src/main/java/mods/natura/entity/NitroCreeper.java +++ b/src/main/java/mods/natura/entity/NitroCreeper.java @@ -9,16 +9,14 @@ import net.minecraft.util.EntityDamageSource; import net.minecraft.world.World; -public class NitroCreeper extends EntityCreeper -{ +public class NitroCreeper extends EntityCreeper { protected int fuseTime = 12; protected int timeSinceIgnited; protected int lastActiveTime; public float explosionRadius = 1f; - public NitroCreeper(World world) - { + public NitroCreeper(World world) { super(world); this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0F, false)); this.isImmuneToFire = true; @@ -37,65 +35,50 @@ public void initCreature () }*/ @Override - protected void fall (float distance) - { - if (!this.worldObj.isRemote) - { - if (distance > 5) - { + protected void fall(float distance) { + if (!this.worldObj.isRemote) { + if (distance > 5) { boolean flag = this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing"); - if (this.getPowered()) - { + if (this.getPowered()) { this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 20f, flag); - } - else - { + } else { this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 3f, false); } this.setDead(); - } - else - super.fall(distance); + } else super.fall(distance); } } @Override - public void writeEntityToNBT (NBTTagCompound tagCompound) - { + public void writeEntityToNBT(NBTTagCompound tagCompound) { super.writeEntityToNBT(tagCompound); tagCompound.setShort("Fuse", (short) this.fuseTime); } @Override - public void readEntityFromNBT (NBTTagCompound tagCompound) - { + public void readEntityFromNBT(NBTTagCompound tagCompound) { super.readEntityFromNBT(tagCompound); - if (tagCompound.hasKey("Fuse")) - { + if (tagCompound.hasKey("Fuse")) { this.fuseTime = tagCompound.getShort("Fuse"); } } @Override - public void onUpdate () - { - if (this.isEntityAlive()) - { + public void onUpdate() { + if (this.isEntityAlive()) { this.lastActiveTime = this.timeSinceIgnited; int i = this.getCreeperState(); - if (i > 0 && this.timeSinceIgnited == 0) - { + if (i > 0 && this.timeSinceIgnited == 0) { this.playSound("random.fuse", 1.0F, 0.5F); } this.timeSinceIgnited += i; - if (this.timeSinceIgnited < 0) - { + if (this.timeSinceIgnited < 0) { this.timeSinceIgnited = 0; } @@ -103,20 +86,15 @@ public void onUpdate () int lengthBoost = 4 * (3 - difficulty); int powered = this.getPowered() ? 12 : 0; - if (this.timeSinceIgnited >= this.fuseTime + difficulty + powered) - { + if (this.timeSinceIgnited >= this.fuseTime + difficulty + powered) { this.timeSinceIgnited = this.fuseTime; - if (!this.worldObj.isRemote) - { + if (!this.worldObj.isRemote) { boolean flag = this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing"); - if (powered > 0) - { + if (powered > 0) { this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 20f, flag); - } - else - { + } else { this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, 3f, flag); } @@ -129,44 +107,35 @@ public void onUpdate () } @Override - public float getCreeperFlashIntensity (float intensity) - { + public float getCreeperFlashIntensity(float intensity) { return (this.lastActiveTime + (this.timeSinceIgnited - this.lastActiveTime) * intensity) / (this.fuseTime - 2); } @Override - protected void dropFewItems (boolean hitByPlayer, int lootingLevel) - { + protected void dropFewItems(boolean hitByPlayer, int lootingLevel) { Item dropItem = this.getDropItem(); - if (dropItem != null) - { + if (dropItem != null) { int dropCount = this.rand.nextInt(4) + 2; - if (lootingLevel > 0) - { - dropCount += this.rand.nextInt(lootingLevel + 1); + if (lootingLevel > 0) { + dropCount += this.rand.nextInt(lootingLevel + 1); } - for (int l = 0; l < dropCount; ++l) - { + for (int l = 0; l < dropCount; ++l) { this.dropItem(dropItem, 1); } } - if (this.getPowered()) - { - if (dropItem != null) - { + if (this.getPowered()) { + if (dropItem != null) { int dropCount = this.rand.nextInt(40) + 20; - if (lootingLevel > 0) - { - dropCount += this.rand.nextInt(lootingLevel * 6 + 1); + if (lootingLevel > 0) { + dropCount += this.rand.nextInt(lootingLevel * 6 + 1); } - for (int l = 0; l < dropCount; ++l) - { + for (int l = 0; l < dropCount; ++l) { this.dropItem(dropItem, 1); } } @@ -186,10 +155,9 @@ protected void dropFewItems (boolean hitByPlayer, int lootingLevel) } } - public boolean attackEntityFrom (DamageSource source, int damage) - { - if (source instanceof EntityDamageSource && ((EntityDamageSource) source).getEntity() instanceof EntityIronGolem) - { + public boolean attackEntityFrom(DamageSource source, int damage) { + if (source instanceof EntityDamageSource + && ((EntityDamageSource) source).getEntity() instanceof EntityIronGolem) { damage = 1000; } return super.attackEntityFrom(source, damage); diff --git a/src/main/java/mods/natura/gui/FurnaceContainer.java b/src/main/java/mods/natura/gui/FurnaceContainer.java index 0b024639..5abc718f 100644 --- a/src/main/java/mods/natura/gui/FurnaceContainer.java +++ b/src/main/java/mods/natura/gui/FurnaceContainer.java @@ -13,38 +13,32 @@ import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraft.tileentity.TileEntityFurnace; -public class FurnaceContainer extends Container -{ +public class FurnaceContainer extends Container { private NetherrackFurnaceLogic furnace; private int lastCookTime; private int lastBurnTime; private int lastItemBurnTime; - public FurnaceContainer(InventoryPlayer par1InventoryPlayer, NetherrackFurnaceLogic par2TileEntityFurnace) - { + public FurnaceContainer(InventoryPlayer par1InventoryPlayer, NetherrackFurnaceLogic par2TileEntityFurnace) { this.furnace = par2TileEntityFurnace; this.addSlotToContainer(new Slot(par2TileEntityFurnace, 0, 56, 17)); this.addSlotToContainer(new Slot(par2TileEntityFurnace, 1, 56, 53)); this.addSlotToContainer(new SlotFurnace(par1InventoryPlayer.player, par2TileEntityFurnace, 2, 116, 35)); int i; - for (i = 0; i < 3; ++i) - { - for (int j = 0; j < 9; ++j) - { + for (i = 0; i < 3; ++i) { + for (int j = 0; j < 9; ++j) { this.addSlotToContainer(new Slot(par1InventoryPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18)); } } - for (i = 0; i < 9; ++i) - { + for (i = 0; i < 9; ++i) { this.addSlotToContainer(new Slot(par1InventoryPlayer, i, 8 + i * 18, 142)); } } @Override - public void addCraftingToCrafters (ICrafting par1ICrafting) - { + public void addCraftingToCrafters(ICrafting par1ICrafting) { super.addCraftingToCrafters(par1ICrafting); par1ICrafting.sendProgressBarUpdate(this, 0, this.furnace.furnaceCookTime); par1ICrafting.sendProgressBarUpdate(this, 1, this.furnace.furnaceBurnTime); @@ -55,26 +49,21 @@ public void addCraftingToCrafters (ICrafting par1ICrafting) * Looks for changes made in the container, sends them to every listener. */ @Override - public void detectAndSendChanges () - { + public void detectAndSendChanges() { super.detectAndSendChanges(); - for (int i = 0; i < this.crafters.size(); ++i) - { + for (int i = 0; i < this.crafters.size(); ++i) { ICrafting icrafting = (ICrafting) this.crafters.get(i); - if (this.lastCookTime != this.furnace.furnaceCookTime) - { + if (this.lastCookTime != this.furnace.furnaceCookTime) { icrafting.sendProgressBarUpdate(this, 0, this.furnace.furnaceCookTime); } - if (this.lastBurnTime != this.furnace.furnaceBurnTime) - { + if (this.lastBurnTime != this.furnace.furnaceBurnTime) { icrafting.sendProgressBarUpdate(this, 1, this.furnace.furnaceBurnTime); } - if (this.lastItemBurnTime != this.furnace.currentItemBurnTime) - { + if (this.lastItemBurnTime != this.furnace.currentItemBurnTime) { icrafting.sendProgressBarUpdate(this, 2, this.furnace.currentItemBurnTime); } } @@ -86,27 +75,22 @@ public void detectAndSendChanges () @Override @SideOnly(Side.CLIENT) - public void updateProgressBar (int par1, int par2) - { - if (par1 == 0) - { + public void updateProgressBar(int par1, int par2) { + if (par1 == 0) { this.furnace.furnaceCookTime = par2; } - if (par1 == 1) - { + if (par1 == 1) { this.furnace.furnaceBurnTime = par2; } - if (par1 == 2) - { + if (par1 == 2) { this.furnace.currentItemBurnTime = par2; } } @Override - public boolean canInteractWith (EntityPlayer par1EntityPlayer) - { + public boolean canInteractWith(EntityPlayer par1EntityPlayer) { return this.furnace.isUseableByPlayer(par1EntityPlayer); } @@ -114,69 +98,47 @@ public boolean canInteractWith (EntityPlayer par1EntityPlayer) * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. */ @Override - public ItemStack transferStackInSlot (EntityPlayer par1EntityPlayer, int par2) - { + public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) { ItemStack itemstack = null; Slot slot = (Slot) this.inventorySlots.get(par2); - if (slot != null && slot.getHasStack()) - { + if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); - if (par2 == 2) - { - if (!this.mergeItemStack(itemstack1, 3, 39, true)) - { + if (par2 == 2) { + if (!this.mergeItemStack(itemstack1, 3, 39, true)) { return null; } slot.onSlotChange(itemstack1, itemstack); - } - else if (par2 != 1 && par2 != 0) - { - if (FurnaceRecipes.smelting().getSmeltingResult(itemstack1) != null) - { - if (!this.mergeItemStack(itemstack1, 0, 1, false)) - { + } else if (par2 != 1 && par2 != 0) { + if (FurnaceRecipes.smelting().getSmeltingResult(itemstack1) != null) { + if (!this.mergeItemStack(itemstack1, 0, 1, false)) { return null; } - } - else if (TileEntityFurnace.isItemFuel(itemstack1)) - { - if (!this.mergeItemStack(itemstack1, 1, 2, false)) - { + } else if (TileEntityFurnace.isItemFuel(itemstack1)) { + if (!this.mergeItemStack(itemstack1, 1, 2, false)) { return null; } - } - else if (par2 >= 3 && par2 < 30) - { - if (!this.mergeItemStack(itemstack1, 30, 39, false)) - { + } else if (par2 >= 3 && par2 < 30) { + if (!this.mergeItemStack(itemstack1, 30, 39, false)) { return null; } - } - else if (par2 >= 30 && par2 < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) - { + } else if (par2 >= 30 && par2 < 39 && !this.mergeItemStack(itemstack1, 3, 30, false)) { return null; } - } - else if (!this.mergeItemStack(itemstack1, 3, 39, false)) - { + } else if (!this.mergeItemStack(itemstack1, 3, 39, false)) { return null; } - if (itemstack1.stackSize == 0) - { + if (itemstack1.stackSize == 0) { slot.putStack((ItemStack) null); - } - else - { + } else { slot.onSlotChanged(); } - if (itemstack1.stackSize == itemstack.stackSize) - { + if (itemstack1.stackSize == itemstack.stackSize) { return null; } diff --git a/src/main/java/mods/natura/gui/FurnaceGui.java b/src/main/java/mods/natura/gui/FurnaceGui.java index ff137d5f..a073ec9c 100644 --- a/src/main/java/mods/natura/gui/FurnaceGui.java +++ b/src/main/java/mods/natura/gui/FurnaceGui.java @@ -1,7 +1,5 @@ package mods.natura.gui; -import org.lwjgl.opengl.GL11; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import mods.natura.blocks.tech.NetherrackFurnaceLogic; @@ -10,15 +8,15 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ContainerFurnace; import net.minecraft.util.ResourceLocation; +import org.lwjgl.opengl.GL11; @SideOnly(Side.CLIENT) -public class FurnaceGui extends GuiContainer -{ - private static final ResourceLocation furnaceGuiTextures = new ResourceLocation("textures/gui/container/furnace.png"); +public class FurnaceGui extends GuiContainer { + private static final ResourceLocation furnaceGuiTextures = + new ResourceLocation("textures/gui/container/furnace.png"); private NetherrackFurnaceLogic logic; - public FurnaceGui(InventoryPlayer par1InventoryPlayer, NetherrackFurnaceLogic par2TileEntityFurnace) - { + public FurnaceGui(InventoryPlayer par1InventoryPlayer, NetherrackFurnaceLogic par2TileEntityFurnace) { super(new ContainerFurnace(par1InventoryPlayer, par2TileEntityFurnace)); this.logic = par2TileEntityFurnace; } @@ -27,8 +25,7 @@ public FurnaceGui(InventoryPlayer par1InventoryPlayer, NetherrackFurnaceLogic pa * Draw the foreground layer for the GuiContainer (everything in front of the items) */ @Override - protected void drawGuiContainerForegroundLayer (int par1, int par2) - { + protected void drawGuiContainerForegroundLayer(int par1, int par2) { String s = this.logic.isInvNameLocalized() ? this.logic.getInvName() : I18n.format(this.logic.getInvName()); this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752); this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752); @@ -38,8 +35,7 @@ protected void drawGuiContainerForegroundLayer (int par1, int par2) * Draw the background layer for the GuiContainer (everything behind the items) */ @Override - protected void drawGuiContainerBackgroundLayer (float par1, int par2, int par3) - { + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(furnaceGuiTextures); int k = (this.width - this.xSize) / 2; @@ -47,8 +43,7 @@ protected void drawGuiContainerBackgroundLayer (float par1, int par2, int par3) this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize); int i1; - if (this.logic.isBurning()) - { + if (this.logic.isBurning()) { i1 = this.logic.getBurnTimeRemainingScaled(12); this.drawTexturedModalRect(k + 56, l + 36 + 12 - i1, 176, 12 - i1, 14, i1 + 2); } diff --git a/src/main/java/mods/natura/gui/NGuiHandler.java b/src/main/java/mods/natura/gui/NGuiHandler.java index 6eacf49f..2cefc6f8 100644 --- a/src/main/java/mods/natura/gui/NGuiHandler.java +++ b/src/main/java/mods/natura/gui/NGuiHandler.java @@ -5,34 +5,27 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; -public class NGuiHandler implements IGuiHandler -{ +public class NGuiHandler implements IGuiHandler { public static final int craftingGui = 1; public static final int furnaceGui = 2; @Override - public Object getClientGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z) - { - if (ID == craftingGui) - { + public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + if (ID == craftingGui) { return new WorkbenchGui(player.inventory, world); } - if (ID == furnaceGui) - { + if (ID == furnaceGui) { return new FurnaceGui(player.inventory, (NetherrackFurnaceLogic) world.getTileEntity(x, y, z)); } return null; } @Override - public Object getServerGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z) - { - if (ID == craftingGui) - { + public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) { + if (ID == craftingGui) { return new WorkbenchContainer(player.inventory, world); } - if (ID == furnaceGui) - { + if (ID == furnaceGui) { return new FurnaceContainer(player.inventory, (NetherrackFurnaceLogic) world.getTileEntity(x, y, z)); } return null; diff --git a/src/main/java/mods/natura/gui/WorkbenchContainer.java b/src/main/java/mods/natura/gui/WorkbenchContainer.java index ae81a8bc..fe276a32 100644 --- a/src/main/java/mods/natura/gui/WorkbenchContainer.java +++ b/src/main/java/mods/natura/gui/WorkbenchContainer.java @@ -12,36 +12,30 @@ import net.minecraft.item.crafting.CraftingManager; import net.minecraft.world.World; -public class WorkbenchContainer extends Container -{ +public class WorkbenchContainer extends Container { public InventoryCrafting craftMatrix; public IInventory craftResult; private World worldObj; - public WorkbenchContainer(InventoryPlayer inventoryplayer, World world) - { + public WorkbenchContainer(InventoryPlayer inventoryplayer, World world) { craftMatrix = new InventoryCrafting(this, 3, 3); craftResult = new InventoryCraftResult(); worldObj = world; this.addSlotToContainer(new SlotCrafting(inventoryplayer.player, craftMatrix, craftResult, 0, 124, 35)); - for (int i = 0; i < 3; i++) - { - for (int l = 0; l < 3; l++) - { + for (int i = 0; i < 3; i++) { + for (int l = 0; l < 3; l++) { this.addSlotToContainer(new Slot(craftMatrix, l + i * 3, 30 + l * 18, 17 + i * 18)); } } - for (int column = 0; column < 3; column++) - { - for (int row = 0; row < 9; row++) - { - this.addSlotToContainer(new Slot(inventoryplayer, row + column * 9 + 9, 8 + row * 18, 84 + column * 18)); + for (int column = 0; column < 3; column++) { + for (int row = 0; row < 9; row++) { + this.addSlotToContainer( + new Slot(inventoryplayer, row + column * 9 + 9, 8 + row * 18, 84 + column * 18)); } } - for (int column = 0; column < 9; column++) - { + for (int column = 0; column < 9; column++) { this.addSlotToContainer(new Slot(inventoryplayer, column, 8 + column * 18, 142)); } @@ -49,83 +43,60 @@ public WorkbenchContainer(InventoryPlayer inventoryplayer, World world) } @Override - public void onCraftMatrixChanged (IInventory iinventory) - { - craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj)); + public void onCraftMatrixChanged(IInventory iinventory) { + craftResult.setInventorySlotContents( + 0, CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj)); } @Override - public void onContainerClosed (EntityPlayer entityplayer) - { + public void onContainerClosed(EntityPlayer entityplayer) { super.onContainerClosed(entityplayer); - if (worldObj.isRemote) - { + if (worldObj.isRemote) { return; } - for (int i = 0; i < 9; i++) - { + for (int i = 0; i < 9; i++) { ItemStack itemstack = craftMatrix.getStackInSlot(i); - if (itemstack != null) - { + if (itemstack != null) { entityplayer.entityDropItem(itemstack, 0); } } } @Override - public boolean canInteractWith (EntityPlayer entityplayer) - { + public boolean canInteractWith(EntityPlayer entityplayer) { return true; } @Override - public ItemStack transferStackInSlot (EntityPlayer entityplayer, int i) - { + public ItemStack transferStackInSlot(EntityPlayer entityplayer, int i) { ItemStack itemstack = null; Slot slot = (Slot) inventorySlots.get(i); - if (slot != null && slot.getHasStack()) - { + if (slot != null && slot.getHasStack()) { ItemStack itemstack1 = slot.getStack(); itemstack = itemstack1.copy(); - if (i == 0) - { - if (!mergeItemStack(itemstack1, 10, 46, true)) - { + if (i == 0) { + if (!mergeItemStack(itemstack1, 10, 46, true)) { return null; } - } - else if (i >= 10 && i < 37) - { - if (!mergeItemStack(itemstack1, 37, 46, false)) - { + } else if (i >= 10 && i < 37) { + if (!mergeItemStack(itemstack1, 37, 46, false)) { return null; } - } - else if (i >= 37 && i < 46) - { - if (!mergeItemStack(itemstack1, 10, 37, false)) - { + } else if (i >= 37 && i < 46) { + if (!mergeItemStack(itemstack1, 10, 37, false)) { return null; } - } - else if (!mergeItemStack(itemstack1, 10, 46, false)) - { + } else if (!mergeItemStack(itemstack1, 10, 46, false)) { return null; } - if (itemstack1.stackSize == 0) - { + if (itemstack1.stackSize == 0) { slot.putStack(null); - } - else - { + } else { slot.onSlotChanged(); } - if (itemstack1.stackSize != itemstack.stackSize) - { + if (itemstack1.stackSize != itemstack.stackSize) { slot.onPickupFromSlot(entityplayer, itemstack1); - } - else - { + } else { return null; } } diff --git a/src/main/java/mods/natura/gui/WorkbenchGui.java b/src/main/java/mods/natura/gui/WorkbenchGui.java index acec7324..005056d1 100644 --- a/src/main/java/mods/natura/gui/WorkbenchGui.java +++ b/src/main/java/mods/natura/gui/WorkbenchGui.java @@ -1,17 +1,14 @@ package mods.natura.gui; -import org.lwjgl.opengl.GL11; - import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; +import org.lwjgl.opengl.GL11; -public class WorkbenchGui extends GuiContainer -{ - public WorkbenchGui(InventoryPlayer inventoryplayer, World world) - { +public class WorkbenchGui extends GuiContainer { + public WorkbenchGui(InventoryPlayer inventoryplayer, World world) { super(new WorkbenchContainer(inventoryplayer, world)); } @@ -31,18 +28,17 @@ protected void drawGuiContainerBackgroundLayer (float f, int i, int j) drawTexturedModalRect(l, i1, 0, 0, xSize, ySize); }*/ - private static final ResourceLocation field_110422_t = new ResourceLocation("textures/gui/container/crafting_table.png"); + private static final ResourceLocation field_110422_t = + new ResourceLocation("textures/gui/container/crafting_table.png"); @Override - protected void drawGuiContainerForegroundLayer (int par1, int par2) - { + protected void drawGuiContainerForegroundLayer(int par1, int par2) { this.fontRendererObj.drawString(I18n.format("container.crafting"), 28, 6, 4210752); this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752); } @Override - protected void drawGuiContainerBackgroundLayer (float par1, int par2, int par3) - { + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); this.mc.getTextureManager().bindTexture(field_110422_t); int k = (this.width - this.xSize) / 2; diff --git a/src/main/java/mods/natura/items/BerryItem.java b/src/main/java/mods/natura/items/BerryItem.java index b13273c8..a5ca320e 100644 --- a/src/main/java/mods/natura/items/BerryItem.java +++ b/src/main/java/mods/natura/items/BerryItem.java @@ -1,9 +1,8 @@ package mods.natura.items; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mods.natura.common.NaturaTab; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -17,7 +16,7 @@ public class BerryItem extends ItemFood { public IIcon[] icons; - public String[] textureNames = new String[] { "rasp", "blue", "black", "geo" }; + public String[] textureNames = new String[] {"rasp", "blue", "black", "geo"}; public BerryItem(int healAmount) { super(healAmount, 0.4F, false); @@ -28,7 +27,7 @@ public BerryItem(int healAmount) { } @Override - public ItemStack onItemRightClick (ItemStack itemStack, World world, EntityPlayer player) { + public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { if (player.canEat(true) && player.getFoodStats().getSaturationLevel() < 18F) { player.setItemInUse(itemStack, this.getMaxItemUseDuration(itemStack)); } @@ -36,19 +35,19 @@ public ItemStack onItemRightClick (ItemStack itemStack, World world, EntityPlaye } @Override - public int getMaxItemUseDuration (ItemStack itemStack) { + public int getMaxItemUseDuration(ItemStack itemStack) { return 16; } @SideOnly(Side.CLIENT) @Override - public IIcon getIconFromDamage (int meta) { + public IIcon getIconFromDamage(int meta) { return meta >= icons.length ? icons[0] : icons[meta]; } @SideOnly(Side.CLIENT) @Override - public void registerIcons (IIconRegister iconRegister) { + public void registerIcons(IIconRegister iconRegister) { this.icons = new IIcon[textureNames.length]; for (int i = 0; i < this.icons.length; ++i) { @@ -58,14 +57,15 @@ public void registerIcons (IIconRegister iconRegister) { @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) { + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { list.add(StatCollector.translateToLocal("tooltip.berry")); } /* Name override */ @Override - public String getUnlocalizedName (ItemStack itemstack) { - return "item.berry." + textureNames[itemstack.getItemDamage() >= textureNames.length ? 0 : itemstack.getItemDamage()]; + public String getUnlocalizedName(ItemStack itemstack) { + return "item.berry." + + textureNames[itemstack.getItemDamage() >= textureNames.length ? 0 : itemstack.getItemDamage()]; } /** @@ -73,10 +73,9 @@ public String getUnlocalizedName (ItemStack itemstack) { */ @SideOnly(Side.CLIENT) @Override - public void getSubItems (Item item, CreativeTabs par2CreativeTabs, List par3List) { + public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List par3List) { for (int i = 0; i < 4; ++i) { par3List.add(new ItemStack(item, 1, i)); } } - } diff --git a/src/main/java/mods/natura/items/BerryMedley.java b/src/main/java/mods/natura/items/BerryMedley.java index fb50067b..37a91f44 100644 --- a/src/main/java/mods/natura/items/BerryMedley.java +++ b/src/main/java/mods/natura/items/BerryMedley.java @@ -1,16 +1,14 @@ package mods.natura.items; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mods.natura.common.NaturaTab; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.ItemFood; import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; import net.minecraft.world.World; @@ -25,7 +23,7 @@ public BerryMedley(int healAmount) { } @Override - public ItemStack onItemRightClick (ItemStack itemStack, World world, EntityPlayer player) { + public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) { if (player.canEat(true) && player.getFoodStats().getSaturationLevel() < 18F) { player.setItemInUse(itemStack, this.getMaxItemUseDuration(itemStack)); } @@ -34,7 +32,7 @@ public ItemStack onItemRightClick (ItemStack itemStack, World world, EntityPlaye } @Override - public ItemStack onEaten (ItemStack itemStack, World world, EntityPlayer player) { + public ItemStack onEaten(ItemStack itemStack, World world, EntityPlayer player) { ItemStack stack = super.onEaten(itemStack, world, player); if (!player.capabilities.isCreativeMode) { @@ -49,25 +47,25 @@ public ItemStack onEaten (ItemStack itemStack, World world, EntityPlayer player) } @Override - public int getMaxItemUseDuration (ItemStack itemStack) { + public int getMaxItemUseDuration(ItemStack itemStack) { return 32; } @SideOnly(Side.CLIENT) @Override - public void registerIcons (IIconRegister iconRegister) { - itemIcon = iconRegister.registerIcon("natura:berry_medley"); + public void registerIcons(IIconRegister iconRegister) { + itemIcon = iconRegister.registerIcon("natura:berry_medley"); } @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) { + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { list.add(StatCollector.translateToLocal("tooltip.berrymedley")); } /* Name override */ @Override - public String getUnlocalizedName (ItemStack itemstack) { + public String getUnlocalizedName(ItemStack itemstack) { return "item.berry.medley"; } } diff --git a/src/main/java/mods/natura/items/BoneBag.java b/src/main/java/mods/natura/items/BoneBag.java index 66815d54..77ee5962 100644 --- a/src/main/java/mods/natura/items/BoneBag.java +++ b/src/main/java/mods/natura/items/BoneBag.java @@ -1,10 +1,9 @@ package mods.natura.items; -import java.util.List; - import cpw.mods.fml.common.eventhandler.Event.Result; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mods.natura.common.NaturaTab; import net.minecraft.block.Block; import net.minecraft.block.BlockCocoa; @@ -23,64 +22,61 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.BonemealEvent; -public class BoneBag extends Item -{ +public class BoneBag extends Item { String textureName; - public BoneBag(String texture) - { + public BoneBag(String texture) { super(); textureName = texture; this.setCreativeTab(NaturaTab.tab); } @Override - public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float par8, float par9, float par10) - { - if (side != 1) - return false; + public boolean onItemUse( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float par8, + float par9, + float par10) { + if (side != 1) return false; boolean planted = false; - for (int posX = x - 1; posX <= x + 1; posX++) - { - for (int posZ = z - 1; posZ <= z + 1; posZ++) - { - if (player.canPlayerEdit(posX, y, posZ, side, stack) && player.canPlayerEdit(posX, y + 1, posZ, side, stack)) - { - if (applyBonemeal(stack, world, posX, y, posZ, player)) - { + for (int posX = x - 1; posX <= x + 1; posX++) { + for (int posZ = z - 1; posZ <= z + 1; posZ++) { + if (player.canPlayerEdit(posX, y, posZ, side, stack) + && player.canPlayerEdit(posX, y + 1, posZ, side, stack)) { + if (applyBonemeal(stack, world, posX, y, posZ, player)) { planted = true; - if (!world.isRemote) - { + if (!world.isRemote) { world.playAuxSFX(2005, posX, y, posZ, 0); } } } } } - if (planted) - { - if (!player.capabilities.isCreativeMode) - stack.stackSize--; - if (stack.stackSize < 1) - player.destroyCurrentEquippedItem(); + if (planted) { + if (!player.capabilities.isCreativeMode) stack.stackSize--; + if (stack.stackSize < 1) player.destroyCurrentEquippedItem(); } return planted; } - public static boolean applyBonemeal (ItemStack par0ItemStack, World par1World, int par2, int par3, int par4, EntityPlayer player) - { + public static boolean applyBonemeal( + ItemStack par0ItemStack, World par1World, int par2, int par3, int par4, EntityPlayer player) { Block l = par1World.getBlock(par2, par3, par4); BonemealEvent event = new BonemealEvent(player, par1World, l, par2, par3, par4); - if (MinecraftForge.EVENT_BUS.post(event)) - { + if (MinecraftForge.EVENT_BUS.post(event)) { return false; } event.getResult(); - if (event.getResult() == Result.ALLOW) - { + if (event.getResult() == Result.ALLOW) { /*if (!par1World.isRemote) { par0ItemStack.stackSize--; @@ -88,110 +84,81 @@ public static boolean applyBonemeal (ItemStack par0ItemStack, World par1World, i return true; } - if (l == Blocks.sapling) - { - if (!par1World.isRemote) - { - if (par1World.rand.nextFloat() < 0.45D) - { - ((BlockSapling) Blocks.sapling).func_149879_c/*markOrGrowMarked*/(par1World, par2, par3, par4, par1World.rand); + if (l == Blocks.sapling) { + if (!par1World.isRemote) { + if (par1World.rand.nextFloat() < 0.45D) { + ((BlockSapling) Blocks.sapling) + .func_149879_c /*markOrGrowMarked*/(par1World, par2, par3, par4, par1World.rand); } - //--par0ItemStack.stackSize; + // --par0ItemStack.stackSize; } return true; - } - else if (l != Blocks.brown_mushroom && l != Blocks.red_mushroom) - { - if (l != Blocks.melon_stem && l != Blocks.pumpkin_stem) - { - if (l != null && l instanceof BlockCrops) - { - if (par1World.getBlockMetadata(par2, par3, par4) == 7) - { + } else if (l != Blocks.brown_mushroom && l != Blocks.red_mushroom) { + if (l != Blocks.melon_stem && l != Blocks.pumpkin_stem) { + if (l != null && l instanceof BlockCrops) { + if (par1World.getBlockMetadata(par2, par3, par4) == 7) { return false; - } - else - { - if (!par1World.isRemote) - { - ((BlockCrops) l).func_149863_m/*fertilize*/(par1World, par2, par3, par4); - //--par0ItemStack.stackSize; + } else { + if (!par1World.isRemote) { + ((BlockCrops) l).func_149863_m /*fertilize*/(par1World, par2, par3, par4); + // --par0ItemStack.stackSize; } return true; } - } - else - { + } else { int i1; int j1; int k1; - if (l == Blocks.cocoa) - { + if (l == Blocks.cocoa) { i1 = par1World.getBlockMetadata(par2, par3, par4); j1 = BlockDirectional.getDirection(i1); k1 = BlockCocoa.func_149987_c(i1); - if (k1 >= 2) - { + if (k1 >= 2) { return false; - } - else - { - if (!par1World.isRemote) - { + } else { + if (!par1World.isRemote) { ++k1; par1World.setBlockMetadataWithNotify(par2, par3, par4, k1 << 2 | j1, 2); - //--par0ItemStack.stackSize; + // --par0ItemStack.stackSize; } return true; } - } - else if (l != Blocks.grass) - { + } else if (l != Blocks.grass) { return false; - } - else - { - if (!par1World.isRemote) - { + } else { + if (!par1World.isRemote) { --par0ItemStack.stackSize; label102: - - for (i1 = 0; i1 < 128; ++i1) - { + for (i1 = 0; i1 < 128; ++i1) { j1 = par2; k1 = par3 + 1; int l1 = par4; - for (int i2 = 0; i2 < i1 / 16; ++i2) - { + for (int i2 = 0; i2 < i1 / 16; ++i2) { j1 += itemRand.nextInt(3) - 1; k1 += (itemRand.nextInt(3) - 1) * itemRand.nextInt(3) / 2; l1 += itemRand.nextInt(3) - 1; - if (par1World.getBlock(j1, k1 - 1, l1) != Blocks.grass || par1World.getBlock(j1, k1, l1).isNormalCube()) - { + if (par1World.getBlock(j1, k1 - 1, l1) != Blocks.grass + || par1World.getBlock(j1, k1, l1).isNormalCube()) { continue label102; } } - if (par1World.getBlock(j1, k1, l1) == Blocks.air) - { - if (itemRand.nextInt(10) != 0) - { - if (Blocks.tallgrass.canBlockStay(par1World, j1, k1, l1)) - { + if (par1World.getBlock(j1, k1, l1) == Blocks.air) { + if (itemRand.nextInt(10) != 0) { + if (Blocks.tallgrass.canBlockStay(par1World, j1, k1, l1)) { par1World.setBlock(j1, k1, l1, Blocks.tallgrass, 1, 3); } - } - else - { - // TODO 1.7 Probably a vanilla method for this now? ForgeHooks.plantGrass(par1World, j1, k1, l1); + } else { + // TODO 1.7 Probably a vanilla method for this now? + // ForgeHooks.plantGrass(par1World, j1, k1, l1); } } } @@ -200,32 +167,24 @@ else if (l != Blocks.grass) return true; } } - } - else if (par1World.getBlockMetadata(par2, par3, par4) == 7) - { + } else if (par1World.getBlockMetadata(par2, par3, par4) == 7) { return false; - } - else - { - if (!par1World.isRemote) - { - ((BlockStem) l).func_149874_m/*fertilizeStem*/(par1World, par2, par3, par4); - //--par0ItemStack.stackSize; + } else { + if (!par1World.isRemote) { + ((BlockStem) l).func_149874_m /*fertilizeStem*/(par1World, par2, par3, par4); + // --par0ItemStack.stackSize; } return true; } - } - else - { - if (!par1World.isRemote) - { - if (par1World.rand.nextFloat() < 0.4D) - { - ((BlockMushroom) l).func_149884_c/*fertilizeMushroom*/(par1World, par2, par3, par4, par1World.rand); + } else { + if (!par1World.isRemote) { + if (par1World.rand.nextFloat() < 0.4D) { + ((BlockMushroom) l) + .func_149884_c /*fertilizeMushroom*/(par1World, par2, par3, par4, par1World.rand); } - //--par0ItemStack.stackSize; + // --par0ItemStack.stackSize; } return true; @@ -234,15 +193,13 @@ else if (par1World.getBlockMetadata(par2, par3, par4) == 7) @SideOnly(Side.CLIENT) @Override - public void registerIcons (IIconRegister par1IconRegister) - { + public void registerIcons(IIconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon("natura:seedbag_" + textureName); } @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { list.add(StatCollector.translateToLocal("tooltip.bonebag")); } } diff --git a/src/main/java/mods/natura/items/BowlEmpty.java b/src/main/java/mods/natura/items/BowlEmpty.java index 5cfd8636..d35942f3 100644 --- a/src/main/java/mods/natura/items/BowlEmpty.java +++ b/src/main/java/mods/natura/items/BowlEmpty.java @@ -8,41 +8,34 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -public class BowlEmpty extends Item -{ +public class BowlEmpty extends Item { IIcon[] icons; - public static String[] textureNames = new String[] { "", "", "ghostwood", "", "bloodwood", "", "", "", "", "", "", "darkwood", "fusewood" }; + public static String[] textureNames = + new String[] {"", "", "ghostwood", "", "bloodwood", "", "", "", "", "", "", "darkwood", "fusewood"}; - public BowlEmpty() - { + public BowlEmpty() { super(); } @SideOnly(Side.CLIENT) @Override - public IIcon getIconFromDamage (int meta) - { + public IIcon getIconFromDamage(int meta) { return icons[meta]; } @SideOnly(Side.CLIENT) @Override - public void registerIcons (IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.icons = new IIcon[textureNames.length]; - for (int i = 0; i < BowlEmpty.textureNames.length; ++i) - { + for (int i = 0; i < BowlEmpty.textureNames.length; ++i) { if (!textureNames[i].equals("")) this.icons[i] = iconRegister.registerIcon("natura:" + textureNames[i] + "_bowl"); - else - this.icons[i] = iconRegister.registerIcon("bowl"); - + else this.icons[i] = iconRegister.registerIcon("bowl"); } } @Override - public String getUnlocalizedName (ItemStack stack) - { + public String getUnlocalizedName(ItemStack stack) { return Items.bowl.getUnlocalizedName(stack); /*int arr = MathHelper.clamp_int(stack.getItemDamage(), 0, textureNames.length); return "item.bowl." +textureNames[arr];*/ diff --git a/src/main/java/mods/natura/items/BowlStew.java b/src/main/java/mods/natura/items/BowlStew.java index 46f9f1c9..bfda00eb 100644 --- a/src/main/java/mods/natura/items/BowlStew.java +++ b/src/main/java/mods/natura/items/BowlStew.java @@ -1,9 +1,8 @@ package mods.natura.items; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mods.natura.common.NContent; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; @@ -18,71 +17,57 @@ import net.minecraft.util.MathHelper; import net.minecraft.world.World; -public class BowlStew extends ItemFood -{ +public class BowlStew extends ItemFood { IIcon[] icons; - public static String[] textureNames = new String[] { "mushroom", "glowshroom" }; + public static String[] textureNames = new String[] {"mushroom", "glowshroom"}; - public BowlStew() - { + public BowlStew() { super(6, 0.6f, false); } @SideOnly(Side.CLIENT) @Override - public boolean requiresMultipleRenderPasses () - { + public boolean requiresMultipleRenderPasses() { return true; } @Override - public IIcon getIcon (ItemStack stack, int renderPass) - { - if (renderPass == 0) - { + public IIcon getIcon(ItemStack stack, int renderPass) { + if (renderPass == 0) { int stackDamage = stack.getItemDamage() % 14; - if (stackDamage == 0) - return Items.bowl.getIconFromDamage(0); + if (stackDamage == 0) return Items.bowl.getIconFromDamage(0); return NContent.bowlEmpty.getIconFromDamage(stack.getItemDamage() % 14 - 1); - } - else - return icons[stack.getItemDamage() / 14]; + } else return icons[stack.getItemDamage() / 14]; } @SideOnly(Side.CLIENT) @Override - public void registerIcons (IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.icons = new IIcon[textureNames.length]; - for (int i = 0; i < BowlStew.textureNames.length; ++i) - { + for (int i = 0; i < BowlStew.textureNames.length; ++i) { if (!textureNames[i].equals("")) this.icons[i] = iconRegister.registerIcon("natura:stew_" + textureNames[i]); } } + @Override - public ItemStack onEaten (ItemStack stack, World world, EntityPlayer player) - { + public ItemStack onEaten(ItemStack stack, World world, EntityPlayer player) { player.getFoodStats().func_151686_a(this, stack); world.playSoundAtEntity(player, "random.burp", 0.5F, world.rand.nextFloat() * 0.1F + 0.9F); this.onFoodEaten(stack, world, player); - if (!player.capabilities.isCreativeMode) - { + if (!player.capabilities.isCreativeMode) { --stack.stackSize; - if (stack.stackSize <= 0) - { + if (stack.stackSize <= 0) { int stackDamage = stack.getItemDamage() % 14; - if (stackDamage == 0) - return new ItemStack(Items.bowl); + if (stackDamage == 0) return new ItemStack(Items.bowl); return new ItemStack(NContent.bowlEmpty, 1, stackDamage - 1); } ItemStack returnStack = new ItemStack(Items.bowl); int stackDamage = stack.getItemDamage() % 14; - if (stackDamage != 0) - returnStack = new ItemStack(NContent.bowlEmpty, 1, stackDamage - 1); + if (stackDamage != 0) returnStack = new ItemStack(NContent.bowlEmpty, 1, stackDamage - 1); player.inventory.addItemStackToInventory(returnStack); } @@ -91,49 +76,38 @@ public ItemStack onEaten (ItemStack stack, World world, EntityPlayer player) } @Override - protected void onFoodEaten (ItemStack stack, World world, EntityPlayer player) - { - if (!world.isRemote && stack.getItemDamage() / 14 == 1) - { + protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player) { + if (!world.isRemote && stack.getItemDamage() / 14 == 1) { int duration = 0; PotionEffect potion; potion = player.getActivePotionEffect(Potion.nightVision); - if (potion != null) - duration = potion.getDuration(); - else - duration = 0; + if (potion != null) duration = potion.getDuration(); + else duration = 0; player.addPotionEffect(new PotionEffect(Potion.nightVision.id, duration + 45 * 25, 0)); potion = player.getActivePotionEffect(Potion.weakness); - if (potion != null) - duration = potion.getDuration(); - else - duration = 0; + if (potion != null) duration = potion.getDuration(); + else duration = 0; player.addPotionEffect(new PotionEffect(Potion.weakness.id, duration + 16 * 25, 0)); potion = player.getActivePotionEffect(Potion.weakness); - if (potion != null) - duration = potion.getDuration(); - else - duration = 0; + if (potion != null) duration = potion.getDuration(); + else duration = 0; player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, duration + 8 * 25, 0)); } } @Override - public String getUnlocalizedName (ItemStack stack) - { + public String getUnlocalizedName(ItemStack stack) { int arr = MathHelper.clamp_int(stack.getItemDamage() / 14, 0, textureNames.length); return "item.bowl." + textureNames[arr]; } @SideOnly(Side.CLIENT) @Override - public void getSubItems (Item par1, CreativeTabs par2CreativeTabs, List par3List) - { - for (int iter = 1; iter < textureNames.length; iter++) - { + public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + for (int iter = 1; iter < textureNames.length; iter++) { par3List.add(new ItemStack(par1, 1, iter * 14)); } } diff --git a/src/main/java/mods/natura/items/CactusJuice.java b/src/main/java/mods/natura/items/CactusJuice.java index 3f61765e..124cf7ce 100644 --- a/src/main/java/mods/natura/items/CactusJuice.java +++ b/src/main/java/mods/natura/items/CactusJuice.java @@ -1,9 +1,8 @@ package mods.natura.items; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mods.natura.common.NaturaTab; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -19,20 +18,19 @@ public CactusJuice(boolean flag) { } @Override - public int getMaxItemUseDuration (ItemStack itemStack) { + public int getMaxItemUseDuration(ItemStack itemStack) { return 12; } @SideOnly(Side.CLIENT) @Override - public void registerIcons (IIconRegister par1IconRegister) { + public void registerIcons(IIconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon("natura:waterdrop"); } @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) { + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { list.add(StatCollector.translateToLocal("tooltip.cactusjuice")); } - } diff --git a/src/main/java/mods/natura/items/ImpMeat.java b/src/main/java/mods/natura/items/ImpMeat.java index 58130eaf..158e4bd1 100644 --- a/src/main/java/mods/natura/items/ImpMeat.java +++ b/src/main/java/mods/natura/items/ImpMeat.java @@ -1,9 +1,8 @@ package mods.natura.items; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mods.natura.Natura; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; @@ -12,71 +11,58 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; -public class ImpMeat extends NSpecialFood -{ - public ImpMeat() - { - super(new int[] { 3, 8 }, new float[] { 0.2f, 0.6f }, new String[] { "raw", "cooked" }, new String[] { "impmeat_raw", "impmeat_cooked" }); +public class ImpMeat extends NSpecialFood { + public ImpMeat() { + super(new int[] {3, 8}, new float[] {0.2f, 0.6f}, new String[] {"raw", "cooked"}, new String[] { + "impmeat_raw", "impmeat_cooked" + }); } @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { - switch (stack.getItemDamage()) - { - case 0: - list.add(StatCollector.translateToLocal("tooltip.impmeat1")); - break; - case 1: - list.add(StatCollector.translateToLocal("tooltip.impmeat2")); - break; + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + switch (stack.getItemDamage()) { + case 0: + list.add(StatCollector.translateToLocal("tooltip.impmeat1")); + break; + case 1: + list.add(StatCollector.translateToLocal("tooltip.impmeat2")); + break; } } @Override - protected void onFoodEaten (ItemStack stack, World world, EntityPlayer player) - { - if (!world.isRemote) - { + protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player) { + if (!world.isRemote) { int duration = 0; PotionEffect potion; - switch (stack.getItemDamage()) - { - case 0: - potion = player.getActivePotionEffect(Potion.hunger); - if (potion != null) - duration = potion.getDuration(); - player.addPotionEffect(new PotionEffect(Potion.hunger.id, duration + 8 * 20, 0)); - player.setFire(10); + switch (stack.getItemDamage()) { + case 0: + potion = player.getActivePotionEffect(Potion.hunger); + if (potion != null) duration = potion.getDuration(); + player.addPotionEffect(new PotionEffect(Potion.hunger.id, duration + 8 * 20, 0)); + player.setFire(10); - if (Natura.random.nextFloat() < 0.75f) - { - potion = player.getActivePotionEffect(Potion.poison); - if (potion != null) - duration = potion.getDuration(); - else - duration = 0; - player.addPotionEffect(new PotionEffect(Potion.poison.id, duration + 5 * 20, 0)); - } - break; + if (Natura.random.nextFloat() < 0.75f) { + potion = player.getActivePotionEffect(Potion.poison); + if (potion != null) duration = potion.getDuration(); + else duration = 0; + player.addPotionEffect(new PotionEffect(Potion.poison.id, duration + 5 * 20, 0)); + } + break; - case 1: - potion = player.getActivePotionEffect(Potion.fireResistance); - if (potion != null) - duration = potion.getDuration(); - player.addPotionEffect(new PotionEffect(Potion.fireResistance.id, duration + 15 * 20, 0)); + case 1: + potion = player.getActivePotionEffect(Potion.fireResistance); + if (potion != null) duration = potion.getDuration(); + player.addPotionEffect(new PotionEffect(Potion.fireResistance.id, duration + 15 * 20, 0)); - if (Natura.random.nextFloat() < 0.75f) - { - potion = player.getActivePotionEffect(Potion.poison); - if (potion != null) - duration = potion.getDuration(); - else - duration = 0; - player.addPotionEffect(new PotionEffect(Potion.poison.id, duration + 5 * 20, 0)); - } - break; + if (Natura.random.nextFloat() < 0.75f) { + potion = player.getActivePotionEffect(Potion.poison); + if (potion != null) duration = potion.getDuration(); + else duration = 0; + player.addPotionEffect(new PotionEffect(Potion.poison.id, duration + 5 * 20, 0)); + } + break; } } } diff --git a/src/main/java/mods/natura/items/NSpecialFood.java b/src/main/java/mods/natura/items/NSpecialFood.java index 597a9d53..2dd5210a 100644 --- a/src/main/java/mods/natura/items/NSpecialFood.java +++ b/src/main/java/mods/natura/items/NSpecialFood.java @@ -1,9 +1,8 @@ package mods.natura.items; -import java.util.List; - 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; @@ -12,16 +11,14 @@ import net.minecraft.util.IIcon; import net.minecraft.util.MathHelper; -public class NSpecialFood extends ItemFood -{ +public class NSpecialFood extends ItemFood { int[] hunger; float[] saturation; String[] unlocalizedNames; String[] iconNames; IIcon[] icons; - public NSpecialFood(int[] hunger, float[] saturation, String[] textureNames, String[] iconNames) - { + public NSpecialFood(int[] hunger, float[] saturation, String[] textureNames, String[] iconNames) { super(0, 0, false); this.hunger = hunger; this.saturation = saturation; @@ -31,47 +28,39 @@ public NSpecialFood(int[] hunger, float[] saturation, String[] textureNames, Str } @Override - public int func_150905_g(ItemStack stack) - { + public int func_150905_g(ItemStack stack) { return hunger[stack.getItemDamage()]; } @Override - public float func_150906_h(ItemStack stack) - { + public float func_150906_h(ItemStack stack) { return saturation[stack.getItemDamage()]; } @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage (int meta) - { + public IIcon getIconFromDamage(int meta) { return icons[meta]; } @SideOnly(Side.CLIENT) @Override - public void registerIcons (IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.icons = new IIcon[iconNames.length]; - for (int i = 0; i < this.icons.length; ++i) - { + for (int i = 0; i < this.icons.length; ++i) { this.icons[i] = iconRegister.registerIcon("natura:" + iconNames[i]); } } @Override - public String getUnlocalizedName (ItemStack stack) - { + public String getUnlocalizedName(ItemStack stack) { int arr = MathHelper.clamp_int(stack.getItemDamage(), 0, unlocalizedNames.length); return getUnlocalizedName() + "." + unlocalizedNames[arr]; } @Override - public void getSubItems (Item id, CreativeTabs tab, List list) - { - for (int i = 0; i < unlocalizedNames.length; i++) - list.add(new ItemStack(id, 1, i)); + public void getSubItems(Item id, CreativeTabs tab, List list) { + for (int i = 0; i < unlocalizedNames.length; i++) list.add(new ItemStack(id, 1, i)); } } diff --git a/src/main/java/mods/natura/items/NaturaSeeds.java b/src/main/java/mods/natura/items/NaturaSeeds.java index a36d04f3..b5ecf65b 100644 --- a/src/main/java/mods/natura/items/NaturaSeeds.java +++ b/src/main/java/mods/natura/items/NaturaSeeds.java @@ -1,9 +1,8 @@ package mods.natura.items; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mods.natura.common.NaturaTab; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; @@ -18,15 +17,13 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class NaturaSeeds extends ItemSeeds -{ - public String[] textureNames = new String[] { "barley", "cotton" }; +public class NaturaSeeds extends ItemSeeds { + public String[] textureNames = new String[] {"barley", "cotton"}; public IIcon[] icons; public Block blockType; - public NaturaSeeds(Block cropID, Block soilID) - { + public NaturaSeeds(Block cropID, Block soilID) { super(cropID, soilID); blockType = cropID; this.setCreativeTab(NaturaTab.tab); @@ -35,77 +32,73 @@ public NaturaSeeds(Block cropID, Block soilID) @SideOnly(Side.CLIENT) @Override - public void registerIcons (IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.icons = new IIcon[textureNames.length]; - for (int i = 0; i < this.icons.length; ++i) - { + for (int i = 0; i < this.icons.length; ++i) { this.icons[i] = iconRegister.registerIcon("natura:" + textureNames[i] + "_seeds"); } } @Override - public void getSubItems (Item id, CreativeTabs tab, List list) - { - for (int i = 0; i < textureNames.length; i++) - list.add(new ItemStack(id, 1, i)); + public void getSubItems(Item id, CreativeTabs tab, List list) { + for (int i = 0; i < textureNames.length; i++) list.add(new ItemStack(id, 1, i)); } @SideOnly(Side.CLIENT) @Override - public IIcon getIconFromDamage (int meta) - { + public IIcon getIconFromDamage(int meta) { return icons[meta]; } @Override - public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int xPos, int yPos, int zPos, int side, float xClick, float yClick, float zClick) - { - if (side != 1) - { + public boolean onItemUse( + ItemStack stack, + EntityPlayer player, + World world, + int xPos, + int yPos, + int zPos, + int side, + float xClick, + float yClick, + float zClick) { + if (side != 1) { return false; - } - else if (player.canPlayerEdit(xPos, yPos, zPos, side, stack) && player.canPlayerEdit(xPos, yPos + 1, zPos, side, stack)) - { + } else if (player.canPlayerEdit(xPos, yPos, zPos, side, stack) + && player.canPlayerEdit(xPos, yPos + 1, zPos, side, stack)) { Block soil = world.getBlock(xPos, yPos, zPos); - if (soil != null && soil.canSustainPlant(world, xPos, yPos, zPos, ForgeDirection.UP, this) && world.isAirBlock(xPos, yPos + 1, zPos)) - { + if (soil != null + && soil.canSustainPlant(world, xPos, yPos, zPos, ForgeDirection.UP, this) + && world.isAirBlock(xPos, yPos + 1, zPos)) { world.setBlock(xPos, yPos + 1, zPos, this.blockType, stack.getItemDamage() * 4, 3); --stack.stackSize; return true; - } - else - { + } else { return false; } - } - else - { + } else { return false; } } @Override - public String getUnlocalizedName (ItemStack stack) - { + public String getUnlocalizedName(ItemStack stack) { int arr = MathHelper.clamp_int(stack.getItemDamage(), 0, textureNames.length); return "item." + textureNames[arr] + ".seed"; } @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { - switch (stack.getItemDamage()) - { - case 0: - list.add(StatCollector.translateToLocal("tooltip.barley")); - break; - case 1: - list.add(StatCollector.translateToLocal("tooltip.cotton")); - break; + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + switch (stack.getItemDamage()) { + case 0: + list.add(StatCollector.translateToLocal("tooltip.barley")); + break; + case 1: + list.add(StatCollector.translateToLocal("tooltip.cotton")); + break; } } } diff --git a/src/main/java/mods/natura/items/NetherBerryItem.java b/src/main/java/mods/natura/items/NetherBerryItem.java index e7011402..18b74655 100644 --- a/src/main/java/mods/natura/items/NetherBerryItem.java +++ b/src/main/java/mods/natura/items/NetherBerryItem.java @@ -1,9 +1,8 @@ package mods.natura.items; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mods.natura.Natura; import mods.natura.common.NaturaTab; import net.minecraft.client.renderer.texture.IIconRegister; @@ -20,18 +19,18 @@ public class NetherBerryItem extends ItemFood { public IIcon[] icons; - public String[] textureNames = new String[] { "blight", "dusk", "sky", "sting" };//, "haste" + public String[] textureNames = new String[] {"blight", "dusk", "sky", "sting"}; // , "haste" public NetherBerryItem(int healAmount) { super(healAmount, 0.4F, false); setHasSubtypes(true); setMaxDamage(0); this.setCreativeTab(NaturaTab.tab); - //this.setAlwaysEdible(); + // this.setAlwaysEdible(); } @Override - public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player) { + public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) { if (player.canEat(true) && player.getFoodStats().getSaturationLevel() < 18F) { player.setItemInUse(stack, this.getMaxItemUseDuration(stack)); } @@ -39,116 +38,99 @@ public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer pl } @Override - protected void onFoodEaten (ItemStack stack, World world, EntityPlayer player) { + protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player) { if (!world.isRemote) { int duration = 0; PotionEffect potion; switch (stack.getItemDamage()) { - case 0: - potion = player.getActivePotionEffect(Potion.regeneration); - if (potion != null) - duration = potion.getDuration(); - player.addPotionEffect(new PotionEffect(Potion.regeneration.id, duration + 8 * 20, 0)); - - if (Natura.random.nextFloat() < 0.75f) { - potion = player.getActivePotionEffect(Potion.poison); - if (potion != null) - duration = potion.getDuration(); - else - duration = 0; - player.addPotionEffect(new PotionEffect(Potion.poison.id, duration + 5 * 20, 0)); - } - if (Natura.random.nextFloat() < 0.15f) { - potion = player.getActivePotionEffect(Potion.wither); - if (potion != null) - duration = potion.getDuration(); - else - duration = 0; - player.addPotionEffect(new PotionEffect(Potion.wither.id, duration + 5 * 20, 0)); - } - break; - - case 1: - potion = player.getActivePotionEffect(Potion.nightVision); - if (potion != null) - duration = potion.getDuration(); - player.addPotionEffect(new PotionEffect(Potion.nightVision.id, duration + 15 * 20, 0)); - - if (Natura.random.nextFloat() < 0.75f) { - potion = player.getActivePotionEffect(Potion.blindness); - if (potion != null) - duration = potion.getDuration(); - else - duration = 0; - player.addPotionEffect(new PotionEffect(Potion.blindness.id, duration + 3 * 20, 0)); - } - break; - - case 2: - potion = player.getActivePotionEffect(Potion.jump); - if (potion != null) - duration = potion.getDuration(); - player.addPotionEffect(new PotionEffect(Potion.jump.id, duration + 8 * 20, 0)); - - if (Natura.random.nextFloat() < 0.75f) { - potion = player.getActivePotionEffect(Potion.moveSlowdown); - if (potion != null) - duration = potion.getDuration(); - else - duration = 0; - player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, duration + 3 * 20, 0)); - } - break; - - case 3: - potion = player.getActivePotionEffect(Potion.damageBoost); - if (potion != null) - duration = potion.getDuration(); - player.addPotionEffect(new PotionEffect(Potion.damageBoost.id, duration + 10 * 20, 0)); - - if (Natura.random.nextFloat() < 0.75f) { - potion = player.getActivePotionEffect(Potion.digSlowdown); - if (potion != null) - duration = potion.getDuration(); - else - duration = 0; - player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, duration + 10 * 20, 0)); - } - break; - - case 4: - potion = player.getActivePotionEffect(Potion.digSpeed); - if (potion != null) - duration = potion.getDuration(); - player.addPotionEffect(new PotionEffect(Potion.digSpeed.id, duration + 10 * 20, 0)); - - if (Natura.random.nextFloat() < 0.75f) { - potion = player.getActivePotionEffect(Potion.weakness); - if (potion != null) - duration = potion.getDuration(); - else - duration = 0; - player.addPotionEffect(new PotionEffect(Potion.weakness.id, duration + 10 * 20, 0)); - } - break; + case 0: + potion = player.getActivePotionEffect(Potion.regeneration); + if (potion != null) duration = potion.getDuration(); + player.addPotionEffect(new PotionEffect(Potion.regeneration.id, duration + 8 * 20, 0)); + + if (Natura.random.nextFloat() < 0.75f) { + potion = player.getActivePotionEffect(Potion.poison); + if (potion != null) duration = potion.getDuration(); + else duration = 0; + player.addPotionEffect(new PotionEffect(Potion.poison.id, duration + 5 * 20, 0)); + } + if (Natura.random.nextFloat() < 0.15f) { + potion = player.getActivePotionEffect(Potion.wither); + if (potion != null) duration = potion.getDuration(); + else duration = 0; + player.addPotionEffect(new PotionEffect(Potion.wither.id, duration + 5 * 20, 0)); + } + break; + + case 1: + potion = player.getActivePotionEffect(Potion.nightVision); + if (potion != null) duration = potion.getDuration(); + player.addPotionEffect(new PotionEffect(Potion.nightVision.id, duration + 15 * 20, 0)); + + if (Natura.random.nextFloat() < 0.75f) { + potion = player.getActivePotionEffect(Potion.blindness); + if (potion != null) duration = potion.getDuration(); + else duration = 0; + player.addPotionEffect(new PotionEffect(Potion.blindness.id, duration + 3 * 20, 0)); + } + break; + + case 2: + potion = player.getActivePotionEffect(Potion.jump); + if (potion != null) duration = potion.getDuration(); + player.addPotionEffect(new PotionEffect(Potion.jump.id, duration + 8 * 20, 0)); + + if (Natura.random.nextFloat() < 0.75f) { + potion = player.getActivePotionEffect(Potion.moveSlowdown); + if (potion != null) duration = potion.getDuration(); + else duration = 0; + player.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, duration + 3 * 20, 0)); + } + break; + + case 3: + potion = player.getActivePotionEffect(Potion.damageBoost); + if (potion != null) duration = potion.getDuration(); + player.addPotionEffect(new PotionEffect(Potion.damageBoost.id, duration + 10 * 20, 0)); + + if (Natura.random.nextFloat() < 0.75f) { + potion = player.getActivePotionEffect(Potion.digSlowdown); + if (potion != null) duration = potion.getDuration(); + else duration = 0; + player.addPotionEffect(new PotionEffect(Potion.digSlowdown.id, duration + 10 * 20, 0)); + } + break; + + case 4: + potion = player.getActivePotionEffect(Potion.digSpeed); + if (potion != null) duration = potion.getDuration(); + player.addPotionEffect(new PotionEffect(Potion.digSpeed.id, duration + 10 * 20, 0)); + + if (Natura.random.nextFloat() < 0.75f) { + potion = player.getActivePotionEffect(Potion.weakness); + if (potion != null) duration = potion.getDuration(); + else duration = 0; + player.addPotionEffect(new PotionEffect(Potion.weakness.id, duration + 10 * 20, 0)); + } + break; } } } @Override - public int getMaxItemUseDuration (ItemStack itemStack) { + public int getMaxItemUseDuration(ItemStack itemStack) { return 24; } @SideOnly(Side.CLIENT) @Override - public IIcon getIconFromDamage (int meta) { - return meta >= icons.length ? icons[0] : icons[meta]; + public IIcon getIconFromDamage(int meta) { + return meta >= icons.length ? icons[0] : icons[meta]; } @SideOnly(Side.CLIENT) @Override - public void registerIcons (IIconRegister iconRegister) { + public void registerIcons(IIconRegister iconRegister) { this.icons = new IIcon[textureNames.length]; for (int i = 0; i < this.icons.length; ++i) { @@ -158,28 +140,29 @@ public void registerIcons (IIconRegister iconRegister) { @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) { + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { list.add(StatCollector.translateToLocal("tooltip.netherberrybush1")); switch (stack.getItemDamage() % 4) { - case 0: - list.add(StatCollector.translateToLocal("tooltip.netherberrybush2")); - break; - case 1: - list.add(StatCollector.translateToLocal("tooltip.netherberrybush3")); - break; - case 2: - list.add(StatCollector.translateToLocal("tooltip.netherberrybush4")); - break; - case 3: - list.add(StatCollector.translateToLocal("tooltip.netherberrybush5")); - break; + case 0: + list.add(StatCollector.translateToLocal("tooltip.netherberrybush2")); + break; + case 1: + list.add(StatCollector.translateToLocal("tooltip.netherberrybush3")); + break; + case 2: + list.add(StatCollector.translateToLocal("tooltip.netherberrybush4")); + break; + case 3: + list.add(StatCollector.translateToLocal("tooltip.netherberrybush5")); + break; } } /* Name override */ @Override - public String getUnlocalizedName (ItemStack itemstack) { - return "item.berry." + textureNames[itemstack.getItemDamage() >= textureNames.length ? 0 : itemstack.getItemDamage()]; + public String getUnlocalizedName(ItemStack itemstack) { + return "item.berry." + + textureNames[itemstack.getItemDamage() >= textureNames.length ? 0 : itemstack.getItemDamage()]; } /** @@ -187,10 +170,9 @@ public String getUnlocalizedName (ItemStack itemstack) { */ @SideOnly(Side.CLIENT) @Override - public void getSubItems (Item item, CreativeTabs par2CreativeTabs, List par3List) { + public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List par3List) { for (int var4 = 0; var4 < 4; ++var4) { par3List.add(new ItemStack(item, 1, var4)); } } - } diff --git a/src/main/java/mods/natura/items/NetherFoodItem.java b/src/main/java/mods/natura/items/NetherFoodItem.java index fc904b23..0dcd7530 100644 --- a/src/main/java/mods/natura/items/NetherFoodItem.java +++ b/src/main/java/mods/natura/items/NetherFoodItem.java @@ -1,9 +1,8 @@ package mods.natura.items; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mods.natura.Natura; import mods.natura.common.NaturaTab; import net.minecraft.client.renderer.texture.IIconRegister; @@ -18,18 +17,16 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; -public class NetherFoodItem extends ItemFood -{ +public class NetherFoodItem extends ItemFood { public IIcon[] icons; - public String[] textureNames = new String[] { "potashapple" };//, "haste" + public String[] textureNames = new String[] {"potashapple"}; // , "haste" - public NetherFoodItem() - { + public NetherFoodItem() { super(4, 0.4F, false); setHasSubtypes(true); setMaxDamage(0); this.setCreativeTab(NaturaTab.tab); - //this.setAlwaysEdible(); + // this.setAlwaysEdible(); } /*public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer player) @@ -43,25 +40,19 @@ public NetherFoodItem() }*/ @Override - protected void onFoodEaten (ItemStack stack, World world, EntityPlayer player) - { - if (!world.isRemote) - { + protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player) { + if (!world.isRemote) { int duration = 0; PotionEffect potion; - switch (stack.getItemDamage()) - { - case 0: - if (Natura.random.nextFloat() < 0.75f) - { - potion = player.getActivePotionEffect(Potion.poison); - if (potion != null) - duration = potion.getDuration(); - else - duration = 0; - player.addPotionEffect(new PotionEffect(Potion.poison.id, duration + 2 * 25, 0)); - } - break; + switch (stack.getItemDamage()) { + case 0: + if (Natura.random.nextFloat() < 0.75f) { + potion = player.getActivePotionEffect(Potion.poison); + if (potion != null) duration = potion.getDuration(); + else duration = 0; + player.addPotionEffect(new PotionEffect(Potion.poison.id, duration + 2 * 25, 0)); + } + break; } } } @@ -74,31 +65,27 @@ public int getMaxItemUseDuration(ItemStack itemstack) @SideOnly(Side.CLIENT) @Override - public IIcon getIconFromDamage (int meta) - { + public IIcon getIconFromDamage(int meta) { return icons[meta]; } @SideOnly(Side.CLIENT) @Override - public void registerIcons (IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.icons = new IIcon[textureNames.length]; - for (int i = 0; i < this.icons.length; ++i) - { + for (int i = 0; i < this.icons.length; ++i) { this.icons[i] = iconRegister.registerIcon("natura:fruit_" + textureNames[i]); } } @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { list.add(StatCollector.translateToLocal("tooltip.netherfood")); /*switch (stack.getItemDamage()) { - case 0: + case 0: list.add("Killer healing"); break; case 1: @@ -115,9 +102,11 @@ public void addInformation (ItemStack stack, EntityPlayer player, List list, boo /* Name override */ @Override - public String getUnlocalizedName (ItemStack itemstack) - { - return (new StringBuilder()).append("item.food.nether.").append(textureNames[itemstack.getItemDamage()]).toString(); + public String getUnlocalizedName(ItemStack itemstack) { + return (new StringBuilder()) + .append("item.food.nether.") + .append(textureNames[itemstack.getItemDamage()]) + .toString(); } /** @@ -125,10 +114,8 @@ public String getUnlocalizedName (ItemStack itemstack) */ @SideOnly(Side.CLIENT) @Override - public void getSubItems (Item par1, CreativeTabs par2CreativeTabs, List par3List) - { - for (int var4 = 0; var4 < 1; ++var4) - { + public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) { + for (int var4 = 0; var4 < 1; ++var4) { par3List.add(new ItemStack(par1, 1, var4)); } } diff --git a/src/main/java/mods/natura/items/PlantItem.java b/src/main/java/mods/natura/items/PlantItem.java index f0d40692..44f894ed 100644 --- a/src/main/java/mods/natura/items/PlantItem.java +++ b/src/main/java/mods/natura/items/PlantItem.java @@ -1,9 +1,8 @@ package mods.natura.items; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mods.natura.common.NCraftingItem; import mods.natura.common.NaturaTab; import mods.natura.common.PHNatura; @@ -13,57 +12,75 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; -public class PlantItem extends NCraftingItem -{ - public PlantItem() - { - super(new String[] { "barley.plant", "barley.flour", "wheat.flour", "cotton.plant", "powder.sulfur", "fletching.ghostwood", "leather.imp", "string.flame", "dye.blue" }, new String[] { - "barley_plant", "barley_flour", "wheat_flour", "cotton_plant", "sulfur", "ghostwood_fletching", "leather_imp", "flamestring", "dye_blue" }); +public class PlantItem extends NCraftingItem { + public PlantItem() { + super( + new String[] { + "barley.plant", + "barley.flour", + "wheat.flour", + "cotton.plant", + "powder.sulfur", + "fletching.ghostwood", + "leather.imp", + "string.flame", + "dye.blue" + }, + new String[] { + "barley_plant", + "barley_flour", + "wheat_flour", + "cotton_plant", + "sulfur", + "ghostwood_fletching", + "leather_imp", + "flamestring", + "dye_blue" + }); this.setCreativeTab(NaturaTab.tab); this.setHasSubtypes(true); } @Override - public String getUnlocalizedName (ItemStack itemstack) - { - return (new StringBuilder()).append("item.").append(unlocalizedNames[itemstack.getItemDamage()]).toString(); + public String getUnlocalizedName(ItemStack itemstack) { + return (new StringBuilder()) + .append("item.") + .append(unlocalizedNames[itemstack.getItemDamage()]) + .toString(); } @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { - switch (stack.getItemDamage()) - { - case 0: - list.add(StatCollector.translateToLocal("tooltip.barley")); - break; - case 1: - case 2: - list.add(StatCollector.translateToLocal("tooltip.flour1")); - list.add(StatCollector.translateToLocal("tooltip.flour2")); - break; - case 3: - list.add(StatCollector.translateToLocal("tooltip.cotton")); - break; - case 4: - list.add(StatCollector.translateToLocal("tooltip.sulfur")); - break; - case 5: - list.add(StatCollector.translateToLocal("tooltip.fletching")); - break; - case 6: - list.add(StatCollector.translateToLocal("tooltip.imp")); - break; - case 7: - list.add(StatCollector.translateToLocal("tooltip.string")); - break; + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + switch (stack.getItemDamage()) { + case 0: + list.add(StatCollector.translateToLocal("tooltip.barley")); + break; + case 1: + case 2: + list.add(StatCollector.translateToLocal("tooltip.flour1")); + list.add(StatCollector.translateToLocal("tooltip.flour2")); + break; + case 3: + list.add(StatCollector.translateToLocal("tooltip.cotton")); + break; + case 4: + list.add(StatCollector.translateToLocal("tooltip.sulfur")); + break; + case 5: + list.add(StatCollector.translateToLocal("tooltip.fletching")); + break; + case 6: + list.add(StatCollector.translateToLocal("tooltip.imp")); + break; + case 7: + list.add(StatCollector.translateToLocal("tooltip.string")); + break; } } - + @Override - public void getSubItems (Item id, CreativeTabs tab, List list) - { + public void getSubItems(Item id, CreativeTabs tab, List list) { list.add(new ItemStack(id, 1, 0)); list.add(new ItemStack(id, 1, 1)); list.add(new ItemStack(id, 1, 2)); diff --git a/src/main/java/mods/natura/items/SeedBag.java b/src/main/java/mods/natura/items/SeedBag.java index bc0dfd7a..9eeee900 100644 --- a/src/main/java/mods/natura/items/SeedBag.java +++ b/src/main/java/mods/natura/items/SeedBag.java @@ -1,9 +1,8 @@ package mods.natura.items; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mods.natura.common.NaturaTab; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; @@ -15,14 +14,12 @@ import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.util.ForgeDirection; -public class SeedBag extends Item -{ +public class SeedBag extends Item { Block crop; int cropMetadata; String textureName; - public SeedBag(Block block, int cMD, String texture) - { + public SeedBag(Block block, int cMD, String texture) { super(); crop = block; cropMetadata = cMD; @@ -31,49 +28,51 @@ public SeedBag(Block block, int cMD, String texture) } @Override - public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float par8, float par9, float par10) - { - if (side != 1) - return false; + public boolean onItemUse( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float par8, + float par9, + float par10) { + if (side != 1) return false; boolean planted = false; - for (int posX = x - 1; posX <= x + 1; posX++) - { - for (int posZ = z - 1; posZ <= z + 1; posZ++) - { - if (player.canPlayerEdit(posX, y, posZ, side, stack) && player.canPlayerEdit(posX, y + 1, posZ, side, stack)) - { + for (int posX = x - 1; posX <= x + 1; posX++) { + for (int posZ = z - 1; posZ <= z + 1; posZ++) { + if (player.canPlayerEdit(posX, y, posZ, side, stack) + && player.canPlayerEdit(posX, y + 1, posZ, side, stack)) { Block block = world.getBlock(posX, y, posZ); - if (block != null && block.canSustainPlant(world, posX, y, posZ, ForgeDirection.UP, (IPlantable) crop) && world.isAirBlock(posX, y + 1, posZ)) - { + if (block != null + && block.canSustainPlant(world, posX, y, posZ, ForgeDirection.UP, (IPlantable) crop) + && world.isAirBlock(posX, y + 1, posZ)) { world.setBlock(posX, y + 1, posZ, crop, cropMetadata, 3); planted = true; } } } } - if (planted) - { - if (!player.capabilities.isCreativeMode) - stack.stackSize--; - if (!world.isRemote) - world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(crop)); + if (planted) { + if (!player.capabilities.isCreativeMode) stack.stackSize--; + if (!world.isRemote) world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(crop)); } return planted; } @SideOnly(Side.CLIENT) @Override - public void registerIcons (IIconRegister par1IconRegister) - { + public void registerIcons(IIconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon("natura:seedbag_" + textureName); } @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { list.add(StatCollector.translateToLocal("tooltip.seedbag")); } } diff --git a/src/main/java/mods/natura/items/SeedFood.java b/src/main/java/mods/natura/items/SeedFood.java index 896b0de9..0f4a704d 100644 --- a/src/main/java/mods/natura/items/SeedFood.java +++ b/src/main/java/mods/natura/items/SeedFood.java @@ -1,9 +1,8 @@ package mods.natura.items; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mods.natura.common.NContent; import mods.natura.common.NaturaTab; import net.minecraft.block.Block; @@ -17,12 +16,10 @@ import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.util.ForgeDirection; -public class SeedFood extends ItemSeedFood -{ +public class SeedFood extends ItemSeedFood { public Block crop; - public SeedFood(int hunger, float saturation, Block cropID) - { + public SeedFood(int hunger, float saturation, Block cropID) { // TODO 1.7 check last param super(hunger, saturation, cropID, Blocks.farmland); crop = cropID; @@ -30,46 +27,46 @@ public SeedFood(int hunger, float saturation, Block cropID) } @Override - public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float clickX, float clickY, float clickZ) - { - if (side != 1) - { + public boolean onItemUse( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float clickX, + float clickY, + float clickZ) { + if (side != 1) { return false; - } - else if (player.canPlayerEdit(x, y, z, side, stack) && player.canPlayerEdit(x, y + 1, z, side, stack)) - { + } else if (player.canPlayerEdit(x, y, z, side, stack) && player.canPlayerEdit(x, y + 1, z, side, stack)) { Block soil = world.getBlock(x, y, z); - if (soil != null && soil.canSustainPlant(world, x, y, z, ForgeDirection.UP, (IPlantable) NContent.saguaro) && world.isAirBlock(x, y + 1, z)) - { + if (soil != null + && soil.canSustainPlant(world, x, y, z, ForgeDirection.UP, (IPlantable) NContent.saguaro) + && world.isAirBlock(x, y + 1, z)) { world.setBlock(x, y + 1, z, this.crop, 1, 3); --stack.stackSize; - if (!world.isRemote) - world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(crop)); + if (!world.isRemote) world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(crop)); return true; - } - else - { + } else { return false; } - } - else - { + } else { return false; } } @SideOnly(Side.CLIENT) @Override - public void registerIcons (IIconRegister par1IconRegister) - { + public void registerIcons(IIconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon("natura:saguaro_fruit_item"); } @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { list.add(StatCollector.translateToLocal("tooltip.sagurofruit")); } } diff --git a/src/main/java/mods/natura/items/SpawnEgg.java b/src/main/java/mods/natura/items/SpawnEgg.java index 5c6e489d..27cc97bc 100644 --- a/src/main/java/mods/natura/items/SpawnEgg.java +++ b/src/main/java/mods/natura/items/SpawnEgg.java @@ -1,9 +1,8 @@ package mods.natura.items; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mods.natura.common.PHNatura; import mods.natura.entity.BabyHeatscarSpider; import mods.natura.entity.HeatscarSpider; @@ -22,46 +21,38 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; -public class SpawnEgg extends Item -{ - int[] primaryColor = { 0xF29735, 0xE64D10, 0xF73E6C, 0xE64D10 }; - int[] secondaryColor = { 0x2E1F10, 0x57B1BD, 0x9B5004, 0x57B1BD }; - String[] mobNames = { "Natura.Imp", "Natura.FlameSpider", "Natura.NitroCreeper", "Natura.FlameSpiderBaby" }; +public class SpawnEgg extends Item { + int[] primaryColor = {0xF29735, 0xE64D10, 0xF73E6C, 0xE64D10}; + int[] secondaryColor = {0x2E1F10, 0x57B1BD, 0x9B5004, 0x57B1BD}; + String[] mobNames = {"Natura.Imp", "Natura.FlameSpider", "Natura.NitroCreeper", "Natura.FlameSpiderBaby"}; - public SpawnEgg() - { + public SpawnEgg() { super(); this.setCreativeTab(CreativeTabs.tabMisc); this.setHasSubtypes(true); } @Override - public void registerIcons (IIconRegister iconRegister) - { - } + public void registerIcons(IIconRegister iconRegister) {} @Override @SideOnly(Side.CLIENT) - public boolean requiresMultipleRenderPasses () - { + public boolean requiresMultipleRenderPasses() { return true; } @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamageForRenderPass (int par1, int par2) - { + public IIcon getIconFromDamageForRenderPass(int par1, int par2) { return Items.spawn_egg.getIconFromDamageForRenderPass(par1, par2); } @Override - public String getItemStackDisplayName (ItemStack par1ItemStack) - { + public String getItemStackDisplayName(ItemStack par1ItemStack) { String s = ("" + StatCollector.translateToLocal(this.getUnlocalizedName() + ".name")).trim(); String s1 = mobNames[par1ItemStack.getItemDamage()]; - if (s1 != null) - { + if (s1 != null) { s = s + " " + StatCollector.translateToLocal("entity." + s1 + ".name"); } @@ -69,8 +60,7 @@ public String getItemStackDisplayName (ItemStack par1ItemStack) } @Override - public void getSubItems (Item item, CreativeTabs tab, List list) - { + public void getSubItems(Item item, CreativeTabs tab, List list) { if (PHNatura.enableImps) list.add(new ItemStack(item, 1, 0)); if (PHNatura.enableHeatscarSpiders) list.add(new ItemStack(item, 1, 1)); if (PHNatura.enableNitroCreepers) list.add(new ItemStack(item, 1, 2)); @@ -79,75 +69,77 @@ public void getSubItems (Item item, CreativeTabs tab, List list) @Override @SideOnly(Side.CLIENT) - public int getColorFromItemStack (ItemStack stack, int pass) - { + public int getColorFromItemStack(ItemStack stack, int pass) { int damage = stack.getItemDamage(); return pass == 0 ? primaryColor[damage] : secondaryColor[damage]; } @Override - public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int posX, int posY, int posZ, int par7, float par8, float par9, float par10) - { - if (!world.isRemote) - { + public boolean onItemUse( + ItemStack stack, + EntityPlayer player, + World world, + int posX, + int posY, + int posZ, + int par7, + float par8, + float par9, + float par10) { + if (!world.isRemote) { activateSpawnEgg(stack, world, posX, posY, posZ, par7); - if (!player.capabilities.isCreativeMode) - { + if (!player.capabilities.isCreativeMode) { --stack.stackSize; } } return true; } - public static EntityLiving activateSpawnEgg (ItemStack stack, World world, double posX, double posY, double posZ, int par7) - { + public static EntityLiving activateSpawnEgg( + ItemStack stack, World world, double posX, double posY, double posZ, int par7) { Block i1 = world.getBlock((int) posX, (int) posY, (int) posZ); posX += Facing.offsetsXForSide[par7]; posY += Facing.offsetsYForSide[par7]; posZ += Facing.offsetsZForSide[par7]; double d0 = 0.0D; - if (par7 == 1 && i1 != null && i1.getRenderType() == 11) - { + if (par7 == 1 && i1 != null && i1.getRenderType() == 11) { d0 = 0.5D; } int damage = stack.getItemDamage(); EntityLiving entity = null; - switch (damage) - { - case 0: - if (PHNatura.enableImps) { - entity = new ImpEntity(world); - spawnEntity(posX, posY, posZ, entity, world); - } - break; - case 1: - if (PHNatura.enableHeatscarSpiders) { - entity = new HeatscarSpider(world); - spawnEntity(posX, posY, posZ, entity, world); - } - break; - case 2: - if (PHNatura.enableNitroCreepers) { - entity = new NitroCreeper(world); - spawnEntity(posX, posY, posZ, entity, world); - } - break; - case 3: - if (PHNatura.enableHeatscarSpiders) { - entity = new BabyHeatscarSpider(world); - spawnEntity(posX, posY, posZ, entity, world); - } - break; + switch (damage) { + case 0: + if (PHNatura.enableImps) { + entity = new ImpEntity(world); + spawnEntity(posX, posY, posZ, entity, world); + } + break; + case 1: + if (PHNatura.enableHeatscarSpiders) { + entity = new HeatscarSpider(world); + spawnEntity(posX, posY, posZ, entity, world); + } + break; + case 2: + if (PHNatura.enableNitroCreepers) { + entity = new NitroCreeper(world); + spawnEntity(posX, posY, posZ, entity, world); + } + break; + case 3: + if (PHNatura.enableHeatscarSpiders) { + entity = new BabyHeatscarSpider(world); + spawnEntity(posX, posY, posZ, entity, world); + } + break; } return entity; } - public static void spawnEntity (double x, double y, double z, EntityLiving entity, World world) - { - if (!world.isRemote) - { + public static void spawnEntity(double x, double y, double z, EntityLiving entity, World world) { + if (!world.isRemote) { entity.setPosition(x, y, z); world.spawnEntityInWorld(entity); } diff --git a/src/main/java/mods/natura/items/StickItem.java b/src/main/java/mods/natura/items/StickItem.java index 7b46df95..1c0ad25c 100644 --- a/src/main/java/mods/natura/items/StickItem.java +++ b/src/main/java/mods/natura/items/StickItem.java @@ -1,9 +1,8 @@ package mods.natura.items; -import java.util.List; - 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.init.Items; @@ -11,43 +10,48 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -public class StickItem extends Item -{ - public static final String textureNames[] = { "eucalyptus", "sakura", "ghostwood", "redwood", "bloodwood", "hopseed", "maple", "silverbell", "purpleheart", "tiger", "willow", "darkwood", - "fusewood" }; +public class StickItem extends Item { + public static final String textureNames[] = { + "eucalyptus", + "sakura", + "ghostwood", + "redwood", + "bloodwood", + "hopseed", + "maple", + "silverbell", + "purpleheart", + "tiger", + "willow", + "darkwood", + "fusewood" + }; public IIcon[] icons; - public StickItem() - { + public StickItem() { super(); this.setHasSubtypes(true); } @SideOnly(Side.CLIENT) @Override - public IIcon getIconFromDamage (int meta) - { - if (meta >= textureNames.length) - return Items.leather_helmet.getIconFromDamage(meta); + public IIcon getIconFromDamage(int meta) { + if (meta >= textureNames.length) return Items.leather_helmet.getIconFromDamage(meta); return icons[meta]; } @SideOnly(Side.CLIENT) @Override - public void registerIcons (IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.icons = new IIcon[textureNames.length]; - for (int i = 0; i < StickItem.textureNames.length; ++i) - { + for (int i = 0; i < StickItem.textureNames.length; ++i) { this.icons[i] = iconRegister.registerIcon("natura:" + textureNames[i] + "_stick"); } } @Override - public void getSubItems (Item id, CreativeTabs tab, List list) - { - for (int i = 0; i < textureNames.length; i++) - list.add(new ItemStack(id, 1, i)); + public void getSubItems(Item id, CreativeTabs tab, List list) { + for (int i = 0; i < textureNames.length; i++) list.add(new ItemStack(id, 1, i)); } /*public CreativeTabs[] getCreativeTabs () diff --git a/src/main/java/mods/natura/items/blocks/BerryBushItem.java b/src/main/java/mods/natura/items/blocks/BerryBushItem.java index 49fe7971..0688160a 100644 --- a/src/main/java/mods/natura/items/blocks/BerryBushItem.java +++ b/src/main/java/mods/natura/items/blocks/BerryBushItem.java @@ -1,9 +1,8 @@ package mods.natura.items.blocks; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mantle.blocks.abstracts.MultiItemBlock; import mods.natura.common.NContent; import net.minecraft.block.Block; @@ -13,78 +12,77 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class BerryBushItem extends MultiItemBlock -{ - public static final String blockType[] = { "rasp", "blue", "black", "geo", "rasp", "blue", "black", "geo", "rasp", "blue", "black", "geo", "rasp", "blue", "black", "geo" }; +public class BerryBushItem extends MultiItemBlock { + public static final String blockType[] = { + "rasp", "blue", "black", "geo", "rasp", "blue", "black", "geo", "rasp", "blue", "black", "geo", "rasp", "blue", + "black", "geo" + }; - public BerryBushItem(Block block) - { + public BerryBushItem(Block block) { super(block, "block", "berryBush", blockType); setHasSubtypes(true); } @Override - public int getMetadata (int meta) - { + public int getMetadata(int meta) { return meta % 4; } /* Place bushes on dirt, grass, or other bushes only */ @Override - public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float par8, float par9, float par10) - { - if (side != 1) - return false; - - else if (player.canPlayerEdit(x, y, z, side, stack) && player.canPlayerEdit(x, y + 1, z, side, stack)) - { + public boolean onItemUse( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float par8, + float par9, + float par10) { + if (side != 1) return false; + else if (player.canPlayerEdit(x, y, z, side, stack) && player.canPlayerEdit(x, y + 1, z, side, stack)) { Block block = world.getBlock(x, y, z); - if (block != null && block.canSustainPlant(world, x, y, z, ForgeDirection.UP, NContent.berryBush) && world.isAirBlock(x, y + 1, z)) - { + if (block != null + && block.canSustainPlant(world, x, y, z, ForgeDirection.UP, NContent.berryBush) + && world.isAirBlock(x, y + 1, z)) { world.setBlock(x, y + 1, z, NContent.berryBush, stack.getItemDamage() % 4, 3); - if (!player.capabilities.isCreativeMode) - stack.stackSize--; - if (!world.isRemote) - world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(NContent.berryBush)); + if (!player.capabilities.isCreativeMode) stack.stackSize--; + if (!world.isRemote) world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(NContent.berryBush)); return true; - } - else - return false; - } - else - return false; + } else return false; + } else return false; } /* Block name in inventory */ /* @Override - public String getUnlocalizedName (ItemStack itemstack) - { - return (new StringBuilder()).append("block.").append(blockType[itemstack.getItemDamage()]).append("berryBush").toString(); - }*/ + public String getUnlocalizedName (ItemStack itemstack) + { + return (new StringBuilder()).append("block.").append(blockType[itemstack.getItemDamage()]).append("berryBush").toString(); + }*/ @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { - switch (stack.getItemDamage() % 4) - { - case 0: - list.add(StatCollector.translateToLocal("tooltip.berrybush1")); - list.add(StatCollector.translateToLocal("tooltip.berrybush2")); - break; - case 1: - list.add(StatCollector.translateToLocal("tooltip.berrybush3")); - list.add(StatCollector.translateToLocal("tooltip.berrybush4")); - break; - case 2: - list.add(StatCollector.translateToLocal("tooltip.berrybush5")); - list.add(StatCollector.translateToLocal("tooltip.berrybush6")); - break; - case 3: - list.add(StatCollector.translateToLocal("tooltip.berrybush7")); - list.add(StatCollector.translateToLocal("tooltip.berrybush8")); - break; + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + switch (stack.getItemDamage() % 4) { + case 0: + list.add(StatCollector.translateToLocal("tooltip.berrybush1")); + list.add(StatCollector.translateToLocal("tooltip.berrybush2")); + break; + case 1: + list.add(StatCollector.translateToLocal("tooltip.berrybush3")); + list.add(StatCollector.translateToLocal("tooltip.berrybush4")); + break; + case 2: + list.add(StatCollector.translateToLocal("tooltip.berrybush5")); + list.add(StatCollector.translateToLocal("tooltip.berrybush6")); + break; + case 3: + list.add(StatCollector.translateToLocal("tooltip.berrybush7")); + list.add(StatCollector.translateToLocal("tooltip.berrybush8")); + break; } } } diff --git a/src/main/java/mods/natura/items/blocks/CloudItem.java b/src/main/java/mods/natura/items/blocks/CloudItem.java index d406c329..662abfe0 100644 --- a/src/main/java/mods/natura/items/blocks/CloudItem.java +++ b/src/main/java/mods/natura/items/blocks/CloudItem.java @@ -1,51 +1,46 @@ package mods.natura.items.blocks; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mantle.blocks.abstracts.MultiItemBlock; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; -public class CloudItem extends MultiItemBlock -{ - public static final String blockType[] = { "normal", "dark", "ash", "sulfur" }; +public class CloudItem extends MultiItemBlock { + public static final String blockType[] = {"normal", "dark", "ash", "sulfur"}; - public CloudItem(Block i) - { + public CloudItem(Block i) { super(i, "block", "cloud", blockType); setMaxDamage(0); setHasSubtypes(true); } /* @Override - public String getUnlocalizedName (ItemStack itemstack) - { - return (new StringBuilder()).append(blockType[itemstack.getItemDamage()]).append("cloud").toString(); - }*/ + public String getUnlocalizedName (ItemStack itemstack) + { + return (new StringBuilder()).append(blockType[itemstack.getItemDamage()]).append("cloud").toString(); + }*/ @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { list.add(StatCollector.translateToLocal("tooltip.cloud1")); - switch (stack.getItemDamage() % 4) - { - case 0: - list.add(StatCollector.translateToLocal("tooltip.cloud2")); - break; - case 1: - list.add(StatCollector.translateToLocal("tooltip.cloud3")); - break; - case 2: - list.add(StatCollector.translateToLocal("tooltip.cloud4")); - break; - case 3: - list.add(StatCollector.translateToLocal("tooltip.cloud5")); - break; + switch (stack.getItemDamage() % 4) { + case 0: + list.add(StatCollector.translateToLocal("tooltip.cloud2")); + break; + case 1: + list.add(StatCollector.translateToLocal("tooltip.cloud3")); + break; + case 2: + list.add(StatCollector.translateToLocal("tooltip.cloud4")); + break; + case 3: + list.add(StatCollector.translateToLocal("tooltip.cloud5")); + break; } } } diff --git a/src/main/java/mods/natura/items/blocks/DarkTreeItem.java b/src/main/java/mods/natura/items/blocks/DarkTreeItem.java index d5e38d00..310fe680 100644 --- a/src/main/java/mods/natura/items/blocks/DarkTreeItem.java +++ b/src/main/java/mods/natura/items/blocks/DarkTreeItem.java @@ -1,21 +1,18 @@ package mods.natura.items.blocks; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mantle.blocks.abstracts.MultiItemBlock; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; -public class DarkTreeItem extends MultiItemBlock -{ - public static final String blockType[] = { "darkwood", "fusewood" }; +public class DarkTreeItem extends MultiItemBlock { + public static final String blockType[] = {"darkwood", "fusewood"}; - public DarkTreeItem(Block i) - { + public DarkTreeItem(Block i) { super(i, "block.log", blockType); setMaxDamage(0); setHasSubtypes(true); @@ -33,17 +30,15 @@ public String getUnlocalizedName (ItemStack itemstack) @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { - switch (stack.getItemDamage()) - { - case 0: - list.add(StatCollector.translateToLocal("tooltip.nethertree")); - break; - case 1: - list.add(StatCollector.translateToLocal("tooltip.nethertree")); - list.add(StatCollector.translateToLocal("tooltip.fusewood.log")); - break; + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + switch (stack.getItemDamage()) { + case 0: + list.add(StatCollector.translateToLocal("tooltip.nethertree")); + break; + case 1: + list.add(StatCollector.translateToLocal("tooltip.nethertree")); + list.add(StatCollector.translateToLocal("tooltip.fusewood.log")); + break; } } } diff --git a/src/main/java/mods/natura/items/blocks/FenceItem.java b/src/main/java/mods/natura/items/blocks/FenceItem.java index 0aee8ca7..c5df9b42 100644 --- a/src/main/java/mods/natura/items/blocks/FenceItem.java +++ b/src/main/java/mods/natura/items/blocks/FenceItem.java @@ -7,25 +7,21 @@ import net.minecraft.block.Block; import net.minecraft.util.IIcon; -public class FenceItem extends MultiItemBlock -{ - public FenceItem(Block block) - { +public class FenceItem extends MultiItemBlock { + public FenceItem(Block block) { super(block, block.getUnlocalizedName(), NContent.woodTextureNames); setMaxDamage(0); setHasSubtypes(true); } @Override - public int getMetadata (int meta) - { + public int getMetadata(int meta) { return meta; } @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage (int meta) - { + public IIcon getIconFromDamage(int meta) { return NContent.planks.getIcon(0, meta); } } diff --git a/src/main/java/mods/natura/items/blocks/GlowshroomItem.java b/src/main/java/mods/natura/items/blocks/GlowshroomItem.java index c0ea2f83..b069d063 100644 --- a/src/main/java/mods/natura/items/blocks/GlowshroomItem.java +++ b/src/main/java/mods/natura/items/blocks/GlowshroomItem.java @@ -1,9 +1,8 @@ package mods.natura.items.blocks; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mantle.blocks.abstracts.MultiItemBlock; import mods.natura.common.NContent; import net.minecraft.block.Block; @@ -12,33 +11,29 @@ import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; -public class GlowshroomItem extends MultiItemBlock -{ - public static final String blockType[] = { "green", "purple", "blue" }; +public class GlowshroomItem extends MultiItemBlock { + public static final String blockType[] = {"green", "purple", "blue"}; - public GlowshroomItem(Block i) - { + public GlowshroomItem(Block i) { super(i, "block.glowshroom", blockType); setMaxDamage(0); setHasSubtypes(true); } @Override - public IIcon getIconFromDamage (int i) - { + public IIcon getIconFromDamage(int i) { return NContent.glowshroom.getIcon(0, i); } /* @Override - public String getUnlocalizedName (ItemStack itemstack) - { - return (new StringBuilder()).append("block.glowshroom.").append(blockType[itemstack.getItemDamage()]).toString(); - }*/ + public String getUnlocalizedName (ItemStack itemstack) + { + return (new StringBuilder()).append("block.glowshroom.").append(blockType[itemstack.getItemDamage()]).toString(); + }*/ @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { list.add(StatCollector.translateToLocal("tooltip.shroom")); } } diff --git a/src/main/java/mods/natura/items/blocks/GrassBlockItem.java b/src/main/java/mods/natura/items/blocks/GrassBlockItem.java index bcb4ea92..7d4b94ec 100644 --- a/src/main/java/mods/natura/items/blocks/GrassBlockItem.java +++ b/src/main/java/mods/natura/items/blocks/GrassBlockItem.java @@ -3,12 +3,10 @@ import mantle.blocks.abstracts.MultiItemBlock; import net.minecraft.block.Block; -public class GrassBlockItem extends MultiItemBlock -{ - public static final String blockType[] = { "grass", "bluegrass", "autumngrass" }; +public class GrassBlockItem extends MultiItemBlock { + public static final String blockType[] = {"grass", "bluegrass", "autumngrass"}; - public GrassBlockItem(Block id) - { + public GrassBlockItem(Block id) { super(id, "block.soil", blockType); setMaxDamage(0); setHasSubtypes(true); diff --git a/src/main/java/mods/natura/items/blocks/GrassSlabItem.java b/src/main/java/mods/natura/items/blocks/GrassSlabItem.java index 488cffd6..1b7cd907 100644 --- a/src/main/java/mods/natura/items/blocks/GrassSlabItem.java +++ b/src/main/java/mods/natura/items/blocks/GrassSlabItem.java @@ -3,21 +3,19 @@ import mantle.blocks.abstracts.MultiItemBlock; import net.minecraft.block.Block; -public class GrassSlabItem extends MultiItemBlock -{ - public static final String blockType[] = { "grass", "bluegrass", "autumngrass" }; +public class GrassSlabItem extends MultiItemBlock { + public static final String blockType[] = {"grass", "bluegrass", "autumngrass"}; - public GrassSlabItem(Block id) - { + public GrassSlabItem(Block id) { super(id, "block.soil", "slab", blockType); setMaxDamage(0); setHasSubtypes(true); } /* @Override - public String getUnlocalizedName (ItemStack itemstack) - { - int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1); - return (new StringBuilder()).append("block.soil.").append(blockType[pos]).append(".slab").toString(); - }*/ + public String getUnlocalizedName (ItemStack itemstack) + { + int pos = MathHelper.clamp_int(itemstack.getItemDamage(), 0, blockType.length - 1); + return (new StringBuilder()).append("block.soil.").append(blockType[pos]).append(".slab").toString(); + }*/ } diff --git a/src/main/java/mods/natura/items/blocks/LogTwoxTwoItem.java b/src/main/java/mods/natura/items/blocks/LogTwoxTwoItem.java index fad3623b..d45c5aa9 100644 --- a/src/main/java/mods/natura/items/blocks/LogTwoxTwoItem.java +++ b/src/main/java/mods/natura/items/blocks/LogTwoxTwoItem.java @@ -1,34 +1,29 @@ package mods.natura.items.blocks; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; -public class LogTwoxTwoItem extends ItemBlock -{ - public LogTwoxTwoItem(Block i) - { +public class LogTwoxTwoItem extends ItemBlock { + public LogTwoxTwoItem(Block i) { super(i); setMaxDamage(0); setHasSubtypes(true); } @Override - public int getMetadata (int meta) - { + public int getMetadata(int meta) { return meta; } @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { list.add(StatCollector.translateToLocal("tooltip.tree12")); } } diff --git a/src/main/java/mods/natura/items/blocks/NAlternateItem.java b/src/main/java/mods/natura/items/blocks/NAlternateItem.java index 72128892..87725b35 100644 --- a/src/main/java/mods/natura/items/blocks/NAlternateItem.java +++ b/src/main/java/mods/natura/items/blocks/NAlternateItem.java @@ -3,18 +3,15 @@ import net.minecraft.block.Block; import net.minecraft.item.ItemBlock; -public class NAlternateItem extends ItemBlock -{ - public NAlternateItem(Block i) - { +public class NAlternateItem extends ItemBlock { + public NAlternateItem(Block i) { super(i); setMaxDamage(0); setHasSubtypes(true); } @Override - public int getMetadata (int meta) - { + public int getMetadata(int meta) { return meta; } } diff --git a/src/main/java/mods/natura/items/blocks/NDoorItem.java b/src/main/java/mods/natura/items/blocks/NDoorItem.java index fe0d61d9..14bdab56 100644 --- a/src/main/java/mods/natura/items/blocks/NDoorItem.java +++ b/src/main/java/mods/natura/items/blocks/NDoorItem.java @@ -1,9 +1,8 @@ package mods.natura.items.blocks; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mods.natura.common.NContent; import mods.natura.common.NaturaTab; import net.minecraft.block.Block; @@ -18,74 +17,80 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; -public class NDoorItem extends Item -{ +public class NDoorItem extends Item { public IIcon[] icons; - public String[] textureNames = new String[] { "redwood", "eucalyptus", "hopseed", "sakura", "ghostwood", "bloodwood", "redwoodbark" }; + public String[] textureNames = + new String[] {"redwood", "eucalyptus", "hopseed", "sakura", "ghostwood", "bloodwood", "redwoodbark"}; - public NDoorItem() - { + public NDoorItem() { super(); maxStackSize = 64; setCreativeTab(NaturaTab.tab); setHasSubtypes(true); } - public static final String unlocalizedNames[] = { "redwood", "eucalyptus", "hopseed", "sakura", "ghost", "blood", "redwoodBark" }; + public static final String unlocalizedNames[] = { + "redwood", "eucalyptus", "hopseed", "sakura", "ghost", "blood", "redwoodBark" + }; @Override - public String getUnlocalizedName (ItemStack itemstack) - { - return (new StringBuilder()).append(unlocalizedNames[itemstack.getItemDamage()]).append("NDoor").toString(); + public String getUnlocalizedName(ItemStack itemstack) { + return (new StringBuilder()) + .append(unlocalizedNames[itemstack.getItemDamage()]) + .append("NDoor") + .toString(); } @Override - public boolean onItemUse (ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int side, float clickX, float clickY, float clickZ) - { - if (side != 1) - { + public boolean onItemUse( + ItemStack itemstack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float clickX, + float clickY, + float clickZ) { + if (side != 1) { return false; } y++; Block block; - switch (itemstack.getItemDamage()) - { - case 0: - block = NContent.redwoodDoor; - break; - case 1: - block = NContent.eucalyptusDoor; - break; - case 2: - block = NContent.hopseedDoor; - break; - case 3: - block = NContent.sakuraDoor; - break; - case 4: - block = NContent.ghostDoor; - break; - case 5: - block = NContent.bloodDoor; - break; - case 6: - block = NContent.redwoodBarkDoor; - break; - default: - block = Blocks.wooden_door; - break; + switch (itemstack.getItemDamage()) { + case 0: + block = NContent.redwoodDoor; + break; + case 1: + block = NContent.eucalyptusDoor; + break; + case 2: + block = NContent.hopseedDoor; + break; + case 3: + block = NContent.sakuraDoor; + break; + case 4: + block = NContent.ghostDoor; + break; + case 5: + block = NContent.bloodDoor; + break; + case 6: + block = NContent.redwoodBarkDoor; + break; + default: + block = Blocks.wooden_door; + break; } - if (!player.canPlayerEdit(x, y, z, side, itemstack) || !player.canPlayerEdit(x, y + 1, z, side, itemstack)) - { + if (!player.canPlayerEdit(x, y, z, side, itemstack) || !player.canPlayerEdit(x, y + 1, z, side, itemstack)) { return false; } - if (!block.canPlaceBlockAt(world, x, y, z)) - { + if (!block.canPlaceBlockAt(world, x, y, z)) { return false; - } - else - { + } else { int rotate = MathHelper.floor_double(((player.rotationYaw + 180F) * 4F) / 360F - 0.5D) & 3; placeDoorBlock(world, x, y, z, rotate, block); itemstack.stackSize--; @@ -93,43 +98,39 @@ public boolean onItemUse (ItemStack itemstack, EntityPlayer player, World world, } } - public static void placeDoorBlock (World world, int x, int y, int z, int rotate, Block block) - { + public static void placeDoorBlock(World world, int x, int y, int z, int rotate, Block block) { byte var6 = 0; byte var7 = 0; - if (rotate == 0) - { + if (rotate == 0) { var7 = 1; } - if (rotate == 1) - { + if (rotate == 1) { var6 = -1; } - if (rotate == 2) - { + if (rotate == 2) { var7 = -1; } - if (rotate == 3) - { + if (rotate == 3) { var6 = 1; } - int var8 = (world.getBlock(x - var6, y, z - var7).isNormalCube() ? 1 : 0) + (world.getBlock(x - var6, y + 1, z - var7).isNormalCube() ? 1 : 0); - int var9 = (world.getBlock(x + var6, y, z + var7).isNormalCube() ? 1 : 0) + (world.getBlock(x + var6, y + 1, z + var7).isNormalCube() ? 1 : 0); - boolean var10 = world.getBlock(x - var6, y, z - var7) == block || world.getBlock(x - var6, y + 1, z - var7) == block; - boolean var11 = world.getBlock(x + var6, y, z + var7) == block || world.getBlock(x + var6, y + 1, z + var7) == block; + int var8 = (world.getBlock(x - var6, y, z - var7).isNormalCube() ? 1 : 0) + + (world.getBlock(x - var6, y + 1, z - var7).isNormalCube() ? 1 : 0); + int var9 = (world.getBlock(x + var6, y, z + var7).isNormalCube() ? 1 : 0) + + (world.getBlock(x + var6, y + 1, z + var7).isNormalCube() ? 1 : 0); + boolean var10 = + world.getBlock(x - var6, y, z - var7) == block || world.getBlock(x - var6, y + 1, z - var7) == block; + boolean var11 = + world.getBlock(x + var6, y, z + var7) == block || world.getBlock(x + var6, y + 1, z + var7) == block; boolean var12 = false; - if (var10 && !var11) - { + if (var10 && !var11) { var12 = true; - } - else if (var9 > var8) - { + } else if (var9 > var8) { var12 = true; } @@ -141,57 +142,50 @@ else if (var9 > var8) @SideOnly(Side.CLIENT) @Override - public IIcon getIconFromDamage (int meta) - { + public IIcon getIconFromDamage(int meta) { return icons[meta]; } @SideOnly(Side.CLIENT) @Override - public void registerIcons (IIconRegister iconRegister) - { + public void registerIcons(IIconRegister iconRegister) { this.icons = new IIcon[textureNames.length]; - for (int i = 0; i < this.icons.length; ++i) - { + for (int i = 0; i < this.icons.length; ++i) { this.icons[i] = iconRegister.registerIcon("natura:" + textureNames[i] + "_door_item"); } } @Override - public void getSubItems (Item id, CreativeTabs tab, List list) - { - for (int i = 0; i < unlocalizedNames.length; i++) - list.add(new ItemStack(id, 1, i)); + public void getSubItems(Item id, CreativeTabs tab, List list) { + for (int i = 0; i < unlocalizedNames.length; i++) list.add(new ItemStack(id, 1, i)); } @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { - switch (stack.getItemDamage()) - { - case 0: - list.add(StatCollector.translateToLocal("tooltip.tree4")); - break; - case 1: - list.add(StatCollector.translateToLocal("tooltip.tree1")); - break; - case 2: - list.add(StatCollector.translateToLocal("tooltip.tree6")); - break; - case 3: - list.add(StatCollector.translateToLocal("tooltip.tree2")); - break; - case 4: - list.add(StatCollector.translateToLocal("tooltip.tree3")); - break; - case 5: - list.add(StatCollector.translateToLocal("tooltip.firedoor")); - break; - case 6: - list.add(StatCollector.translateToLocal("tooltip.barkdoor")); - break; + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + switch (stack.getItemDamage()) { + case 0: + list.add(StatCollector.translateToLocal("tooltip.tree4")); + break; + case 1: + list.add(StatCollector.translateToLocal("tooltip.tree1")); + break; + case 2: + list.add(StatCollector.translateToLocal("tooltip.tree6")); + break; + case 3: + list.add(StatCollector.translateToLocal("tooltip.tree2")); + break; + case 4: + list.add(StatCollector.translateToLocal("tooltip.tree3")); + break; + case 5: + list.add(StatCollector.translateToLocal("tooltip.firedoor")); + break; + case 6: + list.add(StatCollector.translateToLocal("tooltip.barkdoor")); + break; } } } diff --git a/src/main/java/mods/natura/items/blocks/NLeavesDarkItem.java b/src/main/java/mods/natura/items/blocks/NLeavesDarkItem.java index fa2b01ff..f790204e 100644 --- a/src/main/java/mods/natura/items/blocks/NLeavesDarkItem.java +++ b/src/main/java/mods/natura/items/blocks/NLeavesDarkItem.java @@ -1,59 +1,71 @@ package mods.natura.items.blocks; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mantle.blocks.abstracts.MultiItemBlock; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; -public class NLeavesDarkItem extends MultiItemBlock -{ - public static final String blockType[] = { "darkwood", "darkwood.flowering", "darkwood.fruit", "fusewood", "", "", "", "", "", "", "", "", "", "", "", "", "" }; +public class NLeavesDarkItem extends MultiItemBlock { + public static final String blockType[] = { + "darkwood", + "darkwood.flowering", + "darkwood.fruit", + "fusewood", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "" + }; - public NLeavesDarkItem(Block i) - { + public NLeavesDarkItem(Block i) { super(i, "block.leaves", blockType); setMaxDamage(0); setHasSubtypes(true); } @Override - public int getMetadata (int md) - { + public int getMetadata(int md) { return md | 4; } /* @Override - public String getUnlocalizedName (ItemStack itemstack) - { - return (new StringBuilder()).append("block.leaves.").append(blockType[itemstack.getItemDamage()]).toString(); - }*/ + public String getUnlocalizedName (ItemStack itemstack) + { + return (new StringBuilder()).append("block.leaves.").append(blockType[itemstack.getItemDamage()]).toString(); + }*/ @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { - switch (stack.getItemDamage()) - { - case 0: - list.add(StatCollector.translateToLocal("tooltip.nethertree")); - break; - case 1: - list.add(StatCollector.translateToLocal("tooltip.nethertree")); - list.add(StatCollector.translateToLocal("tooltip.darkwood1")); - break; - case 2: - list.add(StatCollector.translateToLocal("tooltip.nethertree")); - list.add(StatCollector.translateToLocal("tooltip.darkwood2")); - break; - case 3: - list.add(StatCollector.translateToLocal("tooltip.nethertree")); - list.add(StatCollector.translateToLocal("tooltip.fusewood.log")); - break; + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + switch (stack.getItemDamage()) { + case 0: + list.add(StatCollector.translateToLocal("tooltip.nethertree")); + break; + case 1: + list.add(StatCollector.translateToLocal("tooltip.nethertree")); + list.add(StatCollector.translateToLocal("tooltip.darkwood1")); + break; + case 2: + list.add(StatCollector.translateToLocal("tooltip.nethertree")); + list.add(StatCollector.translateToLocal("tooltip.darkwood2")); + break; + case 3: + list.add(StatCollector.translateToLocal("tooltip.nethertree")); + list.add(StatCollector.translateToLocal("tooltip.fusewood.log")); + break; } } } diff --git a/src/main/java/mods/natura/items/blocks/NLeavesItem.java b/src/main/java/mods/natura/items/blocks/NLeavesItem.java index 312d06c9..1bdcd458 100644 --- a/src/main/java/mods/natura/items/blocks/NLeavesItem.java +++ b/src/main/java/mods/natura/items/blocks/NLeavesItem.java @@ -1,53 +1,49 @@ package mods.natura.items.blocks; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mantle.blocks.abstracts.MultiItemBlock; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; -public class NLeavesItem extends MultiItemBlock -{ - public static final String blockType[] = { "redwood", "eucalyptus", "bush", "", "", "", "", "", "", "", "", "", "", "", "", "" }; +public class NLeavesItem extends MultiItemBlock { + public static final String blockType[] = { + "redwood", "eucalyptus", "bush", "", "", "", "", "", "", "", "", "", "", "", "", "" + }; - public NLeavesItem(Block i) - { + public NLeavesItem(Block i) { super(i, "block", "NLeaves", blockType); setMaxDamage(0); setHasSubtypes(true); } @Override - public int getMetadata (int md) - { + public int getMetadata(int md) { return md | 4; } /* @Override - public String getUnlocalizedName (ItemStack itemstack) - { - return (new StringBuilder()).append(blockType[itemstack.getItemDamage()]).append("NLeaves").toString(); - }*/ + public String getUnlocalizedName (ItemStack itemstack) + { + return (new StringBuilder()).append(blockType[itemstack.getItemDamage()]).append("NLeaves").toString(); + }*/ @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { - switch (stack.getItemDamage()) - { - case 0: - list.add(StatCollector.translateToLocal("tooltip.tree4")); - break; - case 1: - list.add(StatCollector.translateToLocal("tooltip.tree1")); - break; - case 2: - list.add(StatCollector.translateToLocal("tooltip.tree6")); - break; + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + switch (stack.getItemDamage()) { + case 0: + list.add(StatCollector.translateToLocal("tooltip.tree4")); + break; + case 1: + list.add(StatCollector.translateToLocal("tooltip.tree1")); + break; + case 2: + list.add(StatCollector.translateToLocal("tooltip.tree6")); + break; } } } diff --git a/src/main/java/mods/natura/items/blocks/NOverrideItem.java b/src/main/java/mods/natura/items/blocks/NOverrideItem.java index 0d5cfe42..81525b3b 100644 --- a/src/main/java/mods/natura/items/blocks/NOverrideItem.java +++ b/src/main/java/mods/natura/items/blocks/NOverrideItem.java @@ -5,24 +5,20 @@ import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.ItemBlock; -public class NOverrideItem extends ItemBlock -{ - public NOverrideItem(Block i) - { +public class NOverrideItem extends ItemBlock { + public NOverrideItem(Block i) { super(i); setMaxDamage(0); setHasSubtypes(true); } @Override - public int getMetadata (int meta) - { + public int getMetadata(int meta) { return meta; } @Override - public CreativeTabs[] getCreativeTabs () - { - return new CreativeTabs[] { getCreativeTab(), NaturaTab.tab }; + public CreativeTabs[] getCreativeTabs() { + return new CreativeTabs[] {getCreativeTab(), NaturaTab.tab}; } } diff --git a/src/main/java/mods/natura/items/blocks/NSaplingItem.java b/src/main/java/mods/natura/items/blocks/NSaplingItem.java index 65ced222..e4e52ce3 100644 --- a/src/main/java/mods/natura/items/blocks/NSaplingItem.java +++ b/src/main/java/mods/natura/items/blocks/NSaplingItem.java @@ -1,9 +1,8 @@ package mods.natura.items.blocks; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mantle.blocks.abstracts.MultiItemBlock; import mods.natura.common.NContent; import net.minecraft.block.Block; @@ -14,13 +13,29 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; -public class NSaplingItem extends MultiItemBlock -{ - public static final String blockType[] = { "redwood", "eucalyptus", "bush", "sakura", "ghost", "blood", "darkwood", "fusewood", "", "", "", "", "", "", "", "", "" }; +public class NSaplingItem extends MultiItemBlock { + public static final String blockType[] = { + "redwood", + "eucalyptus", + "bush", + "sakura", + "ghost", + "blood", + "darkwood", + "fusewood", + "", + "", + "", + "", + "", + "", + "", + "", + "" + }; private Block bID; - public NSaplingItem(Block block) - { + public NSaplingItem(Block block) { super(block, "block.sapling", blockType); setMaxDamage(0); setHasSubtypes(true); @@ -28,8 +43,7 @@ public NSaplingItem(Block block) } @Override - public IIcon getIconFromDamage (int i) - { + public IIcon getIconFromDamage(int i) { return NContent.floraSapling.getIcon(0, i); } @@ -41,122 +55,114 @@ public String getUnlocalizedName (ItemStack itemstack) @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { - switch (stack.getItemDamage()) - { - case 0: - list.add(StatCollector.translateToLocal("tooltip.sapling1")); - list.add(StatCollector.translateToLocal("tooltip.sapling2")); - break; - case 1: - list.add(StatCollector.translateToLocal("tooltip.tree1")); - break; - case 2: - list.add(StatCollector.translateToLocal("tooltip.tree6")); - break; - case 3: - list.add(StatCollector.translateToLocal("tooltip.tree2")); - break; - case 4: - list.add(StatCollector.translateToLocal("tooltip.tree3")); - break; - case 5: - list.add(StatCollector.translateToLocal("tooltip.sapling3")); - list.add(StatCollector.translateToLocal("tooltip.sapling4")); - break; - case 6: - list.add(StatCollector.translateToLocal("tooltip.sapling5")); - break; - case 7: - list.add(StatCollector.translateToLocal("tooltip.fusewood.log")); - break; + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + switch (stack.getItemDamage()) { + case 0: + list.add(StatCollector.translateToLocal("tooltip.sapling1")); + list.add(StatCollector.translateToLocal("tooltip.sapling2")); + break; + case 1: + list.add(StatCollector.translateToLocal("tooltip.tree1")); + break; + case 2: + list.add(StatCollector.translateToLocal("tooltip.tree6")); + break; + case 3: + list.add(StatCollector.translateToLocal("tooltip.tree2")); + break; + case 4: + list.add(StatCollector.translateToLocal("tooltip.tree3")); + break; + case 5: + list.add(StatCollector.translateToLocal("tooltip.sapling3")); + list.add(StatCollector.translateToLocal("tooltip.sapling4")); + break; + case 6: + list.add(StatCollector.translateToLocal("tooltip.sapling5")); + break; + case 7: + list.add(StatCollector.translateToLocal("tooltip.fusewood.log")); + break; } } @Override - public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float par8, float par9, float par10) - { + public boolean onItemUse( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float par8, + float par9, + float par10) { Block blockID = world.getBlock(x, y, z); - if (blockID == Blocks.snow && (world.getBlockMetadata(x, y, z) & 7) < 1) - { + if (blockID == Blocks.snow && (world.getBlockMetadata(x, y, z) & 7) < 1) { side = 1; - } - else if (blockID != Blocks.vine && blockID != Blocks.tallgrass && blockID != Blocks.deadbush && (blockID == null || !blockID.isReplaceable(world, x, y, z))) - { - if (side == 0) - { + } else if (blockID != Blocks.vine + && blockID != Blocks.tallgrass + && blockID != Blocks.deadbush + && (blockID == null || !blockID.isReplaceable(world, x, y, z))) { + if (side == 0) { --y; } - if (side == 1) - { + if (side == 1) { ++y; } - if (side == 2) - { + if (side == 2) { --z; } - if (side == 3) - { + if (side == 3) { ++z; } - if (side == 4) - { + if (side == 4) { --x; } - if (side == 5) - { + if (side == 5) { ++x; } } - if (stack.getItemDamage() == 5) - { + if (stack.getItemDamage() == 5) { Block block = world.getBlock(x, y + 1, z); - if (block == null || world.isAirBlock(x, y + 1, z)) - return false; - } - else - { + if (block == null || world.isAirBlock(x, y + 1, z)) return false; + } else { Block block = world.getBlock(x, y - 1, z); - if (block == null || world.isAirBlock(x, y - 1, z)) - return false; + if (block == null || world.isAirBlock(x, y - 1, z)) return false; } - if (stack.stackSize == 0) - { + if (stack.stackSize == 0) { return false; - } - else if (!player.canPlayerEdit(x, y, z, side, stack)) - { + } else if (!player.canPlayerEdit(x, y, z, side, stack)) { return false; - } - else if (y == 255 && this.bID.getMaterial().isSolid()) - { + } else if (y == 255 && this.bID.getMaterial().isSolid()) { return false; - } - else if (world.canPlaceEntityOnSide(this.bID, x, y, z, false, side, player, stack)) - { + } else if (world.canPlaceEntityOnSide(this.bID, x, y, z, false, side, player, stack)) { Block block = this.bID; int j1 = this.getMetadata(stack.getItemDamage()); int k1 = this.bID.onBlockPlaced(world, x, y, z, side, par8, par9, par10, j1); - if (placeBlockAt(stack, player, world, x, y, z, side, par8, par9, par10, k1)) - { - world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, block.stepSound.getBreakSound(), (block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F); + if (placeBlockAt(stack, player, world, x, y, z, side, par8, par9, par10, k1)) { + world.playSoundEffect( + x + 0.5F, + y + 0.5F, + z + 0.5F, + block.stepSound.getBreakSound(), + (block.stepSound.getVolume() + 1.0F) / 2.0F, + block.stepSound.getPitch() * 0.8F); --stack.stackSize; } return true; - } - else - { + } else { return false; } } diff --git a/src/main/java/mods/natura/items/blocks/NetherBerryBushItem.java b/src/main/java/mods/natura/items/blocks/NetherBerryBushItem.java index 35097cb9..c3045d2d 100644 --- a/src/main/java/mods/natura/items/blocks/NetherBerryBushItem.java +++ b/src/main/java/mods/natura/items/blocks/NetherBerryBushItem.java @@ -1,9 +1,8 @@ package mods.natura.items.blocks; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mantle.blocks.abstracts.MultiItemBlock; import mods.natura.common.NContent; import net.minecraft.block.Block; @@ -14,77 +13,77 @@ import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class NetherBerryBushItem extends MultiItemBlock -{ +public class NetherBerryBushItem extends MultiItemBlock { - public static final String blockType[] = { "blight", "dusk", "sky", "sting", "blight", "dusk", "sky", "sting", "blight", "dusk", "sky", "sting", "blight", "dusk", "sky", "sting" }; + public static final String blockType[] = { + "blight", "dusk", "sky", "sting", "blight", "dusk", "sky", "sting", "blight", "dusk", "sky", "sting", "blight", + "dusk", "sky", "sting" + }; - public NetherBerryBushItem(Block block) - { + public NetherBerryBushItem(Block block) { super(block, "block.bush.berry", blockType); - //setMaxDamage(0); + // setMaxDamage(0); setHasSubtypes(true); } @Override - public int getMetadata (int meta) - { + public int getMetadata(int meta) { return meta % 4; } /* Place bushes on dirt, grass, or other bushes only */ @Override - public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float par8, float par9, float par10) - { - if (side != 1) - return false; - - else if (player.canPlayerEdit(x, y, z, side, stack) && player.canPlayerEdit(x, y + 1, z, side, stack)) - { + public boolean onItemUse( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float par8, + float par9, + float par10) { + if (side != 1) return false; + else if (player.canPlayerEdit(x, y, z, side, stack) && player.canPlayerEdit(x, y + 1, z, side, stack)) { Block block = world.getBlock(x, y, z); - if (block != null && (block.canSustainPlant(world, x, y, z, ForgeDirection.UP, NContent.netherBerryBush) || block == Blocks.netherrack) && world.isAirBlock(x, y + 1, z)) - { + if (block != null + && (block.canSustainPlant(world, x, y, z, ForgeDirection.UP, NContent.netherBerryBush) + || block == Blocks.netherrack) + && world.isAirBlock(x, y + 1, z)) { world.setBlock(x, y + 1, z, NContent.netherBerryBush, stack.getItemDamage() % 4, 3); - if (!player.capabilities.isCreativeMode) - stack.stackSize--; - if (!world.isRemote) - world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(NContent.netherBerryBush)); + if (!player.capabilities.isCreativeMode) stack.stackSize--; + if (!world.isRemote) world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(NContent.netherBerryBush)); return true; - } - else - return false; - } - else - return false; + } else return false; + } else return false; } /* Block name in inventory */ /* @Override - public String getUnlocalizedName (ItemStack itemstack) - { - return (new StringBuilder()).append("block.bush.berry.").append(blockType[itemstack.getItemDamage()]).toString(); - }*/ + public String getUnlocalizedName (ItemStack itemstack) + { + return (new StringBuilder()).append("block.bush.berry.").append(blockType[itemstack.getItemDamage()]).toString(); + }*/ @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { list.add(StatCollector.translateToLocal("tooltip.netherberrybush1")); - switch (stack.getItemDamage() % 4) - { - case 0: - list.add(StatCollector.translateToLocal("tooltip.netherberrybush2")); - break; - case 1: - list.add(StatCollector.translateToLocal("tooltip.netherberrybush3")); - break; - case 2: - list.add(StatCollector.translateToLocal("tooltip.netherberrybush4")); - break; - case 3: - list.add(StatCollector.translateToLocal("tooltip.netherberrybush5")); - break; + switch (stack.getItemDamage() % 4) { + case 0: + list.add(StatCollector.translateToLocal("tooltip.netherberrybush2")); + break; + case 1: + list.add(StatCollector.translateToLocal("tooltip.netherberrybush3")); + break; + case 2: + list.add(StatCollector.translateToLocal("tooltip.netherberrybush4")); + break; + case 3: + list.add(StatCollector.translateToLocal("tooltip.netherberrybush5")); + break; } } } diff --git a/src/main/java/mods/natura/items/blocks/NetherGlassItem.java b/src/main/java/mods/natura/items/blocks/NetherGlassItem.java index 47e1b93b..2adf2688 100644 --- a/src/main/java/mods/natura/items/blocks/NetherGlassItem.java +++ b/src/main/java/mods/natura/items/blocks/NetherGlassItem.java @@ -1,9 +1,8 @@ package mods.natura.items.blocks; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mantle.blocks.abstracts.MultiItemBlock; import mods.natura.common.NContent; import net.minecraft.block.Block; @@ -12,41 +11,35 @@ import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; -public class NetherGlassItem extends MultiItemBlock -{ - public static final String blockType[] = { "soul", "heat" }; +public class NetherGlassItem extends MultiItemBlock { + public static final String blockType[] = {"soul", "heat"}; - public NetherGlassItem(Block block) - { + public NetherGlassItem(Block block) { super(block, "tile.glass", blockType); setMaxDamage(0); setHasSubtypes(true); } /* @Override - public String getUnlocalizedName (ItemStack itemstack) - { - return (new StringBuilder()).append("tile.glass.").append(blockType[itemstack.getItemDamage()]).toString(); - }*/ + public String getUnlocalizedName (ItemStack itemstack) + { + return (new StringBuilder()).append("tile.glass.").append(blockType[itemstack.getItemDamage()]).toString(); + }*/ @Override @SideOnly(Side.CLIENT) - public IIcon getIconFromDamage (int meta) - { - if (meta < 1) - return NContent.netherGlass.icons[2]; + public IIcon getIconFromDamage(int meta) { + if (meta < 1) return NContent.netherGlass.icons[2]; return NContent.netherGlass.icons[3]; } @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { - switch (stack.getItemDamage()) - { - case 0: - list.add(StatCollector.translateToLocal("tooltip.glass.soul")); - break; + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + switch (stack.getItemDamage()) { + case 0: + list.add(StatCollector.translateToLocal("tooltip.glass.soul")); + break; } } } diff --git a/src/main/java/mods/natura/items/blocks/NoColorLeavesItem.java b/src/main/java/mods/natura/items/blocks/NoColorLeavesItem.java index df393806..feaeae50 100644 --- a/src/main/java/mods/natura/items/blocks/NoColorLeavesItem.java +++ b/src/main/java/mods/natura/items/blocks/NoColorLeavesItem.java @@ -1,58 +1,54 @@ package mods.natura.items.blocks; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mantle.blocks.abstracts.MultiItemBlock; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; -public class NoColorLeavesItem extends MultiItemBlock -{ - public static final String blockType[] = { "sakura", "ghost", "blood", "willow", "", "", "", "", "", "", "", "", "", "", "", "", "" }; +public class NoColorLeavesItem extends MultiItemBlock { + public static final String blockType[] = { + "sakura", "ghost", "blood", "willow", "", "", "", "", "", "", "", "", "", "", "", "", "" + }; - public NoColorLeavesItem(Block i) - { + public NoColorLeavesItem(Block i) { super(i, "block.leaves", blockType); setMaxDamage(0); setHasSubtypes(true); } @Override - public int getMetadata (int md) - { + public int getMetadata(int md) { return md | 4; } /* @Override - public String getUnlocalizedName (ItemStack itemstack) - { - return (new StringBuilder()).append("block.leaves.").append(blockType[itemstack.getItemDamage()]).toString(); - }*/ + public String getUnlocalizedName (ItemStack itemstack) + { + return (new StringBuilder()).append("block.leaves.").append(blockType[itemstack.getItemDamage()]).toString(); + }*/ @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { - switch (stack.getItemDamage()) - { - case 0: - list.add(StatCollector.translateToLocal("tooltip.tree2")); - break; - case 1: - list.add(StatCollector.translateToLocal("tooltip.nethertree")); - list.add(StatCollector.translateToLocal("tooltip.tree3")); - break; - case 2: - list.add(StatCollector.translateToLocal("tooltip.nethertree")); - list.add(StatCollector.translateToLocal("tooltip.fireleaves")); - break; - case 3: - list.add(StatCollector.translateToLocal("tooltip.tree11")); - break; + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + switch (stack.getItemDamage()) { + case 0: + list.add(StatCollector.translateToLocal("tooltip.tree2")); + break; + case 1: + list.add(StatCollector.translateToLocal("tooltip.nethertree")); + list.add(StatCollector.translateToLocal("tooltip.tree3")); + break; + case 2: + list.add(StatCollector.translateToLocal("tooltip.nethertree")); + list.add(StatCollector.translateToLocal("tooltip.fireleaves")); + break; + case 3: + list.add(StatCollector.translateToLocal("tooltip.tree11")); + break; } } } diff --git a/src/main/java/mods/natura/items/blocks/OmniShapeBlockItem.java b/src/main/java/mods/natura/items/blocks/OmniShapeBlockItem.java index 8aa6f8f4..5f92dd1d 100644 --- a/src/main/java/mods/natura/items/blocks/OmniShapeBlockItem.java +++ b/src/main/java/mods/natura/items/blocks/OmniShapeBlockItem.java @@ -3,24 +3,25 @@ import mantle.blocks.abstracts.MultiItemBlock; import net.minecraft.block.Block; -public class OmniShapeBlockItem extends MultiItemBlock -{ - public static final String blockType[] = { "stair", "stair", "stair", "stair", "stair", "stair", "stair", "stair", "slab", "slab", "slab", "slab", "slab", "slab", "fence", "none" }; +public class OmniShapeBlockItem extends MultiItemBlock { + public static final String blockType[] = { + "stair", "stair", "stair", "stair", "stair", "stair", "stair", "stair", "slab", "slab", "slab", "slab", "slab", + "slab", "fence", "none" + }; - public OmniShapeBlockItem(Block i) - { + public OmniShapeBlockItem(Block i) { super(i, "", "omni", blockType); setMaxDamage(0); setHasSubtypes(true); } /* @Override - public String getUnlocalizedName (ItemStack itemstack) - { - return (new StringBuilder()).append(blockType[itemstack.getItemDamage()]).append("omni").toString(); - }*/ + public String getUnlocalizedName (ItemStack itemstack) + { + return (new StringBuilder()).append(blockType[itemstack.getItemDamage()]).append("omni").toString(); + }*/ - //was commented out already when moving to mantle interfaces + // was commented out already when moving to mantle interfaces /*@Override @SideOnly(Side.CLIENT) public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) diff --git a/src/main/java/mods/natura/items/blocks/OverworldLeavesItem.java b/src/main/java/mods/natura/items/blocks/OverworldLeavesItem.java index a4c8beda..52d4e4e0 100644 --- a/src/main/java/mods/natura/items/blocks/OverworldLeavesItem.java +++ b/src/main/java/mods/natura/items/blocks/OverworldLeavesItem.java @@ -1,51 +1,46 @@ package mods.natura.items.blocks; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mantle.blocks.abstracts.MultiItemBlock; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; -public class OverworldLeavesItem extends MultiItemBlock -{ - public static final String blockType[] = { "maple", "silverbell", "purpleheart", "tiger" }; +public class OverworldLeavesItem extends MultiItemBlock { + public static final String blockType[] = {"maple", "silverbell", "purpleheart", "tiger"}; - public OverworldLeavesItem(Block i) - { + public OverworldLeavesItem(Block i) { super(i, "block.leaves", blockType); setMaxDamage(0); setHasSubtypes(true); } /* @Override - public String getUnlocalizedName (ItemStack itemstack) - { - int i = MathHelper.clamp_int(itemstack.getItemDamage(), 0, 3); - return (new StringBuilder()).append("block.leaves.").append(blockType[i]).toString(); - }*/ + public String getUnlocalizedName (ItemStack itemstack) + { + int i = MathHelper.clamp_int(itemstack.getItemDamage(), 0, 3); + return (new StringBuilder()).append("block.leaves.").append(blockType[i]).toString(); + }*/ @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { - switch (stack.getItemDamage() % 4) - { - case 0: - list.add(StatCollector.translateToLocal("tooltip.tree7")); - break; - case 1: - list.add(StatCollector.translateToLocal("tooltip.tree8")); - break; - case 2: - list.add(StatCollector.translateToLocal("tooltip.tree9")); - break; - case 3: - list.add(StatCollector.translateToLocal("tooltip.tree10")); - break; + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + switch (stack.getItemDamage() % 4) { + case 0: + list.add(StatCollector.translateToLocal("tooltip.tree7")); + break; + case 1: + list.add(StatCollector.translateToLocal("tooltip.tree8")); + break; + case 2: + list.add(StatCollector.translateToLocal("tooltip.tree9")); + break; + case 3: + list.add(StatCollector.translateToLocal("tooltip.tree10")); + break; } } } diff --git a/src/main/java/mods/natura/items/blocks/OverworldSaplingItem.java b/src/main/java/mods/natura/items/blocks/OverworldSaplingItem.java index de45e875..bca170a1 100644 --- a/src/main/java/mods/natura/items/blocks/OverworldSaplingItem.java +++ b/src/main/java/mods/natura/items/blocks/OverworldSaplingItem.java @@ -1,9 +1,8 @@ package mods.natura.items.blocks; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mantle.blocks.abstracts.MultiItemBlock; import mods.natura.common.NContent; import net.minecraft.block.Block; @@ -12,51 +11,46 @@ import net.minecraft.util.IIcon; import net.minecraft.util.StatCollector; -public class OverworldSaplingItem extends MultiItemBlock -{ - public static final String blockType[] = { "maple", "silverbell", "purpleheart", "tiger", "willow" }; +public class OverworldSaplingItem extends MultiItemBlock { + public static final String blockType[] = {"maple", "silverbell", "purpleheart", "tiger", "willow"}; - public OverworldSaplingItem(Block b) - { + public OverworldSaplingItem(Block b) { super(b, "block.sapling", blockType); setMaxDamage(0); setHasSubtypes(true); } @Override - public IIcon getIconFromDamage (int i) - { + public IIcon getIconFromDamage(int i) { return NContent.rareSapling.getIcon(0, i); } /* @Override - public String getUnlocalizedName (ItemStack itemstack) - { - int i = MathHelper.clamp_int(itemstack.getItemDamage(), 0, 4); - return (new StringBuilder()).append("block.sapling.").append(blockType[i]).toString(); - }*/ + public String getUnlocalizedName (ItemStack itemstack) + { + int i = MathHelper.clamp_int(itemstack.getItemDamage(), 0, 4); + return (new StringBuilder()).append("block.sapling.").append(blockType[i]).toString(); + }*/ @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { - switch (stack.getItemDamage()) - { - case 0: - list.add(StatCollector.translateToLocal("tooltip.tree7")); - break; - case 1: - list.add(StatCollector.translateToLocal("tooltip.tree8")); - break; - case 2: - list.add(StatCollector.translateToLocal("tooltip.tree9")); - break; - case 3: - list.add(StatCollector.translateToLocal("tooltip.tree10")); - break; - case 4: - list.add(StatCollector.translateToLocal("tooltip.tree11")); - break; + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + switch (stack.getItemDamage()) { + case 0: + list.add(StatCollector.translateToLocal("tooltip.tree7")); + break; + case 1: + list.add(StatCollector.translateToLocal("tooltip.tree8")); + break; + case 2: + list.add(StatCollector.translateToLocal("tooltip.tree9")); + break; + case 3: + list.add(StatCollector.translateToLocal("tooltip.tree10")); + break; + case 4: + list.add(StatCollector.translateToLocal("tooltip.tree11")); + break; } } } diff --git a/src/main/java/mods/natura/items/blocks/OverworldTreeItem.java b/src/main/java/mods/natura/items/blocks/OverworldTreeItem.java index 6d023314..9148f3b0 100644 --- a/src/main/java/mods/natura/items/blocks/OverworldTreeItem.java +++ b/src/main/java/mods/natura/items/blocks/OverworldTreeItem.java @@ -1,21 +1,18 @@ package mods.natura.items.blocks; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mantle.blocks.abstracts.MultiItemBlock; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; -public class OverworldTreeItem extends MultiItemBlock -{ - public static final String blockType[] = { "maple", "silverbell", "purpleheart", "tiger" }; +public class OverworldTreeItem extends MultiItemBlock { + public static final String blockType[] = {"maple", "silverbell", "purpleheart", "tiger"}; - public OverworldTreeItem(Block i) - { + public OverworldTreeItem(Block i) { super(i, "block.log", blockType); setMaxDamage(0); setHasSubtypes(true); @@ -30,22 +27,20 @@ public String getUnlocalizedName (ItemStack itemstack) @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { - switch (stack.getItemDamage() % 4) - { - case 0: - list.add(StatCollector.translateToLocal("tooltip.tree7")); - break; - case 1: - list.add(StatCollector.translateToLocal("tooltip.tree8")); - break; - case 2: - list.add(StatCollector.translateToLocal("tooltip.tree9")); - break; - case 3: - list.add(StatCollector.translateToLocal("tooltip.tree10")); - break; + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + switch (stack.getItemDamage() % 4) { + case 0: + list.add(StatCollector.translateToLocal("tooltip.tree7")); + break; + case 1: + list.add(StatCollector.translateToLocal("tooltip.tree8")); + break; + case 2: + list.add(StatCollector.translateToLocal("tooltip.tree9")); + break; + case 3: + list.add(StatCollector.translateToLocal("tooltip.tree10")); + break; } } } diff --git a/src/main/java/mods/natura/items/blocks/PlankSlab1Item.java b/src/main/java/mods/natura/items/blocks/PlankSlab1Item.java index f3174f8f..dd3c232c 100644 --- a/src/main/java/mods/natura/items/blocks/PlankSlab1Item.java +++ b/src/main/java/mods/natura/items/blocks/PlankSlab1Item.java @@ -1,9 +1,8 @@ package mods.natura.items.blocks; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mantle.blocks.abstracts.MultiItemBlock; import mods.natura.common.NContent; import net.minecraft.block.Block; @@ -12,13 +11,13 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; -public class PlankSlab1Item extends MultiItemBlock -{ - public static final String blockType[] = { "eucalyptus", "sakura", "ghost", "redwood", "blood", "bush", "maple", "silverbell" }; +public class PlankSlab1Item extends MultiItemBlock { + public static final String blockType[] = { + "eucalyptus", "sakura", "ghost", "redwood", "blood", "bush", "maple", "silverbell" + }; Block block; - public PlankSlab1Item(Block id) - { + public PlankSlab1Item(Block id) { super(id, "block.wood", "slab", blockType); this.block = id; setMaxDamage(0); @@ -43,50 +42,61 @@ public String getUnlocalizedName (ItemStack itemstack) @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { - switch (stack.getItemDamage()) - { - case 0: - list.add(StatCollector.translateToLocal("tooltip.tree1")); - break; - case 1: - list.add(StatCollector.translateToLocal("tooltip.tree2")); - break; - case 2: - list.add(StatCollector.translateToLocal("tooltip.tree3")); - break; - case 3: - list.add(StatCollector.translateToLocal("tooltip.tree4")); - break; - case 4: - list.add(StatCollector.translateToLocal("tooltip.tree5")); - break; - case 5: - list.add(StatCollector.translateToLocal("tooltip.tree6")); - break; - case 6: - list.add(StatCollector.translateToLocal("tooltip.tree7")); - break; - case 7: - list.add(StatCollector.translateToLocal("tooltip.tree8")); - break; + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + switch (stack.getItemDamage()) { + case 0: + list.add(StatCollector.translateToLocal("tooltip.tree1")); + break; + case 1: + list.add(StatCollector.translateToLocal("tooltip.tree2")); + break; + case 2: + list.add(StatCollector.translateToLocal("tooltip.tree3")); + break; + case 3: + list.add(StatCollector.translateToLocal("tooltip.tree4")); + break; + case 4: + list.add(StatCollector.translateToLocal("tooltip.tree5")); + break; + case 5: + list.add(StatCollector.translateToLocal("tooltip.tree6")); + break; + case 6: + list.add(StatCollector.translateToLocal("tooltip.tree7")); + break; + case 7: + list.add(StatCollector.translateToLocal("tooltip.tree8")); + break; } } @Override - public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) - { + public boolean onItemUse( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float hitX, + float hitY, + float hitZ) { Block id = world.getBlock(x, y, z); int meta = world.getBlockMetadata(x, y, z); int trueMeta = meta % 8; boolean flag = id != null; - if ((side == 1 && !flag || side == 0 && flag) && id == this.block && trueMeta == stack.getItemDamage()) - { - if (world.setBlock(x, y, z, NContent.planks, trueMeta, 3)) - { - world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, this.block.stepSound.getBreakSound(), (this.block.stepSound.getVolume() + 1.0F) / 2.0F, this.block.stepSound.getPitch() * 0.8F); + if ((side == 1 && !flag || side == 0 && flag) && id == this.block && trueMeta == stack.getItemDamage()) { + if (world.setBlock(x, y, z, NContent.planks, trueMeta, 3)) { + world.playSoundEffect( + x + 0.5F, + y + 0.5F, + z + 0.5F, + this.block.stepSound.getBreakSound(), + (this.block.stepSound.getVolume() + 1.0F) / 2.0F, + this.block.stepSound.getPitch() * 0.8F); --stack.stackSize; return true; } diff --git a/src/main/java/mods/natura/items/blocks/PlankSlab2Item.java b/src/main/java/mods/natura/items/blocks/PlankSlab2Item.java index 0b680add..c4516b41 100644 --- a/src/main/java/mods/natura/items/blocks/PlankSlab2Item.java +++ b/src/main/java/mods/natura/items/blocks/PlankSlab2Item.java @@ -1,9 +1,8 @@ package mods.natura.items.blocks; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mantle.blocks.abstracts.MultiItemBlock; import mods.natura.common.NContent; import net.minecraft.block.Block; @@ -12,13 +11,11 @@ import net.minecraft.util.StatCollector; import net.minecraft.world.World; -public class PlankSlab2Item extends MultiItemBlock -{ - public static final String blockType[] = { "purpleheart", "tiger", "willow", "darkwood", "fusewood", "", "", "" }; +public class PlankSlab2Item extends MultiItemBlock { + public static final String blockType[] = {"purpleheart", "tiger", "willow", "darkwood", "fusewood", "", "", ""}; Block block; - public PlankSlab2Item(Block id) - { + public PlankSlab2Item(Block id) { super(id, "block.wood", "slab", blockType); this.block = id; setMaxDamage(0); @@ -26,59 +23,71 @@ public PlankSlab2Item(Block id) } @Override - public String getUnlocalizedName (ItemStack itemstack) - { + public String getUnlocalizedName(ItemStack itemstack) { int damage = itemstack.getItemDamage(); - if (damage >= blockType.length) - { - if (blockType.length == 0) - { + if (damage >= blockType.length) { + if (blockType.length == 0) { return ""; } damage %= blockType.length; } - return (new StringBuilder()).append("block.wood.").append(blockType[damage]).append(".slab").toString(); + return (new StringBuilder()) + .append("block.wood.") + .append(blockType[damage]) + .append(".slab") + .toString(); } @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { - switch (stack.getItemDamage()) - { - case 0: - list.add(StatCollector.translateToLocal("tooltip.tree9")); - break; - case 1: - list.add(StatCollector.translateToLocal("tooltip.tree10")); - break; - case 2: - list.add(StatCollector.translateToLocal("tooltip.tree11")); - break; - case 3: - list.add(StatCollector.translateToLocal("tooltip.nethertree")); - break; - case 4: - list.add(StatCollector.translateToLocal("tooltip.nethertree")); - list.add(StatCollector.translateToLocal("tooltip.fusewood.log")); - break; + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + switch (stack.getItemDamage()) { + case 0: + list.add(StatCollector.translateToLocal("tooltip.tree9")); + break; + case 1: + list.add(StatCollector.translateToLocal("tooltip.tree10")); + break; + case 2: + list.add(StatCollector.translateToLocal("tooltip.tree11")); + break; + case 3: + list.add(StatCollector.translateToLocal("tooltip.nethertree")); + break; + case 4: + list.add(StatCollector.translateToLocal("tooltip.nethertree")); + list.add(StatCollector.translateToLocal("tooltip.fusewood.log")); + break; } } @Override - public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) - { + public boolean onItemUse( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float hitX, + float hitY, + float hitZ) { Block id = world.getBlock(x, y, z); int meta = world.getBlockMetadata(x, y, z); int trueMeta = meta % 8; boolean flag = id != null; - if ((side == 1 && !flag || side == 0 && flag) && id == this.block && trueMeta == stack.getItemDamage()) - { - if (world.setBlock(x, y, z, NContent.planks, trueMeta + 8, 3)) - { - world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, this.block.stepSound.getBreakSound(), (this.block.stepSound.getVolume() + 1.0F) / 2.0F, this.block.stepSound.getPitch() * 0.8F); + if ((side == 1 && !flag || side == 0 && flag) && id == this.block && trueMeta == stack.getItemDamage()) { + if (world.setBlock(x, y, z, NContent.planks, trueMeta + 8, 3)) { + world.playSoundEffect( + x + 0.5F, + y + 0.5F, + z + 0.5F, + this.block.stepSound.getBreakSound(), + (this.block.stepSound.getVolume() + 1.0F) / 2.0F, + this.block.stepSound.getPitch() * 0.8F); --stack.stackSize; return true; } diff --git a/src/main/java/mods/natura/items/blocks/PlanksItem.java b/src/main/java/mods/natura/items/blocks/PlanksItem.java index eb6bf538..cdd878dd 100644 --- a/src/main/java/mods/natura/items/blocks/PlanksItem.java +++ b/src/main/java/mods/natura/items/blocks/PlanksItem.java @@ -1,78 +1,90 @@ package mods.natura.items.blocks; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mantle.blocks.abstracts.MultiItemBlock; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; -public class PlanksItem extends MultiItemBlock -{ - public static final String blockType[] = { "eucalyptus", "sakura", "ghost", "redwood", "blood", "bush", "maple", "silverbell", "purpleheart", "tiger", "willow", "darkwood", "fusewood", "", "", "" }; +public class PlanksItem extends MultiItemBlock { + public static final String blockType[] = { + "eucalyptus", + "sakura", + "ghost", + "redwood", + "blood", + "bush", + "maple", + "silverbell", + "purpleheart", + "tiger", + "willow", + "darkwood", + "fusewood", + "", + "", + "" + }; - public PlanksItem(Block i) - { + public PlanksItem(Block i) { super(i, "block", "NPlanks", blockType); setMaxDamage(0); setHasSubtypes(true); } /* @Override - public String getUnlocalizedName (ItemStack itemstack) - { - return (new StringBuilder()).append(blockType[itemstack.getItemDamage()]).append("NPlanks").toString(); - }*/ + public String getUnlocalizedName (ItemStack itemstack) + { + return (new StringBuilder()).append(blockType[itemstack.getItemDamage()]).append("NPlanks").toString(); + }*/ @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { - switch (stack.getItemDamage()) - { - case 0: - list.add(StatCollector.translateToLocal("tooltip.tree1")); - break; - case 1: - list.add(StatCollector.translateToLocal("tooltip.tree2")); - break; - case 2: - list.add(StatCollector.translateToLocal("tooltip.tree3")); - break; - case 3: - list.add(StatCollector.translateToLocal("tooltip.tree4")); - break; - case 4: - list.add(StatCollector.translateToLocal("tooltip.tree5")); - break; - case 5: - list.add(StatCollector.translateToLocal("tooltip.tree6")); - break; - case 6: - list.add(StatCollector.translateToLocal("tooltip.tree7")); - break; - case 7: - list.add(StatCollector.translateToLocal("tooltip.tree8")); - break; - case 8: - list.add(StatCollector.translateToLocal("tooltip.tree9")); - break; - case 9: - list.add(StatCollector.translateToLocal("tooltip.tree10")); - break; - case 10: - list.add(StatCollector.translateToLocal("tooltip.tree11")); - break; - case 11: - list.add(StatCollector.translateToLocal("tooltip.nethertree")); - break; - case 12: - list.add(StatCollector.translateToLocal("tooltip.nethertree")); - list.add(StatCollector.translateToLocal("tooltip.fusewood.log")); - break; + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + switch (stack.getItemDamage()) { + case 0: + list.add(StatCollector.translateToLocal("tooltip.tree1")); + break; + case 1: + list.add(StatCollector.translateToLocal("tooltip.tree2")); + break; + case 2: + list.add(StatCollector.translateToLocal("tooltip.tree3")); + break; + case 3: + list.add(StatCollector.translateToLocal("tooltip.tree4")); + break; + case 4: + list.add(StatCollector.translateToLocal("tooltip.tree5")); + break; + case 5: + list.add(StatCollector.translateToLocal("tooltip.tree6")); + break; + case 6: + list.add(StatCollector.translateToLocal("tooltip.tree7")); + break; + case 7: + list.add(StatCollector.translateToLocal("tooltip.tree8")); + break; + case 8: + list.add(StatCollector.translateToLocal("tooltip.tree9")); + break; + case 9: + list.add(StatCollector.translateToLocal("tooltip.tree10")); + break; + case 10: + list.add(StatCollector.translateToLocal("tooltip.tree11")); + break; + case 11: + list.add(StatCollector.translateToLocal("tooltip.nethertree")); + break; + case 12: + list.add(StatCollector.translateToLocal("tooltip.nethertree")); + list.add(StatCollector.translateToLocal("tooltip.fusewood.log")); + break; } } } diff --git a/src/main/java/mods/natura/items/blocks/RedwoodItem.java b/src/main/java/mods/natura/items/blocks/RedwoodItem.java index 703ba530..143bac9b 100644 --- a/src/main/java/mods/natura/items/blocks/RedwoodItem.java +++ b/src/main/java/mods/natura/items/blocks/RedwoodItem.java @@ -1,48 +1,45 @@ package mods.natura.items.blocks; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mantle.blocks.abstracts.MultiItemBlock; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; -public class RedwoodItem extends MultiItemBlock -{ - public static final String blockType[] = { "bark", "heart", "root", "", "", "", "", "", "", "", "", "", "", "", "", "" }; +public class RedwoodItem extends MultiItemBlock { + public static final String blockType[] = { + "bark", "heart", "root", "", "", "", "", "", "", "", "", "", "", "", "", "" + }; - public RedwoodItem(Block i) - { + public RedwoodItem(Block i) { super(i, "block", "redwood", blockType); setMaxDamage(0); setHasSubtypes(true); } /* @Override - public String getUnlocalizedName (ItemStack itemstack) - { - return (new StringBuilder()).append(blockType[itemstack.getItemDamage()]).append("Redwood").toString(); - }*/ + public String getUnlocalizedName (ItemStack itemstack) + { + return (new StringBuilder()).append(blockType[itemstack.getItemDamage()]).append("Redwood").toString(); + }*/ @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { - switch (stack.getItemDamage()) - { - case 0: - list.add(StatCollector.translateToLocal("tooltip.redwood1")); - list.add(StatCollector.translateToLocal("tooltip.redwood2")); - break; - case 1: - list.add(StatCollector.translateToLocal("tooltip.redwood3")); - break; - case 2: - list.add(StatCollector.translateToLocal("tooltip.redwood4")); - break; + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + switch (stack.getItemDamage()) { + case 0: + list.add(StatCollector.translateToLocal("tooltip.redwood1")); + list.add(StatCollector.translateToLocal("tooltip.redwood2")); + break; + case 1: + list.add(StatCollector.translateToLocal("tooltip.redwood3")); + break; + case 2: + list.add(StatCollector.translateToLocal("tooltip.redwood4")); + break; } } } diff --git a/src/main/java/mods/natura/items/blocks/SaguaroItem.java b/src/main/java/mods/natura/items/blocks/SaguaroItem.java index 582e7398..814a2194 100644 --- a/src/main/java/mods/natura/items/blocks/SaguaroItem.java +++ b/src/main/java/mods/natura/items/blocks/SaguaroItem.java @@ -1,34 +1,29 @@ package mods.natura.items.blocks; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; -public class SaguaroItem extends ItemBlock -{ - public SaguaroItem(Block i) - { +public class SaguaroItem extends ItemBlock { + public SaguaroItem(Block i) { super(i); setMaxDamage(0); setHasSubtypes(true); } @Override - public int getMetadata (int meta) - { + public int getMetadata(int meta) { return meta; } @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { list.add(StatCollector.translateToLocal("tooltip.saguroplant1")); list.add(StatCollector.translateToLocal("tooltip.saguroplant2")); } diff --git a/src/main/java/mods/natura/items/blocks/TreeItem.java b/src/main/java/mods/natura/items/blocks/TreeItem.java index d27b1309..b2b91d57 100644 --- a/src/main/java/mods/natura/items/blocks/TreeItem.java +++ b/src/main/java/mods/natura/items/blocks/TreeItem.java @@ -1,52 +1,47 @@ package mods.natura.items.blocks; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mantle.blocks.abstracts.MultiItemBlock; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; -public class TreeItem extends MultiItemBlock -{ - public static final String blockType[] = { "eucalyptus", "sakura", "ghost", "hopseed" }; +public class TreeItem extends MultiItemBlock { + public static final String blockType[] = {"eucalyptus", "sakura", "ghost", "hopseed"}; - public TreeItem(Block i) - { + public TreeItem(Block i) { super(i, "block", "log", blockType); setMaxDamage(0); setHasSubtypes(true); } /* @Override - public String getUnlocalizedName (ItemStack itemstack) - { - int i = MathHelper.clamp_int(itemstack.getItemDamage(), 0, 3); - return (new StringBuilder()).append(blockType[i]).append("Log").toString(); - }*/ + public String getUnlocalizedName (ItemStack itemstack) + { + int i = MathHelper.clamp_int(itemstack.getItemDamage(), 0, 3); + return (new StringBuilder()).append(blockType[i]).append("Log").toString(); + }*/ @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { - switch (stack.getItemDamage() % 4) - { - case 0: - list.add(StatCollector.translateToLocal("tooltip.tree1")); - break; - case 1: - list.add(StatCollector.translateToLocal("tooltip.tree2")); - break; - case 2: - list.add(StatCollector.translateToLocal("tooltip.nethertree")); - list.add(StatCollector.translateToLocal("tooltip.tree3")); - break; - case 3: - list.add(StatCollector.translateToLocal("tooltip.tree6")); - break; + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + switch (stack.getItemDamage() % 4) { + case 0: + list.add(StatCollector.translateToLocal("tooltip.tree1")); + break; + case 1: + list.add(StatCollector.translateToLocal("tooltip.tree2")); + break; + case 2: + list.add(StatCollector.translateToLocal("tooltip.nethertree")); + list.add(StatCollector.translateToLocal("tooltip.tree3")); + break; + case 3: + list.add(StatCollector.translateToLocal("tooltip.tree6")); + break; } } } diff --git a/src/main/java/mods/natura/items/blocks/WillowItem.java b/src/main/java/mods/natura/items/blocks/WillowItem.java index f9afda28..39a17ffe 100644 --- a/src/main/java/mods/natura/items/blocks/WillowItem.java +++ b/src/main/java/mods/natura/items/blocks/WillowItem.java @@ -1,42 +1,37 @@ package mods.natura.items.blocks; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mantle.blocks.abstracts.MultiItemBlock; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.util.StatCollector; -public class WillowItem extends MultiItemBlock -{ - public static final String blockType[] = { "willow", "sakura", "ghost", "hopseed" }; +public class WillowItem extends MultiItemBlock { + public static final String blockType[] = {"willow", "sakura", "ghost", "hopseed"}; - public WillowItem(Block i) - { + public WillowItem(Block i) { super(i, "block.log", blockType); setMaxDamage(0); setHasSubtypes(true); } /* @Override - public String getUnlocalizedName (ItemStack itemstack) - { - int i = MathHelper.clamp_int(itemstack.getItemDamage(), 0, 3); - return (new StringBuilder()).append("block.log.").append(blockType[i]).toString(); - }*/ + public String getUnlocalizedName (ItemStack itemstack) + { + int i = MathHelper.clamp_int(itemstack.getItemDamage(), 0, 3); + return (new StringBuilder()).append("block.log.").append(blockType[i]).toString(); + }*/ @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { - switch (stack.getItemDamage() % 4) - { - case 0: - list.add(StatCollector.translateToLocal("tooltip.tree11")); - break; + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { + switch (stack.getItemDamage() % 4) { + case 0: + list.add(StatCollector.translateToLocal("tooltip.tree11")); + break; } } } diff --git a/src/main/java/mods/natura/items/tools/FlintAndBlaze.java b/src/main/java/mods/natura/items/tools/FlintAndBlaze.java index 6b278ecf..fb37d6f5 100644 --- a/src/main/java/mods/natura/items/tools/FlintAndBlaze.java +++ b/src/main/java/mods/natura/items/tools/FlintAndBlaze.java @@ -7,10 +7,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.world.World; -public class FlintAndBlaze extends Item -{ - public FlintAndBlaze() - { +public class FlintAndBlaze extends Item { + public FlintAndBlaze() { super(); this.maxStackSize = 1; this.setMaxDamage(256); @@ -62,49 +60,49 @@ public EnumAction getItemUseAction (ItemStack par1ItemStack) return EnumAction.bow; }*/ - //Right-click on blocks + // Right-click on blocks @Override - public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) - { - if (side == 0) - { + public boolean onItemUse( + ItemStack stack, + EntityPlayer player, + World world, + int x, + int y, + int z, + int side, + float hitX, + float hitY, + float hitZ) { + if (side == 0) { --y; } - if (side == 1) - { + if (side == 1) { ++y; } - if (side == 2) - { + if (side == 2) { --z; } - if (side == 3) - { + if (side == 3) { ++z; } - if (side == 4) - { + if (side == 4) { --x; } - if (side == 5) - { + if (side == 5) { ++x; } - if (!player.canPlayerEdit(x, y, z, side, stack)) - { + if (!player.canPlayerEdit(x, y, z, side, stack)) { return false; - } - else - { - if (world.isAirBlock(x, y, z)) - { - world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); + } else { + if (world.isAirBlock(x, y, z)) { + world.playSoundEffect( + x + 0.5D, y + 0.5D, z + 0.5D, "fire.ignite", 1.0F, itemRand.nextFloat() * 0.4F + 0.8F); world.setBlock(x, y, z, Blocks.fire); } diff --git a/src/main/java/mods/natura/items/tools/FusewoodBow.java b/src/main/java/mods/natura/items/tools/FusewoodBow.java index 60d0da50..6c4bb614 100644 --- a/src/main/java/mods/natura/items/tools/FusewoodBow.java +++ b/src/main/java/mods/natura/items/tools/FusewoodBow.java @@ -10,85 +10,73 @@ import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.ArrowLooseEvent; -public class FusewoodBow extends NaturaBow -{ +public class FusewoodBow extends NaturaBow { - public FusewoodBow(int damage, String type) - { + public FusewoodBow(int damage, String type) { super(damage, type); } @Override - public void onPlayerStoppedUsing (ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4) - { + public void onPlayerStoppedUsing( + ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4) { int j = this.getMaxItemUseDuration(par1ItemStack) - par4; ArrowLooseEvent event = new ArrowLooseEvent(par3EntityPlayer, par1ItemStack, j); MinecraftForge.EVENT_BUS.post(event); - if (event.isCanceled()) - { + if (event.isCanceled()) { return; } j = event.charge; - boolean flag = par3EntityPlayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, par1ItemStack) > 0; + boolean flag = par3EntityPlayer.capabilities.isCreativeMode + || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, par1ItemStack) > 0; - if (flag || par3EntityPlayer.inventory.hasItem(Items.arrow)) - { + if (flag || par3EntityPlayer.inventory.hasItem(Items.arrow)) { float f = j / 20.0F; f = (f * f + f * 2.0F) / 3.0F; - if (f < 0.1D) - { + if (f < 0.1D) { return; } - if (f > 1.0F) - { + if (f > 1.0F) { f = 1.0F; } FusewoodArrow entityarrow = new FusewoodArrow(par2World, par3EntityPlayer, f * 2.0F); entityarrow.shootingEntity = par3EntityPlayer; - if (f == 1.0F) - { + if (f == 1.0F) { entityarrow.setIsCritical(true); } int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, par1ItemStack); - if (k > 0) - { + if (k > 0) { entityarrow.setDamage(entityarrow.getDamage() + k * 0.5D + 0.5D); } int l = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, par1ItemStack); - if (l > 0) - { + if (l > 0) { entityarrow.setKnockbackStrength(l); } - if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, par1ItemStack) > 0) - { + if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, par1ItemStack) > 0) { entityarrow.setFire(100); } par1ItemStack.damageItem(1, par3EntityPlayer); - par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F); + par2World.playSoundAtEntity( + par3EntityPlayer, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F); - if (flag) - { + if (flag) { entityarrow.canBePickedUp = 2; - } - else - { + } else { par3EntityPlayer.inventory.consumeInventoryItem(Items.arrow); } - if (!par2World.isRemote) - { + if (!par2World.isRemote) { par2World.spawnEntityInWorld(entityarrow); } } diff --git a/src/main/java/mods/natura/items/tools/NaturaArmor.java b/src/main/java/mods/natura/items/tools/NaturaArmor.java index fc2e431c..6cc695f6 100644 --- a/src/main/java/mods/natura/items/tools/NaturaArmor.java +++ b/src/main/java/mods/natura/items/tools/NaturaArmor.java @@ -1,9 +1,8 @@ package mods.natura.items.tools; -import java.util.List; - import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import java.util.List; import mods.natura.common.NContent; import mods.natura.common.NaturaTab; import net.minecraft.client.renderer.texture.IIconRegister; @@ -13,13 +12,11 @@ import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; -public class NaturaArmor extends ItemArmor -{ +public class NaturaArmor extends ItemArmor { String itemTexture; String armorTexture; - public NaturaArmor(ArmorMaterial material, int renderIndex, int slotType, String itemTexture, String armorTexture) - { + public NaturaArmor(ArmorMaterial material, int renderIndex, int slotType, String itemTexture, String armorTexture) { super(material, renderIndex, slotType); this.itemTexture = itemTexture; this.armorTexture = armorTexture; @@ -28,37 +25,31 @@ public NaturaArmor(ArmorMaterial material, int renderIndex, int slotType, String @Override @SideOnly(Side.CLIENT) - public void registerIcons (IIconRegister par1IconRegister) - { + public void registerIcons(IIconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon("natura:armor_" + itemTexture); } @Override - public String getArmorTexture (ItemStack stack, Entity entity, int slot, String type) - { - if (slot == 2) - return "natura:textures/armor/" + armorTexture + "_2.png"; - else - return "natura:textures/armor/" + armorTexture + "_1.png"; + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { + if (slot == 2) return "natura:textures/armor/" + armorTexture + "_2.png"; + else return "natura:textures/armor/" + armorTexture + "_1.png"; } @Override - public void getSubItems (Item id, CreativeTabs tab, List list) - { - switch (armorType) - { - case 0: - list.add(NContent.impHelmetStack.copy()); - break; - case 1: - list.add(NContent.impJerkinStack.copy()); - break; - case 2: - list.add(NContent.impLeggingsStack.copy()); - break; - case 3: - list.add(NContent.impBootsStack.copy()); - break; + public void getSubItems(Item id, CreativeTabs tab, List list) { + switch (armorType) { + case 0: + list.add(NContent.impHelmetStack.copy()); + break; + case 1: + list.add(NContent.impJerkinStack.copy()); + break; + case 2: + list.add(NContent.impLeggingsStack.copy()); + break; + case 3: + list.add(NContent.impBootsStack.copy()); + break; } } } diff --git a/src/main/java/mods/natura/items/tools/NaturaBow.java b/src/main/java/mods/natura/items/tools/NaturaBow.java index 4df9b024..17a15aab 100644 --- a/src/main/java/mods/natura/items/tools/NaturaBow.java +++ b/src/main/java/mods/natura/items/tools/NaturaBow.java @@ -9,14 +9,12 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; -public class NaturaBow extends ItemBow -{ - public static final String[] drawNames = new String[] { "_bow_drawn_0", "_bow_drawn_1", "_bow_drawn_2" }; +public class NaturaBow extends ItemBow { + public static final String[] drawNames = new String[] {"_bow_drawn_0", "_bow_drawn_1", "_bow_drawn_2"}; IIcon[] icons; String woodType; - public NaturaBow(int damage, String type) - { + public NaturaBow(int damage, String type) { super(); this.setMaxDamage(damage); this.woodType = type; @@ -26,28 +24,22 @@ public NaturaBow(int damage, String type) @Override @SideOnly(Side.CLIENT) - public void registerIcons (IIconRegister par1IconRegister) - { + public void registerIcons(IIconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon("natura:" + woodType + "_bow"); this.icons = new IIcon[bowPullIconNameArray.length]; - for (int i = 0; i < this.icons.length; ++i) - { + for (int i = 0; i < this.icons.length; ++i) { this.icons[i] = par1IconRegister.registerIcon("natura:" + woodType + drawNames[i]); } } @Override @SideOnly(Side.CLIENT) - public IIcon getIcon (ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) - { - if (usingItem != null) - { + public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { + if (usingItem != null) { int time = 72000 - useRemaining; - if (time < 8) - return icons[0]; - if (time < 14) - return icons[1]; + if (time < 8) return icons[0]; + if (time < 14) return icons[1]; return icons[2]; } return getIcon(stack, renderPass); @@ -55,8 +47,7 @@ public IIcon getIcon (ItemStack stack, int renderPass, EntityPlayer player, Item @Override @SideOnly(Side.CLIENT) - public IIcon getItemIconForUseDuration (int par1) - { + public IIcon getItemIconForUseDuration(int par1) { return this.icons[par1]; } } diff --git a/src/main/java/mods/natura/items/tools/NaturaHatchet.java b/src/main/java/mods/natura/items/tools/NaturaHatchet.java index 630cf06d..b8fca31d 100644 --- a/src/main/java/mods/natura/items/tools/NaturaHatchet.java +++ b/src/main/java/mods/natura/items/tools/NaturaHatchet.java @@ -17,8 +17,7 @@ public NaturaHatchet(ToolMaterial toolMaterial, String texture) { @SideOnly(Side.CLIENT) @Override - public void registerIcons (IIconRegister iconRegister) { + public void registerIcons(IIconRegister iconRegister) { this.itemIcon = iconRegister.registerIcon("natura:" + texture + "_hatchet"); } - } diff --git a/src/main/java/mods/natura/items/tools/NaturaKama.java b/src/main/java/mods/natura/items/tools/NaturaKama.java index b8fec1e5..78136540 100644 --- a/src/main/java/mods/natura/items/tools/NaturaKama.java +++ b/src/main/java/mods/natura/items/tools/NaturaKama.java @@ -1,11 +1,10 @@ package mods.natura.items.tools; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.List; import java.util.Random; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import mods.natura.common.NaturaTab; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; @@ -23,12 +22,10 @@ import net.minecraft.world.World; import net.minecraftforge.common.IShearable; -public class NaturaKama extends ItemSword -{ +public class NaturaKama extends ItemSword { String texture; - public NaturaKama(ToolMaterial toolmaterial, String texture) - { + public NaturaKama(ToolMaterial toolmaterial, String texture) { super(toolmaterial); this.texture = texture; this.setCreativeTab(NaturaTab.tab); @@ -36,19 +33,23 @@ public NaturaKama(ToolMaterial toolmaterial, String texture) @Override @SideOnly(Side.CLIENT) - public void registerIcons (IIconRegister par1IconRegister) - { + public void registerIcons(IIconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon("natura:" + texture + "_kama"); } /* Shears */ - public boolean onBlockDestroyed (ItemStack par1ItemStack, World par2World, int par3, int par4, int par5, int par6, EntityLiving par7EntityLiving) - { + public boolean onBlockDestroyed( + ItemStack par1ItemStack, + World par2World, + int par3, + int par4, + int par5, + int par6, + EntityLiving par7EntityLiving) { return true; } - public boolean canHarvestBlock (Block par1Block) - { + public boolean canHarvestBlock(Block par1Block) { return par1Block == Blocks.web || par1Block == Blocks.redstone_wire || par1Block == Blocks.tripwire; } @@ -56,29 +57,31 @@ public boolean canHarvestBlock (Block par1Block) * Returns the strength of the stack against a given block. 1.0F base, (Quality+1)*2 if correct blocktype, 1.5F if * sword */ - public float getStrVsBlock (ItemStack par1ItemStack, Block par2Block) - { - return par2Block != Blocks.web && par2Block != Blocks.leaves ? (par2Block == Blocks.wool ? 5.0F : super.func_150893_a/*getStrVsBlock*/(par1ItemStack, par2Block)) : 15.0F; + public float getStrVsBlock(ItemStack par1ItemStack, Block par2Block) { + return par2Block != Blocks.web && par2Block != Blocks.leaves + ? (par2Block == Blocks.wool ? 5.0F : super.func_150893_a /*getStrVsBlock*/(par1ItemStack, par2Block)) + : 15.0F; } @Override - public boolean itemInteractionForEntity (ItemStack itemstack, EntityPlayer player, EntityLivingBase entity) - { - if (entity.worldObj.isRemote) - { + public boolean itemInteractionForEntity(ItemStack itemstack, EntityPlayer player, EntityLivingBase entity) { + if (entity.worldObj.isRemote) { return false; } - if (entity instanceof IShearable) - { + if (entity instanceof IShearable) { IShearable target = (IShearable) entity; - if (target.isShearable(itemstack, entity.worldObj, (int) entity.posX, (int) entity.posY, (int) entity.posZ)) - { - ArrayList drops = target.onSheared(itemstack, entity.worldObj, (int) entity.posX, (int) entity.posY, (int) entity.posZ, + if (target.isShearable( + itemstack, entity.worldObj, (int) entity.posX, (int) entity.posY, (int) entity.posZ)) { + ArrayList drops = target.onSheared( + itemstack, + entity.worldObj, + (int) entity.posX, + (int) entity.posY, + (int) entity.posZ, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, itemstack)); Random rand = new Random(); - for (ItemStack stack : drops) - { + for (ItemStack stack : drops) { EntityItem ent = entity.entityDropItem(stack, 1.0F); ent.motionY += rand.nextFloat() * 0.05F; ent.motionX += (rand.nextFloat() - rand.nextFloat()) * 0.1F; @@ -92,23 +95,24 @@ public boolean itemInteractionForEntity (ItemStack itemstack, EntityPlayer playe } @Override - public boolean onBlockStartBreak (ItemStack itemstack, int x, int y, int z, EntityPlayer player) - { - if (player.worldObj.isRemote) - { + public boolean onBlockStartBreak(ItemStack itemstack, int x, int y, int z, EntityPlayer player) { + if (player.worldObj.isRemote) { return false; } Block id = player.worldObj.getBlock(x, y, z); - if (id instanceof IShearable) - { + if (id instanceof IShearable) { IShearable target = (IShearable) id; - if (target.isShearable(itemstack, player.worldObj, x, y, z)) - { - ArrayList drops = target.onSheared(itemstack, player.worldObj, x, y, z, EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, itemstack)); + if (target.isShearable(itemstack, player.worldObj, x, y, z)) { + ArrayList drops = target.onSheared( + itemstack, + player.worldObj, + x, + y, + z, + EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, itemstack)); Random rand = new Random(); - for (ItemStack stack : drops) - { + for (ItemStack stack : drops) { float f = 0.7F; double d = rand.nextFloat() * f + (1.0F - f) * 0.5D; double d1 = rand.nextFloat() * f + (1.0F - f) * 0.5D; @@ -127,8 +131,7 @@ public boolean onBlockStartBreak (ItemStack itemstack, int x, int y, int z, Enti @Override @SideOnly(Side.CLIENT) - public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4) - { + public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) { list.add(StatCollector.translateToLocal("tooltip.kama")); } } diff --git a/src/main/java/mods/natura/items/tools/NaturaPickaxe.java b/src/main/java/mods/natura/items/tools/NaturaPickaxe.java index 5de18f89..10f0a142 100644 --- a/src/main/java/mods/natura/items/tools/NaturaPickaxe.java +++ b/src/main/java/mods/natura/items/tools/NaturaPickaxe.java @@ -20,5 +20,4 @@ public NaturaPickaxe(ToolMaterial toolMaterial, String texture) { public void registerIcons(IIconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon("natura:" + texture + "_pickaxe"); } - } diff --git a/src/main/java/mods/natura/items/tools/NaturaShovel.java b/src/main/java/mods/natura/items/tools/NaturaShovel.java index 4e0aad91..aee6a387 100644 --- a/src/main/java/mods/natura/items/tools/NaturaShovel.java +++ b/src/main/java/mods/natura/items/tools/NaturaShovel.java @@ -20,5 +20,4 @@ public NaturaShovel(ToolMaterial toolMaterial, String texture) { public void registerIcons(IIconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon("natura:" + texture + "_shovel"); } - } diff --git a/src/main/java/mods/natura/items/tools/NaturaSword.java b/src/main/java/mods/natura/items/tools/NaturaSword.java index 8a71832f..adb168bd 100644 --- a/src/main/java/mods/natura/items/tools/NaturaSword.java +++ b/src/main/java/mods/natura/items/tools/NaturaSword.java @@ -20,5 +20,4 @@ public NaturaSword(ToolMaterial toolMaterial, String texture) { public void registerIcons(IIconRegister par1IconRegister) { this.itemIcon = par1IconRegister.registerIcon("natura:" + texture + "_sword"); } - } diff --git a/src/main/java/mods/natura/plugins/PluginController.java b/src/main/java/mods/natura/plugins/PluginController.java index d7f294f2..235670c2 100644 --- a/src/main/java/mods/natura/plugins/PluginController.java +++ b/src/main/java/mods/natura/plugins/PluginController.java @@ -19,19 +19,17 @@ */ public class PluginController { - private PluginController() { - } // Not to be instantiated. + private PluginController() {} // Not to be instantiated. public static void registerBuiltins() { - pulsar.registerPulse(new TE4Pulse()); - pulsar.registerPulse(new BuildCraftPulse()); - pulsar.registerPulse(new ForestryPulse()); - pulsar.registerPulse(new TreeCapitatorPulse()); - pulsar.registerPulse(new ThaumcraftPulse()); - pulsar.registerPulse(new FMPPulse()); - pulsar.registerPulse(new NEIPulse()); - pulsar.registerPulse(new MFRPulse()); - pulsar.registerPulse(new WailaPulse()); + pulsar.registerPulse(new TE4Pulse()); + pulsar.registerPulse(new BuildCraftPulse()); + pulsar.registerPulse(new ForestryPulse()); + pulsar.registerPulse(new TreeCapitatorPulse()); + pulsar.registerPulse(new ThaumcraftPulse()); + pulsar.registerPulse(new FMPPulse()); + pulsar.registerPulse(new NEIPulse()); + pulsar.registerPulse(new MFRPulse()); + pulsar.registerPulse(new WailaPulse()); } - } diff --git a/src/main/java/mods/natura/plugins/fmp/FMPPulse.java b/src/main/java/mods/natura/plugins/fmp/FMPPulse.java index 318c0de0..79a8ac9a 100644 --- a/src/main/java/mods/natura/plugins/fmp/FMPPulse.java +++ b/src/main/java/mods/natura/plugins/fmp/FMPPulse.java @@ -7,9 +7,9 @@ @Pulse(id = "Natura FMP Compatibility", modsRequired = ForgeMultiPart.modId) public class FMPPulse { - + @Handler - public void init (FMLInitializationEvent evt) { + public void init(FMLInitializationEvent evt) { try { Natura.logger.debug("[FMP] Registering Natura decorative blocks with FMP."); ForgeMultiPart.registerBlocks(); @@ -17,5 +17,4 @@ public void init (FMLInitializationEvent evt) { Natura.logger.catching(e); } } - } diff --git a/src/main/java/mods/natura/plugins/fmp/ForgeMultiPart.java b/src/main/java/mods/natura/plugins/fmp/ForgeMultiPart.java index b18defa4..67679927 100644 --- a/src/main/java/mods/natura/plugins/fmp/ForgeMultiPart.java +++ b/src/main/java/mods/natura/plugins/fmp/ForgeMultiPart.java @@ -22,7 +22,7 @@ public static void registerBlocks() { registerBlock(NContent.floraLeavesNoColor, 0, 2); } - //For blocks with metadata values only + // For blocks with metadata values only public static void registerBlock(Block block, int metastart, int metaend) { for (int meta = metastart; meta <= metaend; meta++) { String identifier = new String(block.getUnlocalizedName()); @@ -30,22 +30,22 @@ public static void registerBlock(Block block, int metastart, int metaend) { } } - //For blocks without metadata values only. + // For blocks without metadata values only. public static void registerBlock(Block block) { BlockMicroMaterial.createAndRegister(block, 0); } - //For blocks with metadata values and special MicroMaterial only - public static void registerBlock(Block block, int metastart, int metaend, MicroMaterialRegistry.IMicroMaterial material) { + // For blocks with metadata values and special MicroMaterial only + public static void registerBlock( + Block block, int metastart, int metaend, MicroMaterialRegistry.IMicroMaterial material) { for (int meta = metastart; meta <= metaend; meta++) { String identifier = new String(block.getUnlocalizedName()); MicroMaterialRegistry.registerMaterial(material, identifier + meta); } } - //For blocks without metadata values and special MicroMaterial only. + // For blocks without metadata values and special MicroMaterial only. public static void registerBlock(Block block, MicroMaterialRegistry.IMicroMaterial material) { MicroMaterialRegistry.registerMaterial(material, new String(block.getUnlocalizedName())); } - } diff --git a/src/main/java/mods/natura/plugins/imc/BuildCraftPulse.java b/src/main/java/mods/natura/plugins/imc/BuildCraftPulse.java index de59d229..5b3204ff 100644 --- a/src/main/java/mods/natura/plugins/imc/BuildCraftPulse.java +++ b/src/main/java/mods/natura/plugins/imc/BuildCraftPulse.java @@ -15,22 +15,21 @@ public class BuildCraftPulse { public static final String modId = "BuildCraft|Transport"; @Handler - public void init (FMLInitializationEvent evt) { - if(PHNatura.enableNetherBerryBushes) { + public void init(FMLInitializationEvent evt) { + if (PHNatura.enableNetherBerryBushes) { for (int i = 0; i < 4; i++) { addFacade(NContent.netherBerryBush, i); } - } - if(PHNatura.enableBerryBushes) { + } + if (PHNatura.enableBerryBushes) { for (int i = 0; i < 4; i++) { addFacade(NContent.berryBush, i); } - } + } addFacade(NContent.saguaro, 0); } - private void addFacade (Block b, int meta) { + private void addFacade(Block b, int meta) { FMLInterModComms.sendMessage("BuildCraft|Transport", "add-facade", new ItemStack(b, 1, meta)); } - } diff --git a/src/main/java/mods/natura/plugins/imc/ForestryPulse.java b/src/main/java/mods/natura/plugins/imc/ForestryPulse.java index e56592c9..e561216f 100644 --- a/src/main/java/mods/natura/plugins/imc/ForestryPulse.java +++ b/src/main/java/mods/natura/plugins/imc/ForestryPulse.java @@ -5,14 +5,12 @@ import mantle.pulsar.pulse.Pulse; @Pulse(id = "Natura Forestry Compatibility", modsRequired = ForestryPulse.modId) -public class ForestryPulse -{ +public class ForestryPulse { public static final String modId = "Forestry"; @Handler - public void init (FMLInitializationEvent evt) - { + public void init(FMLInitializationEvent evt) { /* //Forestry StringBuilder builder = new StringBuilder(); @@ -23,5 +21,4 @@ public void init (FMLInitializationEvent evt) FMLInterModComms.sendMessage("Forestry", "add-farmable-crop", string); */ } - } diff --git a/src/main/java/mods/natura/plugins/imc/TreeCapitatorPulse.java b/src/main/java/mods/natura/plugins/imc/TreeCapitatorPulse.java index c71923b5..b2176d5e 100644 --- a/src/main/java/mods/natura/plugins/imc/TreeCapitatorPulse.java +++ b/src/main/java/mods/natura/plugins/imc/TreeCapitatorPulse.java @@ -17,11 +17,18 @@ public class TreeCapitatorPulse { public static final String modId = "Treecapitator"; @Handler - public void init (FMLInitializationEvent evt) { + public void init(FMLInitializationEvent evt) { NBTTagCompound tpModCfg = new NBTTagCompound(); tpModCfg.setString("modID", "Natura"); - tpModCfg.setString("axeIDList", String.format("%s; %s; %s; %s; %s", getUniqueName(NContent.ghostwoodAxe), getUniqueName(NContent.bloodwoodAxe), getUniqueName(NContent.darkwoodAxe), - getUniqueName(NContent.fusewoodAxe), getUniqueName(NContent.netherquartzAxe))); + tpModCfg.setString( + "axeIDList", + String.format( + "%s; %s; %s; %s; %s", + getUniqueName(NContent.ghostwoodAxe), + getUniqueName(NContent.bloodwoodAxe), + getUniqueName(NContent.darkwoodAxe), + getUniqueName(NContent.fusewoodAxe), + getUniqueName(NContent.netherquartzAxe))); tpModCfg.setBoolean("useShiftedItemID", false); NBTTagList treeList = new NBTTagList(); @@ -29,90 +36,166 @@ public void init (FMLInitializationEvent evt) { // amaranth NBTTagCompound treeDef = new NBTTagCompound(); treeDef.setString("treeName", "amaranth"); - treeDef.setString("logs", String.format("%s,2; %s,6; %s,10", getUniqueName(NContent.rareTree), getUniqueName(NContent.rareTree), getUniqueName(NContent.rareTree))); - treeDef.setString("leaves", String.format("%s,2; %s,10", getUniqueName(NContent.rareLeaves), getUniqueName(NContent.rareLeaves))); + treeDef.setString( + "logs", + String.format( + "%s,2; %s,6; %s,10", + getUniqueName(NContent.rareTree), + getUniqueName(NContent.rareTree), + getUniqueName(NContent.rareTree))); + treeDef.setString( + "leaves", + String.format("%s,2; %s,10", getUniqueName(NContent.rareLeaves), getUniqueName(NContent.rareLeaves))); treeList.appendTag(treeDef); // bloodwood treeDef = new NBTTagCompound(); treeDef.setString("treeName", "bloodwood"); treeDef.setString("logs", String.format("%s", getUniqueName(NContent.bloodwood))); - treeDef.setString("leaves", String.format("%s,2; %s,10", getUniqueName(NContent.floraLeavesNoColor), getUniqueName(NContent.floraLeavesNoColor))); + treeDef.setString( + "leaves", + String.format( + "%s,2; %s,10", + getUniqueName(NContent.floraLeavesNoColor), getUniqueName(NContent.floraLeavesNoColor))); treeList.appendTag(treeDef); // darkwood treeDef = new NBTTagCompound(); treeDef.setString("treeName", "darkwood"); - treeDef.setString("logs", String.format("%s,0; %s,4; %s,8", getUniqueName(NContent.darkTree), getUniqueName(NContent.darkTree), getUniqueName(NContent.darkTree))); + treeDef.setString( + "logs", + String.format( + "%s,0; %s,4; %s,8", + getUniqueName(NContent.darkTree), + getUniqueName(NContent.darkTree), + getUniqueName(NContent.darkTree))); treeDef.setString("leaves", String.format("%s", getUniqueName(NContent.darkLeaves))); treeList.appendTag(treeDef); // eucalyptus treeDef = new NBTTagCompound(); treeDef.setString("treeName", "eucalyptus"); - treeDef.setString("logs", String.format("%s,0; %s,4; %s,8", getUniqueName(NContent.tree), getUniqueName(NContent.tree), getUniqueName(NContent.tree))); - treeDef.setString("leaves", String.format("%s,1; %s,9", getUniqueName(NContent.floraLeaves), getUniqueName(NContent.floraLeaves))); + treeDef.setString( + "logs", + String.format( + "%s,0; %s,4; %s,8", + getUniqueName(NContent.tree), getUniqueName(NContent.tree), getUniqueName(NContent.tree))); + treeDef.setString( + "leaves", + String.format("%s,1; %s,9", getUniqueName(NContent.floraLeaves), getUniqueName(NContent.floraLeaves))); treeList.appendTag(treeDef); // ghostwood treeDef = new NBTTagCompound(); treeDef.setString("treeName", "ghostwood"); - treeDef.setString("logs", String.format("%s,2; %s,6; %s,10", getUniqueName(NContent.tree), getUniqueName(NContent.tree), getUniqueName(NContent.tree))); - treeDef.setString("leaves", String.format("%s,1; %s,9", getUniqueName(NContent.floraLeavesNoColor), getUniqueName(NContent.floraLeavesNoColor))); + treeDef.setString( + "logs", + String.format( + "%s,2; %s,6; %s,10", + getUniqueName(NContent.tree), getUniqueName(NContent.tree), getUniqueName(NContent.tree))); + treeDef.setString( + "leaves", + String.format( + "%s,1; %s,9", + getUniqueName(NContent.floraLeavesNoColor), getUniqueName(NContent.floraLeavesNoColor))); treeList.appendTag(treeDef); // hopseed treeDef = new NBTTagCompound(); treeDef.setString("treeName", "hopseed"); - treeDef.setString("logs", String.format("%s,3; %s,7; %s,11", getUniqueName(NContent.tree), getUniqueName(NContent.tree), getUniqueName(NContent.tree))); - treeDef.setString("leaves", String.format("%s,2; %s,10", getUniqueName(NContent.floraLeaves), getUniqueName(NContent.floraLeaves))); + treeDef.setString( + "logs", + String.format( + "%s,3; %s,7; %s,11", + getUniqueName(NContent.tree), getUniqueName(NContent.tree), getUniqueName(NContent.tree))); + treeDef.setString( + "leaves", + String.format("%s,2; %s,10", getUniqueName(NContent.floraLeaves), getUniqueName(NContent.floraLeaves))); treeList.appendTag(treeDef); // maple treeDef = new NBTTagCompound(); treeDef.setString("treeName", "maple"); - treeDef.setString("logs", String.format("%s,0; %s,4; %s,8", getUniqueName(NContent.rareTree), getUniqueName(NContent.rareTree), getUniqueName(NContent.rareTree))); - treeDef.setString("leaves", String.format("%s,0; %s,8", getUniqueName(NContent.rareLeaves), getUniqueName(NContent.rareLeaves))); + treeDef.setString( + "logs", + String.format( + "%s,0; %s,4; %s,8", + getUniqueName(NContent.rareTree), + getUniqueName(NContent.rareTree), + getUniqueName(NContent.rareTree))); + treeDef.setString( + "leaves", + String.format("%s,0; %s,8", getUniqueName(NContent.rareLeaves), getUniqueName(NContent.rareLeaves))); treeList.appendTag(treeDef); // redwood treeDef = new NBTTagCompound(); treeDef.setString("treeName", "redwood"); treeDef.setString("logs", String.format("%s", getUniqueName(NContent.redwood))); - treeDef.setString("leaves", String.format("%s,0; %s,8", getUniqueName(NContent.floraLeaves), getUniqueName(NContent.floraLeaves))); + treeDef.setString( + "leaves", + String.format("%s,0; %s,8", getUniqueName(NContent.floraLeaves), getUniqueName(NContent.floraLeaves))); treeList.appendTag(treeDef); // sakura treeDef = new NBTTagCompound(); treeDef.setString("treeName", "sakura"); - treeDef.setString("logs", String.format("%s,1; %s,5; %s,9", getUniqueName(NContent.tree), getUniqueName(NContent.tree), getUniqueName(NContent.tree))); - treeDef.setString("leaves", String.format("%s,0; %s,8", getUniqueName(NContent.floraLeavesNoColor), getUniqueName(NContent.floraLeavesNoColor))); + treeDef.setString( + "logs", + String.format( + "%s,1; %s,5; %s,9", + getUniqueName(NContent.tree), getUniqueName(NContent.tree), getUniqueName(NContent.tree))); + treeDef.setString( + "leaves", + String.format( + "%s,0; %s,8", + getUniqueName(NContent.floraLeavesNoColor), getUniqueName(NContent.floraLeavesNoColor))); treeList.appendTag(treeDef); // siverbell treeDef = new NBTTagCompound(); treeDef.setString("treeName", "siverbell"); - treeDef.setString("logs", String.format("%s,1; %s,5; %s,9", getUniqueName(NContent.rareTree), getUniqueName(NContent.rareTree), getUniqueName(NContent.rareTree))); - treeDef.setString("leaves", String.format("%s,1; %s,9", getUniqueName(NContent.rareLeaves), getUniqueName(NContent.rareLeaves))); + treeDef.setString( + "logs", + String.format( + "%s,1; %s,5; %s,9", + getUniqueName(NContent.rareTree), + getUniqueName(NContent.rareTree), + getUniqueName(NContent.rareTree))); + treeDef.setString( + "leaves", + String.format("%s,1; %s,9", getUniqueName(NContent.rareLeaves), getUniqueName(NContent.rareLeaves))); treeList.appendTag(treeDef); // tigerwood treeDef = new NBTTagCompound(); treeDef.setString("treeName", "tigerwood"); - treeDef.setString("logs", String.format("%s,3; %s,7; %s,11", getUniqueName(NContent.rareTree), getUniqueName(NContent.rareTree), getUniqueName(NContent.rareTree))); - treeDef.setString("leaves", String.format("%s,3; %s,11", getUniqueName(NContent.rareLeaves), getUniqueName(NContent.rareLeaves))); + treeDef.setString( + "logs", + String.format( + "%s,3; %s,7; %s,11", + getUniqueName(NContent.rareTree), + getUniqueName(NContent.rareTree), + getUniqueName(NContent.rareTree))); + treeDef.setString( + "leaves", + String.format("%s,3; %s,11", getUniqueName(NContent.rareLeaves), getUniqueName(NContent.rareLeaves))); treeList.appendTag(treeDef); // willow treeDef = new NBTTagCompound(); treeDef.setString("treeName", "willow"); treeDef.setString("logs", String.format("%s", getUniqueName(NContent.willow))); - treeDef.setString("leaves", String.format("%s,3; %s,7; %s,11; %s,15", getUniqueName(NContent.floraLeavesNoColor), getUniqueName(NContent.floraLeavesNoColor), - getUniqueName(NContent.floraLeavesNoColor), getUniqueName(NContent.floraLeavesNoColor))); + treeDef.setString( + "leaves", + String.format( + "%s,3; %s,7; %s,11; %s,15", + getUniqueName(NContent.floraLeavesNoColor), + getUniqueName(NContent.floraLeavesNoColor), + getUniqueName(NContent.floraLeavesNoColor), + getUniqueName(NContent.floraLeavesNoColor))); treeDef.setInteger("maxHorLeafBreakDist", 5); treeList.appendTag(treeDef); tpModCfg.setTag("trees", treeList); FMLInterModComms.sendMessage(modId, "ThirdPartyModConfig", tpModCfg); - } - public static String getUniqueName (Block block) { + public static String getUniqueName(Block block) { return GameData.getBlockRegistry().getNameForObject(block); } - public static String getUniqueName (Item item) { + public static String getUniqueName(Item item) { return GameData.getItemRegistry().getNameForObject(item); } - } diff --git a/src/main/java/mods/natura/plugins/minefactoryreloaded/MFRPulse.java b/src/main/java/mods/natura/plugins/minefactoryreloaded/MFRPulse.java index 96d6795f..4b78fa9f 100644 --- a/src/main/java/mods/natura/plugins/minefactoryreloaded/MFRPulse.java +++ b/src/main/java/mods/natura/plugins/minefactoryreloaded/MFRPulse.java @@ -19,5 +19,4 @@ public void init(FMLInitializationEvent evt) { Natura.logger.warn("Something went wrong in Natura plugin MineFactoryReloaded.", t); } } - } diff --git a/src/main/java/mods/natura/plugins/minefactoryreloaded/MRFRegistering.java b/src/main/java/mods/natura/plugins/minefactoryreloaded/MRFRegistering.java index 75ff60df..6055bf91 100644 --- a/src/main/java/mods/natura/plugins/minefactoryreloaded/MRFRegistering.java +++ b/src/main/java/mods/natura/plugins/minefactoryreloaded/MRFRegistering.java @@ -12,7 +12,6 @@ import mods.natura.plugins.minefactoryreloaded.plantables.PlantableNaturaCrop; import mods.natura.plugins.minefactoryreloaded.plantables.PlantableNaturaNetherBerry; import mods.natura.plugins.minefactoryreloaded.plantables.PlantableStandard; -import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -20,53 +19,68 @@ import powercrystals.minefactoryreloaded.api.HarvestType; public class MRFRegistering { - public static void registerWithMFR () { - String registerPlantable = "registerPlantable"; - String registerHarvestable = "registerHarvestable"; - String registerFertilizable = "registerFertilizable"; - String registerSludgeDrop = "registerSludgeDrop"; + public static void registerWithMFR() { + String registerPlantable = "registerPlantable"; + String registerHarvestable = "registerHarvestable"; + String registerFertilizable = "registerFertilizable"; + String registerSludgeDrop = "registerSludgeDrop"; - //Berry Bushes + // Berry Bushes if (PHNatura.enableNetherBerryBushes) { - FactoryRegistry.sendMessage(registerPlantable, new PlantableNaturaNetherBerry(Item.getItemFromBlock(NContent.netherBerryBush), NContent.netherBerryBush)); - FactoryRegistry.sendMessage(registerHarvestable, new HarvestableNaturaBerry(NContent.netherBerryBush, NContent.netherBerryItem)); - + FactoryRegistry.sendMessage( + registerPlantable, + new PlantableNaturaNetherBerry( + Item.getItemFromBlock(NContent.netherBerryBush), NContent.netherBerryBush)); + FactoryRegistry.sendMessage( + registerHarvestable, + new HarvestableNaturaBerry(NContent.netherBerryBush, NContent.netherBerryItem)); } if (PHNatura.enableBerryBushes) { - FactoryRegistry.sendMessage(registerPlantable, new PlantableNaturaBerry(Item.getItemFromBlock(NContent.berryBush), NContent.berryBush)); - FactoryRegistry.sendMessage(registerHarvestable, new HarvestableNaturaBerry(NContent.berryBush, NContent.berryItem)); + FactoryRegistry.sendMessage( + registerPlantable, + new PlantableNaturaBerry(Item.getItemFromBlock(NContent.berryBush), NContent.berryBush)); + FactoryRegistry.sendMessage( + registerHarvestable, new HarvestableNaturaBerry(NContent.berryBush, NContent.berryItem)); } - //Crops + // Crops FactoryRegistry.sendMessage(registerPlantable, new PlantableNaturaCrop(NContent.seeds, NContent.crops)); FactoryRegistry.sendMessage(registerPlantable, new PlantableStandard(NContent.seedFood, NContent.saguaro)); - FactoryRegistry.sendMessage(registerPlantable, new PlantableStandard(Item.getItemFromBlock(NContent.floraSapling), NContent.floraSapling)); + FactoryRegistry.sendMessage( + registerPlantable, + new PlantableStandard(Item.getItemFromBlock(NContent.floraSapling), NContent.floraSapling)); - //misc plants - FactoryRegistry.sendMessage(registerHarvestable, new HarvestableStandard(NContent.bluebells, HarvestType.Normal)); - //glowshrooms - FactoryRegistry.sendMessage(registerHarvestable, new HarvestableStandard(NContent.glowshroom, HarvestType.Normal)); - FactoryRegistry.sendMessage(registerHarvestable, new HarvestableStandard(NContent.glowshroomBlue, HarvestType.Normal)); - FactoryRegistry.sendMessage(registerHarvestable, new HarvestableStandard(NContent.glowshroomGreen, HarvestType.Normal)); - FactoryRegistry.sendMessage(registerHarvestable, new HarvestableStandard(NContent.glowshroomPurple, HarvestType.Normal)); - //crops - FactoryRegistry.sendMessage(registerHarvestable, new HarvestableNaturaCropPlant(NContent.crops, NContent.plantItem)); + // misc plants + FactoryRegistry.sendMessage( + registerHarvestable, new HarvestableStandard(NContent.bluebells, HarvestType.Normal)); + // glowshrooms + FactoryRegistry.sendMessage( + registerHarvestable, new HarvestableStandard(NContent.glowshroom, HarvestType.Normal)); + FactoryRegistry.sendMessage( + registerHarvestable, new HarvestableStandard(NContent.glowshroomBlue, HarvestType.Normal)); + FactoryRegistry.sendMessage( + registerHarvestable, new HarvestableStandard(NContent.glowshroomGreen, HarvestType.Normal)); + FactoryRegistry.sendMessage( + registerHarvestable, new HarvestableStandard(NContent.glowshroomPurple, HarvestType.Normal)); + // crops + FactoryRegistry.sendMessage( + registerHarvestable, new HarvestableNaturaCropPlant(NContent.crops, NContent.plantItem)); - //trees + // trees FactoryRegistry.sendMessage(registerHarvestable, new HarvestableStandard(NContent.tree, HarvestType.Tree)); FactoryRegistry.sendMessage(registerHarvestable, new HarvestableStandard(NContent.rareTree, HarvestType.Tree)); FactoryRegistry.sendMessage(registerHarvestable, new HarvestableStandard(NContent.darkTree, HarvestType.Tree)); FactoryRegistry.sendMessage(registerHarvestable, new HarvestableStandard(NContent.redwood, HarvestType.Tree)); FactoryRegistry.sendMessage(registerHarvestable, new HarvestableStandard(NContent.willow, HarvestType.Tree)); - FactoryRegistry.sendMessage(registerHarvestable, new HarvestableStandard(NContent.bloodwood, HarvestType.TreeFlipped)); - //Nether plants + FactoryRegistry.sendMessage( + registerHarvestable, new HarvestableStandard(NContent.bloodwood, HarvestType.TreeFlipped)); + // Nether plants FactoryRegistry.sendMessage(registerHarvestable, new HarvestableNaturaTreeLeaves(NContent.thornVines)); - //leaves + // leaves FactoryRegistry.sendMessage(registerHarvestable, new HarvestableNaturaTreeLeaves(NContent.rareLeaves)); FactoryRegistry.sendMessage(registerHarvestable, new HarvestableNaturaTreeLeaves(NContent.darkLeaves)); FactoryRegistry.sendMessage(registerHarvestable, new HarvestableNaturaTreeLeaves(NContent.floraLeaves)); FactoryRegistry.sendMessage(registerHarvestable, new HarvestableNaturaTreeLeaves(NContent.floraLeavesNoColor)); - FactoryRegistry.sendMessage(registerFertilizable, new FertilizableNaturaCrop(NContent.crops)); FactoryRegistry.sendMessage(registerFertilizable, new FertilizableSapling(NContent.floraSapling)); @@ -74,7 +88,7 @@ public static void registerWithMFR () { /* * The sludge boiler takes sludge from harvester machines and boils it to get soil-like items, - * such as dirt, sand, clay, or rarely things like soulsand and mycelium. + * such as dirt, sand, clay, or rarely things like soulsand and mycelium. */ NBTTagCompound heatSand = new ItemStack(NContent.heatSand).writeToNBT(new NBTTagCompound()); heatSand.setInteger("value", 5); @@ -82,7 +96,6 @@ public static void registerWithMFR () { NBTTagCompound taintedSoil = new ItemStack(NContent.taintedSoil).writeToNBT(new NBTTagCompound()); taintedSoil.setInteger("value", 5); - FactoryRegistry.sendMessage(registerSludgeDrop, taintedSoil); + FactoryRegistry.sendMessage(registerSludgeDrop, taintedSoil); } } - diff --git a/src/main/java/mods/natura/plugins/minefactoryreloaded/fertilizables/FertilizableNaturaCrop.java b/src/main/java/mods/natura/plugins/minefactoryreloaded/fertilizables/FertilizableNaturaCrop.java index 3e852d7e..b5827bda 100644 --- a/src/main/java/mods/natura/plugins/minefactoryreloaded/fertilizables/FertilizableNaturaCrop.java +++ b/src/main/java/mods/natura/plugins/minefactoryreloaded/fertilizables/FertilizableNaturaCrop.java @@ -1,55 +1,45 @@ package mods.natura.plugins.minefactoryreloaded.fertilizables; import java.util.Random; - import net.minecraft.block.Block; import net.minecraft.world.World; import powercrystals.minefactoryreloaded.api.FertilizerType; import powercrystals.minefactoryreloaded.api.IFactoryFertilizable; -public class FertilizableNaturaCrop implements IFactoryFertilizable -{ +public class FertilizableNaturaCrop implements IFactoryFertilizable { private Block _blockId; - public FertilizableNaturaCrop(Block blockId) - { + public FertilizableNaturaCrop(Block blockId) { _blockId = blockId; } @Override - public Block getPlant () - { + public Block getPlant() { return _blockId; } @Override - public boolean canFertilize (World world, int x, int y, int z, FertilizerType fertilizerType) - { - return fertilizerType == FertilizerType.GrowPlant && world.getBlockMetadata(x, y, z) != 3 && world.getBlockMetadata(x, y, z) != 8; + public boolean canFertilize(World world, int x, int y, int z, FertilizerType fertilizerType) { + return fertilizerType == FertilizerType.GrowPlant + && world.getBlockMetadata(x, y, z) != 3 + && world.getBlockMetadata(x, y, z) != 8; } @Override - public boolean fertilize (World world, Random rand, int x, int y, int z, FertilizerType fertilizerType) - { + public boolean fertilize(World world, Random rand, int x, int y, int z, FertilizerType fertilizerType) { int meta = world.getBlockMetadata(x, y, z); - if (meta != 3 && meta != 8) - { - if (meta < 3) - { + if (meta != 3 && meta != 8) { + if (meta < 3) { int output = rand.nextInt(3) + 1 + meta; - if (output > 3) - output = 3; + if (output > 3) output = 3; world.setBlockMetadataWithNotify(x, y, z, output, 3); - } - else - { + } else { int output = rand.nextInt(4) + 1 + meta; - if (output > 8) - output = 8; + if (output > 8) output = 8; world.setBlockMetadataWithNotify(x, y, z, output, 3); } return true; } return false; } -} \ No newline at end of file +} diff --git a/src/main/java/mods/natura/plugins/minefactoryreloaded/fertilizables/FertilizableSapling.java b/src/main/java/mods/natura/plugins/minefactoryreloaded/fertilizables/FertilizableSapling.java index 607e6856..adf9a83e 100644 --- a/src/main/java/mods/natura/plugins/minefactoryreloaded/fertilizables/FertilizableSapling.java +++ b/src/main/java/mods/natura/plugins/minefactoryreloaded/fertilizables/FertilizableSapling.java @@ -1,37 +1,31 @@ package mods.natura.plugins.minefactoryreloaded.fertilizables; import java.util.Random; - import net.minecraft.block.Block; import net.minecraft.block.BlockSapling; import net.minecraft.world.World; import powercrystals.minefactoryreloaded.api.FertilizerType; import powercrystals.minefactoryreloaded.api.IFactoryFertilizable; -public class FertilizableSapling implements IFactoryFertilizable -{ +public class FertilizableSapling implements IFactoryFertilizable { private Block _blockId; - public FertilizableSapling(Block blockId) - { + public FertilizableSapling(Block blockId) { _blockId = blockId; } @Override - public Block getPlant () - { + public Block getPlant() { return _blockId; } @Override - public boolean canFertilize (World world, int x, int y, int z, FertilizerType fertilizerType) - { + public boolean canFertilize(World world, int x, int y, int z, FertilizerType fertilizerType) { return fertilizerType == FertilizerType.GrowPlant; } @Override - public boolean fertilize (World world, Random rand, int x, int y, int z, FertilizerType fertilizerType) - { + public boolean fertilize(World world, Random rand, int x, int y, int z, FertilizerType fertilizerType) { ((BlockSapling) world.getBlock(x, y, z)).func_149878_d(world, x, y, z, world.rand); return world.getBlock(x, y, z) != _blockId; } diff --git a/src/main/java/mods/natura/plugins/minefactoryreloaded/harvestables/HarvestableNaturaBerry.java b/src/main/java/mods/natura/plugins/minefactoryreloaded/harvestables/HarvestableNaturaBerry.java index b4af9f2e..f0c5462f 100644 --- a/src/main/java/mods/natura/plugins/minefactoryreloaded/harvestables/HarvestableNaturaBerry.java +++ b/src/main/java/mods/natura/plugins/minefactoryreloaded/harvestables/HarvestableNaturaBerry.java @@ -4,7 +4,6 @@ import java.util.List; import java.util.Map; import java.util.Random; - import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -12,56 +11,47 @@ import powercrystals.minefactoryreloaded.api.HarvestType; import powercrystals.minefactoryreloaded.api.IFactoryHarvestable; -public class HarvestableNaturaBerry implements IFactoryHarvestable -{ +public class HarvestableNaturaBerry implements IFactoryHarvestable { private Block _sourceBlockId; private Item _berryItemId; - public HarvestableNaturaBerry(Block sourceBlockId, Item berryItemId) - { + public HarvestableNaturaBerry(Block sourceBlockId, Item berryItemId) { _sourceBlockId = sourceBlockId; _berryItemId = berryItemId; } @Override - public Block getPlant () - { + public Block getPlant() { return _sourceBlockId; } @Override - public HarvestType getHarvestType () - { + public HarvestType getHarvestType() { return HarvestType.Column; } @Override - public boolean breakBlock () - { + public boolean breakBlock() { return false; } @Override - public boolean canBeHarvested (World world, Map harvesterSettings, int x, int y, int z) - { + public boolean canBeHarvested(World world, Map harvesterSettings, int x, int y, int z) { return world.getBlockMetadata(x, y, z) >= 12; } @Override - public List getDrops (World world, Random rand, Map harvesterSettings, int x, int y, int z) - { - ItemStack[] returnItems = { new ItemStack(_berryItemId, 1, world.getBlockMetadata(x, y, z) - 12) }; + public List getDrops( + World world, Random rand, Map harvesterSettings, int x, int y, int z) { + ItemStack[] returnItems = {new ItemStack(_berryItemId, 1, world.getBlockMetadata(x, y, z) - 12)}; return Arrays.asList(returnItems); } @Override - public void preHarvest (World world, int x, int y, int z) - { - } + public void preHarvest(World world, int x, int y, int z) {} @Override - public void postHarvest (World world, int x, int y, int z) - { + public void postHarvest(World world, int x, int y, int z) { world.setBlockMetadataWithNotify(x, y, z, world.getBlockMetadata(x, y, z) - 4, 2); } } diff --git a/src/main/java/mods/natura/plugins/minefactoryreloaded/harvestables/HarvestableNaturaCropPlant.java b/src/main/java/mods/natura/plugins/minefactoryreloaded/harvestables/HarvestableNaturaCropPlant.java index eef215d5..18abd340 100644 --- a/src/main/java/mods/natura/plugins/minefactoryreloaded/harvestables/HarvestableNaturaCropPlant.java +++ b/src/main/java/mods/natura/plugins/minefactoryreloaded/harvestables/HarvestableNaturaCropPlant.java @@ -4,7 +4,6 @@ import java.util.List; import java.util.Map; import java.util.Random; - import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -12,69 +11,54 @@ import powercrystals.minefactoryreloaded.api.HarvestType; import powercrystals.minefactoryreloaded.api.IFactoryHarvestable; -public class HarvestableNaturaCropPlant implements IFactoryHarvestable -{ +public class HarvestableNaturaCropPlant implements IFactoryHarvestable { private Block _sourceId; private Item _cottonItemId; - public HarvestableNaturaCropPlant(Block sourceId, Item cottonItemId) - { + public HarvestableNaturaCropPlant(Block sourceId, Item cottonItemId) { _sourceId = sourceId; _cottonItemId = cottonItemId; } @Override - public Block getPlant () - { + public Block getPlant() { return _sourceId; } @Override - public HarvestType getHarvestType () - { + public HarvestType getHarvestType() { return HarvestType.Normal; } @Override - public boolean breakBlock () - { + public boolean breakBlock() { return false; } @Override - public boolean canBeHarvested (World world, Map harvesterSettings, int x, int y, int z) - { + public boolean canBeHarvested(World world, Map harvesterSettings, int x, int y, int z) { return world.getBlockMetadata(x, y, z) == 3 || world.getBlockMetadata(x, y, z) == 8; } @Override - public List getDrops (World world, Random rand, Map harvesterSettings, int x, int y, int z) - { - if (world.getBlockMetadata(x, y, z) == 8) - { - ItemStack[] returnItems = { new ItemStack(_cottonItemId, 1, 3) }; + public List getDrops( + World world, Random rand, Map harvesterSettings, int x, int y, int z) { + if (world.getBlockMetadata(x, y, z) == 8) { + ItemStack[] returnItems = {new ItemStack(_cottonItemId, 1, 3)}; return Arrays.asList(returnItems); - } - else - { + } else { return _sourceId.getDrops(world, x, y, z, world.getBlockMetadata(x, y, z), 0); } } @Override - public void preHarvest (World world, int x, int y, int z) - { - } + public void preHarvest(World world, int x, int y, int z) {} @Override - public void postHarvest (World world, int x, int y, int z) - { - if (world.getBlockMetadata(x, y, z) == 3) - { + public void postHarvest(World world, int x, int y, int z) { + if (world.getBlockMetadata(x, y, z) == 3) { world.setBlockToAir(x, y, z); - } - else if (world.getBlockMetadata(x, y, z) == 8) - { + } else if (world.getBlockMetadata(x, y, z) == 8) { world.setBlockMetadataWithNotify(x, y, z, 6, 2); } } diff --git a/src/main/java/mods/natura/plugins/minefactoryreloaded/harvestables/HarvestableNaturaTreeLeaves.java b/src/main/java/mods/natura/plugins/minefactoryreloaded/harvestables/HarvestableNaturaTreeLeaves.java index 504a52c7..8c7f5410 100644 --- a/src/main/java/mods/natura/plugins/minefactoryreloaded/harvestables/HarvestableNaturaTreeLeaves.java +++ b/src/main/java/mods/natura/plugins/minefactoryreloaded/harvestables/HarvestableNaturaTreeLeaves.java @@ -1,35 +1,28 @@ package mods.natura.plugins.minefactoryreloaded.harvestables; +import com.google.common.collect.Lists; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Random; - -import com.google.common.collect.Lists; - import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import powercrystals.minefactoryreloaded.api.HarvestType; -public class HarvestableNaturaTreeLeaves extends HarvestableStandard -{ - public HarvestableNaturaTreeLeaves(Block id) - { +public class HarvestableNaturaTreeLeaves extends HarvestableStandard { + public HarvestableNaturaTreeLeaves(Block id) { super(id, HarvestType.TreeLeaf); } @Override - public List getDrops (World world, Random rand, Map harvesterSettings, int x, int y, int z) - { - if (harvesterSettings.get("silkTouch") != null && harvesterSettings.get("silkTouch")) - { + public List getDrops( + World world, Random rand, Map harvesterSettings, int x, int y, int z) { + if (harvesterSettings.get("silkTouch") != null && harvesterSettings.get("silkTouch")) { ArrayList drops = Lists.newArrayList(); drops.add(new ItemStack(getPlant(), 1, world.getBlockMetadata(x, y, z))); return drops; - } - else - { + } else { return getPlant().getDrops(world, x, y, z, world.getBlockMetadata(x, y, z), 0); } } diff --git a/src/main/java/mods/natura/plugins/minefactoryreloaded/harvestables/HarvestableStandard.java b/src/main/java/mods/natura/plugins/minefactoryreloaded/harvestables/HarvestableStandard.java index ed91066a..884f071d 100644 --- a/src/main/java/mods/natura/plugins/minefactoryreloaded/harvestables/HarvestableStandard.java +++ b/src/main/java/mods/natura/plugins/minefactoryreloaded/harvestables/HarvestableStandard.java @@ -3,61 +3,50 @@ import java.util.List; import java.util.Map; import java.util.Random; - import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import powercrystals.minefactoryreloaded.api.HarvestType; import powercrystals.minefactoryreloaded.api.IFactoryHarvestable; -public class HarvestableStandard implements IFactoryHarvestable -{ +public class HarvestableStandard implements IFactoryHarvestable { private Block sourceId; private HarvestType harvestType; - public HarvestableStandard(Block sourceId, HarvestType harvestType) - { + public HarvestableStandard(Block sourceId, HarvestType harvestType) { this.sourceId = sourceId; this.harvestType = harvestType; } @Override - public Block getPlant () - { + public Block getPlant() { return sourceId; } @Override - public HarvestType getHarvestType () - { + public HarvestType getHarvestType() { return harvestType; } @Override - public boolean breakBlock () - { + public boolean breakBlock() { return true; } @Override - public boolean canBeHarvested (World world, Map harvesterSettings, int x, int y, int z) - { + public boolean canBeHarvested(World world, Map harvesterSettings, int x, int y, int z) { return true; } @Override - public List getDrops (World world, Random rand, Map harvesterSettings, int x, int y, int z) - { + public List getDrops( + World world, Random rand, Map harvesterSettings, int x, int y, int z) { return sourceId.getDrops(world, x, y, z, world.getBlockMetadata(x, y, z), 0); } @Override - public void preHarvest (World world, int x, int y, int z) - { - } + public void preHarvest(World world, int x, int y, int z) {} @Override - public void postHarvest (World world, int x, int y, int z) - { - } + public void postHarvest(World world, int x, int y, int z) {} } diff --git a/src/main/java/mods/natura/plugins/minefactoryreloaded/plantables/PlantableNaturaBerry.java b/src/main/java/mods/natura/plugins/minefactoryreloaded/plantables/PlantableNaturaBerry.java index 94d4a97a..654af014 100644 --- a/src/main/java/mods/natura/plugins/minefactoryreloaded/plantables/PlantableNaturaBerry.java +++ b/src/main/java/mods/natura/plugins/minefactoryreloaded/plantables/PlantableNaturaBerry.java @@ -18,12 +18,13 @@ public PlantableNaturaBerry(Item sourceId, Block plantedBlockId) { public boolean canBePlantedHere(World world, int x, int y, int z, ItemStack stack) { Block groundBlock = world.getBlock(x, y - 1, z); - return (groundBlock != null && groundBlock.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, (IPlantable) NContent.berryBush) && world.isAirBlock(x, y, z)); + return (groundBlock != null + && groundBlock.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, (IPlantable) NContent.berryBush) + && world.isAirBlock(x, y, z)); } @Override public int getMeta(ItemStack stack) { return stack.getItemDamage() % 4; } - } diff --git a/src/main/java/mods/natura/plugins/minefactoryreloaded/plantables/PlantableNaturaCrop.java b/src/main/java/mods/natura/plugins/minefactoryreloaded/plantables/PlantableNaturaCrop.java index b6340261..53c7d053 100644 --- a/src/main/java/mods/natura/plugins/minefactoryreloaded/plantables/PlantableNaturaCrop.java +++ b/src/main/java/mods/natura/plugins/minefactoryreloaded/plantables/PlantableNaturaCrop.java @@ -21,8 +21,13 @@ public boolean canBePlantedHere(World world, int x, int y, int z, ItemStack stac if (!world.isAirBlock(x, y, z)) { return false; } - return (groundId == Blocks.dirt || groundId == Blocks.grass || groundId == Blocks.farmland || (_plantedBlockId instanceof IPlantable - && groundId != null && groundId.canSustainPlant(world, x, y, z, ForgeDirection.UP, ((IPlantable) _plantedBlockId)))); + return (groundId == Blocks.dirt + || groundId == Blocks.grass + || groundId == Blocks.farmland + || (_plantedBlockId instanceof IPlantable + && groundId != null + && groundId.canSustainPlant( + world, x, y, z, ForgeDirection.UP, ((IPlantable) _plantedBlockId)))); } return false; } @@ -30,8 +35,7 @@ public boolean canBePlantedHere(World world, int x, int y, int z, ItemStack stac @Override public void prePlant(World world, int x, int y, int z, ItemStack stack) { Block groundId = world.getBlock(x, y - 1, z); - if (groundId == Blocks.dirt || groundId == Blocks.grass) - { + if (groundId == Blocks.dirt || groundId == Blocks.grass) { world.setBlock(x, y - 1, z, Blocks.farmland); } } @@ -40,5 +44,4 @@ public void prePlant(World world, int x, int y, int z, ItemStack stack) { public int getMeta(ItemStack stack) { return stack.getItemDamage() == 0 ? 0 : 4; } - } diff --git a/src/main/java/mods/natura/plugins/minefactoryreloaded/plantables/PlantableNaturaNetherBerry.java b/src/main/java/mods/natura/plugins/minefactoryreloaded/plantables/PlantableNaturaNetherBerry.java index 22b98538..fe2144b2 100644 --- a/src/main/java/mods/natura/plugins/minefactoryreloaded/plantables/PlantableNaturaNetherBerry.java +++ b/src/main/java/mods/natura/plugins/minefactoryreloaded/plantables/PlantableNaturaNetherBerry.java @@ -19,12 +19,15 @@ public PlantableNaturaNetherBerry(Item sourceId, Block plantedBlockId) { public boolean canBePlantedHere(World world, int x, int y, int z, ItemStack stack) { Block groundBlock = world.getBlock(x, y - 1, z); - return (groundBlock != null && (groundBlock.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, (IPlantable) NContent.netherBerryBush) || groundBlock == Blocks.netherrack) && world.isAirBlock(x, y, z)); + return (groundBlock != null + && (groundBlock.canSustainPlant( + world, x, y - 1, z, ForgeDirection.UP, (IPlantable) NContent.netherBerryBush) + || groundBlock == Blocks.netherrack) + && world.isAirBlock(x, y, z)); } @Override public int getMeta(ItemStack stack) { return stack.getItemDamage() % 4; } - } diff --git a/src/main/java/mods/natura/plugins/minefactoryreloaded/plantables/PlantableStandard.java b/src/main/java/mods/natura/plugins/minefactoryreloaded/plantables/PlantableStandard.java index ca31d74c..9a42ca46 100644 --- a/src/main/java/mods/natura/plugins/minefactoryreloaded/plantables/PlantableStandard.java +++ b/src/main/java/mods/natura/plugins/minefactoryreloaded/plantables/PlantableStandard.java @@ -23,8 +23,9 @@ public PlantableStandard(Item sourceId, Block plantedBlockId) { this._sourceId = sourceId; this._plantedBlockId = plantedBlockId; } + public boolean canBePlanted(ItemStack stack, boolean forFermenting) { - return true;//TODO figure out what on earth this is supposed to be + return true; // TODO figure out what on earth this is supposed to be } @Override @@ -34,8 +35,9 @@ public boolean canBePlantedHere(World world, int x, int y, int z, ItemStack stac return false; } return (_plantedBlockId.canPlaceBlockAt(world, x, y, z) && _plantedBlockId.canBlockStay(world, x, y, z)) - || (_plantedBlockId instanceof IPlantable && groundId != null && groundId.canSustainPlant(world, x, y, z, ForgeDirection.UP, - ((IPlantable) _plantedBlockId))); + || (_plantedBlockId instanceof IPlantable + && groundId != null + && groundId.canSustainPlant(world, x, y, z, ForgeDirection.UP, ((IPlantable) _plantedBlockId))); } @Override @@ -47,6 +49,7 @@ public void prePlant(World world, int x, int y, int z, ItemStack stack) { public void postPlant(World world, int x, int y, int z, ItemStack stack) { return; } + @Override public ReplacementBlock getPlantedBlock(World world, int x, int y, int z, ItemStack stack) { if (stack.getItem() != _sourceId) { @@ -63,5 +66,4 @@ public Item getSeed() { public int getMeta(ItemStack i) { return i.getItemDamage(); } - } diff --git a/src/main/java/mods/natura/plugins/nei/NEIPulse.java b/src/main/java/mods/natura/plugins/nei/NEIPulse.java index d086c0fd..515451d0 100644 --- a/src/main/java/mods/natura/plugins/nei/NEIPulse.java +++ b/src/main/java/mods/natura/plugins/nei/NEIPulse.java @@ -12,8 +12,7 @@ public class NEIPulse { @Handler public void init(FMLInitializationEvent evt) { - if (FMLCommonHandler.instance().getSide().isServer()) - return; + if (FMLCommonHandler.instance().getSide().isServer()) return; try { Natura.logger.debug("[NEI] Registering Natura NEI plugin."); @@ -22,5 +21,4 @@ public void init(FMLInitializationEvent evt) { e.printStackTrace(); } } - } diff --git a/src/main/java/mods/natura/plugins/nei/NotEnoughItems.java b/src/main/java/mods/natura/plugins/nei/NotEnoughItems.java index 3c8f37b2..ea2d236a 100644 --- a/src/main/java/mods/natura/plugins/nei/NotEnoughItems.java +++ b/src/main/java/mods/natura/plugins/nei/NotEnoughItems.java @@ -16,16 +16,15 @@ public static void registerNEICompat() { API.registerGuiOverlay(WorkbenchGui.class, "crafting"); API.registerGuiOverlayHandler(WorkbenchGui.class, new DefaultOverlayHandler(), "crafting"); API.hideItem(new ItemStack(NContent.crops)); - if (PHNatura.enableWoodenDoors) { - API.hideItem(new ItemStack(NContent.redwoodDoor)); - API.hideItem(new ItemStack(NContent.eucalyptusDoor)); - API.hideItem(new ItemStack(NContent.hopseedDoor)); - API.hideItem(new ItemStack(NContent.sakuraDoor)); - API.hideItem(new ItemStack(NContent.ghostDoor)); - API.hideItem(new ItemStack(NContent.bloodDoor)); - API.hideItem(new ItemStack(NContent.redwoodBarkDoor)); - } + if (PHNatura.enableWoodenDoors) { + API.hideItem(new ItemStack(NContent.redwoodDoor)); + API.hideItem(new ItemStack(NContent.eucalyptusDoor)); + API.hideItem(new ItemStack(NContent.hopseedDoor)); + API.hideItem(new ItemStack(NContent.sakuraDoor)); + API.hideItem(new ItemStack(NContent.ghostDoor)); + API.hideItem(new ItemStack(NContent.bloodDoor)); + API.hideItem(new ItemStack(NContent.redwoodBarkDoor)); + } } } - } diff --git a/src/main/java/mods/natura/plugins/te4/TE4Pulse.java b/src/main/java/mods/natura/plugins/te4/TE4Pulse.java index 96fd69f8..f9fb8ba1 100644 --- a/src/main/java/mods/natura/plugins/te4/TE4Pulse.java +++ b/src/main/java/mods/natura/plugins/te4/TE4Pulse.java @@ -1,11 +1,10 @@ package mods.natura.plugins.te4; -import java.util.Arrays; -import java.util.List; - import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLInterModComms; import cpw.mods.fml.common.registry.GameRegistry; +import java.util.Arrays; +import java.util.List; import mantle.pulsar.pulse.Handler; import mantle.pulsar.pulse.Pulse; import mods.natura.blocks.trees.Planks; @@ -27,7 +26,8 @@ public int findPlankForName(String name) { return list.indexOf(name); } - public void createSawmillRecipe(int energy, ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput, int chance) { + public void createSawmillRecipe( + int energy, ItemStack input, ItemStack primaryOutput, ItemStack secondaryOutput, int chance) { NBTTagCompound toSend = new NBTTagCompound(); toSend.setInteger("energy", energy); toSend.setTag("input", new NBTTagCompound()); @@ -50,7 +50,12 @@ public void createSawmillRecipe(int energy, ItemStack input, ItemStack primaryOu } public void addFenceGate(Block input, String type) { - createSawmillRecipe(2400, new ItemStack(input, 1), new ItemStack(NContent.planks, 2, findPlankForName(type)), GameRegistry.findItemStack("ThermalExpansion", "sawdust", 1), 100); + createSawmillRecipe( + 2400, + new ItemStack(input, 1), + new ItemStack(NContent.planks, 2, findPlankForName(type)), + GameRegistry.findItemStack("ThermalExpansion", "sawdust", 1), + 100); } public void addTrapdoor(Block input, String type) { @@ -58,51 +63,65 @@ public void addTrapdoor(Block input, String type) { } public void addWood(Block log, int meta, String type) { - createSawmillRecipe(800, new ItemStack(log, 1, meta), new ItemStack(NContent.planks, 6, findPlankForName(type)), GameRegistry.findItemStack("ThermalExpansion", "sawdust", 1), 100); + createSawmillRecipe( + 800, + new ItemStack(log, 1, meta), + new ItemStack(NContent.planks, 6, findPlankForName(type)), + GameRegistry.findItemStack("ThermalExpansion", "sawdust", 1), + 100); } - public void addPressurePlate(Block input, String type) { + public void addPressurePlate(Block input, String type) { createSawmillRecipe(2400, new ItemStack(input, 1), new ItemStack(NContent.planks, 2, findPlankForName(type))); } @Handler public void init(FMLInitializationEvent evt) { list = Arrays.asList(Planks.textureNames); - //Sawmill recipes + // Sawmill recipes - //Doors + // Doors if (PHNatura.enableWoodenDoors) { String[] doorNames = ((NDoorItem) NContent.doorItem).textureNames; for (int i = 0; i < doorNames.length; i++) { int plankMeta = findPlankForName(doorNames[i]); if (plankMeta >= 0) { - createSawmillRecipe(2400, new ItemStack(NContent.doorItem, 1, i), new ItemStack(NContent.planks, 6, plankMeta)); + createSawmillRecipe( + 2400, new ItemStack(NContent.doorItem, 1, i), new ItemStack(NContent.planks, 6, plankMeta)); } } } String[] texNames = NContent.woodTextureNames; - //Bookshelves + // Bookshelves if (PHNatura.enableWoodenBookshelves) { for (int i = 0; i < texNames.length; i++) { int plankMeta = findPlankForName(texNames[i]); if (plankMeta >= 0) { - createSawmillRecipe(2400, new ItemStack(NContent.alternateBookshelf, 1, i), new ItemStack(NContent.planks, 6, plankMeta), new ItemStack(Items.book, 3), 100); + createSawmillRecipe( + 2400, + new ItemStack(NContent.alternateBookshelf, 1, i), + new ItemStack(NContent.planks, 6, plankMeta), + new ItemStack(Items.book, 3), + 100); } } } - //Workbenches + // Workbenches if (PHNatura.enableWoodenWorkbenches) { for (int i = 0; i < texNames.length; i++) { int plankMeta = findPlankForName(texNames[i]); if (plankMeta >= 0) { - createSawmillRecipe(2400, new ItemStack(NContent.alternateWorkbench, 1, i), new ItemStack(NContent.planks, 4, plankMeta)); + createSawmillRecipe( + 2400, + new ItemStack(NContent.alternateWorkbench, 1, i), + new ItemStack(NContent.planks, 4, plankMeta)); } } } - //Fence Gates + // Fence Gates if (PHNatura.enableWoodenFenceGates) { addFenceGate(NContent.fenceGateAmaranth, "purpleheart"); addFenceGate(NContent.fenceGateBloodwood, "bloodwood"); @@ -119,7 +138,7 @@ public void init(FMLInitializationEvent evt) { addFenceGate(NContent.fenceGateWillow, "willow"); } - //Pressure Plates + // Pressure Plates if (PHNatura.enableWoodenPressurePlates) { addPressurePlate(NContent.pressurePlateAmaranth, "purpleheart"); addPressurePlate(NContent.pressurePlateBloodwood, "bloodwood"); @@ -136,7 +155,7 @@ public void init(FMLInitializationEvent evt) { addPressurePlate(NContent.pressurePlateWillow, "willow"); } - //Trapdoors + // Trapdoors if (PHNatura.enableWoodenTrapdoors) { addTrapdoor(NContent.trapdoorAmaranth, "purpleheart"); addTrapdoor(NContent.trapdoorBloodwood, "bloodwood"); @@ -153,7 +172,7 @@ public void init(FMLInitializationEvent evt) { addTrapdoor(NContent.trapdoorWillow, "willow"); } - //Wood + // Wood addWood(NContent.rareTree, 2, "purpleheart"); addWood(NContent.bloodwood, 0, "bloodwood"); addWood(NContent.darkTree, 0, "darkwood"); @@ -168,5 +187,4 @@ public void init(FMLInitializationEvent evt) { addWood(NContent.rareTree, 3, "tiger"); addWood(NContent.willow, 0, "willow"); } - } diff --git a/src/main/java/mods/natura/plugins/thaumcraft/ThaumcraftPulse.java b/src/main/java/mods/natura/plugins/thaumcraft/ThaumcraftPulse.java index 71391412..ef1ce177 100644 --- a/src/main/java/mods/natura/plugins/thaumcraft/ThaumcraftPulse.java +++ b/src/main/java/mods/natura/plugins/thaumcraft/ThaumcraftPulse.java @@ -19,17 +19,25 @@ public class ThaumcraftPulse { @Handler public void init(FMLInitializationEvent evt) { - if(PHNatura.enableBerryBushes) { - FMLInterModComms.sendMessage("Thaumcraft", "harvestClickableCrop", new ItemStack(NContent.berryBush, 1, 12)); - FMLInterModComms.sendMessage("Thaumcraft", "harvestClickableCrop", new ItemStack(NContent.berryBush, 1, 13)); - FMLInterModComms.sendMessage("Thaumcraft", "harvestClickableCrop", new ItemStack(NContent.berryBush, 1, 14)); - FMLInterModComms.sendMessage("Thaumcraft", "harvestClickableCrop", new ItemStack(NContent.berryBush, 1, 15)); - } - if(PHNatura.enableNetherBerryBushes) { - FMLInterModComms.sendMessage("Thaumcraft", "harvestClickableCrop", new ItemStack(NContent.netherBerryBush, 1, 12)); - FMLInterModComms.sendMessage("Thaumcraft", "harvestClickableCrop", new ItemStack(NContent.netherBerryBush, 1, 13)); - FMLInterModComms.sendMessage("Thaumcraft", "harvestClickableCrop", new ItemStack(NContent.netherBerryBush, 1, 14)); - FMLInterModComms.sendMessage("Thaumcraft", "harvestClickableCrop", new ItemStack(NContent.netherBerryBush, 1, 15)); + if (PHNatura.enableBerryBushes) { + FMLInterModComms.sendMessage( + "Thaumcraft", "harvestClickableCrop", new ItemStack(NContent.berryBush, 1, 12)); + FMLInterModComms.sendMessage( + "Thaumcraft", "harvestClickableCrop", new ItemStack(NContent.berryBush, 1, 13)); + FMLInterModComms.sendMessage( + "Thaumcraft", "harvestClickableCrop", new ItemStack(NContent.berryBush, 1, 14)); + FMLInterModComms.sendMessage( + "Thaumcraft", "harvestClickableCrop", new ItemStack(NContent.berryBush, 1, 15)); + } + if (PHNatura.enableNetherBerryBushes) { + FMLInterModComms.sendMessage( + "Thaumcraft", "harvestClickableCrop", new ItemStack(NContent.netherBerryBush, 1, 12)); + FMLInterModComms.sendMessage( + "Thaumcraft", "harvestClickableCrop", new ItemStack(NContent.netherBerryBush, 1, 13)); + FMLInterModComms.sendMessage( + "Thaumcraft", "harvestClickableCrop", new ItemStack(NContent.netherBerryBush, 1, 14)); + FMLInterModComms.sendMessage( + "Thaumcraft", "harvestClickableCrop", new ItemStack(NContent.netherBerryBush, 1, 15)); } FMLInterModComms.sendMessage("Thaumcraft", "harvestClickableCrop", new ItemStack(NContent.crops, 1, 8)); FMLInterModComms.sendMessage("Thaumcraft", "harvestStandardCrop", new ItemStack(NContent.crops, 1, 3)); @@ -40,22 +48,42 @@ public void postInit(FMLPostInitializationEvent evt) { try { Class.forName("thaumcraft.api.ThaumcraftApi"); - //Register seeds + // Register seeds AspectList seedTags = new AspectList(); seedTags.add(Aspect.PLANT, 1); seedTags.add(Aspect.EXCHANGE, 1); ThaumcraftApi.registerObjectTag(new ItemStack(NContent.seeds, 1, 0), seedTags); ThaumcraftApi.registerObjectTag(new ItemStack(NContent.seeds, 1, 1), seedTags); - //Register plants - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.plantItem, 0, 0), new AspectList().add(Aspect.LIFE, 2).add(Aspect.CROP, 2)); - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.plantItem, 0, 3), new AspectList().add(Aspect.CLOTH, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.plantItem, 0, 4), new AspectList().add(Aspect.ENTROPY, 1).add(Aspect.FIRE, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.plantItem, 0, 5), new AspectList().add(Aspect.AIR, 1).add(Aspect.FLIGHT, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.plantItem, 0, 6), new AspectList().add(Aspect.BEAST, 1).add(Aspect.FLESH, 1).add(Aspect.CLOTH, 1).add(Aspect.ARMOR, 1).add(Aspect.FIRE, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.plantItem, 0, 7), new AspectList().add(Aspect.BEAST, 1).add(Aspect.CLOTH, 1).add(Aspect.TRAP, 1).add(Aspect.FIRE, 1)); + // Register plants + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.plantItem, 0, 0), + new AspectList().add(Aspect.LIFE, 2).add(Aspect.CROP, 2)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.plantItem, 0, 3), new AspectList().add(Aspect.CLOTH, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.plantItem, 0, 4), + new AspectList().add(Aspect.ENTROPY, 1).add(Aspect.FIRE, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.plantItem, 0, 5), + new AspectList().add(Aspect.AIR, 1).add(Aspect.FLIGHT, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.plantItem, 0, 6), + new AspectList() + .add(Aspect.BEAST, 1) + .add(Aspect.FLESH, 1) + .add(Aspect.CLOTH, 1) + .add(Aspect.ARMOR, 1) + .add(Aspect.FIRE, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.plantItem, 0, 7), + new AspectList() + .add(Aspect.BEAST, 1) + .add(Aspect.CLOTH, 1) + .add(Aspect.TRAP, 1) + .add(Aspect.FIRE, 1)); - //Register wood + // Register wood AspectList logTags = new AspectList(); logTags.add(Aspect.TREE, 4); ThaumcraftApi.registerObjectTag(new ItemStack(NContent.tree, 0, 0), logTags); @@ -63,28 +91,34 @@ public void postInit(FMLPostInitializationEvent evt) { ThaumcraftApi.registerObjectTag(new ItemStack(NContent.tree, 0, 3), logTags); ThaumcraftApi.registerObjectTag(new ItemStack(NContent.willow, 0, 0), logTags); ThaumcraftApi.registerObjectTag(new ItemStack(NContent.willow, 0, 1), logTags); - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.redwood, 0, 0), new AspectList().add(Aspect.ARMOR, 1).add(Aspect.TREE, 3)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.redwood, 0, 0), + new AspectList().add(Aspect.ARMOR, 1).add(Aspect.TREE, 3)); ThaumcraftApi.registerObjectTag(new ItemStack(NContent.redwood, 0, 1), logTags); - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.redwood, 0, 2), new AspectList().add(Aspect.EARTH, 1).add(Aspect.TREE, 3)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.redwood, 0, 2), + new AspectList().add(Aspect.EARTH, 1).add(Aspect.TREE, 3)); - //Register Leaves + // Register Leaves AspectList leafTags = new AspectList(); leafTags.add(Aspect.PLANT, 2); ThaumcraftApi.registerObjectTag(new ItemStack(NContent.floraLeavesNoColor, 0, 0), leafTags); ThaumcraftApi.registerObjectTag(new ItemStack(NContent.floraLeavesNoColor, 0, 1), leafTags); - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.floraLeavesNoColor, 0, 2), new AspectList().add(Aspect.TREE, 2).add(Aspect.METAL, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.floraLeavesNoColor, 0, 2), + new AspectList().add(Aspect.TREE, 2).add(Aspect.METAL, 1)); ThaumcraftApi.registerObjectTag(new ItemStack(NContent.floraLeaves, 0, 0), leafTags); ThaumcraftApi.registerObjectTag(new ItemStack(NContent.floraLeaves, 0, 1), leafTags); ThaumcraftApi.registerObjectTag(new ItemStack(NContent.floraLeaves, 0, 2), leafTags); ThaumcraftApi.registerObjectTag(new ItemStack(NContent.floraLeaves, 0, 3), leafTags); - //Register rare trees + // Register rare trees for (int i = 0; i < 4; i++) { ThaumcraftApi.registerObjectTag(new ItemStack(NContent.rareTree, 0, i), logTags); ThaumcraftApi.registerObjectTag(new ItemStack(NContent.rareLeaves, 0, i), leafTags); } - //Register mushrooms + // Register mushrooms AspectList shroomTag = new AspectList(); shroomTag.add(Aspect.PLANT, 4); shroomTag.add(Aspect.LIGHT, 1); @@ -93,7 +127,7 @@ public void postInit(FMLPostInitializationEvent evt) { ThaumcraftApi.registerObjectTag(new ItemStack(NContent.glowshroom, 0, i), shroomTag); } - //Register berries and berry bushes + // Register berries and berry bushes if (PHNatura.enableBerryBushes) { AspectList berryTag = new AspectList(); berryTag.add(Aspect.LIFE, 1); @@ -106,7 +140,7 @@ public void postInit(FMLPostInitializationEvent evt) { } } - //Register bowls, bowls of stew, and other bowl-based things + // Register bowls, bowls of stew, and other bowl-based things AspectList bowlEmptyTag = new AspectList(); bowlEmptyTag.add(Aspect.VOID, 1); AspectList bowlStewTag = new AspectList(); @@ -125,7 +159,7 @@ public void postInit(FMLPostInitializationEvent evt) { ThaumcraftApi.registerObjectTag(new ItemStack(NContent.bowlStew, 0, i + 13), glowStewTag); } - //Register other overworld saplings + // Register other overworld saplings AspectList saplingTag = new AspectList(); saplingTag.add(Aspect.TREE, 2); saplingTag.add(Aspect.PLANT, 2); @@ -135,67 +169,167 @@ public void postInit(FMLPostInitializationEvent evt) { ThaumcraftApi.registerObjectTag(new ItemStack(NContent.rareSapling, 0, i), saplingTag); } - //Register cactus stuff - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.saguaro, 0, 0), new AspectList().add(Aspect.WATER, 1).add(Aspect.PLANT, 2).add(Aspect.WEAPON, 1).add(Aspect.TREE, 2)); + // Register cactus stuff + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.saguaro, 0, 0), + new AspectList() + .add(Aspect.WATER, 1) + .add(Aspect.PLANT, 2) + .add(Aspect.WEAPON, 1) + .add(Aspect.TREE, 2)); if (PHNatura.enableCactusJuice) { - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.waterDrop, 0, 0), new AspectList().add(Aspect.WATER, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.waterDrop, 0, 0), new AspectList().add(Aspect.WATER, 1)); } - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.seedFood, 0, 0), new AspectList().add(Aspect.CROP, 2).add(Aspect.PLANT, 1).add(Aspect.WATER, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.seedFood, 0, 0), + new AspectList().add(Aspect.CROP, 2).add(Aspect.PLANT, 1).add(Aspect.WATER, 1)); - //Register overworld clouds - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.cloud, 0, 0), new AspectList().add(Aspect.AIR, 1).add(Aspect.FLIGHT, 1).add(Aspect.WATER, 1).add(Aspect.WEATHER, 1)); + // Register overworld clouds + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.cloud, 0, 0), + new AspectList() + .add(Aspect.AIR, 1) + .add(Aspect.FLIGHT, 1) + .add(Aspect.WATER, 1) + .add(Aspect.WEATHER, 1)); - //Register Nether saplings - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.floraSapling, 0, 4), new AspectList().add(Aspect.SOUL, 1).add(Aspect.PLANT, 2).add(Aspect.TREE, 2)); - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.floraSapling, 0, 5), new AspectList().add(Aspect.TREE, 2).add(Aspect.PLANT, 2)); - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.floraSapling, 0, 6), new AspectList().add(Aspect.TREE, 2).add(Aspect.PLANT, 2)); - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.floraSapling, 0, 7), new AspectList().add(Aspect.TREE, 2).add(Aspect.PLANT, 2).add(Aspect.ENTROPY, 2)); + // Register Nether saplings + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.floraSapling, 0, 4), + new AspectList().add(Aspect.SOUL, 1).add(Aspect.PLANT, 2).add(Aspect.TREE, 2)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.floraSapling, 0, 5), + new AspectList().add(Aspect.TREE, 2).add(Aspect.PLANT, 2)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.floraSapling, 0, 6), + new AspectList().add(Aspect.TREE, 2).add(Aspect.PLANT, 2)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.floraSapling, 0, 7), + new AspectList().add(Aspect.TREE, 2).add(Aspect.PLANT, 2).add(Aspect.ENTROPY, 2)); - //Register Nether blocks - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.heatSand, 0, 0), new AspectList().add(Aspect.FIRE, 2).add(Aspect.EARTH, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.taintedSoil, 0, 0), new AspectList().add(Aspect.EARTH, 2)); + // Register Nether blocks + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.heatSand, 0, 0), + new AspectList().add(Aspect.FIRE, 2).add(Aspect.EARTH, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.taintedSoil, 0, 0), new AspectList().add(Aspect.EARTH, 2)); - //Register Nether trees and leaves - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.tree, 0, 2), new AspectList().add(Aspect.TREE, 3).add(Aspect.SOUL, 1)); + // Register Nether trees and leaves + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.tree, 0, 2), + new AspectList().add(Aspect.TREE, 3).add(Aspect.SOUL, 1)); ThaumcraftApi.registerObjectTag(new ItemStack(NContent.planks, 0, 2), new AspectList().add(Aspect.TREE, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.planks, 0, 4), new AspectList().add(Aspect.TREE, 1).add(Aspect.METAL, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.darkTree, 0, 0), new AspectList().add(Aspect.TREE, 4)); - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.darkTree, 0, 1), new AspectList().add(Aspect.TREE, 4).add(Aspect.ENTROPY, 2)); - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.bloodwood, 0, 0), new AspectList().add(Aspect.TREE, 2).add(Aspect.ENERGY, 2).add(Aspect.METAL, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.bloodwood, 0, 15), new AspectList().add(Aspect.TREE, 2).add(Aspect.ENERGY, 2).add(Aspect.METAL, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.planks, 0, 4), + new AspectList().add(Aspect.TREE, 1).add(Aspect.METAL, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.darkTree, 0, 0), new AspectList().add(Aspect.TREE, 4)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.darkTree, 0, 1), + new AspectList().add(Aspect.TREE, 4).add(Aspect.ENTROPY, 2)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.bloodwood, 0, 0), + new AspectList().add(Aspect.TREE, 2).add(Aspect.ENERGY, 2).add(Aspect.METAL, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.bloodwood, 0, 15), + new AspectList().add(Aspect.TREE, 2).add(Aspect.ENERGY, 2).add(Aspect.METAL, 1)); ThaumcraftApi.registerObjectTag(new ItemStack(NContent.darkLeaves, 0, 0), leafTags); ThaumcraftApi.registerObjectTag(new ItemStack(NContent.darkLeaves, 0, 1), leafTags); - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.darkLeaves, 0, 2), new AspectList().add(Aspect.PLANT, 2).add(Aspect.CROP, 2)); - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.darkLeaves, 0, 3), new AspectList().add(Aspect.PLANT, 2).add(Aspect.ENTROPY, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.darkLeaves, 0, 2), + new AspectList().add(Aspect.PLANT, 2).add(Aspect.CROP, 2)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.darkLeaves, 0, 3), + new AspectList().add(Aspect.PLANT, 2).add(Aspect.ENTROPY, 1)); - //Register Nether vines - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.thornVines, 0, 0), new AspectList().add(Aspect.FIRE, 1).add(Aspect.PLANT, 1)); + // Register Nether vines + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.thornVines, 0, 0), + new AspectList().add(Aspect.FIRE, 1).add(Aspect.PLANT, 1)); - //Register Nether berries and berry bushes + // Register Nether berries and berry bushes if (PHNatura.enableNetherBerryBushes) { - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.netherBerryBush, 0, 0), new AspectList().add(Aspect.ENTROPY, 4).add(Aspect.POISON, 4).add(Aspect.PLANT, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.netherBerryBush, 0, 1), new AspectList().add(Aspect.ENTROPY, 4).add(Aspect.DARKNESS, 4).add(Aspect.PLANT, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.netherBerryBush, 0, 2), new AspectList().add(Aspect.ENTROPY, 4).add(Aspect.FLIGHT, 4).add(Aspect.PLANT, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.netherBerryBush, 0, 3), new AspectList().add(Aspect.ENTROPY, 8).add(Aspect.PLANT, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.netherBerryItem, 0, 0), new AspectList().add(Aspect.ENTROPY, 4).add(Aspect.POISON, 4).add(Aspect.LIFE, 1).add(Aspect.CROP, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.netherBerryItem, 0, 1), new AspectList().add(Aspect.ENTROPY, 4).add(Aspect.DARKNESS, 4).add(Aspect.LIFE, 1).add(Aspect.CROP, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.netherBerryItem, 0, 2), new AspectList().add(Aspect.ENTROPY, 4).add(Aspect.FLIGHT, 4).add(Aspect.LIFE, 1).add(Aspect.CROP, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.netherBerryItem, 0, 3), new AspectList().add(Aspect.ENTROPY, 8).add(Aspect.LIFE, 1).add(Aspect.CROP, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.netherBerryBush, 0, 0), + new AspectList() + .add(Aspect.ENTROPY, 4) + .add(Aspect.POISON, 4) + .add(Aspect.PLANT, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.netherBerryBush, 0, 1), + new AspectList() + .add(Aspect.ENTROPY, 4) + .add(Aspect.DARKNESS, 4) + .add(Aspect.PLANT, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.netherBerryBush, 0, 2), + new AspectList() + .add(Aspect.ENTROPY, 4) + .add(Aspect.FLIGHT, 4) + .add(Aspect.PLANT, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.netherBerryBush, 0, 3), + new AspectList().add(Aspect.ENTROPY, 8).add(Aspect.PLANT, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.netherBerryItem, 0, 0), + new AspectList() + .add(Aspect.ENTROPY, 4) + .add(Aspect.POISON, 4) + .add(Aspect.LIFE, 1) + .add(Aspect.CROP, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.netherBerryItem, 0, 1), + new AspectList() + .add(Aspect.ENTROPY, 4) + .add(Aspect.DARKNESS, 4) + .add(Aspect.LIFE, 1) + .add(Aspect.CROP, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.netherBerryItem, 0, 2), + new AspectList() + .add(Aspect.ENTROPY, 4) + .add(Aspect.FLIGHT, 4) + .add(Aspect.LIFE, 1) + .add(Aspect.CROP, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.netherBerryItem, 0, 3), + new AspectList() + .add(Aspect.ENTROPY, 8) + .add(Aspect.LIFE, 1) + .add(Aspect.CROP, 1)); } - //Register Nether and End clouds - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.cloud, 0, 2), new AspectList().add(Aspect.AIR, 1).add(Aspect.FLIGHT, 1).add(Aspect.FIRE, 1).add(Aspect.WEATHER, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.cloud, 0, 3), new AspectList().add(Aspect.AIR, 1).add(Aspect.FLIGHT, 1).add(Aspect.POISON, 1).add(Aspect.WEATHER, 1)); - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.cloud, 0, 1), new AspectList().add(Aspect.AIR, 1).add(Aspect.FLIGHT, 1).add(Aspect.ELDRITCH, 1).add(Aspect.WEATHER, 1)); + // Register Nether and End clouds + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.cloud, 0, 2), + new AspectList() + .add(Aspect.AIR, 1) + .add(Aspect.FLIGHT, 1) + .add(Aspect.FIRE, 1) + .add(Aspect.WEATHER, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.cloud, 0, 3), + new AspectList() + .add(Aspect.AIR, 1) + .add(Aspect.FLIGHT, 1) + .add(Aspect.POISON, 1) + .add(Aspect.WEATHER, 1)); + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.cloud, 0, 1), + new AspectList() + .add(Aspect.AIR, 1) + .add(Aspect.FLIGHT, 1) + .add(Aspect.ELDRITCH, 1) + .add(Aspect.WEATHER, 1)); - //Register other Nether items/plants - ThaumcraftApi.registerObjectTag(new ItemStack(NContent.potashApple, 0, 0), new AspectList().add(Aspect.CROP, 2).add(Aspect.POISON, 2)); - - + // Register other Nether items/plants + ThaumcraftApi.registerObjectTag( + new ItemStack(NContent.potashApple, 0, 0), + new AspectList().add(Aspect.CROP, 2).add(Aspect.POISON, 2)); } catch (Exception e) { Natura.logger.warn("ThaumCraft integration failed.", e); } } - } diff --git a/src/main/java/mods/natura/plugins/waila/NaturaCropDataProvider.java b/src/main/java/mods/natura/plugins/waila/NaturaCropDataProvider.java index 8f368dcf..3f8f93ee 100644 --- a/src/main/java/mods/natura/plugins/waila/NaturaCropDataProvider.java +++ b/src/main/java/mods/natura/plugins/waila/NaturaCropDataProvider.java @@ -1,7 +1,6 @@ package mods.natura.plugins.waila; import java.util.List; - import mcp.mobius.waila.api.IWailaConfigHandler; import mcp.mobius.waila.api.IWailaDataAccessor; import mcp.mobius.waila.api.IWailaDataProvider; @@ -18,36 +17,39 @@ public class NaturaCropDataProvider implements IWailaDataProvider { @Override public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config) { - Block block = accessor.getBlock(); + Block block = accessor.getBlock(); if (accessor.getBlock() instanceof CropBlock) { int meta = accessor.getMetadata(); CropBlock cropBlock = (CropBlock) block; - + return new ItemStack(cropBlock.getCropItem(meta), 1, cropBlock.damageDropped(meta)); } return null; } @Override - public List getWailaHead(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public List getWailaHead( + ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { return currenttip; } @Override - public List getWailaBody(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public List getWailaBody( + ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { if (config.getConfig("general.showcrop")) { Block block = accessor.getBlock(); if (block instanceof CropBlock) { int meta = accessor.getMetadata(); - float startGrowth = ((CropBlock)block).getStartGrowth(meta); - float maxGrowth = ((CropBlock)block).getMaxGrowth(meta) - startGrowth; + float startGrowth = ((CropBlock) block).getStartGrowth(meta); + float maxGrowth = ((CropBlock) block).getMaxGrowth(meta) - startGrowth; float growthValue; growthValue = ((meta - startGrowth) / maxGrowth) * 100.0F; if (growthValue < 100.0) { - currenttip.add(StatCollector.translateToLocalFormatted("tooltip.waila.growth.percentage", growthValue)); + currenttip.add( + StatCollector.translateToLocalFormatted("tooltip.waila.growth.percentage", growthValue)); } else { currenttip.add(StatCollector.translateToLocal("tooltip.waila.growth.mature")); } @@ -58,13 +60,14 @@ public List getWailaBody(ItemStack itemStack, List currenttip, I } @Override - public List getWailaTail(ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { + public List getWailaTail( + ItemStack itemStack, List currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) { return currenttip; } @Override - public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) { + public NBTTagCompound getNBTData( + EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z) { return tag; } - } diff --git a/src/main/java/mods/natura/plugins/waila/WailaPulse.java b/src/main/java/mods/natura/plugins/waila/WailaPulse.java index 01a3e0aa..8d655014 100644 --- a/src/main/java/mods/natura/plugins/waila/WailaPulse.java +++ b/src/main/java/mods/natura/plugins/waila/WailaPulse.java @@ -8,13 +8,12 @@ @Pulse(id = "Natura Waila Compatibility", modsRequired = WailaPulse.modId) public class WailaPulse { - + public static final String modId = "Waila"; - + @Handler - public void init (FMLInitializationEvent evt) { + public void init(FMLInitializationEvent evt) { Natura.logger.info("Waila detected."); FMLInterModComms.sendMessage(modId, "register", "mods.natura.plugins.waila.WailaRegistrar.wailaCallback"); } - } diff --git a/src/main/java/mods/natura/plugins/waila/WailaRegistrar.java b/src/main/java/mods/natura/plugins/waila/WailaRegistrar.java index 9731ce3b..5778b2f9 100644 --- a/src/main/java/mods/natura/plugins/waila/WailaRegistrar.java +++ b/src/main/java/mods/natura/plugins/waila/WailaRegistrar.java @@ -5,12 +5,11 @@ import mods.natura.blocks.crops.CropBlock; public class WailaRegistrar { - - public static void wailaCallback (IWailaRegistrar registrar) { + + public static void wailaCallback(IWailaRegistrar registrar) { IWailaDataProvider cropProvider = new NaturaCropDataProvider(); - + registrar.registerStackProvider(cropProvider, CropBlock.class); registrar.registerBodyProvider(cropProvider, CropBlock.class); } - } diff --git a/src/main/java/mods/natura/util/DispenserBehaviorSpawnEgg.java b/src/main/java/mods/natura/util/DispenserBehaviorSpawnEgg.java index 71679c71..bfa515a4 100644 --- a/src/main/java/mods/natura/util/DispenserBehaviorSpawnEgg.java +++ b/src/main/java/mods/natura/util/DispenserBehaviorSpawnEgg.java @@ -8,22 +8,19 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.EnumFacing; -public class DispenserBehaviorSpawnEgg extends BehaviorDefaultDispenseItem -{ +public class DispenserBehaviorSpawnEgg extends BehaviorDefaultDispenseItem { /** * Dispense the specified stack, play the dispense sound and spawn particles. */ @Override - public ItemStack dispenseStack (IBlockSource par1IBlockSource, ItemStack par2ItemStack) - { + public ItemStack dispenseStack(IBlockSource par1IBlockSource, ItemStack par2ItemStack) { EnumFacing enumfacing = BlockDispenser.func_149937_b(par1IBlockSource.getBlockMetadata()); double d0 = par1IBlockSource.getX() + enumfacing.getFrontOffsetX(); double d1 = par1IBlockSource.getYInt() + 0.2F; double d2 = par1IBlockSource.getZ() + enumfacing.getFrontOffsetZ(); EntityLiving entity = SpawnEgg.activateSpawnEgg(par2ItemStack, par1IBlockSource.getWorld(), d0, d1, d2, 0); - if (par2ItemStack.hasDisplayName()) - { + if (par2ItemStack.hasDisplayName()) { entity.setCustomNameTag(par2ItemStack.getDisplayName()); } diff --git a/src/main/java/mods/natura/util/ICrop.java b/src/main/java/mods/natura/util/ICrop.java index c26533af..f0094e8c 100644 --- a/src/main/java/mods/natura/util/ICrop.java +++ b/src/main/java/mods/natura/util/ICrop.java @@ -2,21 +2,20 @@ import java.util.Collections; import java.util.List; - import net.minecraft.item.ItemStack; import net.minecraft.world.IBlockAccess; -public interface ICrop -{ - public enum HarvestType - { - BREAK, USE, MACHINE +public interface ICrop { + public enum HarvestType { + BREAK, + USE, + MACHINE } - public static final List NO_YIELD = Collections. emptyList(); + public static final List NO_YIELD = Collections.emptyList(); - /** - * + /** + * * @param world * @param x * @param y @@ -24,11 +23,11 @@ public enum HarvestType * @param type * @return A list of items harvested. If no items are returned, NO_YIELD should be passed. */ - public List harvestCrop (IBlockAccess world, int x, int y, int z, HarvestType type); + public List harvestCrop(IBlockAccess world, int x, int y, int z, HarvestType type); - public boolean isFullyGrown (IBlockAccess world, int x, int y, int z); + public boolean isFullyGrown(IBlockAccess world, int x, int y, int z); - public boolean hasYield (IBlockAccess world, int x, int y, int z); + public boolean hasYield(IBlockAccess world, int x, int y, int z); - public void growthTick (IBlockAccess world, int x, int y, int z); + public void growthTick(IBlockAccess world, int x, int y, int z); } diff --git a/src/main/java/mods/natura/worldgen/BaseCloudWorldgen.java b/src/main/java/mods/natura/worldgen/BaseCloudWorldgen.java index caca4a83..3fcc6629 100644 --- a/src/main/java/mods/natura/worldgen/BaseCloudWorldgen.java +++ b/src/main/java/mods/natura/worldgen/BaseCloudWorldgen.java @@ -1,8 +1,8 @@ package mods.natura.worldgen; -import java.util.Random; - import cpw.mods.fml.common.IWorldGenerator; +import java.util.Random; +import mods.natura.Natura; import mods.natura.common.NContent; import mods.natura.common.PHNatura; import net.minecraft.world.World; @@ -59,13 +59,27 @@ public BaseCloudWorldgen() { } @Override - public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { + public void generate( + Random random, + int chunkX, + int chunkZ, + World world, + IChunkProvider chunkGenerator, + IChunkProvider chunkProvider) { + int dimSettings = Natura.getDimensionWorldgenOverrides(world.provider.dimensionId); + if ((dimSettings & Natura.DIM_WORLDGEN_CLOUD_BIT) == 0) { + return; + } // Overworld int xCh, yCh, zCh; int xChunk = chunkX * 16 + 8, zChunk = chunkZ * 16 + 8; BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(xChunk + 16, zChunk + 16); - if (PHNatura.generateOverworldClouds && biome.rainfall > 0.15f && random.nextInt(PHNatura.cloudSpawnRarity) == 0 && world.provider.dimensionId != 1 && shouldGenerateInDim(world.provider.dimensionId)) { + if (PHNatura.generateOverworldClouds + && biome.rainfall > 0.15f + && random.nextInt(PHNatura.cloudSpawnRarity) == 0 + && world.provider.dimensionId != 1 + && shouldGenerateInDim(world.provider.dimensionId)) { xCh = xChunk + random.nextInt(16); zCh = zChunk + random.nextInt(16); yCh = random.nextInt(PHNatura.cloudSpawnRange) + PHNatura.cloudSpawnHeight; @@ -82,7 +96,11 @@ public void generate(Random random, int chunkX, int chunkZ, World world, IChunkP } // End Generation - if (PHNatura.generateDarkClouds && biome == BiomeGenBase.sky && world.provider.dimensionId == 1 && random.nextInt(4) == 0 && shouldGenerateDarkInDim(world.provider.dimensionId)) { + if (PHNatura.generateDarkClouds + && biome == BiomeGenBase.sky + && world.provider.dimensionId == 1 + && random.nextInt(4) == 0 + && shouldGenerateDarkInDim(world.provider.dimensionId)) { xCh = xChunk + random.nextInt(16); zCh = zChunk + random.nextInt(16); for (int iter = 0; iter < PHNatura.darkCloudSpawnRarity; iter++) { @@ -118,7 +136,9 @@ public void generate(Random random, int chunkX, int chunkZ, World world, IChunkP } } - if (PHNatura.generateSulfurClouds && random.nextInt(PHNatura.sulfurSpawnRarity) == 0 && shouldGenerateSulfurInDim(world.provider.dimensionId)) { + if (PHNatura.generateSulfurClouds + && random.nextInt(PHNatura.sulfurSpawnRarity) == 0 + && shouldGenerateSulfurInDim(world.provider.dimensionId)) { xCh = xChunk + random.nextInt(16); yCh = random.nextInt(PHNatura.sulfurSpawnRange) + PHNatura.sulfurSpawnHeight; zCh = zChunk + random.nextInt(16); @@ -162,5 +182,4 @@ public boolean shouldGenerateDarkInDim(int dim) { } return true; } - } diff --git a/src/main/java/mods/natura/worldgen/BaseCropWorldgen.java b/src/main/java/mods/natura/worldgen/BaseCropWorldgen.java index 0020f943..db50f52a 100644 --- a/src/main/java/mods/natura/worldgen/BaseCropWorldgen.java +++ b/src/main/java/mods/natura/worldgen/BaseCropWorldgen.java @@ -1,8 +1,8 @@ package mods.natura.worldgen; -import java.util.Random; - import cpw.mods.fml.common.IWorldGenerator; +import java.util.Random; +import mods.natura.Natura; import mods.natura.common.NContent; import mods.natura.common.PHNatura; import net.minecraft.init.Blocks; @@ -17,23 +17,33 @@ public class BaseCropWorldgen implements IWorldGenerator { public BaseCropWorldgen() { - if (PHNatura.enableBerryBushes) { + if (PHNatura.enableBerryBushes) { raspgen = new BerryBushGen(0, PHNatura.seaLevel + PHNatura.raspSpawnRange); bluegen = new BerryBushGen(1, PHNatura.seaLevel + PHNatura.blueSpawnRange); blackgen = new BerryBushGen(2, PHNatura.seaLevel + PHNatura.blackSpawnRange); malogen = new BerryBushGen(3, PHNatura.seaLevel + PHNatura.geoSpawnRange); - } + } - if (PHNatura.enableNetherBerryBushes) { + if (PHNatura.enableNetherBerryBushes) { blightgen = new NetherBerryBushGen(NContent.netherBerryBush, 0); duskgen = new NetherBerryBushGen(NContent.netherBerryBush, 1); skygen = new NetherBerryBushGen(NContent.netherBerryBush, 2); stinggen = new NetherBerryBushGen(NContent.netherBerryBush, 3); - } + } } @Override - public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { + public void generate( + Random random, + int chunkX, + int chunkZ, + World world, + IChunkProvider chunkGenerator, + IChunkProvider chunkProvider) { + int dimSettings = Natura.getDimensionWorldgenOverrides(world.provider.dimensionId); + if ((dimSettings & Natura.DIM_WORLDGEN_CROP_BIT) == 0) { + return; + } final int xChunk = chunkX * 16 + 8, zChunk = chunkZ * 16 + 8; int xCh = chunkX * 16 + random.nextInt(16); int yCh = random.nextInt(128); @@ -59,35 +69,45 @@ public void generate(Random random, int chunkX, int chunkZ, World world, IChunkP } // Berry bushes - if (PHNatura.generateRaspberries && random.nextInt(PHNatura.raspSpawnRarity) == 0 && goodClimate(biome, 0.6f, 2.0f, 0.2f, 0.93f)) { + if (PHNatura.generateRaspberries + && random.nextInt(PHNatura.raspSpawnRarity) == 0 + && goodClimate(biome, 0.6f, 2.0f, 0.2f, 0.93f)) { xCh = xChunk + random.nextInt(16); yCh = random.nextInt(PHNatura.raspSpawnRange) + PHNatura.seaLevel; zCh = zChunk + random.nextInt(16); raspgen.generate(world, random, xCh, yCh, zCh); } - if (PHNatura.generateBlueberries && random.nextInt(PHNatura.blueSpawnRarity) == 0 && goodClimate(biome, 0.3f, 0.81f, 0.3f, 0.8f)) { + if (PHNatura.generateBlueberries + && random.nextInt(PHNatura.blueSpawnRarity) == 0 + && goodClimate(biome, 0.3f, 0.81f, 0.3f, 0.8f)) { xCh = xChunk + random.nextInt(16); yCh = random.nextInt(PHNatura.blueSpawnRange) + PHNatura.seaLevel; zCh = zChunk + random.nextInt(16); bluegen.generate(world, random, xCh, yCh, zCh); } - if (PHNatura.generateBlackberries && random.nextInt(PHNatura.blackSpawnRarity) == 0 && goodClimate(biome, 0.5f, 5.0f, 0.6f, 3.0f)) { + if (PHNatura.generateBlackberries + && random.nextInt(PHNatura.blackSpawnRarity) == 0 + && goodClimate(biome, 0.5f, 5.0f, 0.6f, 3.0f)) { xCh = xChunk + random.nextInt(16); yCh = random.nextInt(PHNatura.blackSpawnRange) + PHNatura.seaLevel; zCh = zChunk + random.nextInt(16); blackgen.generate(world, random, xCh, yCh, zCh); } - if (PHNatura.generateBlackberries && random.nextInt(PHNatura.blackSpawnRarity / 3) == 0 && biome == BiomeGenBase.swampland) { + if (PHNatura.generateBlackberries + && random.nextInt(PHNatura.blackSpawnRarity / 3) == 0 + && biome == BiomeGenBase.swampland) { xCh = xChunk + random.nextInt(16); yCh = random.nextInt(PHNatura.blackSpawnRange) + PHNatura.seaLevel; zCh = zChunk + random.nextInt(16); blackgen.generate(world, random, xCh, yCh, zCh); } - if (PHNatura.generateMaloberries && random.nextInt(PHNatura.geoSpawnRarity) == 0 && goodClimate(biome, 0.0f, 0.3f, 0.0f, 5.0f)) { + if (PHNatura.generateMaloberries + && random.nextInt(PHNatura.geoSpawnRarity) == 0 + && goodClimate(biome, 0.0f, 0.3f, 0.0f, 5.0f)) { xCh = xChunk + random.nextInt(16); yCh = random.nextInt(PHNatura.geoSpawnRange) + PHNatura.seaLevel; zCh = zChunk + random.nextInt(16); @@ -182,5 +202,4 @@ public boolean goodClimate(BiomeGenBase biome, float minTemp, float maxTemp, flo FlowerGen lily; FlowerGen tulip; FlowerGen pansy; - } diff --git a/src/main/java/mods/natura/worldgen/BaseTreeWorldgen.java b/src/main/java/mods/natura/worldgen/BaseTreeWorldgen.java index afc5741a..99ba016d 100644 --- a/src/main/java/mods/natura/worldgen/BaseTreeWorldgen.java +++ b/src/main/java/mods/natura/worldgen/BaseTreeWorldgen.java @@ -1,8 +1,8 @@ package mods.natura.worldgen; -import java.util.Random; - import cpw.mods.fml.common.IWorldGenerator; +import java.util.Random; +import mods.natura.Natura; import mods.natura.common.NContent; import mods.natura.common.PHNatura; import net.minecraft.block.Block; @@ -57,7 +57,17 @@ public BaseTreeWorldgen() { public static boolean retrogen; @Override - public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider) { + public void generate( + Random random, + int chunkX, + int chunkZ, + World world, + IChunkProvider chunkGenerator, + IChunkProvider chunkProvider) { + int dimSettings = Natura.getDimensionWorldgenOverrides(world.provider.dimensionId); + if ((dimSettings & Natura.DIM_WORLDGEN_TREE_BIT) == 0) { + return; + } int xSpawn, ySpawn, zSpawn; int xPos = chunkX * 16 + 8, zPos = chunkZ * 16 + 8; String biomeName = world.getWorldChunkManager().getBiomeGenAt(xPos, zPos).biomeName; @@ -66,7 +76,13 @@ public void generate(Random random, int chunkX, int chunkZ, World world, IChunkP return; } - if (biomeName == "Forest" || biomeName == "AutumnWoods" || biomeName == "BirchForest" || biomeName == "PineForest" || biomeName == "Rainforest" || biomeName == "TemperateRainforest" || biomeName == "Woodlands") { + if (biomeName == "Forest" + || biomeName == "AutumnWoods" + || biomeName == "BirchForest" + || biomeName == "PineForest" + || biomeName == "Rainforest" + || biomeName == "TemperateRainforest" + || biomeName == "Woodlands") { if (PHNatura.generateSakura && random.nextInt(PHNatura.sakuraSpawnRarity * 5) == 0) { for (int iter = 0; iter < 3; iter++) { xSpawn = xPos + random.nextInt(16); @@ -88,14 +104,18 @@ public void generate(Random random, int chunkX, int chunkZ, World world, IChunkP zSpawn = zPos + random.nextInt(16); genRedwood.generate(world, random, xSpawn, PHNatura.seaLevel + 16, zSpawn); } - if (PHNatura.generateSmallEucalyptus && random.nextInt((int) (PHNatura.eucalyptusShortSpawnRarity * 1.5)) == 0) { + if (PHNatura.generateSmallEucalyptus + && random.nextInt((int) (PHNatura.eucalyptusShortSpawnRarity * 1.5)) == 0) { xSpawn = xPos + random.nextInt(16); ySpawn = random.nextInt(32) + PHNatura.seaLevel; zSpawn = zPos + random.nextInt(16); eucalyptusShort.generate(world, random, xSpawn, ySpawn, zSpawn); } } - if (biomeName == "Extreme Hills" || biomeName == "Extreme Hills Edge" || biomeName == "ForestedHills" || biomeName == "GreenHills") { + if (biomeName == "Extreme Hills" + || biomeName == "Extreme Hills Edge" + || biomeName == "ForestedHills" + || biomeName == "GreenHills") { if (PHNatura.generateBush && random.nextInt(PHNatura.bushSpawnRarity) == 0) { xSpawn = xPos + random.nextInt(16) + 8; ySpawn = random.nextInt(PHNatura.bushSpawnRange) + PHNatura.seaLevel; @@ -122,7 +142,6 @@ public void generate(Random random, int chunkX, int chunkZ, World world, IChunkP xSpawn = xPos + random.nextInt(16); zSpawn = zPos + random.nextInt(16); willow.generate(world, random, xSpawn, PHNatura.seaLevel + 16, zSpawn); - } } @@ -136,7 +155,7 @@ public void generate(Random random, int chunkX, int chunkZ, World world, IChunkP } if (biomeName == "Jungle" || biomeName == "JungleHills" || biomeName == "Extreme Jungle") { - if (PHNatura.generatePurpleheart)// && random.nextInt((int) PHNatura.purpleheartRarity) == 0) + if (PHNatura.generatePurpleheart) // && random.nextInt((int) PHNatura.purpleheartRarity) == 0) { xSpawn = xPos + random.nextInt(16); zSpawn = zPos + random.nextInt(16); @@ -174,7 +193,10 @@ public void generate(Random random, int chunkX, int chunkZ, World world, IChunkP } // Nether trees - if (biomeName.equals("Hell") || biomeName.equals("Boneyard") || biomeName.equals("Phantasmagoric Inferno") || biomeName.equals("Corrupted Sands")) { + if (biomeName.equals("Hell") + || biomeName.equals("Boneyard") + || biomeName.equals("Phantasmagoric Inferno") + || biomeName.equals("Corrupted Sands")) { if (PHNatura.generateBloodwood && random.nextInt(PHNatura.bloodSpawnRarity) == 0) { xSpawn = xPos + random.nextInt(16); ySpawn = 72; @@ -236,11 +258,13 @@ int findGround(World world, int x, int y, int z) { do { height--; Block underID = world.getBlock(x, height, z); - if (underID == Blocks.netherrack || underID == Blocks.soul_sand || underID == NContent.taintedSoil || height < 0) { + if (underID == Blocks.netherrack + || underID == Blocks.soul_sand + || underID == NContent.taintedSoil + || height < 0) { foundGround = true; } } while (!foundGround); return height + 1; } - } diff --git a/src/main/java/mods/natura/worldgen/BerryBushGen.java b/src/main/java/mods/natura/worldgen/BerryBushGen.java index 4768b0bc..7844dda5 100644 --- a/src/main/java/mods/natura/worldgen/BerryBushGen.java +++ b/src/main/java/mods/natura/worldgen/BerryBushGen.java @@ -1,7 +1,6 @@ package mods.natura.worldgen; import java.util.Random; - import mods.natura.common.NContent; import mods.natura.common.PHNatura; import net.minecraft.block.Block; @@ -24,14 +23,10 @@ public boolean generate(World world, Random random, int x, int y, int z) { int height = findGround(world, x, y, z); if (height != -1) { int type = random.nextInt(10); - if (type == 9) - generateLargeNode(world, random, x, height, z); - else if (type >= 7) - generateShrub(world, random, x, height, z); - else if (type >= 3) - generateSmallNode(world, random, x, height, z); - else - generateTinyNode(world, random, x, height, z); + if (type == 9) generateLargeNode(world, random, x, height, z); + else if (type >= 7) generateShrub(world, random, x, height, z); + else if (type >= 3) generateSmallNode(world, random, x, height, z); + else generateTinyNode(world, random, x, height, z); } return true; } @@ -123,7 +118,8 @@ public void generateShrub(World world, Random random, int x, int y, int z) { block = world.getBlock(xPos, yPos, zPos); - if ((Math.abs(j2) != l1 || Math.abs(l2) != l1 || random.nextInt(2) != 0) && block.canBeReplacedByLeaves(world, xPos, yPos, zPos)) { + if ((Math.abs(j2) != l1 || Math.abs(l2) != l1 || random.nextInt(2) != 0) + && block.canBeReplacedByLeaves(world, xPos, yPos, zPos)) { // this.setBlockAndMetadata(world, i2, j1, k2, Block.leaves.blockID, // this.field_76527_a); generateBerryBlock(world, xPos, yPos, zPos, random); @@ -136,14 +132,10 @@ public void generateShrub(World world, Random random, int x, int y, int z) { public void generateSmallNode(World world, Random random, int x, int y, int z) { generateBerryBlock(world, x, y, z, random); - if (random.nextBoolean()) - generateBerryBush(world, x + 1, y, z, random); - if (random.nextBoolean()) - generateBerryBush(world, x - 1, y, z, random); - if (random.nextBoolean()) - generateBerryBush(world, x, y, z + 1, random); - if (random.nextBoolean()) - generateBerryBush(world, x, y, z - 1, random); + if (random.nextBoolean()) generateBerryBush(world, x + 1, y, z, random); + if (random.nextBoolean()) generateBerryBush(world, x - 1, y, z, random); + if (random.nextBoolean()) generateBerryBush(world, x, y, z + 1, random); + if (random.nextBoolean()) generateBerryBush(world, x, y, z - 1, random); } public void generateTinyNode(World world, Random random, int x, int y, int z) { @@ -163,5 +155,4 @@ void generateBerryBush(World world, int x, int y, int z, Random random) { world.setBlock(x, y, z, NContent.berryBush, metadata + metaOffset * 4, 0); } } - } diff --git a/src/main/java/mods/natura/worldgen/BloodTreeLargeGen.java b/src/main/java/mods/natura/worldgen/BloodTreeLargeGen.java index dc7306e5..a2cfd5f6 100644 --- a/src/main/java/mods/natura/worldgen/BloodTreeLargeGen.java +++ b/src/main/java/mods/natura/worldgen/BloodTreeLargeGen.java @@ -1,7 +1,6 @@ package mods.natura.worldgen; import java.util.Random; - import mods.natura.common.NContent; import net.minecraft.block.Block; import net.minecraft.init.Blocks; @@ -19,8 +18,7 @@ public BloodTreeLargeGen(int wood, int leaves) { public boolean generate(World world, Random random, int x, int y, int z) { int height = findCeiling(world, x, y, z); - if (height == -1) - return false; + if (height == -1) return false; return generateRandomTree(world, random, x, height, z); } @@ -30,7 +28,9 @@ int findCeiling(World world, int x, int y, int z) { int height = y; do { Block blockAtHeight = world.getBlock(x, height, z); - if ((blockAtHeight == Blocks.netherrack || blockAtHeight == Blocks.soul_sand || blockAtHeight == NContent.taintedSoil) + if ((blockAtHeight == Blocks.netherrack + || blockAtHeight == Blocks.soul_sand + || blockAtHeight == NContent.taintedSoil) && !world.getBlock(x, height - 1, z).func_149730_j()) { ret = height - 1; break; @@ -91,22 +91,22 @@ private void genBranch(World world, Random random, int x, int y, int z, int heig byte offsetX = 0; byte offsetZ = 0; switch (direction) { - case 1: - offsetX = 1; - offsetZ = 1; - break; - case 2: - offsetX = -1; - offsetZ = 1; - break; - case 3: - offsetX = 1; - offsetZ = -1; - break; - case 4: - offsetX = -1; - offsetZ = -1; - break; + case 1: + offsetX = 1; + offsetZ = 1; + break; + case 2: + offsetX = -1; + offsetZ = 1; + break; + case 3: + offsetX = 1; + offsetZ = -1; + break; + case 4: + offsetX = -1; + offsetZ = -1; + break; } int i2 = random.nextInt(15); for (int j2 = 4; j2 > 0; j2--) { @@ -129,25 +129,25 @@ private void genStraightBranch(World world, Random random, int x, int y, int z, byte offsetX = 0; byte offsetZ = 0; switch (direction) { - case 1: - offsetX = 1; - offsetZ = 0; - break; - - case 2: - offsetX = 0; - offsetZ = 1; - break; - - case 3: - offsetX = -1; - offsetZ = 0; - break; - - case 4: - offsetX = 0; - offsetZ = -1; - break; + case 1: + offsetX = 1; + offsetZ = 0; + break; + + case 2: + offsetX = 0; + offsetZ = 1; + break; + + case 3: + offsetX = -1; + offsetZ = 0; + break; + + case 4: + offsetX = 0; + offsetZ = -1; + break; } int i2 = random.nextInt(5); for (int j2 = 4; j2 > 0; j2--) { @@ -198,5 +198,4 @@ public boolean generateNode(World world, Random random, int x, int y, int z) { return true; } - } diff --git a/src/main/java/mods/natura/worldgen/BushTreeGen.java b/src/main/java/mods/natura/worldgen/BushTreeGen.java index 620d0c5b..5ba8f0e1 100644 --- a/src/main/java/mods/natura/worldgen/BushTreeGen.java +++ b/src/main/java/mods/natura/worldgen/BushTreeGen.java @@ -1,7 +1,6 @@ package mods.natura.worldgen; import java.util.Random; - import mods.natura.common.NContent; import mods.natura.common.PHNatura; import net.minecraft.block.Block; @@ -33,8 +32,7 @@ int findGround(World world, int x, int y, int z) { do { height--; Block underID = world.getBlock(x, height, z); - if (underID == Blocks.dirt || underID == Blocks.grass || height < PHNatura.seaLevel) - foundGround = true; + if (underID == Blocks.dirt || underID == Blocks.grass || height < PHNatura.seaLevel) foundGround = true; } while (!foundGround); return height + 1; } @@ -148,9 +146,11 @@ private void growLeaves(World world, int par2, int par3, int par4, int par5, Ran if ((var12 >= 0 || var14 >= 0 || var12 * var12 + var14 * var14 <= var10 * var10) && (var12 <= 0 && var14 <= 0 || var12 * var12 + var14 * var14 <= (var10 + 1) * (var10 + 1)) - && (par6Random.nextInt(4) != 0 || var12 * var12 + var14 * var14 <= (var10 - 1) * (var10 - 1)) + && (par6Random.nextInt(4) != 0 + || var12 * var12 + var14 * var14 <= (var10 - 1) * (var10 - 1)) && (block.canBeReplacedByLeaves(world, var11, var8, var13))) { - this.setBlockAndNotifyAdequately(world, var11, var8, var13, NContent.floraLeaves, this.leavesMetadata); + this.setBlockAndNotifyAdequately( + world, var11, var8, var13, NContent.floraLeaves, this.leavesMetadata); } } } @@ -173,6 +173,4 @@ protected boolean isReplaceable(World world, int x, int y, int z) { Block block = world.getBlock(x, y, z); return block.isAir(world, x, y, z) || block.isLeaves(world, x, y, z) || block.isWood(world, x, y, z); } - } - diff --git a/src/main/java/mods/natura/worldgen/CloudGen.java b/src/main/java/mods/natura/worldgen/CloudGen.java index 321c5edc..eab3c7f8 100644 --- a/src/main/java/mods/natura/worldgen/CloudGen.java +++ b/src/main/java/mods/natura/worldgen/CloudGen.java @@ -1,7 +1,6 @@ package mods.natura.worldgen; import java.util.Random; - import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.world.World; @@ -14,7 +13,7 @@ public class CloudGen extends WorldGenerator { private boolean flatCloud; public CloudGen(Block cloud, int metadata, int size, boolean isCloudFlat) { - cloudBlock = cloud; + cloudBlock = cloud; cloudMeta = metadata; numberOfBlocks = size; flatCloud = isCloudFlat; @@ -34,8 +33,8 @@ public boolean generate(World world, Random random, int x, int y, int z) { for (int yIter = y; yIter < y + random.nextInt(1) + 2; yIter++) { for (int zIter = z; zIter < z + random.nextInt(4) + 3 * (flatCloud ? 3 : 1); zIter++) { if (world.getBlock(xIter, yIter, zIter) == Blocks.air - && Math.abs(xIter - x) + Math.abs(yIter - y) - + Math.abs(zIter - z) < 4 * (flatCloud ? 3 : 1) + random.nextInt(2)) { + && Math.abs(xIter - x) + Math.abs(yIter - y) + Math.abs(zIter - z) + < 4 * (flatCloud ? 3 : 1) + random.nextInt(2)) { setBlockAndNotifyAdequately(world, xIter, yIter, zIter, cloudBlock, cloudMeta); } } @@ -44,5 +43,4 @@ public boolean generate(World world, Random random, int x, int y, int z) { } return true; } - } diff --git a/src/main/java/mods/natura/worldgen/DarkwoodGen.java b/src/main/java/mods/natura/worldgen/DarkwoodGen.java index 407a8f26..f27a062c 100644 --- a/src/main/java/mods/natura/worldgen/DarkwoodGen.java +++ b/src/main/java/mods/natura/worldgen/DarkwoodGen.java @@ -1,7 +1,6 @@ package mods.natura.worldgen; import java.util.Random; - import mods.natura.blocks.trees.NSaplingBlock; import mods.natura.common.NContent; import net.minecraft.block.Block; @@ -30,20 +29,23 @@ public DarkwoodGen(boolean notify, int minTreeHeight, int logMetadata) { seekGround = !notify; } - int findGround (World world, int x, int y, int z) { + int findGround(World world, int x, int y, int z) { boolean foundGround = false; int height = y; do { height--; Block blockBelow = world.getBlock(x, height, z); - if (blockBelow == Blocks.netherrack || blockBelow == Blocks.soul_sand || blockBelow == NContent.taintedSoil || height < 0) { + if (blockBelow == Blocks.netherrack + || blockBelow == Blocks.soul_sand + || blockBelow == NContent.taintedSoil + || height < 0) { foundGround = true; } } while (!foundGround); return height + 1; } - public boolean generate (World world, Random random, int xPos, int yPos, int zPos) { + public boolean generate(World world, Random random, int xPos, int yPos, int zPos) { int treeHeight = random.nextInt(3) + this.minTreeHeight; if (treeHeight < 4) { treeHeight = 4; @@ -77,7 +79,12 @@ public boolean generate (World world, Random random, int xPos, int yPos, int zPo Block block = world.getBlock(l1, i1, j1); - if (block != Blocks.air && !block.isLeaves(world, l1, i1, j1) && block != Blocks.netherrack && block != Blocks.soul_sand && block != NContent.taintedSoil && !block.isWood(world, l1, i1, j1)) { + if (block != Blocks.air + && !block.isLeaves(world, l1, i1, j1) + && block != Blocks.netherrack + && block != Blocks.soul_sand + && block != NContent.taintedSoil + && !block.isWood(world, l1, i1, j1)) { flag = false; } } else { @@ -91,7 +98,9 @@ public boolean generate (World world, Random random, int xPos, int yPos, int zPo return false; } else { Block soil = world.getBlock(xPos, yPos - 1, zPos); - boolean isSoil = (soil.canSustainPlant(world, xPos, yPos - 1, zPos, ForgeDirection.UP, (NSaplingBlock) NContent.floraSapling)) || soil == Blocks.netherrack; + boolean isSoil = (soil.canSustainPlant( + world, xPos, yPos - 1, zPos, ForgeDirection.UP, (NSaplingBlock) NContent.floraSapling)) + || soil == Blocks.netherrack; if (isSoil && yPos < 256 - treeHeight - 1) { soil.onPlantGrow(world, xPos, yPos - 1, zPos, xPos, yPos, zPos); @@ -115,7 +124,13 @@ public boolean generate (World world, Random random, int xPos, int yPos, int zPo Block block = world.getBlock(j2, j1, l2); if (block.canBeReplacedByLeaves(world, j2, j1, l2)) { - this.setBlockAndNotifyAdequately(world, j2, j1, l2, NContent.darkLeaves, random.nextInt(25) == 0 ? 2 : random.nextInt(15) == 0 ? 1 : 0); + this.setBlockAndNotifyAdequately( + world, + j2, + j1, + l2, + NContent.darkLeaves, + random.nextInt(25) == 0 ? 2 : random.nextInt(15) == 0 ? 1 : 0); } } } @@ -125,9 +140,11 @@ public boolean generate (World world, Random random, int xPos, int yPos, int zPo for (j1 = 0; j1 < treeHeight; ++j1) { Block block = world.getBlock(xPos, yPos + j1, zPos); - if (block == Blocks.air || block.isLeaves(world, xPos, yPos + j1, zPos) || block.canBeReplacedByLeaves(world, xPos, yPos + j1, zPos)) { - this.setBlockAndNotifyAdequately(world, xPos, yPos + j1, zPos, NContent.darkTree, this.metaWood); - + if (block == Blocks.air + || block.isLeaves(world, xPos, yPos + j1, zPos) + || block.canBeReplacedByLeaves(world, xPos, yPos + j1, zPos)) { + this.setBlockAndNotifyAdequately( + world, xPos, yPos + j1, zPos, NContent.darkTree, this.metaWood); } } @@ -140,5 +157,4 @@ public boolean generate (World world, Random random, int xPos, int yPos, int zPo return false; } } - } diff --git a/src/main/java/mods/natura/worldgen/EucalyptusTreeGenShort.java b/src/main/java/mods/natura/worldgen/EucalyptusTreeGenShort.java index 56d8bf93..d8b5d790 100644 --- a/src/main/java/mods/natura/worldgen/EucalyptusTreeGenShort.java +++ b/src/main/java/mods/natura/worldgen/EucalyptusTreeGenShort.java @@ -1,7 +1,6 @@ package mods.natura.worldgen; import java.util.Random; - import mods.natura.common.NContent; import net.minecraft.block.Block; import net.minecraft.init.Blocks; @@ -17,12 +16,12 @@ public EucalyptusTreeGenShort(int logMetadata, int leavesMetadata) { mdLeaves = leavesMetadata; } - public boolean generate (World world, Random random, int x, int y, int z) { + public boolean generate(World world, Random random, int x, int y, int z) { int height = findGround(world, x, y, z); return generateRandomTree(world, random, x, height, z); } - int findGround (World world, int x, int y, int z) { + int findGround(World world, int x, int y, int z) { int l = 0; Block i1 = world.getBlock(x, y - 1, z); if (!world.getBlock(x, y, z).func_149730_j() && (i1 == Blocks.grass || i1 == Blocks.dirt)) { @@ -34,7 +33,8 @@ int findGround (World world, int x, int y, int z) { break; } Block j1 = world.getBlock(x, k1, z); - if ((j1 == Blocks.grass || j1 == Blocks.dirt) && !world.getBlock(x, k1 + 1, z).func_149730_j()) { + if ((j1 == Blocks.grass || j1 == Blocks.dirt) + && !world.getBlock(x, k1 + 1, z).func_149730_j()) { l = k1 + 1; break; } @@ -43,8 +43,8 @@ int findGround (World world, int x, int y, int z) { return l; } - public boolean generateRandomTree (World world, Random random, int posX, int posY, int posZ) { - int height = random.nextInt(3) + 6; //Height + public boolean generateRandomTree(World world, Random random, int posX, int posY, int posZ) { + int height = random.nextInt(3) + 6; // Height boolean flag = true; if (posY < 1 || posY + height + 1 > 256) { return false; @@ -57,7 +57,8 @@ public boolean generateRandomTree (World world, Random random, int posX, int pos if (i1 >= (posY + 1 + height) - 2) { byte0 = 2; } - label0: for (int l1 = posX - byte0; l1 <= posX + byte0 && flag; l1++) { + label0: + for (int l1 = posX - byte0; l1 <= posX + byte0 && flag; l1++) { int j2 = posZ - byte0; do { if (j2 > posZ + byte0 || !flag) { @@ -65,13 +66,11 @@ public boolean generateRandomTree (World world, Random random, int posX, int pos } if (i1 >= 0 && i1 < 256) { Block k2 = world.getBlock(l1, i1, j2); - if (k2 != Blocks.air && k2 != NContent.floraLeaves) - { + if (k2 != Blocks.air && k2 != NContent.floraLeaves) { flag = false; continue label0; } - } - else { + } else { flag = false; continue label0; } @@ -96,7 +95,10 @@ public boolean generateRandomTree (World world, Random random, int posX, int pos } for (int k1 = 0; k1 < height; k1++) { Block block = world.getBlock(posX, posY + k1, posZ); - if (block == Blocks.air || block.isLeaves(world, posX, posX + k1, posZ) || block.canBeReplacedByLeaves(world, posX, posX + k1, posZ) || block == NContent.floraSapling) { + if (block == Blocks.air + || block.isLeaves(world, posX, posX + k1, posZ) + || block.canBeReplacedByLeaves(world, posX, posX + k1, posZ) + || block == NContent.floraSapling) { this.setBlockAndNotifyAdequately(world, posX, posY + k1, posZ, NContent.tree, mdWood); } } @@ -113,29 +115,29 @@ public boolean generateRandomTree (World world, Random random, int posX, int pos return true; } - private void genBranch (World world, Random random, int x, int y, int z, int height, int direction) { + private void genBranch(World world, Random random, int x, int y, int z, int height, int direction) { int posX = x; int posY = y + height - 3; int posZ = z; byte byte0 = 0; byte byte1 = 0; switch (direction) { - case 1: - byte0 = 1; - byte1 = 1; - break; - case 2: - byte0 = -1; - byte1 = 1; - break; - case 3: - byte0 = 1; - byte1 = -1; - break; - case 4: - byte0 = -1; - byte1 = -1; - break; + case 1: + byte0 = 1; + byte1 = 1; + break; + case 2: + byte0 = -1; + byte1 = 1; + break; + case 3: + byte0 = 1; + byte1 = -1; + break; + case 4: + byte0 = -1; + byte1 = -1; + break; } int heightShift = random.nextInt(6); for (int bIter = 4; bIter > 0; bIter--) { @@ -158,29 +160,29 @@ private void genBranch (World world, Random random, int x, int y, int z, int hei } } - private void genStraightBranch (World world, Random random, int x, int y, int z, int height, int direction) { + private void genStraightBranch(World world, Random random, int x, int y, int z, int height, int direction) { int posX = x; int posY = y + height - 3; int posZ = z; byte xShift = 0; byte zShift = 0; switch (direction) { - case 1: - xShift = 1; - zShift = 0; - break; - case 2: - xShift = 0; - zShift = 1; - break; - case 3: - xShift = -1; - zShift = 0; - break; - case 4: - xShift = 0; - zShift = -1; - break; + case 1: + xShift = 1; + zShift = 0; + break; + case 2: + xShift = 0; + zShift = 1; + break; + case 3: + xShift = -1; + zShift = 0; + break; + case 4: + xShift = 0; + zShift = -1; + break; } int heightShift = random.nextInt(6); for (int j2 = 4; j2 > 0; j2--) { @@ -194,16 +196,14 @@ private void genStraightBranch (World world, Random random, int x, int y, int z, } int branch = heightShift % 3; posY += branch; - if (branch == 2) - this.setBlockAndNotifyAdequately(world, posX, posY - 1, posZ, NContent.tree, mdWood); + if (branch == 2) this.setBlockAndNotifyAdequately(world, posX, posY - 1, posZ, NContent.tree, mdWood); this.setBlockAndNotifyAdequately(world, posX, posY, posZ, NContent.tree, mdWood); - if (j2 == 1) - generateNode(world, random, posX, posY, posZ); + if (j2 == 1) generateNode(world, random, posX, posY, posZ); heightShift = random.nextInt(6); } } - public boolean generateNode (World world, Random random, int x, int y, int z) { + public boolean generateNode(World world, Random random, int x, int y, int z) { this.setBlockAndNotifyAdequately(world, x, y, z, NContent.tree, mdWood); for (int xIter = x - 2; xIter <= x + 2; xIter++) { for (int zIter = z - 1; zIter <= z + 1; zIter++) { @@ -233,5 +233,4 @@ public boolean generateNode (World world, Random random, int x, int y, int z) { } return true; } - } diff --git a/src/main/java/mods/natura/worldgen/FlowerGen.java b/src/main/java/mods/natura/worldgen/FlowerGen.java index 9891a69d..deaa8ccc 100644 --- a/src/main/java/mods/natura/worldgen/FlowerGen.java +++ b/src/main/java/mods/natura/worldgen/FlowerGen.java @@ -1,7 +1,6 @@ package mods.natura.worldgen; import java.util.Random; - import net.minecraft.block.Block; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; @@ -9,6 +8,7 @@ public class FlowerGen extends WorldGenerator { /** The ID of the plant block used in this plant generator. */ public final Block flower; + public final int metadata; public int chances = 64; @@ -24,17 +24,19 @@ public FlowerGen(Block flowerBlock, int flowerMeta, int count) { } @Override - public boolean generate (World world, Random random, int x, int y, int z) { + public boolean generate(World world, Random random, int x, int y, int z) { for (int i = 0; i < chances; ++i) { int posX = x + random.nextInt(8) - random.nextInt(8); int posY = y + random.nextInt(4) - random.nextInt(4); int posZ = z + random.nextInt(8) - random.nextInt(8); - if (posY < 127 && world.isAirBlock(posX, posY, posZ) && !world.provider.hasNoSky && flower.canBlockStay(world, posX, posY, posZ)) { + if (posY < 127 + && world.isAirBlock(posX, posY, posZ) + && !world.provider.hasNoSky + && flower.canBlockStay(world, posX, posY, posZ)) { world.setBlock(posX, posY, posZ, flower, metadata, 2); } } return true; } - } diff --git a/src/main/java/mods/natura/worldgen/FusewoodGen.java b/src/main/java/mods/natura/worldgen/FusewoodGen.java index 1e376cec..2a5fbf20 100644 --- a/src/main/java/mods/natura/worldgen/FusewoodGen.java +++ b/src/main/java/mods/natura/worldgen/FusewoodGen.java @@ -1,7 +1,6 @@ package mods.natura.worldgen; import java.util.Random; - import mods.natura.blocks.trees.NSaplingBlock; import mods.natura.common.NContent; import net.minecraft.block.Block; @@ -30,26 +29,26 @@ public FusewoodGen(boolean notify, int minTreeHeight, int logMeta) { seekGround = !notify; } - int findGround (World world, int x, int y, int z) { + int findGround(World world, int x, int y, int z) { boolean foundGround = false; int height = y; do { height--; Block underID = world.getBlock(x, height, z); - if (underID == Blocks.netherrack || underID == Blocks.soul_sand || underID == NContent.taintedSoil || height < 0) - foundGround = true; + if (underID == Blocks.netherrack + || underID == Blocks.soul_sand + || underID == NContent.taintedSoil + || height < 0) foundGround = true; } while (!foundGround); return height + 1; } - public boolean generate (World world, Random random, int xPos, int yPos, int zPos) { + public boolean generate(World world, Random random, int xPos, int yPos, int zPos) { int treeHeight = random.nextInt(3) + this.minTreeHeight; - if (treeHeight < 4) - treeHeight = 4; + if (treeHeight < 4) treeHeight = 4; boolean flag = true; - if (this.seekGround) - yPos = findGround(world, xPos, yPos, zPos); + if (this.seekGround) yPos = findGround(world, xPos, yPos, zPos); if (yPos >= 1 && yPos + treeHeight + 1 <= 256) { int i1; @@ -73,7 +72,11 @@ public boolean generate (World world, Random random, int xPos, int yPos, int zPo if (i1 >= 0 && i1 < 256) { Block block = world.getBlock(l1, i1, j1); - if (block != Blocks.air && !block.isLeaves(world, l1, i1, j1) && block != Blocks.netherrack && block != Blocks.soul_sand && block != NContent.taintedSoil + if (block != Blocks.air + && !block.isLeaves(world, l1, i1, j1) + && block != Blocks.netherrack + && block != Blocks.soul_sand + && block != NContent.taintedSoil && !block.isWood(world, l1, i1, j1)) { flag = false; } @@ -88,7 +91,9 @@ public boolean generate (World world, Random random, int xPos, int yPos, int zPo return false; } else { Block soil = world.getBlock(xPos, yPos - 1, zPos); - boolean isSoil = (soil.canSustainPlant(world, xPos, yPos - 1, zPos, ForgeDirection.UP, (NSaplingBlock) NContent.floraSapling)) || soil == Blocks.netherrack; + boolean isSoil = (soil.canSustainPlant( + world, xPos, yPos - 1, zPos, ForgeDirection.UP, (NSaplingBlock) NContent.floraSapling)) + || soil == Blocks.netherrack; if (isSoil && yPos < 256 - treeHeight - 1) { soil.onPlantGrow(world, xPos, yPos - 1, zPos, xPos, yPos, zPos); @@ -122,8 +127,11 @@ public boolean generate (World world, Random random, int xPos, int yPos, int zPo for (j1 = 0; j1 < treeHeight; ++j1) { Block block = world.getBlock(xPos, yPos + j1, zPos); - if (block == Blocks.air || block.isLeaves(world, xPos, yPos + j1, zPos) || block.canBeReplacedByLeaves(world, xPos, yPos + j1, zPos)) { - this.setBlockAndNotifyAdequately(world, xPos, yPos + j1, zPos, NContent.darkTree, this.metaWood); + if (block == Blocks.air + || block.isLeaves(world, xPos, yPos + j1, zPos) + || block.canBeReplacedByLeaves(world, xPos, yPos + j1, zPos)) { + this.setBlockAndNotifyAdequately( + world, xPos, yPos + j1, zPos, NContent.darkTree, this.metaWood); } } @@ -136,5 +144,4 @@ public boolean generate (World world, Random random, int xPos, int yPos, int zPo return false; } } - } diff --git a/src/main/java/mods/natura/worldgen/GlowshroomGenBlueGreen.java b/src/main/java/mods/natura/worldgen/GlowshroomGenBlueGreen.java index 98e83869..e1ca49c5 100644 --- a/src/main/java/mods/natura/worldgen/GlowshroomGenBlueGreen.java +++ b/src/main/java/mods/natura/worldgen/GlowshroomGenBlueGreen.java @@ -1,7 +1,6 @@ package mods.natura.worldgen; import java.util.Random; - import mods.natura.common.NContent; import net.minecraft.block.Block; import net.minecraft.init.Blocks; @@ -21,7 +20,7 @@ public GlowshroomGenBlueGreen(boolean doBlockNotify, int mushroomType) { } @Override - public boolean generate (World world, Random random, int x, int y, int z) { + public boolean generate(World world, Random random, int x, int y, int z) { int type; if (mushroomType >= 0) { @@ -52,7 +51,9 @@ public boolean generate (World world, Random random, int x, int y, int z) { if (blockID >= 0 && blockID < 256) { Block block = world.getBlock(posY, blockID, l1); - if (posX != 0 && !block.isLeaves(world, posY, blockID, l1) && blockID != Block.getIdFromBlock(NContent.glowshroom)) { + if (posX != 0 + && !block.isLeaves(world, posY, blockID, l1) + && blockID != Block.getIdFromBlock(NContent.glowshroom)) { flag = false; } } else { @@ -67,7 +68,10 @@ public boolean generate (World world, Random random, int x, int y, int z) { } else { Block blockb = world.getBlock(x, y - 1, z); - if (blockb != Blocks.mycelium && blockb != Blocks.netherrack && blockb != NContent.taintedSoil && blockb != Blocks.soul_sand) { + if (blockb != Blocks.mycelium + && blockb != Blocks.netherrack + && blockb != NContent.taintedSoil + && blockb != Blocks.soul_sand) { return false; } else { int j2 = y + height; @@ -96,7 +100,7 @@ public boolean generate (World world, Random random, int x, int y, int z) { } if (posX == x + l1) { - ++meta; + ++meta; } if (posZ == z - l1) { @@ -151,7 +155,9 @@ public boolean generate (World world, Random random, int x, int y, int z) { Block block = world.getBlock(posX, posY, posZ); - if ((meta != 0 || y >= y + height - 1) && (block == Blocks.fire || block.canBeReplacedByLeaves(world, posX, posY, posZ))) { + if ((meta != 0 || y >= y + height - 1) + && (block == Blocks.fire + || block.canBeReplacedByLeaves(world, posX, posY, posZ))) { Block localID = type == 1 ? NContent.glowshroomBlue : NContent.glowshroomGreen; setBlockAndNotifyAdequately(world, posX, posY, posZ, localID, meta); } @@ -175,6 +181,4 @@ public boolean generate (World world, Random random, int x, int y, int z) { return false; } } - } - diff --git a/src/main/java/mods/natura/worldgen/GlowshroomGenPurple.java b/src/main/java/mods/natura/worldgen/GlowshroomGenPurple.java index 47807dcf..8d81014c 100644 --- a/src/main/java/mods/natura/worldgen/GlowshroomGenPurple.java +++ b/src/main/java/mods/natura/worldgen/GlowshroomGenPurple.java @@ -1,188 +1,154 @@ package mods.natura.worldgen; import java.util.Random; - import mods.natura.common.NContent; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.gen.feature.WorldGenerator; -public class GlowshroomGenPurple extends WorldGenerator -{ +public class GlowshroomGenPurple extends WorldGenerator { - public GlowshroomGenPurple(boolean flag) - { + public GlowshroomGenPurple(boolean flag) { super(flag); } @Override - public boolean generate (World world, Random random, int x, int y, int z) - { + public boolean generate(World world, Random random, int x, int y, int z) { int type = 1; int height = random.nextInt(4) + 1; boolean flag = true; - if (y >= 1 && y + height + 1 < 256) - { + if (y >= 1 && y + height + 1 < 256) { int blockID; int posY; int range; // TODO 1.7 correct init value? int posX = 0; - for (blockID = y; blockID <= y + 1 + height; ++blockID) - { + for (blockID = y; blockID <= y + 1 + height; ++blockID) { byte b0 = 3; - if (blockID <= y + 3) - { + if (blockID <= y + 3) { b0 = 0; } - for (posY = x - b0; posY <= x + b0 && flag; ++posY) - { - for (range = z - b0; range <= z + b0 && flag; ++range) - { - if (blockID >= 0 && blockID < 256) - { + for (posY = x - b0; posY <= x + b0 && flag; ++posY) { + for (range = z - b0; range <= z + b0 && flag; ++range) { + if (blockID >= 0 && blockID < 256) { Block block = world.getBlock(posY, blockID, range); - if (posX != 0 && !block.isLeaves(world, posY, blockID, range)) - { + if (posX != 0 && !block.isLeaves(world, posY, blockID, range)) { flag = false; } - } - else - { + } else { flag = false; } } } } - if (!flag) - { + if (!flag) { return false; - } - else - { + } else { Block blockb = world.getBlock(x, y - 1, z); - if (blockb != Blocks.mycelium && blockb != Blocks.netherrack && blockb != NContent.taintedSoil && blockb != Blocks.soul_sand) - { + if (blockb != Blocks.mycelium + && blockb != Blocks.netherrack + && blockb != NContent.taintedSoil + && blockb != Blocks.soul_sand) { return false; - } - else - { + } else { int heightPos = y + height - 1; - for (posY = heightPos; posY <= y + height; ++posY) - { + for (posY = heightPos; posY <= y + height; ++posY) { range = 2; - if (posY < y + height) - { + if (posY < y + height) { ++range; } - for (posX = x - range; posX <= x + range; ++posX) - { - for (int posZ = z - range; posZ <= z + range; ++posZ) - { + for (posX = x - range; posX <= x + range; ++posX) { + for (int posZ = z - range; posZ <= z + range; ++posZ) { int meta = 5; - if (posX == x - range) - { + if (posX == x - range) { --meta; } - if (posX == x + range) - { + if (posX == x + range) { ++meta; } - if (posZ == z - range) - { + if (posZ == z - range) { meta -= 3; } - if (posZ == z + range) - { + if (posZ == z + range) { meta += 3; } - if (type == 1 || posY < y + height) - { + if (type == 1 || posY < y + height) { int swap = posY < y + height ? 2 : 1; - if (type == 1) - { - if ((posX == x - range || posX == x + range) && (posZ == z - range || posZ == z + range)) - { + if (type == 1) { + if ((posX == x - range || posX == x + range) + && (posZ == z - range || posZ == z + range)) { continue; } } - if (posY < y + height) - { - if ((posX <= x - range + 1 || posX >= x + range - 1) && (posZ <= z - range + 1 || posZ >= z + range - 1)) - { + if (posY < y + height) { + if ((posX <= x - range + 1 || posX >= x + range - 1) + && (posZ <= z - range + 1 || posZ >= z + range - 1)) { continue; } } - if (posX == x - (range - swap) && posZ == z - range) - { + if (posX == x - (range - swap) && posZ == z - range) { meta = 1; } - if (posX == x - range && posZ == z - (range - swap)) - { + if (posX == x - range && posZ == z - (range - swap)) { meta = 1; } - if (posX == x + (range - swap) && posZ == z - range) - { + if (posX == x + (range - swap) && posZ == z - range) { meta = 3; } - if (posX == x + range && posZ == z - (range - swap)) - { + if (posX == x + range && posZ == z - (range - swap)) { meta = 3; } - if (posX == x - (range - swap) && posZ == z + range) - { + if (posX == x - (range - swap) && posZ == z + range) { meta = 7; } - if (posX == x - range && posZ == z + (range - swap)) - { + if (posX == x - range && posZ == z + (range - swap)) { meta = 7; } - if (posX == x + (range - swap) && posZ == z + range) - { + if (posX == x + (range - swap) && posZ == z + range) { meta = 9; } - if (posX == x + range && posZ == z + (range - swap)) - { + if (posX == x + range && posZ == z + (range - swap)) { meta = 9; } } - if (meta == 5 && posY < y + height) - { + if (meta == 5 && posY < y + height) { meta = 0; } Block block = world.getBlock(posX, posY, posZ); - if ((meta != 0 || y >= y + height - 1) && (block == Blocks.fire || block.canBeReplacedByLeaves(world, posX, posY, posZ))) - { - setBlockAndNotifyAdequately(world, posX, posY, posZ, NContent.glowshroomPurple, meta); + if ((meta != 0 || y >= y + height - 1) + && (block == Blocks.fire + || block.canBeReplacedByLeaves(world, posX, posY, posZ))) { + setBlockAndNotifyAdequately( + world, posX, posY, posZ, NContent.glowshroomPurple, meta); } } } @@ -193,22 +159,18 @@ public boolean generate (World world, Random random, int x, int y, int z) setBlockAndNotifyAdequately(world, x - 2, y + height - 1, z + 2, NContent.glowshroomPurple, 7); setBlockAndNotifyAdequately(world, x + 2, y + height - 1, z + 2, NContent.glowshroomPurple, 9); - for (posY = 0; posY < height; ++posY) - { + for (posY = 0; posY < height; ++posY) { Block block = world.getBlock(x, y + posY, z); - if (block == Blocks.fire || block.canBeReplacedByLeaves(world, x, y + posY, z)) - { - setBlockAndNotifyAdequately(world, x, y + posY, z, NContent.glowshroomPurple, 10); + if (block == Blocks.fire || block.canBeReplacedByLeaves(world, x, y + posY, z)) { + setBlockAndNotifyAdequately(world, x, y + posY, z, NContent.glowshroomPurple, 10); } } return true; } } - } - else - { + } else { return false; } } diff --git a/src/main/java/mods/natura/worldgen/NetherBerryBushGen.java b/src/main/java/mods/natura/worldgen/NetherBerryBushGen.java index df274b6e..688d91e5 100644 --- a/src/main/java/mods/natura/worldgen/NetherBerryBushGen.java +++ b/src/main/java/mods/natura/worldgen/NetherBerryBushGen.java @@ -1,7 +1,6 @@ package mods.natura.worldgen; import java.util.Random; - import mods.natura.common.NContent; import net.minecraft.block.Block; import net.minecraft.init.Blocks; @@ -10,59 +9,49 @@ import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.util.ForgeDirection; -public class NetherBerryBushGen extends WorldGenerator -{ +public class NetherBerryBushGen extends WorldGenerator { private Block blockGen; private int metadata; - public NetherBerryBushGen(Block block, int meta) - { + public NetherBerryBushGen(Block block, int meta) { this.blockGen = block; metadata = meta; } @Override - public boolean generate (World world, Random random, int x, int y, int z) - { + public boolean generate(World world, Random random, int x, int y, int z) { int height = findGround(world, x, y, z); - if (height != -1) - { - //System.out.println("True at "+x+", "+height+", "+z); + if (height != -1) { + // System.out.println("True at "+x+", "+height+", "+z); int type = random.nextInt(10); - if (type == 9) - generateLargeNode(world, random, x, height, z); - else if (type >= 7) - generateShrub(world, random, x, height, z); - else if (type >= 3) - generateSmallNode(world, random, x, height, z); - else - generateTinyNode(world, random, x, height, z); + if (type == 9) generateLargeNode(world, random, x, height, z); + else if (type >= 7) generateShrub(world, random, x, height, z); + else if (type >= 3) generateSmallNode(world, random, x, height, z); + else generateTinyNode(world, random, x, height, z); return true; } return false; } - int findGround (World world, int x, int y, int z) - { + int findGround(World world, int x, int y, int z) { int returnHeight = -1; Block blockID = world.getBlock(x, y - 1, z); - if (!world.isAirBlock(x, y - 1, z) && !world.getBlock(x, y, z).isOpaqueCube() && (blockID == Blocks.netherrack || blockID.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, (IPlantable) blockGen))) - { - //System.out.println("Returning "+y); + if (!world.isAirBlock(x, y - 1, z) + && !world.getBlock(x, y, z).isOpaqueCube() + && (blockID == Blocks.netherrack + || blockID.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, (IPlantable) blockGen))) { + // System.out.println("Returning "+y); return y; } int height = y; - do - { + do { Block bID = world.getBlock(x, height, z); - if (!world.isAirBlock(x, height, z)) - { - if (bID == Blocks.netherrack || bID.canSustainPlant(world, x, height, z, ForgeDirection.UP, (IPlantable) blockGen)) - { - if (!world.getBlock(x, height + 1, z).isOpaqueCube()) - { + if (!world.isAirBlock(x, height, z)) { + if (bID == Blocks.netherrack + || bID.canSustainPlant(world, x, height, z, ForgeDirection.UP, (IPlantable) blockGen)) { + if (!world.getBlock(x, height + 1, z).isOpaqueCube()) { returnHeight = height + 1; } break; @@ -73,45 +62,33 @@ int findGround (World world, int x, int y, int z) return returnHeight; } - public void generateLargeNode (World world, Random random, int x, int y, int z) - { - for (int iterX = x - 2; iterX <= x + 2; iterX++) - { - for (int iterZ = z - 1; iterZ <= z + 1; iterZ++) - { - for (int iterY = y - 1; iterY <= y; iterY++) - { + public void generateLargeNode(World world, Random random, int x, int y, int z) { + for (int iterX = x - 2; iterX <= x + 2; iterX++) { + for (int iterZ = z - 1; iterZ <= z + 1; iterZ++) { + for (int iterY = y - 1; iterY <= y; iterY++) { generateBerryBlock(world, iterX, iterY, iterZ, random); } } } - for (int iterX = x - 1; iterX <= x + 1; iterX++) - { - for (int iterZ = z - 2; iterZ <= z - 2; iterZ++) - { - for (int iterY = y - 1; iterY <= y; iterY++) - { + for (int iterX = x - 1; iterX <= x + 1; iterX++) { + for (int iterZ = z - 2; iterZ <= z - 2; iterZ++) { + for (int iterY = y - 1; iterY <= y; iterY++) { generateBerryBlock(world, iterX, iterY, iterZ, random); } } } - for (int iterX = x - 1; iterX <= x + 1; iterX++) - { - for (int iterZ = z + 2; iterZ <= z + 2; iterZ++) - { - for (int iterY = y - 1; iterY <= y; iterY++) - { + for (int iterX = x - 1; iterX <= x + 1; iterX++) { + for (int iterZ = z + 2; iterZ <= z + 2; iterZ++) { + for (int iterY = y - 1; iterY <= y; iterY++) { generateBerryBlock(world, iterX, iterY, iterZ, random); } } } - for (int iterX = x - 1; iterX <= x + 1; iterX++) - { - for (int iterZ = z - 1; iterZ <= z + 1; iterZ++) - { + for (int iterX = x - 1; iterX <= x + 1; iterX++) { + for (int iterZ = z - 1; iterZ <= z + 1; iterZ++) { int yPos = y + 1; generateBerryBlock(world, iterX, yPos, iterZ, random); yPos = y - 2; @@ -120,16 +97,13 @@ public void generateLargeNode (World world, Random random, int x, int y, int z) } } - public void generateShrub (World world, Random random, int x, int y, int z) - { + public void generateShrub(World world, Random random, int x, int y, int z) { int l; Block block = null; - do - { + do { block = world.getBlock(x, y, z); - if (!world.isAirBlock(x, y, z) && !block.isLeaves(world, x, y, z)) - { + if (!world.isAirBlock(x, y, z) && !block.isLeaves(world, x, y, z)) { break; } y--; @@ -137,27 +111,23 @@ public void generateShrub (World world, Random random, int x, int y, int z) Block i1 = world.getBlock(x, y, z); - if (i1 == Blocks.dirt || i1 == Blocks.grass) - { + if (i1 == Blocks.dirt || i1 == Blocks.grass) { ++y; - for (int yPos = y; yPos <= y + 2; ++yPos) - { + for (int yPos = y; yPos <= y + 2; ++yPos) { int k1 = yPos - y; int l1 = 2 - k1; - for (int xPos = x - l1; xPos <= x + l1; ++xPos) - { + for (int xPos = x - l1; xPos <= x + l1; ++xPos) { int j2 = xPos - x; - for (int zPos = z - l1; zPos <= z + l1; ++zPos) - { + for (int zPos = z - l1; zPos <= z + l1; ++zPos) { int l2 = zPos - z; block = world.getBlock(xPos, yPos, zPos); - if ((Math.abs(j2) != l1 || Math.abs(l2) != l1 || random.nextInt(2) != 0) && (block == null || block.canBeReplacedByLeaves(world, xPos, yPos, zPos))) - { + if ((Math.abs(j2) != l1 || Math.abs(l2) != l1 || random.nextInt(2) != 0) + && (block == null || block.canBeReplacedByLeaves(world, xPos, yPos, zPos))) { generateBerryBlock(world, xPos, yPos, zPos, random); } } @@ -166,37 +136,27 @@ public void generateShrub (World world, Random random, int x, int y, int z) } } - public void generateSmallNode (World world, Random random, int x, int y, int z) - { + public void generateSmallNode(World world, Random random, int x, int y, int z) { generateBerryBlock(world, x, y, z, random); - if (random.nextBoolean()) - generateBerryBush(world, x + 1, y, z, random); - if (random.nextBoolean()) - generateBerryBush(world, x - 1, y, z, random); - if (random.nextBoolean()) - generateBerryBush(world, x, y, z + 1, random); - if (random.nextBoolean()) - generateBerryBush(world, x, y, z - 1, random); + if (random.nextBoolean()) generateBerryBush(world, x + 1, y, z, random); + if (random.nextBoolean()) generateBerryBush(world, x - 1, y, z, random); + if (random.nextBoolean()) generateBerryBush(world, x, y, z + 1, random); + if (random.nextBoolean()) generateBerryBush(world, x, y, z - 1, random); } - public void generateTinyNode (World world, Random random, int x, int y, int z) - { + public void generateTinyNode(World world, Random random, int x, int y, int z) { generateBerryBush(world, x, y, z, random); } - void generateBerryBlock (World world, int x, int y, int z, Random random) - { - if (!world.getBlock(x, y, z).isOpaqueCube()) - { + void generateBerryBlock(World world, int x, int y, int z, Random random) { + if (!world.getBlock(x, y, z).isOpaqueCube()) { int metaOffset = random.nextInt(5) == 0 ? 1 : 0; world.setBlock(x, y, z, NContent.netherBerryBush, metadata + 8 + metaOffset * 4, 0); } } - void generateBerryBush (World world, int x, int y, int z, Random random) - { - if (!world.getBlock(x, y, z).isOpaqueCube()) - { + void generateBerryBush(World world, int x, int y, int z, Random random) { + if (!world.getBlock(x, y, z).isOpaqueCube()) { int metaOffset = random.nextInt(4); world.setBlock(x, y, z, NContent.netherBerryBush, metadata + metaOffset * 4, 0); } diff --git a/src/main/java/mods/natura/worldgen/RareTreeGen.java b/src/main/java/mods/natura/worldgen/RareTreeGen.java index 3b7537e3..d4d93219 100644 --- a/src/main/java/mods/natura/worldgen/RareTreeGen.java +++ b/src/main/java/mods/natura/worldgen/RareTreeGen.java @@ -1,7 +1,6 @@ package mods.natura.worldgen; import java.util.Random; - import mods.natura.common.NContent; import mods.natura.common.PHNatura; import net.minecraft.block.Block; @@ -31,17 +30,16 @@ public boolean generate(World world, Random random, int xPos, int yPos, int zPos boolean flag = true; if (seekHeight) { yPos = findGround(world, xPos, yPos, zPos); - if (yPos == -1) - return false; + if (yPos == -1) return false; } if (yPos >= 1 && yPos + height + 1 <= 256) { Block soil = world.getBlock(xPos, yPos - 1, zPos); - boolean isSoil = (soil.canSustainPlant(world, xPos, yPos - 1, zPos, ForgeDirection.UP, NContent.rareSapling)); + boolean isSoil = + (soil.canSustainPlant(world, xPos, yPos - 1, zPos, ForgeDirection.UP, NContent.rareSapling)); if (isSoil) { - if (!checkClear(world, xPos, yPos, zPos, height)) - return false; + if (!checkClear(world, xPos, yPos, zPos, height)) return false; soil.onPlantGrow(world, xPos, yPos - 1, zPos, xPos, yPos, zPos); placeCanopy(world, random, xPos, yPos, zPos, height); @@ -56,10 +54,8 @@ boolean checkClear(World world, int x, int y, int z, int treeHeight) { for (int yPos = 0; yPos < treeHeight + 1; yPos++) { int range = 1; - if (yPos == 0) - range = 0; - else if (yPos >= treeHeight - 1) - range = 2; + if (yPos == 0) range = 0; + else if (yPos >= treeHeight - 1) range = 2; for (int xPos = range; xPos <= range; xPos++) { for (int zPos = range; zPos <= range; zPos++) { @@ -78,7 +74,8 @@ int findGround(World world, int x, int y, int z) { int height = y; do { Block heightID = world.getBlock(x, height, z); - if ((heightID == Blocks.dirt || heightID == Blocks.grass) && !world.getBlock(x, height + 1, z).func_149730_j()) { + if ((heightID == Blocks.dirt || heightID == Blocks.grass) + && !world.getBlock(x, height + 1, z).func_149730_j()) { ret = height + 1; break; } @@ -87,7 +84,7 @@ int findGround(World world, int x, int y, int z) { return ret; } - void placeCanopy (World world, Random random, int xPos, int yPos, int zPos, int height) { + void placeCanopy(World world, Random random, int xPos, int yPos, int zPos, int height) { for (int y = yPos - 3 + height; y <= yPos + height; ++y) { int k1 = y - (yPos + height); int i2 = 0 + 1 - k1 / 2; @@ -101,8 +98,7 @@ void placeCanopy (World world, Random random, int xPos, int yPos, int zPos, int if (Math.abs(k2) != i2 || Math.abs(i3) != i2 || random.nextInt(2) != 0 && k1 != 0) { Block block = world.getBlock(x, y, z); - if (block.canBeReplacedByLeaves(world, x, y, z)) - { + if (block.canBeReplacedByLeaves(world, x, y, z)) { this.setBlockAndNotifyAdequately(world, x, y, z, NContent.rareLeaves, this.metaLeaves); } } @@ -111,14 +107,16 @@ void placeCanopy (World world, Random random, int xPos, int yPos, int zPos, int } } - void placeTrunk (World world, int xPos, int yPos, int zPos, int height) { + void placeTrunk(World world, int xPos, int yPos, int zPos, int height) { for (int localHeight = 0; localHeight < height; ++localHeight) { Block block = world.getBlock(xPos, yPos + localHeight, zPos); - if (block == Blocks.air || block.isLeaves(world, xPos, yPos + localHeight, zPos) || block.canBeReplacedByLeaves(world, xPos, yPos + localHeight, zPos)) { - this.setBlockAndNotifyAdequately(world, xPos, yPos + localHeight, zPos, NContent.rareTree, this.metaWood); + if (block == Blocks.air + || block.isLeaves(world, xPos, yPos + localHeight, zPos) + || block.canBeReplacedByLeaves(world, xPos, yPos + localHeight, zPos)) { + this.setBlockAndNotifyAdequately( + world, xPos, yPos + localHeight, zPos, NContent.rareTree, this.metaWood); } } } - } diff --git a/src/main/java/mods/natura/worldgen/RedwoodTreeGen.java b/src/main/java/mods/natura/worldgen/RedwoodTreeGen.java index b6ce7758..30271a70 100644 --- a/src/main/java/mods/natura/worldgen/RedwoodTreeGen.java +++ b/src/main/java/mods/natura/worldgen/RedwoodTreeGen.java @@ -1,7 +1,6 @@ package mods.natura.worldgen; import java.util.Random; - import mods.natura.common.NContent; import mods.natura.common.PHNatura; import net.minecraft.block.Block; @@ -60,10 +59,10 @@ public class RedwoodTreeGen extends WorldGenerator { return true; }*/ - static final byte otherCoordPairs[] = { 2, 0, 0, 1, 2, 1 }; + static final byte otherCoordPairs[] = {2, 0, 0, 1, 2, 1}; Random rand; World worldObj; - int basePos[] = { 0, 0, 0 }; + int basePos[] = {0, 0, 0}; int heightLimit; int height; double heightAttenuation; @@ -101,13 +100,12 @@ int findGround(World world, int x, int y, int z) { do { height--; Block underID = world.getBlock(x, height, z); - if (underID == Blocks.dirt || underID == Blocks.grass || height < PHNatura.seaLevel) - foundGround = true; + if (underID == Blocks.dirt || underID == Blocks.grass || height < PHNatura.seaLevel) foundGround = true; } while (!foundGround); return height; } - public boolean isValidSpawn (World world, int x, int y, int z) { + public boolean isValidSpawn(World world, int x, int y, int z) { Block bID = world.getBlock(x, y, z); boolean ground = bID == Blocks.dirt || bID == Blocks.grass; boolean transparent = !world.getBlock(x, y + 1, z).func_149730_j(); @@ -119,8 +117,7 @@ public boolean generate(World world, Random random, int x, int yPos, int z) { int groundPoint = yPos; if (!useHeight) { groundPoint = findGround(world, x, yPos, z); - if (!isValidSpawn(world, x, groundPoint, z)) - return false; + if (!isValidSpawn(world, x, groundPoint, z)) return false; } int treeHeight = random.nextInt(60) + 80; @@ -136,11 +133,11 @@ public boolean generate(World world, Random random, int x, int yPos, int z) { for (int currentHeight = 0; currentHeight < treeHeight; currentHeight++) { if (currentHeight < treeHeight * 1 / 10) { genRing13(world, random, x, currentHeight + groundPoint, z); - } else if (currentHeight < treeHeight * 2 / 10) { + } else if (currentHeight < treeHeight * 2 / 10) { genRing12(world, random, x, currentHeight + groundPoint, z); } else if (currentHeight < treeHeight * 3 / 10) { genRing11(world, random, x, currentHeight + groundPoint, z); - } else if (currentHeight < treeHeight * 4 / 10) { + } else if (currentHeight < treeHeight * 4 / 10) { genRing10(world, random, x, currentHeight + groundPoint, z); } else if (currentHeight < treeHeight * 5 / 10) { genRing9(world, random, x, currentHeight + groundPoint, z); @@ -616,7 +613,7 @@ public boolean mediumRoot1(World world, Random random, int x, int y, int z) { } public boolean mediumRoot2(World world, Random random, int x, int y, int z) { - if (world.getBlock(x, y, z) != Blocks.bedrock && y > 0) { + if (world.getBlock(x, y, z) != Blocks.bedrock && y > 0) { setBlockAndNotifyAdequately(world, x - 4, y, z - 1, genWoodID, genWoodMetadata + 2); setBlockAndNotifyAdequately(world, x - 4, y, z + 1, genWoodID, genWoodMetadata + 2); setBlockAndNotifyAdequately(world, x - 3, y, z - 2, genWoodID, genWoodMetadata + 2); @@ -687,7 +684,7 @@ public boolean mediumRoot3(World world, Random random, int x, int j, int k) { return true; } - public boolean mediumRoot4 (World world, Random random, int x, int y, int z) { + public boolean mediumRoot4(World world, Random random, int x, int y, int z) { if (world.getBlock(x, y, z) != Blocks.bedrock && y > 0) { setBlockAndNotifyAdequately(world, x - 2, y, z - 2, genWoodID, genWoodMetadata + 2); setBlockAndNotifyAdequately(world, x - 2, y, z + 2, genWoodID, genWoodMetadata + 2); @@ -701,7 +698,7 @@ public boolean mediumRoot4 (World world, Random random, int x, int y, int z) { return true; } - public boolean mediumRoot5 (World world, Random random, int x, int y, int z) { + public boolean mediumRoot5(World world, Random random, int x, int y, int z) { if (world.getBlock(x, y, z) != Blocks.bedrock && y > 0) { setBlockAndNotifyAdequately(world, x - 1, y, z - 3, genWoodID, genWoodMetadata + 2); setBlockAndNotifyAdequately(world, x - 1, y, z + 3, genWoodID, genWoodMetadata + 2); @@ -711,7 +708,7 @@ public boolean mediumRoot5 (World world, Random random, int x, int y, int z) { return true; } - public boolean bigRoot1 (World world, Random random, int x, int y, int z) { + public boolean bigRoot1(World world, Random random, int x, int y, int z) { if (world.getBlock(x, y, z) != Blocks.bedrock && y > 0) { setBlockAndNotifyAdequately(world, x - 6, y, z - 2, genWoodID, genWoodMetadata + 2); setBlockAndNotifyAdequately(world, x - 6, y, z - 1, genWoodID, genWoodMetadata + 2); @@ -829,7 +826,7 @@ public boolean bigRoot1 (World world, Random random, int x, int y, int z) { return true; } - public boolean bigRoot2 (World world, Random random, int x, int y, int z) { + public boolean bigRoot2(World world, Random random, int x, int y, int z) { if (world.getBlock(x, y, z) != Blocks.bedrock && y > 0) { setBlockAndNotifyAdequately(world, x - 5, y, z - 4, genWoodID, genWoodMetadata + 2); setBlockAndNotifyAdequately(world, x - 5, y, z - 3, genWoodID, genWoodMetadata + 2); @@ -939,7 +936,7 @@ public boolean bigRoot2 (World world, Random random, int x, int y, int z) { return true; } - public boolean bigRoot3 (World world, Random random, int x, int y, int z) { + public boolean bigRoot3(World world, Random random, int x, int y, int z) { if (world.getBlock(x, y, z) != Blocks.bedrock && y > 0) { setBlockAndNotifyAdequately(world, x - 4, y, z - 3, genWoodID, genWoodMetadata + 2); setBlockAndNotifyAdequately(world, x - 4, y, z - 2, genWoodID, genWoodMetadata + 2); @@ -993,7 +990,7 @@ public boolean bigRoot3 (World world, Random random, int x, int y, int z) { return true; } - public boolean bigRoot4 (World world, Random random, int x, int y, int z) { + public boolean bigRoot4(World world, Random random, int x, int y, int z) { if (world.getBlock(x, y, z) != Blocks.bedrock && y > 0) { setBlockAndNotifyAdequately(world, x - 4, y, z - 3, genWoodID, genWoodMetadata + 2); setBlockAndNotifyAdequately(world, x - 4, y, z + 3, genWoodID, genWoodMetadata + 2); @@ -1027,7 +1024,7 @@ public boolean bigRoot4 (World world, Random random, int x, int y, int z) { return true; } - public boolean bigRoot5 (World world, Random random, int x, int y, int z) { + public boolean bigRoot5(World world, Random random, int x, int y, int z) { if (world.getBlock(x, y, z) != Blocks.bedrock && y > 0) { setBlockAndNotifyAdequately(world, x - 3, y, z - 3, genWoodID, genWoodMetadata + 2); setBlockAndNotifyAdequately(world, x - 3, y, z + 3, genWoodID, genWoodMetadata + 2); @@ -1049,7 +1046,7 @@ public boolean bigRoot5 (World world, Random random, int x, int y, int z) { return true; } - public boolean bigRoot6 (World world, Random random, int x, int y, int z) { + public boolean bigRoot6(World world, Random random, int x, int y, int z) { if (world.getBlock(x, y, z) != Blocks.bedrock && y > 0) { setBlockAndNotifyAdequately(world, x - 2, y, z - 4, genWoodID, genWoodMetadata + 2); setBlockAndNotifyAdequately(world, x - 2, y, z - 3, genWoodID, genWoodMetadata + 2); @@ -1063,7 +1060,7 @@ public boolean bigRoot6 (World world, Random random, int x, int y, int z) { return true; } - public boolean genRing13 (World world, Random random, int x, int y, int z) { + public boolean genRing13(World world, Random random, int x, int y, int z) { if (world.getBlock(x, y, z) != Blocks.bedrock && y > 0) { setBlockAndNotifyAdequately(world, x - 6, y, z - 2, genWoodID, genWoodMetadata); setBlockAndNotifyAdequately(world, x - 6, y, z - 1, genWoodID, genWoodMetadata); @@ -1206,7 +1203,7 @@ public boolean genRing13 (World world, Random random, int x, int y, int z) { return true; } - public boolean genRing12 (World world, Random random, int x, int y, int z) { + public boolean genRing12(World world, Random random, int x, int y, int z) { if (world.getBlock(x, y, z) != Blocks.bedrock && y > 0) { setBlockAndNotifyAdequately(world, x - 6, y, z - 1, genWoodID, genWoodMetadata); setBlockAndNotifyAdequately(world, x - 6, y, z, genWoodID, genWoodMetadata); @@ -1337,7 +1334,7 @@ public boolean genRing12 (World world, Random random, int x, int y, int z) { return true; } - public boolean genRing11 (World world, Random random, int x, int y, int z) { + public boolean genRing11(World world, Random random, int x, int y, int z) { if (world.getBlock(x, y, z) != Blocks.bedrock && y > 0) { setBlockAndNotifyAdequately(world, x - 5, y, z - 1, genWoodID, genWoodMetadata); setBlockAndNotifyAdequately(world, x - 5, y, z, genWoodID, genWoodMetadata); @@ -1432,7 +1429,7 @@ public boolean genRing11 (World world, Random random, int x, int y, int z) { return true; } - public boolean genRing10 (World world, Random random, int x, int y, int z) { + public boolean genRing10(World world, Random random, int x, int y, int z) { if (world.getBlock(x, y, z) != Blocks.bedrock && y > 0) { setBlockAndNotifyAdequately(world, x - 4, y, z - 2, genWoodID, genWoodMetadata); setBlockAndNotifyAdequately(world, x - 4, y, z - 1, genWoodID, genWoodMetadata); @@ -1507,7 +1504,7 @@ public boolean genRing10 (World world, Random random, int x, int y, int z) { return true; } - public boolean genRing9 (World world, Random random, int x, int y, int z) { + public boolean genRing9(World world, Random random, int x, int y, int z) { if (world.getBlock(x, y, z) != Blocks.bedrock && y > 0) { setBlockAndNotifyAdequately(world, x - 4, y, z - 1, genWoodID, genWoodMetadata); setBlockAndNotifyAdequately(world, x - 4, y, z, genWoodID, genWoodMetadata); @@ -1574,7 +1571,7 @@ public boolean genRing9 (World world, Random random, int x, int y, int z) { return true; } - public boolean genRing8 (World world, Random random, int x, int y, int z) { + public boolean genRing8(World world, Random random, int x, int y, int z) { if (world.getBlock(x, y, z) != Blocks.bedrock && y > 0) { setBlockAndNotifyAdequately(world, x - 3, y, z - 2, genWoodID, genWoodMetadata); setBlockAndNotifyAdequately(world, x - 3, y, z - 1, genWoodID, genWoodMetadata); @@ -1625,7 +1622,7 @@ public boolean genRing8 (World world, Random random, int x, int y, int z) { return true; } - public boolean genRing7 (World world, Random random, int x, int y, int z) { + public boolean genRing7(World world, Random random, int x, int y, int z) { if (world.getBlock(x, y, z) != Blocks.bedrock && y > 0) { setBlockAndNotifyAdequately(world, x - 3, y, z - 1, genWoodID, genWoodMetadata); setBlockAndNotifyAdequately(world, x - 3, y, z, genWoodID, genWoodMetadata); @@ -1668,7 +1665,7 @@ public boolean genRing7 (World world, Random random, int x, int y, int z) { return true; } - public boolean genRing6 (World world, Random random, int x, int y, int z) { + public boolean genRing6(World world, Random random, int x, int y, int z) { if (world.getBlock(x, y, z) != Blocks.bedrock && y > 0) { setBlockAndNotifyAdequately(world, x - 2, y, z - 2, genWoodID, genWoodMetadata); setBlockAndNotifyAdequately(world, x - 2, y, z - 1, genWoodID, genWoodMetadata); @@ -1699,7 +1696,7 @@ public boolean genRing6 (World world, Random random, int x, int y, int z) { return true; } - public boolean genRing5 (World world, Random random, int x, int y, int z) { + public boolean genRing5(World world, Random random, int x, int y, int z) { if (world.getBlock(x, y, z) != Blocks.bedrock && y > 0) { setBlockAndNotifyAdequately(world, x - 2, y, z - 1, genWoodID, genWoodMetadata); setBlockAndNotifyAdequately(world, x - 2, y, z, genWoodID, genWoodMetadata); @@ -1726,7 +1723,7 @@ public boolean genRing5 (World world, Random random, int x, int y, int z) { return true; } - public boolean genRing4 (World world, Random random, int x, int y, int z) { + public boolean genRing4(World world, Random random, int x, int y, int z) { if (world.getBlock(x, y, z) != Blocks.bedrock && y > 0) { setBlockAndNotifyAdequately(world, x - 2, y, z - 1, genWoodID, genWoodMetadata); setBlockAndNotifyAdequately(world, x - 2, y, z, genWoodID, genWoodMetadata); @@ -1744,7 +1741,7 @@ public boolean genRing4 (World world, Random random, int x, int y, int z) { return true; } - public boolean genRing3s (World world, Random random, int x, int y, int z) { + public boolean genRing3s(World world, Random random, int x, int y, int z) { if (world.getBlock(x, y, z) != Blocks.bedrock && y > 0) { setBlockAndNotifyAdequately(world, x - 1, y, z - 1, genWoodID, genWoodMetadata); setBlockAndNotifyAdequately(world, x - 1, y, z, genWoodID, genWoodMetadata); @@ -1822,13 +1819,14 @@ void generateLeafNodeList() { double d2 = (double) rand.nextFloat() * 2D * 3.1415899999999999D; int k1 = MathHelper.floor_double(d1 * Math.sin(d2) + (double) basePos[0] + d); int l1 = MathHelper.floor_double(d1 * Math.cos(d2) + (double) basePos[2] + d); - int ai1[] = { k1, j, l1 }; - int ai2[] = { k1, j + leafDistanceLimit, l1 }; + int ai1[] = {k1, j, l1}; + int ai2[] = {k1, j + leafDistanceLimit, l1}; if (checkBlockLine(ai1, ai2) != -1) { continue; } - int ai3[] = { basePos[0], basePos[1], basePos[2] }; - double d3 = Math.sqrt(Math.pow(Math.abs(basePos[0] - ai1[0]), 2D) + Math.pow(Math.abs(basePos[2] - ai1[2]), 2D)); + int ai3[] = {basePos[0], basePos[1], basePos[2]}; + double d3 = Math.sqrt( + Math.pow(Math.abs(basePos[0] - ai1[0]), 2D) + Math.pow(Math.abs(basePos[2] - ai1[2]), 2D)); double d4 = d3 * field_874_i; if ((double) ai1[1] - d4 > (double) l) { ai3[1] = l; @@ -1852,26 +1850,26 @@ void generateLeafNodeList() { System.arraycopy(ai, 0, leafNodes, 0, k); } - void func_523_a (int i, int j, int k, float f, byte byte0, Block l) { + void func_523_a(int i, int j, int k, float f, byte byte0, Block l) { int i1 = (int) ((double) f + 0.61799999999999999D); byte byte1 = otherCoordPairs[byte0]; byte byte2 = otherCoordPairs[byte0 + 3]; - int ai[] = { i, j, k }; - int ai1[] = { 0, 0, 0 }; + int ai[] = {i, j, k}; + int ai1[] = {0, 0, 0}; int j1 = -i1; int k1 = -i1; ai1[byte0] = ai[byte0]; for (; j1 <= i1; j1++) { ai1[byte1] = ai[byte1] + j1; - for (int l1 = -i1; l1 <= i1;) { - double d = Math.sqrt(Math.pow((double) Math.abs(j1) + 0.5D, 2D) + Math.pow((double) Math.abs(l1) + 0.5D, 2D)); + for (int l1 = -i1; l1 <= i1; ) { + double d = Math.sqrt( + Math.pow((double) Math.abs(j1) + 0.5D, 2D) + Math.pow((double) Math.abs(l1) + 0.5D, 2D)); if (d > (double) f) { l1++; } else { ai1[byte2] = ai[byte2] + l1; Block i2 = worldObj.getBlock(ai1[0], ai1[1], ai1[2]); - if (i2 != Blocks.air && i2 != Blocks.leaves) - { + if (i2 != Blocks.air && i2 != Blocks.leaves) { l1++; } else { setBlockAndNotifyAdequately(worldObj, ai1[0], ai1[1], ai1[2], l, 0); @@ -1882,7 +1880,7 @@ void func_523_a (int i, int j, int k, float f, byte byte0, Block l) { } } - float func_528_a (int i) { + float func_528_a(int i) { if ((double) i < (double) (float) heightLimit * 0.29999999999999999D) { return -1.618F; } @@ -1900,7 +1898,7 @@ float func_528_a (int i) { return f2; } - float func_526_b (int i) { + float func_526_b(int i) { if (i < 0 || i >= leafDistanceLimit) { return -1F; } else { @@ -1916,8 +1914,8 @@ void generateLeafNode(int x, int y, int z) { } } - void placeBlockLine (int ai[], int ai1[], Block i) { - int ai2[] = { 0, 0, 0 }; + void placeBlockLine(int ai[], int ai1[], Block i) { + int ai2[] = {0, 0, 0}; byte byte0 = 0; int j = 0; for (; byte0 < 3; byte0++) { @@ -1940,7 +1938,7 @@ void placeBlockLine (int ai[], int ai1[], Block i) { } double d = (double) ai2[byte1] / (double) ai2[j]; double d1 = (double) ai2[byte2] / (double) ai2[j]; - int ai3[] = { 0, 0, 0 }; + int ai3[] = {0, 0, 0}; int k = 0; for (int l = ai2[j] + byte3; k != l; k += byte3) { ai3[j] = MathHelper.floor_double((double) (ai[j] + k) + 0.5D); @@ -1966,10 +1964,10 @@ boolean leafNodeNeedsBase(int i) { void generateLeafNodeBases() { int i = 0; int j = leafNodes.length; - int ai[] = { basePos[0], basePos[1], basePos[2] }; + int ai[] = {basePos[0], basePos[1], basePos[2]}; for (; i < j; i++) { int ai1[] = leafNodes[i]; - int ai2[] = { ai1[0], ai1[1], ai1[2] }; + int ai2[] = {ai1[0], ai1[1], ai1[2]}; ai[1] = ai1[3]; int k = ai[1] - basePos[1]; if (leafNodeNeedsBase(k)) { @@ -1978,8 +1976,8 @@ void generateLeafNodeBases() { } } - int checkBlockLine (int ai[], int ai1[]) { - int ai2[] = { 0, 0, 0 }; + int checkBlockLine(int ai[], int ai1[]) { + int ai2[] = {0, 0, 0}; byte byte0 = 0; int i = 0; for (; byte0 < 3; byte0++) { @@ -2002,10 +2000,10 @@ int checkBlockLine (int ai[], int ai1[]) { } double d = (double) ai2[byte1] / (double) ai2[i]; double d1 = (double) ai2[byte2] / (double) ai2[i]; - int ai3[] = { 0, 0, 0 }; + int ai3[] = {0, 0, 0}; int j = 0; int k = ai2[i] + byte3; - do { + do { if (j == k) { break; } @@ -2024,34 +2022,34 @@ int checkBlockLine (int ai[], int ai1[]) { return Math.abs(j); } } -/* Unused? - jss2a98aj - boolean validTreeLocation() { - int ai[] = { basePos[0], basePos[1], basePos[2] }; - int ai1[] = { basePos[0], (basePos[1] + heightLimit) - 1, basePos[2] }; - Block i = worldObj.getBlock(basePos[0], basePos[1] - 1, basePos[2]); - if (i != Blocks.dirt && i != Blocks.glass) { - return false; - } - int j = checkBlockLine(ai, ai1); - if (j == -1) { - return true; - } - if (j < 6) { - return false; - } else { - heightLimit = j; - return true; + /* Unused? - jss2a98aj + boolean validTreeLocation() { + int ai[] = { basePos[0], basePos[1], basePos[2] }; + int ai1[] = { basePos[0], (basePos[1] + heightLimit) - 1, basePos[2] }; + Block i = worldObj.getBlock(basePos[0], basePos[1] - 1, basePos[2]); + if (i != Blocks.dirt && i != Blocks.glass) { + return false; + } + int j = checkBlockLine(ai, ai1); + if (j == -1) { + return true; + } + if (j < 6) { + return false; + } else { + heightLimit = j; + return true; + } } - } - public void func_517_a (double d, double d1, double d2) { - heightLimitLimit = (int) (d * 12D); - if (d > 0.5D) - { - leafDistanceLimit = 5; + public void func_517_a (double d, double d1, double d2) { + heightLimitLimit = (int) (d * 12D); + if (d > 0.5D) + { + leafDistanceLimit = 5; + } + field_873_j = d1; + field_872_k = d2; } - field_873_j = d1; - field_872_k = d2; - } -*/ + */ } diff --git a/src/main/java/mods/natura/worldgen/SaguaroGen.java b/src/main/java/mods/natura/worldgen/SaguaroGen.java index b83b780e..fe7f9efa 100644 --- a/src/main/java/mods/natura/worldgen/SaguaroGen.java +++ b/src/main/java/mods/natura/worldgen/SaguaroGen.java @@ -1,8 +1,6 @@ package mods.natura.worldgen; import java.util.Random; - -import mods.natura.common.NContent; import mods.natura.common.PHNatura; import net.minecraft.block.Block; import net.minecraft.init.Blocks; @@ -13,7 +11,7 @@ public class SaguaroGen extends WorldGenerator { boolean useHeight; - + private final int saguaroMeta; private final Block saguaroBlock; @@ -25,7 +23,7 @@ public SaguaroGen(Block saguaroBlock, int saguaroMeta, boolean useHeight) { } @Override - public boolean generate (World world, Random random, int x, int y, int z) { + public boolean generate(World world, Random random, int x, int y, int z) { int yPos = findGround(world, x, y, z, useHeight); Block currentID = world.getBlock(x, yPos, z); if (!world.isAirBlock(x, yPos, z)) { @@ -53,7 +51,7 @@ public boolean generate (World world, Random random, int x, int y, int z) { return true; } - void generateCactusTree (World world, Random random, int x, int y, int z) { + void generateCactusTree(World world, Random random, int x, int y, int z) { for (int i = 0; i < 6; i++) { genBlock(world, x, y + i, z); } @@ -81,7 +79,7 @@ void generateCactusTree (World world, Random random, int x, int y, int z) { } } - void generateSmallCactus (World world, Random random, int x, int y, int z) { + void generateSmallCactus(World world, Random random, int x, int y, int z) { int height = random.nextInt(4) + 3; for (int iter = 0; iter < height; iter++) { @@ -96,7 +94,6 @@ void generateSmallCactus (World world, Random random, int x, int y, int z) { for (int branch = 0; branch < size; branch++) { genBlock(world, x + 1, y + branch, z); } - } if (random.nextBoolean()) { size = random.nextInt(height - branchY) + branchY - random.nextInt(3); @@ -120,12 +117,11 @@ void generateSmallCactus (World world, Random random, int x, int y, int z) { } } - void genBlock (World world, int x, int y, int z) { - if (!world.getBlock(x, y, z).isOpaqueCube()) - world.setBlock(x, y, z, saguaroBlock, saguaroMeta, 3); + void genBlock(World world, int x, int y, int z) { + if (!world.getBlock(x, y, z).isOpaqueCube()) world.setBlock(x, y, z, saguaroBlock, saguaroMeta, 3); } - int findGround (World world, int x, int y, int z, boolean useHeight) { + int findGround(World world, int x, int y, int z, boolean useHeight) { if (useHeight) { return y; } @@ -135,11 +131,13 @@ int findGround (World world, int x, int y, int z, boolean useHeight) { do { height--; Block underID = world.getBlock(x, height, z); - if (underID == Blocks.sand || underID == Blocks.dirt || underID == Blocks.grass || height < PHNatura.seaLevel) { + if (underID == Blocks.sand + || underID == Blocks.dirt + || underID == Blocks.grass + || height < PHNatura.seaLevel) { foundGround = true; } } while (!foundGround); return height + 1; } - } diff --git a/src/main/java/mods/natura/worldgen/SakuraTreeGen.java b/src/main/java/mods/natura/worldgen/SakuraTreeGen.java index 3bdff584..1186a311 100644 --- a/src/main/java/mods/natura/worldgen/SakuraTreeGen.java +++ b/src/main/java/mods/natura/worldgen/SakuraTreeGen.java @@ -1,7 +1,6 @@ package mods.natura.worldgen; import java.util.Random; - import mods.natura.common.NContent; import mods.natura.common.PHNatura; import net.minecraft.block.Block; @@ -13,7 +12,7 @@ import net.minecraftforge.common.util.ForgeDirection; public class SakuraTreeGen extends WorldGenAbstractTree { - static final byte[] otherCoordPairs = new byte[] {(byte)2, (byte)0, (byte)0, (byte)1, (byte)2, (byte)1}; + static final byte[] otherCoordPairs = new byte[] {(byte) 2, (byte) 0, (byte) 0, (byte) 1, (byte) 2, (byte) 1}; Random rand = new Random(); World worldObj; int[] basePos = new int[] {0, 0, 0}; @@ -28,7 +27,7 @@ public class SakuraTreeGen extends WorldGenAbstractTree { int heightLimitLimit = 12; int leafDistanceLimit = 4; int[][] leafNodes; - + int metaWood; int metaLeaves; boolean dontFindHeight; @@ -41,13 +40,13 @@ public SakuraTreeGen(boolean notify, int mdwood, int mdleaves) { } void generateLeafNodeList() { - this.height = (int)((double)this.heightLimit * this.heightAttenuation); + this.height = (int) ((double) this.heightLimit * this.heightAttenuation); if (this.height >= this.heightLimit) { this.height = this.heightLimit - 1; } - int i = (int)(1.382D + Math.pow(this.leafDensity * (double)this.heightLimit / 13.0D, 2.0D)); + int i = (int) (1.382D + Math.pow(this.leafDensity * (double) this.heightLimit / 13.0D, 2.0D)); if (i < 1) { i = 1; @@ -64,7 +63,7 @@ void generateLeafNodeList() { aint[0][3] = l; --j; - while (i1 >= 0) { + while (i1 >= 0) { int j1 = 0; float f = this.layerSize(i1); @@ -73,22 +72,23 @@ void generateLeafNodeList() { --i1; } else { for (double d0 = 0.5D; j1 < i; ++j1) { - double d1 = this.scaleWidth * (double)f * ((double)this.rand.nextFloat() + 0.328D); - double d2 = (double)this.rand.nextFloat() * 2.0D * Math.PI; - int k1 = MathHelper.floor_double(d1 * Math.sin(d2) + (double)this.basePos[0] + d0); - int l1 = MathHelper.floor_double(d1 * Math.cos(d2) + (double)this.basePos[2] + d0); + double d1 = this.scaleWidth * (double) f * ((double) this.rand.nextFloat() + 0.328D); + double d2 = (double) this.rand.nextFloat() * 2.0D * Math.PI; + int k1 = MathHelper.floor_double(d1 * Math.sin(d2) + (double) this.basePos[0] + d0); + int l1 = MathHelper.floor_double(d1 * Math.cos(d2) + (double) this.basePos[2] + d0); int[] aint1 = new int[] {k1, j, l1}; int[] aint2 = new int[] {k1, j + this.leafDistanceLimit, l1}; if (this.checkBlockLine(aint1, aint2) == -1) { int[] aint3 = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]}; - double d3 = Math.sqrt(Math.pow((double)Math.abs(this.basePos[0] - aint1[0]), 2.0D) + Math.pow((double)Math.abs(this.basePos[2] - aint1[2]), 2.0D)); + double d3 = Math.sqrt(Math.pow((double) Math.abs(this.basePos[0] - aint1[0]), 2.0D) + + Math.pow((double) Math.abs(this.basePos[2] - aint1[2]), 2.0D)); double d4 = d3 * this.branchSlope; - if ((double)aint1[1] - d4 > (double)l) { + if ((double) aint1[1] - d4 > (double) l) { aint3[1] = l; } else { - aint3[1] = (int)((double)aint1[1] - d4); + aint3[1] = (int) ((double) aint1[1] - d4); } if (this.checkBlockLine(aint3, aint1) == -1) { @@ -111,7 +111,7 @@ void generateLeafNodeList() { } void func_150529_a(int x, int y, int z, float p_150529_4_, byte p_150529_5_, Block block) { - int l = (int)((double)p_150529_4_ + 0.618D); + int l = (int) ((double) p_150529_4_ + 0.618D); byte b1 = otherCoordPairs[p_150529_5_]; byte b2 = otherCoordPairs[p_150529_5_ + 3]; int[] aint = new int[] {x, y, z}; @@ -124,18 +124,20 @@ void func_150529_a(int x, int y, int z, float p_150529_4_, byte p_150529_5_, Blo j1 = -l; while (j1 <= l) { - double d0 = Math.pow((double)Math.abs(i1) + 0.5D, 2.0D) + Math.pow((double)Math.abs(j1) + 0.5D, 2.0D); + double d0 = Math.pow((double) Math.abs(i1) + 0.5D, 2.0D) + Math.pow((double) Math.abs(j1) + 0.5D, 2.0D); - if (d0 > (double)(p_150529_4_ * p_150529_4_)) { + if (d0 > (double) (p_150529_4_ * p_150529_4_)) { ++j1; } else { aint1[b2] = aint[b2] + j1; Block block1 = this.worldObj.getBlock(aint1[0], aint1[1], aint1[2]); - if (!block1.isAir(worldObj, aint1[0], aint1[1], aint1[2]) && !block1.isLeaves(worldObj, aint1[0], aint1[1], aint1[2])) { + if (!block1.isAir(worldObj, aint1[0], aint1[1], aint1[2]) + && !block1.isLeaves(worldObj, aint1[0], aint1[1], aint1[2])) { ++j1; } else { - this.setBlockAndNotifyAdequately(this.worldObj, aint1[0], aint1[1], aint1[2], block, metaLeaves); + this.setBlockAndNotifyAdequately( + this.worldObj, aint1[0], aint1[1], aint1[2], block, metaLeaves); ++j1; } } @@ -144,24 +146,19 @@ void func_150529_a(int x, int y, int z, float p_150529_4_, byte p_150529_5_, Blo } float layerSize(int par1) { - if ((double)par1 < (double)((float)this.heightLimit) * 0.3D) { + if ((double) par1 < (double) ((float) this.heightLimit) * 0.3D) { return -1.618F; } else { - float f = (float)this.heightLimit / 2.0F; - float f1 = (float)this.heightLimit / 2.0F - (float)par1; + float f = (float) this.heightLimit / 2.0F; + float f1 = (float) this.heightLimit / 2.0F - (float) par1; float f2; - if (f1 == 0.0F) - { + if (f1 == 0.0F) { f2 = f; - } - else if (Math.abs(f1) >= f) - { + } else if (Math.abs(f1) >= f) { f2 = 0.0F; - } - else - { - f2 = (float)Math.sqrt(Math.pow((double)Math.abs(f), 2.0D) - Math.pow((double)Math.abs(f1), 2.0D)); + } else { + f2 = (float) Math.sqrt(Math.pow((double) Math.abs(f), 2.0D) - Math.pow((double) Math.abs(f1), 2.0D)); } f2 *= 0.5F; @@ -170,7 +167,9 @@ else if (Math.abs(f1) >= f) } float leafSize(int par1) { - return par1 >= 0 && par1 < this.leafDistanceLimit ? (par1 != 0 && par1 != this.leafDistanceLimit - 1 ? 3.0F : 2.0F) : -1.0F; + return par1 >= 0 && par1 < this.leafDistanceLimit + ? (par1 != 0 && par1 != this.leafDistanceLimit - 1 ? 3.0F : 2.0F) + : -1.0F; } void generateLeafNode(int par1, int par2, int par3) { @@ -178,7 +177,7 @@ void generateLeafNode(int par1, int par2, int par3) { for (int i1 = par2 + this.leafDistanceLimit; l < i1; ++l) { float f = this.leafSize(l - par2); - this.func_150529_a(par1, l, par3, f, (byte)1, NContent.floraLeavesNoColor); + this.func_150529_a(par1, l, par3, f, (byte) 1, NContent.floraLeavesNoColor); } } @@ -206,15 +205,15 @@ void func_150530_a(int[] p_150530_1_, int[] p_150530_2_, Block block) { b4 = -1; } - double d0 = (double)aint2[b2] / (double)aint2[b1]; - double d1 = (double)aint2[b3] / (double)aint2[b1]; + double d0 = (double) aint2[b2] / (double) aint2[b1]; + double d1 = (double) aint2[b3] / (double) aint2[b1]; int[] aint3 = new int[] {0, 0, 0}; int i = 0; for (int j = aint2[b1] + b4; i != j; i += b4) { - aint3[b1] = MathHelper.floor_double((double)(p_150530_1_[b1] + i) + 0.5D); - aint3[b2] = MathHelper.floor_double((double)p_150530_1_[b2] + (double)i * d0 + 0.5D); - aint3[b3] = MathHelper.floor_double((double)p_150530_1_[b3] + (double)i * d1 + 0.5D); + aint3[b1] = MathHelper.floor_double((double) (p_150530_1_[b1] + i) + 0.5D); + aint3[b2] = MathHelper.floor_double((double) p_150530_1_[b2] + (double) i * d0 + 0.5D); + aint3[b3] = MathHelper.floor_double((double) p_150530_1_[b3] + (double) i * d1 + 0.5D); int metadata = metaWood; int k = Math.abs(aint3[0] - p_150530_1_[0]); int l = Math.abs(aint3[2] - p_150530_1_[2]); @@ -224,7 +223,7 @@ void func_150530_a(int[] p_150530_1_, int[] p_150530_2_, Block block) { if (k == i1) { metadata = metaWood + 4; } else if (l == i1) { - metadata = metaWood + 8; + metadata = metaWood + 8; } } @@ -245,7 +244,7 @@ void generateLeaves() { } boolean leafNodeNeedsBase(int par1) { - return (double)par1 >= (double)this.heightLimit * 0.2D; + return (double) par1 >= (double) this.heightLimit * 0.2D; } void generateTrunk() { @@ -312,16 +311,16 @@ int checkBlockLine(int[] par1ArrayOfInteger, int[] par2ArrayOfInteger) { b4 = -1; } - double d0 = (double)aint2[b2] / (double)aint2[b1]; - double d1 = (double)aint2[b3] / (double)aint2[b1]; + double d0 = (double) aint2[b2] / (double) aint2[b1]; + double d1 = (double) aint2[b3] / (double) aint2[b1]; int[] aint3 = new int[] {0, 0, 0}; int i = 0; int j; for (j = aint2[b1] + b4; i != j; i += b4) { aint3[b1] = par1ArrayOfInteger[b1] + i; - aint3[b2] = MathHelper.floor_double((double)par1ArrayOfInteger[b2] + (double)i * d0); - aint3[b3] = MathHelper.floor_double((double)par1ArrayOfInteger[b3] + (double)i * d1); + aint3[b2] = MathHelper.floor_double((double) par1ArrayOfInteger[b2] + (double) i * d0); + aint3[b3] = MathHelper.floor_double((double) par1ArrayOfInteger[b3] + (double) i * d1); if (!this.isReplaceable(worldObj, aint3[0], aint3[1], aint3[2])) { break; @@ -337,7 +336,8 @@ boolean validTreeLocation() { int[] aint1 = new int[] {this.basePos[0], this.basePos[1] + this.heightLimit - 1, this.basePos[2]}; Block block = this.worldObj.getBlock(this.basePos[0], this.basePos[1] - 1, this.basePos[2]); - boolean isSoil = block.canSustainPlant(worldObj, basePos[0], basePos[1] - 1, basePos[2], ForgeDirection.UP, (BlockSapling)Blocks.sapling); + boolean isSoil = block.canSustainPlant( + worldObj, basePos[0], basePos[1] - 1, basePos[2], ForgeDirection.UP, (BlockSapling) Blocks.sapling); if (!isSoil) { return false; } else { @@ -355,7 +355,7 @@ boolean validTreeLocation() { } public void setScale(double par1, double par3, double par5) { - this.heightLimitLimit = (int)(par1 * 12.0D); + this.heightLimitLimit = (int) (par1 * 12.0D); if (par1 > 0.5D) { this.leafDistanceLimit = 5; @@ -365,14 +365,13 @@ public void setScale(double par1, double par3, double par5) { this.leafDensity = par5; } - int findGround (World world, int x, int y, int z) { + int findGround(World world, int x, int y, int z) { boolean foundGround = false; int height = PHNatura.seaLevel + 64; do { height--; Block underID = world.getBlock(x, height, z); - if (underID == Blocks.dirt || underID == Blocks.grass || height < PHNatura.seaLevel) - foundGround = true; + if (underID == Blocks.dirt || underID == Blocks.grass || height < PHNatura.seaLevel) foundGround = true; } while (!foundGround); return height + 1; } @@ -382,10 +381,8 @@ public boolean generate(World par1World, Random par2Random, int par3, int par4, long l = par2Random.nextLong(); this.rand.setSeed(l); this.basePos[0] = par3; - if (this.dontFindHeight) - this.basePos[1] = par4; - else - this.basePos[1] = findGround(par1World, par3, par4, par5); + if (this.dontFindHeight) this.basePos[1] = par4; + else this.basePos[1] = findGround(par1World, par3, par4, par5); this.basePos[2] = par5; if (this.heightLimit == 0) { @@ -402,5 +399,4 @@ public boolean generate(World par1World, Random par2Random, int par3, int par4, return true; } } - } diff --git a/src/main/java/mods/natura/worldgen/WhiteTreeGen.java b/src/main/java/mods/natura/worldgen/WhiteTreeGen.java index 79edfa01..312ec026 100644 --- a/src/main/java/mods/natura/worldgen/WhiteTreeGen.java +++ b/src/main/java/mods/natura/worldgen/WhiteTreeGen.java @@ -1,7 +1,6 @@ package mods.natura.worldgen; import java.util.Random; - import mods.natura.common.NContent; import net.minecraft.block.Block; import net.minecraft.block.BlockSapling; @@ -13,7 +12,7 @@ public class WhiteTreeGen extends WorldGenAbstractTree { // JAVADOC FIELD $$ field_76507_a - static final byte[] otherCoordPairs = new byte[] {(byte)2, (byte)0, (byte)0, (byte)1, (byte)2, (byte)1}; + static final byte[] otherCoordPairs = new byte[] {(byte) 2, (byte) 0, (byte) 0, (byte) 1, (byte) 2, (byte) 1}; // JAVADOC FIELD $$ field_76505_b Random rand = new Random(); // JAVADOC FIELD $$ field_76506_c @@ -34,11 +33,11 @@ public class WhiteTreeGen extends WorldGenAbstractTree { int leafDistanceLimit = 4; // JAVADOC FIELD $$ field_76509_o int[][] leafNodes; - + int metaWood; int metaLeaves; boolean dontFindHeight; - + private static final String __OBFID = "CL_00000400"; public WhiteTreeGen(boolean par1, int mdwood, int mdleaves) { @@ -50,13 +49,13 @@ public WhiteTreeGen(boolean par1, int mdwood, int mdleaves) { // JAVADOC METHOD $$ func_76489_a void generateLeafNodeList() { - this.height = (int)((double)this.heightLimit * this.heightAttenuation); + this.height = (int) ((double) this.heightLimit * this.heightAttenuation); if (this.height >= this.heightLimit) { this.height = this.heightLimit - 1; } - int i = (int)(1.382D + Math.pow(this.leafDensity * (double)this.heightLimit / 13.0D, 2.0D)); + int i = (int) (1.382D + Math.pow(this.leafDensity * (double) this.heightLimit / 13.0D, 2.0D)); if (i < 1) { i = 1; @@ -82,22 +81,23 @@ void generateLeafNodeList() { --i1; } else { for (double d0 = 0.5D; j1 < i; ++j1) { - double d1 = this.scaleWidth * (double)f * ((double)this.rand.nextFloat() + 0.328D); - double d2 = (double)this.rand.nextFloat() * 2.0D * Math.PI; - int k1 = MathHelper.floor_double(d1 * Math.sin(d2) + (double)this.basePos[0] + d0); - int l1 = MathHelper.floor_double(d1 * Math.cos(d2) + (double)this.basePos[2] + d0); + double d1 = this.scaleWidth * (double) f * ((double) this.rand.nextFloat() + 0.328D); + double d2 = (double) this.rand.nextFloat() * 2.0D * Math.PI; + int k1 = MathHelper.floor_double(d1 * Math.sin(d2) + (double) this.basePos[0] + d0); + int l1 = MathHelper.floor_double(d1 * Math.cos(d2) + (double) this.basePos[2] + d0); int[] aint1 = new int[] {k1, j, l1}; int[] aint2 = new int[] {k1, j + this.leafDistanceLimit, l1}; if (this.checkBlockLine(aint1, aint2) == -1) { int[] aint3 = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]}; - double d3 = Math.sqrt(Math.pow((double)Math.abs(this.basePos[0] - aint1[0]), 2.0D) + Math.pow((double)Math.abs(this.basePos[2] - aint1[2]), 2.0D)); + double d3 = Math.sqrt(Math.pow((double) Math.abs(this.basePos[0] - aint1[0]), 2.0D) + + Math.pow((double) Math.abs(this.basePos[2] - aint1[2]), 2.0D)); double d4 = d3 * this.branchSlope; - if ((double)aint1[1] - d4 > (double)l) { + if ((double) aint1[1] - d4 > (double) l) { aint3[1] = l; } else { - aint3[1] = (int)((double)aint1[1] - d4); + aint3[1] = (int) ((double) aint1[1] - d4); } if (this.checkBlockLine(aint3, aint1) == -1) { @@ -118,8 +118,9 @@ void generateLeafNodeList() { System.arraycopy(aint, 0, this.leafNodes, 0, k); } - void func_150529_a(int p_150529_1_, int p_150529_2_, int p_150529_3_, float p_150529_4_, byte p_150529_5_, Block block) { - int l = (int)((double)p_150529_4_ + 0.618D); + void func_150529_a( + int p_150529_1_, int p_150529_2_, int p_150529_3_, float p_150529_4_, byte p_150529_5_, Block block) { + int l = (int) ((double) p_150529_4_ + 0.618D); byte b1 = otherCoordPairs[p_150529_5_]; byte b2 = otherCoordPairs[p_150529_5_ + 3]; int[] aint = new int[] {p_150529_1_, p_150529_2_, p_150529_3_}; @@ -132,18 +133,20 @@ void func_150529_a(int p_150529_1_, int p_150529_2_, int p_150529_3_, float p_15 j1 = -l; while (j1 <= l) { - double d0 = Math.pow((double)Math.abs(i1) + 0.5D, 2.0D) + Math.pow((double)Math.abs(j1) + 0.5D, 2.0D); + double d0 = Math.pow((double) Math.abs(i1) + 0.5D, 2.0D) + Math.pow((double) Math.abs(j1) + 0.5D, 2.0D); - if (d0 > (double)(p_150529_4_ * p_150529_4_)) { + if (d0 > (double) (p_150529_4_ * p_150529_4_)) { ++j1; } else { aint1[b2] = aint[b2] + j1; Block block1 = this.worldObj.getBlock(aint1[0], aint1[1], aint1[2]); - if (!block1.isAir(worldObj, aint1[0], aint1[1], aint1[2]) && !block1.isLeaves(worldObj, aint1[0], aint1[1], aint1[2])) { + if (!block1.isAir(worldObj, aint1[0], aint1[1], aint1[2]) + && !block1.isLeaves(worldObj, aint1[0], aint1[1], aint1[2])) { ++j1; } else { - this.setBlockAndNotifyAdequately(this.worldObj, aint1[0], aint1[1], aint1[2], block, metaLeaves); + this.setBlockAndNotifyAdequately( + this.worldObj, aint1[0], aint1[1], aint1[2], block, metaLeaves); ++j1; } } @@ -153,11 +156,11 @@ void func_150529_a(int p_150529_1_, int p_150529_2_, int p_150529_3_, float p_15 // JAVADOC METHOD $$ func_76490_a float layerSize(int par1) { - if ((double)par1 < (double)((float)this.heightLimit) * 0.3D) { + if ((double) par1 < (double) ((float) this.heightLimit) * 0.3D) { return -1.618F; } else { - float f = (float)this.heightLimit / 2.0F; - float f1 = (float)this.heightLimit / 2.0F - (float)par1; + float f = (float) this.heightLimit / 2.0F; + float f1 = (float) this.heightLimit / 2.0F - (float) par1; float f2; if (f1 == 0.0F) { @@ -165,7 +168,7 @@ float layerSize(int par1) { } else if (Math.abs(f1) >= f) { f2 = 0.0F; } else { - f2 = (float)Math.sqrt(Math.pow((double)Math.abs(f), 2.0D) - Math.pow((double)Math.abs(f1), 2.0D)); + f2 = (float) Math.sqrt(Math.pow((double) Math.abs(f), 2.0D) - Math.pow((double) Math.abs(f1), 2.0D)); } f2 *= 0.5F; return f2; @@ -173,7 +176,9 @@ float layerSize(int par1) { } float leafSize(int par1) { - return par1 >= 0 && par1 < this.leafDistanceLimit ? (par1 != 0 && par1 != this.leafDistanceLimit - 1 ? 3.0F : 2.0F) : -1.0F; + return par1 >= 0 && par1 < this.leafDistanceLimit + ? (par1 != 0 && par1 != this.leafDistanceLimit - 1 ? 3.0F : 2.0F) + : -1.0F; } // JAVADOC METHOD $$ func_76491_a @@ -182,7 +187,7 @@ void generateLeafNode(int par1, int par2, int par3) { for (int i1 = par2 + this.leafDistanceLimit; l < i1; ++l) { float f = this.leafSize(l - par2); - this.func_150529_a(par1, l, par3, f, (byte)1, NContent.floraLeavesNoColor); + this.func_150529_a(par1, l, par3, f, (byte) 1, NContent.floraLeavesNoColor); } } @@ -210,15 +215,15 @@ void func_150530_a(int[] p_150530_1_, int[] p_150530_2_, Block p_150530_3_) { b4 = -1; } - double d0 = (double)aint2[b2] / (double)aint2[b1]; - double d1 = (double)aint2[b3] / (double)aint2[b1]; + double d0 = (double) aint2[b2] / (double) aint2[b1]; + double d1 = (double) aint2[b3] / (double) aint2[b1]; int[] aint3 = new int[] {0, 0, 0}; int i = 0; for (int j = aint2[b1] + b4; i != j; i += b4) { - aint3[b1] = MathHelper.floor_double((double)(p_150530_1_[b1] + i) + 0.5D); - aint3[b2] = MathHelper.floor_double((double)p_150530_1_[b2] + (double)i * d0 + 0.5D); - aint3[b3] = MathHelper.floor_double((double)p_150530_1_[b3] + (double)i * d1 + 0.5D); + aint3[b1] = MathHelper.floor_double((double) (p_150530_1_[b1] + i) + 0.5D); + aint3[b2] = MathHelper.floor_double((double) p_150530_1_[b2] + (double) i * d0 + 0.5D); + aint3[b3] = MathHelper.floor_double((double) p_150530_1_[b3] + (double) i * d1 + 0.5D); int metadata = 2; int k = Math.abs(aint3[0] - p_150530_1_[0]); int l = Math.abs(aint3[2] - p_150530_1_[2]); @@ -251,7 +256,7 @@ void generateLeaves() { // JAVADOC METHOD $$ func_76493_c boolean leafNodeNeedsBase(int par1) { - return (double)par1 >= (double)this.heightLimit * 0.2D; + return (double) par1 >= (double) this.heightLimit * 0.2D; } // JAVADOC METHOD $$ func_76499_c @@ -321,16 +326,16 @@ int checkBlockLine(int[] par1ArrayOfInteger, int[] par2ArrayOfInteger) { b4 = -1; } - double d0 = (double)aint2[b2] / (double)aint2[b1]; - double d1 = (double)aint2[b3] / (double)aint2[b1]; + double d0 = (double) aint2[b2] / (double) aint2[b1]; + double d1 = (double) aint2[b3] / (double) aint2[b1]; int[] aint3 = new int[] {0, 0, 0}; int i = 0; int j; for (j = aint2[b1] + b4; i != j; i += b4) { aint3[b1] = par1ArrayOfInteger[b1] + i; - aint3[b2] = MathHelper.floor_double((double)par1ArrayOfInteger[b2] + (double)i * d0); - aint3[b3] = MathHelper.floor_double((double)par1ArrayOfInteger[b3] + (double)i * d1); + aint3[b2] = MathHelper.floor_double((double) par1ArrayOfInteger[b2] + (double) i * d0); + aint3[b3] = MathHelper.floor_double((double) par1ArrayOfInteger[b3] + (double) i * d1); Block block = this.worldObj.getBlock(aint3[0], aint3[1], aint3[2]); if (!this.isReplaceable(worldObj, aint3[0], aint3[1], aint3[2])) { @@ -348,7 +353,10 @@ boolean validTreeLocation() { int[] aint1 = new int[] {this.basePos[0], this.basePos[1] + this.heightLimit - 1, this.basePos[2]}; Block block = this.worldObj.getBlock(this.basePos[0], this.basePos[1] - 1, this.basePos[2]); - boolean isSoil = block.canSustainPlant(worldObj, basePos[0], basePos[1] - 1, basePos[2], ForgeDirection.UP, (BlockSapling)Blocks.sapling) || block == Blocks.netherrack; + boolean isSoil = block.canSustainPlant( + worldObj, basePos[0], basePos[1] - 1, basePos[2], ForgeDirection.UP, (BlockSapling) + Blocks.sapling) + || block == Blocks.netherrack; if (!isSoil) { return false; } else { @@ -367,7 +375,7 @@ boolean validTreeLocation() { // JAVADOC METHOD $$ func_76487_a public void setScale(double par1, double par3, double par5) { - this.heightLimitLimit = (int)(par1 * 12.0D); + this.heightLimitLimit = (int) (par1 * 12.0D); if (par1 > 0.5D) { this.leafDistanceLimit = 5; @@ -376,15 +384,17 @@ public void setScale(double par1, double par3, double par5) { this.scaleWidth = par3; this.leafDensity = par5; } - - int findGround (World world, int x, int y, int z) { + + int findGround(World world, int x, int y, int z) { boolean foundGround = false; int height = y; do { height--; Block blockBelow = world.getBlock(x, height, z); - if (blockBelow == Blocks.netherrack || blockBelow == Blocks.soul_sand || blockBelow == NContent.taintedSoil || height < 0) - foundGround = true; + if (blockBelow == Blocks.netherrack + || blockBelow == Blocks.soul_sand + || blockBelow == NContent.taintedSoil + || height < 0) foundGround = true; } while (!foundGround); return height + 1; } @@ -415,5 +425,4 @@ public boolean generate(World world, Random par2Random, int x, int y, int z) { return true; } } - } diff --git a/src/main/java/mods/natura/worldgen/WillowGen.java b/src/main/java/mods/natura/worldgen/WillowGen.java index d52bec63..27896383 100644 --- a/src/main/java/mods/natura/worldgen/WillowGen.java +++ b/src/main/java/mods/natura/worldgen/WillowGen.java @@ -1,7 +1,6 @@ package mods.natura.worldgen; import java.util.Random; - import mods.natura.common.NContent; import mods.natura.common.PHNatura; import net.minecraft.block.Block; @@ -18,12 +17,13 @@ public WillowGen(boolean notify) { seekHeight = !notify; } - int findGround (World world, int x, int y, int z) { + int findGround(World world, int x, int y, int z) { int ret = -1; int height = y; do { Block blockAtHeight = world.getBlock(x, height, z); - if ((blockAtHeight == Blocks.dirt || blockAtHeight == Blocks.grass || blockAtHeight == Blocks.sand) && !world.getBlock(x, height + 1, z).func_149730_j()) { + if ((blockAtHeight == Blocks.dirt || blockAtHeight == Blocks.grass || blockAtHeight == Blocks.sand) + && !world.getBlock(x, height + 1, z).func_149730_j()) { ret = height + 1; break; } @@ -32,11 +32,10 @@ int findGround (World world, int x, int y, int z) { return ret; } - public boolean generate (World world, Random random, int x, int y, int z) { + public boolean generate(World world, Random random, int x, int y, int z) { if (seekHeight) { y = findGround(world, x, y, z); - if (y == -1) - return false; + if (y == -1) return false; } int l; @@ -96,7 +95,8 @@ public boolean generate (World world, Random random, int x, int y, int z) { int l2 = k2 - z; block = world.getBlock(l1, j2, k2); - if ((Math.abs(i2) != k1 || Math.abs(l2) != k1 || random.nextInt(2) != 0 && j1 != 0) && block.canBeReplacedByLeaves(world, l1, j2, k2)) { + if ((Math.abs(i2) != k1 || Math.abs(l2) != k1 || random.nextInt(2) != 0 && j1 != 0) + && block.canBeReplacedByLeaves(world, l1, j2, k2)) { this.setBlockAndNotifyAdequately(world, l1, j2, k2, NContent.floraLeavesNoColor, 3); } } @@ -106,7 +106,10 @@ public boolean generate (World world, Random random, int x, int y, int z) { for (j2 = 0; j2 < l; ++j2) { block = world.getBlock(x, y + j2, z); - if (block == Blocks.air || block.isLeaves(world, x, y + j2, z) || block.canBeReplacedByLeaves(world, x, y + j2, z) || block == Blocks.water) { + if (block == Blocks.air + || block.isLeaves(world, x, y + j2, z) + || block.canBeReplacedByLeaves(world, x, y + j2, z) + || block == Blocks.water) { this.setBlockAndNotifyAdequately(world, x, y + j2, z, NContent.willow, 0); } } @@ -152,7 +155,7 @@ public boolean generate (World world, Random random, int x, int y, int z) { /** * Generates vines at the given position until it hits a block. */ - private void generateVines (World world, int x, int y, int z, int par5) { + private void generateVines(World world, int x, int y, int z, int par5) { this.setBlockAndNotifyAdequately(world, x, y, z, NContent.floraLeavesNoColor, par5); int i1 = 4; @@ -166,5 +169,4 @@ private void generateVines (World world, int x, int y, int z, int par5) { --i1; } } - } diff --git a/src/main/java/mods/natura/worldgen/retro/TickHandlerWorld.java b/src/main/java/mods/natura/worldgen/retro/TickHandlerWorld.java index 1ee69bd0..1d541377 100644 --- a/src/main/java/mods/natura/worldgen/retro/TickHandlerWorld.java +++ b/src/main/java/mods/natura/worldgen/retro/TickHandlerWorld.java @@ -1,35 +1,30 @@ package mods.natura.worldgen.retro; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Random; - import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.gameevent.TickEvent.Phase; import cpw.mods.fml.common.gameevent.TickEvent.Type; import cpw.mods.fml.common.gameevent.TickEvent.WorldTickEvent; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Random; import mantle.world.ChunkCoord; import net.minecraft.world.World; -public class TickHandlerWorld -{ +public class TickHandlerWorld { public static TickHandlerWorld instance = new TickHandlerWorld(); public static HashMap chunksToGen = new HashMap(); @SubscribeEvent - public void onTick (WorldTickEvent event) - { + public void onTick(WorldTickEvent event) { - if (event.phase.equals(Phase.END) && event.type.equals(Type.WORLD)) - { + if (event.phase.equals(Phase.END) && event.type.equals(Type.WORLD)) { World world = event.world; int dim = world.provider.dimensionId; ArrayList chunks = (ArrayList) chunksToGen.get(Integer.valueOf(dim)); - if (chunks != null && chunks.size() > 0) - { + if (chunks != null && chunks.size() > 0) { ChunkCoord c = (ChunkCoord) chunks.get(0); long worldSeed = world.getSeed(); Random rand = new Random(worldSeed); @@ -42,5 +37,4 @@ public void onTick (WorldTickEvent event) } } } - -} \ No newline at end of file +} diff --git a/src/main/java/mods/natura/worldgen/retro/WorldHandler.java b/src/main/java/mods/natura/worldgen/retro/WorldHandler.java index b38b301b..7d3b91ac 100644 --- a/src/main/java/mods/natura/worldgen/retro/WorldHandler.java +++ b/src/main/java/mods/natura/worldgen/retro/WorldHandler.java @@ -1,10 +1,9 @@ package mods.natura.worldgen.retro; +import cpw.mods.fml.common.eventhandler.SubscribeEvent; import java.util.ArrayList; import java.util.HashSet; import java.util.Random; - -import cpw.mods.fml.common.eventhandler.SubscribeEvent; import mantle.world.ChunkCoord; import mods.natura.Natura; import mods.natura.worldgen.BaseTreeWorldgen; @@ -12,8 +11,7 @@ import net.minecraft.world.World; import net.minecraftforge.event.world.ChunkDataEvent; -public class WorldHandler -{ +public class WorldHandler { private static HashSet dimensionBlacklist = new HashSet(); @@ -22,58 +20,48 @@ public class WorldHandler public static WorldHandler instance = new WorldHandler(); @SubscribeEvent - public void handleChunkSaveEvent (ChunkDataEvent.Save event) - { + public void handleChunkSaveEvent(ChunkDataEvent.Save event) { NBTTagCompound tag = new NBTTagCompound(); - if (Natura.retrogen) - { + if (Natura.retrogen) { tag.setLong("Features", genHash); } event.getData().setTag("NaturaWorld", tag); } @SubscribeEvent - public void handleChunkLoadEvent (ChunkDataEvent.Load event) - { + public void handleChunkLoadEvent(ChunkDataEvent.Load event) { int dim = event.world.provider.dimensionId; - if (dimensionBlacklist.contains(dim)) - { + if (dimensionBlacklist.contains(dim)) { return; } boolean features = false; boolean regen = false; NBTTagCompound tag = (NBTTagCompound) event.getData().getTag("NaturaWorld"); - if (tag != null) - { + if (tag != null) { features = tag.getLong("Features") != genHash && Natura.retrogen; } ChunkCoord cCoord = new ChunkCoord(event.getChunk()); - if (tag == null && (Natura.retrogen) && !event.getData().getBoolean("Natura.Retrogen")) - { + if (tag == null && (Natura.retrogen) && !event.getData().getBoolean("Natura.Retrogen")) { regen = true; } - if (features) - { + if (features) { regen = true; } - if (regen) - { + if (regen) { ArrayList chunks = (ArrayList) TickHandlerWorld.chunksToGen.get(Integer.valueOf(dim)); - if (chunks == null) - { + if (chunks == null) { TickHandlerWorld.chunksToGen.put(Integer.valueOf(dim), new ArrayList()); chunks = (ArrayList) TickHandlerWorld.chunksToGen.get(Integer.valueOf(dim)); } - if (chunks != null) - { + if (chunks != null) { chunks.add(cCoord); TickHandlerWorld.chunksToGen.put(Integer.valueOf(dim), chunks); } @@ -82,26 +70,39 @@ public void handleChunkLoadEvent (ChunkDataEvent.Load event) /* HELPER FUNCTIONS */ - public void generateWorld (Random random, int chunkX, int chunkZ, World world, boolean newGen) - { - if (newGen && !Natura.retrogen) - { + public void generateWorld(Random random, int chunkX, int chunkZ, World world, boolean newGen) { + if (newGen && !Natura.retrogen) { return; } - if (world.provider.dimensionId == 1) - {//|| world.provider.dimensionId == -1) { + if (world.provider.dimensionId == 1) { // || world.provider.dimensionId == -1) { return; } - Natura.crops.generate(random, chunkX, chunkZ, world, world.provider.createChunkGenerator(), world.provider.createChunkGenerator()); - Natura.clouds.generate(random, chunkX, chunkZ, world, world.provider.createChunkGenerator(), world.provider.createChunkGenerator()); + Natura.crops.generate( + random, + chunkX, + chunkZ, + world, + world.provider.createChunkGenerator(), + world.provider.createChunkGenerator()); + Natura.clouds.generate( + random, + chunkX, + chunkZ, + world, + world.provider.createChunkGenerator(), + world.provider.createChunkGenerator()); BaseTreeWorldgen.retrogen = true; - Natura.trees.generate(random, chunkX, chunkZ, world, world.provider.createChunkGenerator(), world.provider.createChunkGenerator()); + Natura.trees.generate( + random, + chunkX, + chunkZ, + world, + world.provider.createChunkGenerator(), + world.provider.createChunkGenerator()); BaseTreeWorldgen.retrogen = false; - if (!newGen) - { + if (!newGen) { world.getChunkFromChunkCoords(chunkX, chunkZ).setChunkModified(); } } - -} \ No newline at end of file +}